define ('DATA_TIMEADDED', 0);
define ('DATA_TIMEMODIFIED', -4);
-class data_field_base { /// Base class for Database Field Types (see field/*/field.class.php)
+class data_field_base { // Base class for Database Field Types (see field/*/field.class.php)
- var $type = 'unknown'; /// Subclasses must override the type with their name
- var $data = NULL; /// The database object that this field belongs to
- var $field = NULL; /// The field object itself, if we know it
+ var $type = 'unknown'; // Subclasses must override the type with their name
+ var $data = NULL; // The database object that this field belongs to
+ var $field = NULL; // The field object itself, if we know it
- var $iconwidth = 16; /// Width of the icon for this fieldtype
- var $iconheight = 16; /// Width of the icon for this fieldtype
+ var $iconwidth = 16; // Width of the icon for this fieldtype
+ var $iconheight = 16; // Width of the icon for this fieldtype
// Constructor function
return;
}
- foreach ($records as $record) { /// Might be just one for the single template
+ foreach ($records as $record) { // Might be just one for the single template
// Replacing tags
$patterns = array();
$patterns[] = '/##lastname##/';
$replacement[] = '<input type="text" size="16" name="u_ln" value="'.$ln.'" />';
- ///actual replacement of the tags
+ // actual replacement of the tags
$newtext = preg_replace($patterns, $replacement, $data->asearchtemplate);
$options = new object();
*/
function data_preset_name($shortname, $path) {
- /// We are looking inside the preset itself as a first choice, but also in normal data directory
+ // We are looking inside the preset itself as a first choice, but also in normal data directory
$string = get_string('modulename', 'datapreset_'.$shortname);
if (substr($string, 0, 1) == '[') {
$currentgroup = groups_get_activity_group($cm);
$groupmode = groups_get_activity_groupmode($cm);
- ///Print the tabs
+ // Print the tabs
if ($currenttab) {
include('tabs.php');
fclose($asearchtemplate);
/* All the display data is now done. Now assemble preset.xml */
- $fields = get_records('data_fields', 'dataid', $data->id);
$presetfile = fopen($tempfolder.'/preset.xml', 'w');
$presetxml = "<preset>\n\n";
// note: grading settings are not exported intentionally
$presetxml .= "</settings>\n\n";
- /* Now for the fields. Grabs all settings that are non-empty */
+ // Now for the fields. Grab all that are non-empty
+ $fields = get_records('data_fields', 'dataid', $data->id);
+ ksort($fields);
if (!empty($fields)) {
foreach ($fields as $field) {
$presetxml .= "<field>\n";
}
$filelist = array(
- 'singletemplate.html',
- 'listtemplate.html',
- 'listtemplateheader.html',
- 'listtemplatefooter.html',
- 'addtemplate.html',
- 'rsstemplate.html',
- 'rsstitletemplate.html',
- 'csstemplate.css',
- 'jstemplate.js',
- 'preset.xml',
- 'asearchtemplate.html');
+ 'singletemplate.html',
+ 'listtemplate.html',
+ 'listtemplateheader.html',
+ 'listtemplatefooter.html',
+ 'addtemplate.html',
+ 'rsstemplate.html',
+ 'rsstitletemplate.html',
+ 'csstemplate.css',
+ 'jstemplate.js',
+ 'preset.xml',
+ 'asearchtemplate.html'
+ );
foreach ($filelist as $key => $file) {
$filelist[$key] = $tempfolder.'/'.$filelist[$key];
if (file_exists($this->folder."/asearchtemplate.html")) {
$settings->asearchtemplate = file_get_contents($this->folder."/asearchtemplate.html");
} else {
- $settings->asearchtemplate = NULL;
+ $settings->asearchtemplate = NULL;
}
$settings->instance = $this->data->id;
// handle special settings here
if (!empty($settings->defaultsort)) {
if (is_numeric($settings->defaultsort)) {
- //old broken value
+ // old broken value
$settings->defaultsort = 0;
} else {
$settings->defaultsort = (int)get_field('data_fields', 'id', 'dataid', $this->data->id, 'name', addslashes($settings->defaultsort));