]> git.mjollnir.org Git - moodle.git/commitdiff
data mod whitespace cleanup - there are already many accessibility related changes...
authorskodak <skodak>
Wed, 13 Dec 2006 20:26:11 +0000 (20:26 +0000)
committerskodak <skodak>
Wed, 13 Dec 2006 20:26:11 +0000 (20:26 +0000)
35 files changed:
mod/data/backuplib.php
mod/data/comment.php
mod/data/config.html
mod/data/css.php
mod/data/db/mysql.php
mod/data/db/mysql.sql
mod/data/db/postgres7.php
mod/data/db/upgrade.php
mod/data/edit.php
mod/data/field.php
mod/data/field/checkbox/field.class.php
mod/data/field/date/field.class.php
mod/data/field/file/field.class.php
mod/data/field/latlong/field.class.php
mod/data/field/latlong/kml.php
mod/data/field/menu/field.class.php
mod/data/field/multimenu/field.class.php
mod/data/field/number/field.class.php
mod/data/field/picture/field.class.php
mod/data/field/radiobutton/field.class.php
mod/data/field/textarea/field.class.php
mod/data/field/url/field.class.php
mod/data/filter.php
mod/data/import.php
mod/data/index.php
mod/data/js.php
mod/data/lib.php
mod/data/mod_form.php
mod/data/pagelib.php
mod/data/preset/imagegallery/jstemplate.js
mod/data/restorelib.php
mod/data/rsslib.php
mod/data/tabs.php
mod/data/templates.php
mod/data/view.php

index cc328f58a0e54ee45789cf3d269da72ef5a3eb8e..2af71ff064be6f0c9570028af5d76aa70c75c225 100644 (file)
 
 
     //Return a content encoded to support interactivities linking. Every module
-  
+
 function data_backup_mods($bf,$preferences) {
     global $CFG;
 
     $status = true;
-    
+
     // iterate
     if ($datas = get_records('data','course',$preferences->backup_course,"id")) {
         foreach ($datas as $data) {
@@ -62,12 +62,12 @@ function data_backup_mods($bf,$preferences) {
 
 function data_backup_one_mod($bf,$preferences,$data) {
     global $CFG;
-        
+
     if (is_numeric($data)) { // backwards compatibility
         $data = get_record('data','id',$data);
     }
     $instanceid = $data->id;
-    
+
     $status = true;
 
 
@@ -98,25 +98,25 @@ function data_backup_one_mod($bf,$preferences,$data) {
     fwrite ($bf,full_tag("APPROVAL",4,false,$data->approval));
     fwrite ($bf,full_tag("SCALE",4,false,$data->scale));
     fwrite ($bf,full_tag("ASSESSED",4,false,$data->assessed));
-    
+
     // if we've selected to backup users info, then call any other functions we need
     // including backing up individual files
-    
+
     $status = backup_data_fields($bf,$preferences,$data->id);
-    
+
     if (backup_userdata_selected($preferences,'data',$data->id)) {
         //$status = backup_someuserdata_for_this_instance();
         //$status = backup_somefiles_for_this_instance();
         // ... etc
 
-        $status = backup_data_records($bf,$preferences,$data->id);        
+        $status = backup_data_records($bf,$preferences,$data->id);
         if ($status) {
             $status = backup_data_files_instance($bf,$preferences,$data->id);    //recursive copy
         }
     }
     fwrite ($bf,end_tag("MOD",3,true));
     return $status;
-    
+
 }
 
 
@@ -150,7 +150,7 @@ function backup_data_fields($bf,$preferences,$dataid){
                 fwrite ($bf,full_tag("PARAM8",6,false,$fie_sub->param8));
                 fwrite ($bf,full_tag("PARAM9",6,false,$fie_sub->param9));
                 fwrite ($bf,full_tag("PARAM10",6,false,$fie_sub->param10));
-                
+
                 //End submission
                 $status =fwrite ($bf,end_tag("FIELD",5,true));
             }
@@ -324,7 +324,7 @@ function backup_data_files($bf,$preferences) {
                                                $CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/data");
         }
     }
-    
+
     return $status;
 }
 
@@ -365,7 +365,7 @@ function data_check_backup_mods($course,$user_data=false,$backup_unique_code,$in
         }
         return $info;
     }
-    
+
     // otherwise continue as normal
     //First the course data
     $info[0][0] = get_string("modulenameplural","data");
@@ -374,7 +374,7 @@ function data_check_backup_mods($course,$user_data=false,$backup_unique_code,$in
     } else {
         $info[0][1] = 0;
     }
-    
+
     //Now, if requested, the user_data
     if ($user_data) {
         // any other needed stuff
index 8b359ad0a59915983fdba8caabd720d0df23ae79..bc2cea1f6a4ab7c7c7b38e32e9757c2550a6e80f 100755 (executable)
     }
 
     require_login($course->id, false, $cm);
-    
+
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-    
+
     if ($commentid) {
         if (! $comment = get_record('data_comments', 'id', $commentid)) {
             error('Comment ID is misconfigured');
         }
-        if ($comment->recordid != $record->id) { 
+        if ($comment->recordid != $record->id) {
             error('Comment ID is misconfigured');
         }
-        if (!has_capability('mod/data:managecomments', $context) && $comment->userid != $USER->id) { 
+        if (!has_capability('mod/data:managecomments', $context) && $comment->userid != $USER->id) {
             error('Comment is not yours to edit!');
         }
     }
@@ -59,7 +59,7 @@
             }
             redirect('view.php?rid='.$record->id.'&amp;page='.$page, get_string('commentsaved', 'data'));
         break;
-        
+
         case 'edit':    //print edit form
             print_header();
             print_heading(get_string('edit'));
@@ -68,7 +68,7 @@
             echo '<input type="hidden" name="commentid" value="'.$comment->id.'" />';
             echo '<input type="hidden" name="rid" value="'.$record->id.'" />';
             echo '<input type="hidden" name="page" value="'.$page.'" />';
-            
+
             echo '<textarea name="commentcontent">'.s($comment->content).'</textarea>';
             echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
             echo '<input type="hidden" name="mode" value="editcommit" />';
@@ -77,7 +77,7 @@
             echo '</form></div>';
             print_footer();
         break;
-        
+
         case 'editcommit':  //update db
             if (empty($commentcontent)) {
                 redirect('view.php?rid='.$record->id.'&amp;page='.$page, get_string('commentempty', 'data'));
@@ -92,7 +92,7 @@
             }
             redirect('view.php?rid='.$record->id.'&amp;page='.$page, get_string('commentsaved', 'data'));
         break;
-        
+
         case 'delete':    //deletes single comment from db
             if ($confirm and confirm_sesskey() and $comment) {
                 delete_records('data_comments','id',$comment->id);
                 print_header();
                 data_print_comment($data, $comment, $page);
 
-                notice_yesno(get_string('deletecomment','data'), 
+                notice_yesno(get_string('deletecomment','data'),
                   'comment.php?rid='.$record->id.'&amp;commentid='.$comment->id.'&amp;page='.$page.
                               '&amp;sesskey='.sesskey().'&amp;mode=delete&amp;confirm=1',
                   'view.php?rid='.$record->id.'&amp;page='.$page);
             }
 
         break;
-        
+
         default:    //print all listing, and add comment form
             print_header();
             data_print_comments($data, $record, $page);
             print_footer();
         break;
-        
+
     }
 
 
index 0022219294e931df0cf8e3cfb4e054e1753e4e62..baca72ff4671def1ef34abf630b1e03e077dec93 100644 (file)
                 $data_enablerssfeeds = true;
             }
 
+
             choose_from_menu ($options, "data_enablerssfeeds", $data_enablerssfeeds, "", "", "");
         }
     ?>
     </td>
     <td>
-    <?php 
+    <?php
         print_string("configenablerssfeeds","data");
         if (!isset($CFG->enablerssfeeds) || $CFG->enablerssfeeds == 0) {
             print_string("configenablerssfeedsdisabled");
index 6e9cf07f9402282bcfa71186025bd2a51555742b..00469ed2ed45092576c5fc01bb63d68807846f8f 100755 (executable)
@@ -37,4 +37,4 @@
         header('Content-type: text/css');  // Correct MIME type
 
         echo $data->csstemplate;
-    } 
+    }
index 38a14a93b66497d4957f6b29d8d908e218584ead..058939611ba9bdf8bb7c38a3f7f2d5d82cdff548 100644 (file)
@@ -2,7 +2,7 @@
 
 // THIS FILE IS DEPRECATED!  PLEASE DO NOT MAKE CHANGES TO IT!
 //
-// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL 
+// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
 // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
 
 function data_upgrade($oldversion) {
@@ -28,12 +28,12 @@ function data_upgrade($oldversion) {
         table_column("data", "", "assessed", "integer", "10");
         table_column("data", "", "assesspublic", "integer", "4");
     }
-    
+
     if ($oldversion < 2006022700) {
         table_column("data_comments", "", "created", "integer", "10");
         table_column("data_comments", "", "modified", "integer", "10");
     }
-    
+
     if ($oldversion < 2006030700) {
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'add', 'data', 'name')");
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'update', 'data', 'name')");
@@ -43,7 +43,7 @@ function data_upgrade($oldversion) {
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates saved', 'data', 'name')");
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates def', 'data', 'name')");
     }
-    
+
     if ($oldversion < 2006032700) {
         table_column('data', '', 'defaultsort', 'integer', '10', 'unsigned', '0');
         table_column('data', '', 'defaultsortdir', 'tinyint', '4', 'unsigned', '0', 'not null', 'defaultsort');
@@ -53,7 +53,7 @@ function data_upgrade($oldversion) {
     if ($oldversion < 2006032900) {
         table_column('data', '', 'csstemplate', 'text', '', '', '', 'not null', 'rsstemplate');
     }
-    
+
     if ($oldversion < 2006050500) { // 2 fields have got no default null values
         table_column('data_comments','content','content','text','','','','not null');
         table_column('data_fields','description','description','text','','','','not null');
@@ -68,7 +68,7 @@ function data_upgrade($oldversion) {
         table_column('data_fields','param9','param9','text','','','','not null');
         table_column('data_fields','param10','param10','text','','','','not null');
     }
-    
+
     if ($oldversion < 2006052400) {
         table_column('data','','rsstitletemplate','text','','','','not null','rsstemplate');
     }
@@ -76,7 +76,7 @@ function data_upgrade($oldversion) {
     if ($oldversion < 2006081700) {
         table_column('data', '', 'jstemplate', 'text', '', '', '', 'not null', 'csstemplate');
     }
-    
+
     if ($oldversion < 2006092000) {
         // Upgrades for new roles and capabilities support.
         require_once($CFG->dirroot.'/mod/data/lib.php');
@@ -110,7 +110,7 @@ function data_upgrade($oldversion) {
         modify_database('', 'ALTER TABLE prefix_data DROP COLUMN participants;');
         modify_database('', 'ALTER TABLE prefix_data DROP COLUMN assesspublic;');
         modify_database('', 'ALTER TABLE prefix_data DROP COLUMN ratings;');
-        
+
     }
 
     if ($oldversion < 2006092302) { // Changing some TEXT fields to NULLable and no default
index 5e03cf6cc95832b5f99527620e93fe653bd2e80e..13cbf8b81c4d472a763bf6ec3c173e0797e84ba0 100755 (executable)
@@ -1,12 +1,12 @@
 # -- phpMyAdmin SQL Dump
 # -- version 2.6.2
 # -- http://www.phpmyadmin.net
-# -- 
+# --
 # -- Host: localhost
 # -- Generation Time: Aug 25, 2005 at 03:52 PM
 # -- Server version: 3.23.54
 # -- PHP Version: 4.2.2
-# -- 
+# --
 
 # -- --------------------------------------------------------
 
index 5c8d2a969d7ebd0f2b563c38926e8f45a11833f9..3a5d7644cd85cdd112d213052a95ebc50b9483df 100644 (file)
@@ -2,7 +2,7 @@
 
 // THIS FILE IS DEPRECATED!  PLEASE DO NOT MAKE CHANGES TO IT!
 //
-// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL 
+// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
 // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
 
 function data_upgrade($oldversion) {
@@ -22,7 +22,7 @@ function data_upgrade($oldversion) {
         table_column("data", "", "approval", "integer", "4", "unsigned", "0", "not null");
         table_column("data_records", "", "approved", "integer", "4", "unsigned", "0", "not null");
     }
-    
+
     if ($oldversion < 2006020801) {
         table_column("data", "", "scale", "integer");
         table_column("data", "", "assessed", "integer");
@@ -33,7 +33,7 @@ function data_upgrade($oldversion) {
         table_column("data_comments", "", "created", "integer");
         table_column("data_comments", "", "modified", "integer");
     }
-    
+
     if ($oldversion < 2006030700) {
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'view', 'data', 'name');");
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'add', 'data', 'name')");
@@ -44,7 +44,7 @@ function data_upgrade($oldversion) {
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates saved', 'data', 'name')");
         modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates defaults', 'data', 'name')");
     }
-    
+
     if ($oldversion < 2006032700) {
         table_column('data', '', 'defaultsort', 'integer', '10', 'unsigned', '0');
         table_column('data', '', 'defaultsortdir', 'tinyint', '4', 'unsigned', '0', 'not null', 'defaultsort');
@@ -54,7 +54,7 @@ function data_upgrade($oldversion) {
     if ($oldversion < 2006032900) {
         table_column('data', '', 'csstemplate', 'text', '', '', '', 'not null', 'rsstemplate');
     }
-    
+
     if ($oldversion < 2006050500) { // drop all tables, and create from scratch
 
         execute_sql("DROP TABLE {$CFG->prefix}data", false);
@@ -150,9 +150,9 @@ function data_upgrade($oldversion) {
                               recordid integer NOT NULL default '0',
                               rating integer NOT NULL default '0'
                             );");
-                            
+
     }
-    
+
     if ($oldversion < 2006052400) {
         table_column('data','','rsstitletemplate','text','','','','not null','rsstemplate');
     }
@@ -160,7 +160,7 @@ function data_upgrade($oldversion) {
     if ($oldversion < 2006081700) {
         table_column('data', '', 'jstemplate', 'text', '', '', '', 'not null', 'csstemplate');
     }
-    
+
     if ($oldversion < 2006092000) {
         // Upgrades for new roles and capabilities support.
         require_once($CFG->dirroot.'/mod/data/lib.php');
@@ -194,7 +194,7 @@ function data_upgrade($oldversion) {
         modify_database('', 'ALTER TABLE prefix_data DROP COLUMN participants;');
         modify_database('', 'ALTER TABLE prefix_data DROP COLUMN assesspublic;');
         modify_database('', 'ALTER TABLE prefix_data DROP COLUMN ratings;');
-        
+
     }
 
     if ($oldversion < 2006092302) { // Changing some TEXT fields to NULLable and no default
index c5105db184c6fd5fb5939e17b2dfb6267dc8a288..954fbdd28126308f089ff14d260cdbfabfae6d71 100644 (file)
@@ -1,6 +1,6 @@
 <?php  //$Id$
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the data module
 //
 // Sometimes, changes between versions involve
@@ -23,8 +23,8 @@ function xmldb_data_upgrade($oldversion=0) {
 
     $result = true;
 
-/// And upgrade begins here. For each one, you'll need one 
-/// block of code similar to the next one. Please, delete 
+/// And upgrade begins here. For each one, you'll need one
+/// block of code similar to the next one. Please, delete
 /// this comment lines once this file start handling proper
 /// upgrade code.
 
index 4300bba674180fe0eff6fd2465dc9db3b1866cd0..8bf2d52ebbdddcc3593b700838e1f226660d3880 100755 (executable)
             error('Course Module ID was incorrect');
         }
     }
-    
+
     require_login($course->id, false, $cm);
-    
+
     if (!isloggedin() or isguest()) {
         redirect('view.php?d='.$data->id);
     }
-    
+
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
 /// If it's hidden then it's don't show anything.  :)
@@ -72,7 +72,7 @@
                  "$navigation ".format_string($data->name), "", "", true, '', navmenu($course, $cm));
         notice(get_string("activityiscurrentlyhidden"));
     }
-    
+
 /// Can't use this if there are no fields
     if (has_capability('mod/data:managetemplates', $context)) {
         if (!record_exists('data_fields','dataid',$data->id)) {      // Brand new database!
@@ -89,7 +89,7 @@
     if ($cancel) {
         redirect('view.php?d='.$data->id);
     }
-  
+
 
 /// RSS and CSS and JS meta
     $meta = '';
     $strdata = get_string('modulenameplural','data');
 
     print_header_simple($data->name, '', "<a href='index.php?id=$course->id'>$strdata</a> -> $data->name",
-                        '', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), 
+                        '', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
                         navmenu($course, $cm), '', '');
 
     print_heading(format_string($data->name));
 
             /// All student edits are marked unapproved by default
             $record = get_record('data_records','id',$rid);
-            
+
             if ($data->approval == 1 || has_capability('mod/data:approve', $context)) {
                 $record->approved = 1;
             } else {
                 $record->approved = 0;
             }
-            
+
             $record->groupid = $currentgroup;
             $record->timemodified = time();
             update_record('data_records',$record);
             ///Empty form checking - you can't submit an empty form!
 
             $emptyform = true;      // assume the worst
-            
-            foreach ($datarecord as $name => $value) {  
+
+            foreach ($datarecord as $name => $value) {
                 if (!in_array($name, $ignorenames)) {
                     $namearr = explode('_', $name);  // Second one is the field id
                     if (empty($field->field) || ($namearr[1] != $field->field->id)) {  // Try to reuse classes
                         $field = data_get_field_from_id($namearr[1], $data);
                     }
                     if ($field->notemptyfield($value, $name)) {
-                        $emptyform = false;    
+                        $emptyform = false;
                         break;             // if anything has content, this form is not empty, so stop now!
                     }
                 }
-            }  
+            }
 
             if ($emptyform){    //nothing gets written to database
                 notify(get_string('emptyaddform','data'));
             }
 
             if (!$emptyform && $recordid = data_add_record($data, $currentgroup)) {    //add instance to data_record
-                
+
                 /// Insert a whole lot of empty records to make sure we have them
                 $fields = get_records('data_fields','dataid',$data->id);
                 foreach ($fields as $field) {
     echo '<input name="rid" value="'.$rid.'" type="hidden" />';
     echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
     print_simple_box_start('center','80%');
-    
+
     if (!$rid){
         print_heading(get_string('newentry','data'), '', 2);
     }
-        
+
     /******************************************
      * Regular expression replacement section *
      ******************************************/
     if ($data->addtemplate){
         $possiblefields = get_records('data_fields','dataid',$data->id,'id');
-        
+
         ///then we generate strings to replace
         foreach ($possiblefields as $eachfield){
             $field = data_get_field($eachfield, $data);
         echo data_generate_default_template($data, 'addtemplate', $rid, true, false);
         $newtext = '';
     }
-   
+
     echo $newtext;
     echo '<div align="center"><input type="submit" name="saveandview" value="'.get_string('saveandview','data').'" />';
     if ($rid) {
     print_simple_box_end();
     echo '</form>';
 
-    
+
 /// Upload records section. Only for teachers and the admin.
-    
+
     if (has_capability('mod/data:manageentries',$context)) {
         if ($import) {
             print_simple_box_start('center','80%');
         $field = data_get_field($eachfield, $data);
         $field->print_after_form();
     }
-    
+
     print_footer($course);
 ?>
index 2459c1cb4bf838e0efc2399c6e0727713c06e26e..3a5ea41f92e637d83ad32072e6941d51efd1c44d 100755 (executable)
@@ -25,7 +25,7 @@
     require_once('../../config.php');
     require_once('lib.php');
 
-    
+
     $id             = optional_param('id', 0, PARAM_INT);            // course module id
     $d              = optional_param('d', 0, PARAM_INT);             // database id
     $fid            = optional_param('fid', 0 , PARAM_INT);          // update field id
@@ -38,8 +38,8 @@
     if ($cancel) {
         $mode = 'list';
     }
-    
-    
+
+
     if ($id) {
         if (! $cm = get_coursemodule_from_id('data', $id)) {
             error('Course Module ID was incorrect');
@@ -67,7 +67,7 @@
 
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     require_capability('mod/data:managetemplates', $context);
-    
+
     /************************************
      *        Data Processing           *
      ***********************************/
             if (confirm_sesskey() and $fieldinput = data_submitted($CFG->wwwroot.'/mod/data/field.php')){
 
                 //$fieldinput->name = data_clean_field_name($fieldinput->name);
-                
+
             /// Only store this new field if it doesn't already exist.
                 if (($fieldinput->name == '') or data_fieldname_exists($fieldinput->name, $data->id)) {
 
                     $displaynoticebad = get_string('invalidfieldname','data');
 
-                } else {   
-                    
+                } else {
+
                 /// Check for arrays and convert to a comma-delimited string
                     data_convert_arrays_to_strings($fieldinput);
 
@@ -98,9 +98,9 @@
                 /// Update some templates
                     data_append_new_field_to_templates($data, $field->field->name);
 
-                    add_to_log($course->id, 'data', 'fields add', 
+                    add_to_log($course->id, 'data', 'fields add',
                                "field.php?d=$data->id&amp;mode=display&amp;fid=$fid", $fid, $cm->id);
-                    
+
                     $displaynoticegood = get_string('fieldadded','data');
                 }
             }
                 //$fieldinput->name = data_clean_field_name($fieldinput->name);
 
                 if (($fieldinput->name == '') or data_fieldname_exists($fieldinput->name, $data->id, $fieldinput->fid)) {
-                    
+
                     $displaynoticebad = get_string('invalidfieldname','data');
 
                 } else {
                 /// Create a field object to collect and store the data safely
                     $field = data_get_field_from_id($fid, $data);
                     $oldfieldname = $field->field->name;
-                    
+
                     $field->field->name = $fieldinput->name;
                     $field->field->description = $fieldinput->description;
-                    
+
                     for ($i=1; $i<=10; $i++) {
                         if (isset($fieldinput->{'param'.$i})) {
                             $field->field->{'param'.$i} = $fieldinput->{'param'.$i};
                             $field->field->{'param'.$i} = '';
                         }
                     }
-                    
+
                     $field->update_field();
-                    
+
                 /// Update the templates.
                     data_replace_field_in_templates($data, $oldfieldname, $field->field->name);
-                    
-                    add_to_log($course->id, 'data', 'fields update', 
+
+                    add_to_log($course->id, 'data', 'fields update',
                                "field.php?d=$data->id&amp;mode=display&amp;fid=$fid", $fid, $cm->id);
-                    
+
                     $displaynoticegood = get_string('fieldupdated','data');
                 }
             }
                                 error('There was an error updating the database');
                             }
                         }
-                        
-                        add_to_log($course->id, 'data', 'fields delete', 
+
+                        add_to_log($course->id, 'data', 'fields delete',
                                    "field.php?d=$data->id", $field->field->name, $cm->id);
-    
+
                         $displaynoticegood = get_string('fielddeleted', 'data');
                     }
 
                     // Print confirmation message.
                     $field = data_get_field_from_id($fid, $data);
 
-                    notice_yesno('<strong>'.$field->name().': '.$field->field->name.'</strong><br /><br />'. get_string('confirmdeletefield','data'), 
+                    notice_yesno('<strong>'.$field->name().': '.$field->field->name.'</strong><br /><br />'. get_string('confirmdeletefield','data'),
                                  'field.php?d='.$data->id.'&amp;mode=delete&amp;fid='.$fid.'&amp;sesskey='.sesskey().'&amp;confirm=1',
                                  'field.php?d='.$data->id);
 
 
 
 /// Print the browsing interface
-    
+
     ///get the list of possible fields (plugins)
     $directories = get_list_of_plugins('mod/data/field/');
     $menufield = array();
         $menufield[$directory] = get_string($directory,'data');    //get from language files
     }
     asort($menufield);    //sort in alphabetical order
-    
+
 
     if (($mode == 'new') && (!empty($newtype)) && confirm_sesskey()) {          ///  Adding a new field
         $CFG->pagepath='mod/data/field/'.$newtype;
 
         $CFG->pagepath='mod/data/field/'.$newtype;
         data_print_header($course,$cm,$data,'fields');
-      
-        
+
+
         if (!record_exists('data_fields','dataid',$data->id)) {
             notify(get_string('nofieldindatabase','data'));  // nothing in database
             notify(get_string('pleaseaddsome','data', 'preset.php?id='.$cm->id));      // link to presets
 
             if ($fff = get_records('data_fields','dataid',$data->id,'id')){
                 foreach ($fff as $ff) {
-                    
+
                     $field = data_get_field($ff, $data);
 
                     $table->data[] = array(
                     '&nbsp;'.
                     '<a href="field.php?d='.$data->id.'&amp;mode=delete&amp;fid='.$field->field->id.'&amp;sesskey='.sesskey().'">'.
                     '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>'
-                    
+
                     );
                 }
             }
             print_table($table);
-        } 
-        
+        }
+
 
         echo '<div class="fieldadd" align="center">';
         echo get_string('newfield','data').': ';
             }
             echo '</select>';
             echo '&nbsp;';
-            
+
             $options = array(0 => get_string('ascending', 'data'),
                              1 => get_string('descending', 'data'));
             choose_from_menu($options, 'defaultsortdir', $data->defaultsortdir, '');
             echo '<input type="submit" value="'.get_string('go').'" />';
-    
+
             echo '</form>';
             echo '</div>';
         }
index 93aa699efccbde94d6c2bfe5a022f6c54d7058c8..61afa0dc752631c5423c7a2bfe0050d076eaa307 100755 (executable)
 class data_field_checkbox extends data_field_base {
 
     var $type = 'checkbox';
-    
+
     function data_field_checkbox($field=0, $data=0) {
         parent::data_field_base($field, $data);
     }
-    
+
     function display_add_field($recordid=0) {
         global $CFG;
-       
+
         $content = array();
 
         if ($recordid) {
@@ -42,7 +42,7 @@ class data_field_checkbox extends data_field_base {
 
         $str = '<div title="'.s($this->field->description).'">';
         $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
+
         $i = 0;
         foreach (explode("\n", $this->field->param1) as $checkbox) {
             $checkbox = trim($checkbox);
@@ -51,7 +51,7 @@ class data_field_checkbox extends data_field_base {
             }
             $str .= '<input type="checkbox" id="field_'.$this->field->id.'_'.$i.'" name="field_' . $this->field->id . '[]" ';
             $str .= 'value="' . s($checkbox) . '" ';
-            
+
             if (array_search($checkbox, $content) !== false) {
                 $str .= 'checked />';
             } else {
@@ -60,7 +60,7 @@ class data_field_checkbox extends data_field_base {
             $str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$checkbox.'</label><br />';
             $i++;
         }
-        $str .= '</fieldset>'; 
+        $str .= '</fieldset>';
         $str .= '</div>';
         return $str;
     }
@@ -70,7 +70,7 @@ class data_field_checkbox extends data_field_base {
         $content->fieldid = $this->field->id;
         $content->recordid = $recordid;
         $content->content = $this->format_data_field_checkbox_content($value);
-       
+
         if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) {
             $content->id = $oldcontent->id;
             return update_record('data_content', $content);
@@ -78,9 +78,9 @@ class data_field_checkbox extends data_field_base {
             return insert_record('data_content', $content);
         }
     }
-    
+
     function display_browse_field($recordid, $template) {
-        
+
         if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)){
             $contentArr = array();
             if (!empty($content->content)) {
index de6ac78569832b403063b87be9a4ce7d16588cef..9717faec04149425d2628e4ab9fa4a662ac4b65c 100755 (executable)
@@ -43,7 +43,7 @@ class data_field_date extends data_field_base {
         }
 
         $str = '<div title="'.s($this->field->description).'">';
-        $str .= print_date_selector('field_'.$this->field->id.'_day', 'field_'.$this->field->id.'_month', 
+        $str .= print_date_selector('field_'.$this->field->id.'_day', 'field_'.$this->field->id.'_month',
                                     'field_'.$this->field->id.'_year', $content, true);
         $str .= '</div>';
 
@@ -63,7 +63,7 @@ class data_field_date extends data_field_base {
             $content->fieldid = $this->field->id;
             $content->recordid = $recordid;
             $content->content = make_timestamp($this->year, $this->month, $this->day, 12, 0, 0, 0, false);
-    
+
             if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) {
                 $content->id = $oldcontent->id;
                 return update_record('data_content', $content);
index e4e2a515bbf1024754deef7e511e211c3a5eb334..006ec36dc5c0ec8950acae6b28c4174e83d0fd9e 100755 (executable)
@@ -23,7 +23,7 @@
 ///////////////////////////////////////////////////////////////////////////
 
 class data_field_file extends data_field_base {
-   
+
     var $type = 'file';
 
     function data_field_file($field=0, $data=0) {
@@ -61,14 +61,14 @@ class data_field_file extends data_field_base {
         }
 
         $str = '<div title="' . s($this->field->description) . '">';
-        $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>'; 
+        $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
         $str .= '<input type="hidden" name ="field_'.$this->field->id.'_file" value="fakevalue" />';
         $str .= get_string('file','data'). ' <input type="file" name ="field_'.$this->field->id.'" id="field_'.
                             $this->field->id.'" title="'.s($this->field->description).'" /><br />';
         $str .= get_string('optionalfilename','data').' <input type="text" name="field_' .$this->field->id.'_filename"
                             id="field_'.$this->field->id.'_filename" value="'.s($displayname).'" /><br />';
         $str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.s($this->field->param3).'" />';
-        $str .= '</fieldset>'; 
+        $str .= '</fieldset>';
         $str .= '</div>';
 
         if ($recordid and isset($content)){                     // Print icon
@@ -87,7 +87,7 @@ class data_field_file extends data_field_base {
         if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)){
             $contents[0] = $content->content;
             $contents[1] = $content->content1;
-            
+
             $src = empty($contents[0])? '':$contents[0];
             $name = empty($contents[1])? $src:$contents[1];
 
@@ -98,10 +98,10 @@ class data_field_file extends data_field_base {
             } else {
                 $source = $CFG->wwwroot.'/file.php?file=/'.$path;
             }
-            
+
             $width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
             $height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
-            
+
             require_once($CFG->libdir.'/filelib.php');
             $icon = mimeinfo('icon', $src);
             $str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
@@ -169,7 +169,7 @@ class data_field_file extends data_field_base {
         }
         return false;
     }
-    
+
 }
 
 ?>
index 6e7251c6eb6f17f7ee97b62f886c8600797be32a..9addeca64fb0952277fb68beb4f6824ee3dd6a6b 100755 (executable)
@@ -1,4 +1,4 @@
-<?php 
+<?php
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
 // NOTICE OF COPYRIGHT                                                   //
@@ -25,7 +25,7 @@
 class data_field_latlong extends data_field_base {
 
     var $type = 'latlong';
-    
+
     // This is an array of URL schemes for linking out to services, using the float values of lat and long.
     // In each scheme, the special markers @lat@ and @long@ will be replaced by the float values.
     // The config options for the field store each service name that should be displayed, in a comma-separated
@@ -65,14 +65,14 @@ class data_field_latlong extends data_field_base {
         }
 
         $str = '<div title="'.s($this->field->description).'">';
-        $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>'; 
+        $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
         $str .= '<table><tr><td align="right">';
         $str .= '<label for="field_'.$this->field->id.'_0">' . get_string('latitude', 'data') . '</label></td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.s($lat).'" size="10" />°N</td></tr>';
         $str .= '<tr><td align="right"><label for="field_'.$this->field->id.'_1">' . get_string('longitude', 'data') . '</label></td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($long).'" size="10" />°E</td></tr>';
         $str .= '</table>';
-        $str .= '</fieldset>'; 
+        $str .= '</fieldset>';
         $str .= '</div>';
-        
+
         return $str;
     }
 
@@ -85,7 +85,7 @@ class data_field_latlong extends data_field_base {
             if (empty($lat) or empty($long)) {
                 return '';
             }
-            
+
           if($lat < 0) {
               $compasslat = "" . sprintf('%01.4f', 0 - $lat) . '°S';
            } else {
@@ -96,11 +96,11 @@ class data_field_latlong extends data_field_base {
            } else {
               $compasslong = "" . sprintf('%01.4f', $long) . "°E";
           }
-          
+
             $str = '<form style="display:inline;">';
             $str.= "$compasslat, $compasslong";
-            
-            
+
+
             // Now let's create the jump-to-services link
             $servicesshown = explode(',', $this->field->param1);
 
@@ -122,7 +122,7 @@ class data_field_latlong extends data_field_base {
                           ."'>$servicesshown[0]</a> ";
             } elseif (sizeof($servicesshown)>1) {
                 $str .= "\n<select name='jumpto'>";
-    
+
                 foreach($servicesshown as $servicename){
                     // Add a link to a service
                     $str .= "\n  <option value='"
@@ -133,9 +133,9 @@ class data_field_latlong extends data_field_base {
                 //   which allows the "Go" button to refer to the drop-down selector.
                 $str .= "\n</select><input type='button' value='" . get_string('go') . "' onclick='if(previousSibling.value){self.location=previousSibling.value}'/>";
             }
-            
+
             $str.= '</form>';
-            
+
             return $str;
         }
         return false;
@@ -157,7 +157,7 @@ class data_field_latlong extends data_field_base {
             default:
                 break;
         }
-        
+
         if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) {
             $content->id = $oldcontent->id;
             return update_record('data_content', $content);
@@ -171,10 +171,10 @@ class data_field_latlong extends data_field_base {
 
         switch ($CFG->dbtype) {
             case 'mysql':   // string in an arithmetic operation is converted to a floating-point number
-                return '('.$fieldname.'+0.0)';  
+                return '('.$fieldname.'+0.0)';
 
             default:
-                return 'CAST('.$fieldname.' AS REAL)';  
+                return 'CAST('.$fieldname.' AS REAL)';
         }
     }
 }
index ce8119ac7698f8e270c5e13a79a34e2f9252a27b..b1fcf746001f1a7f78fe07ca7eb40aef785dea00 100644 (file)
@@ -90,7 +90,7 @@ if($rid) { // List one single item
 } else {   // List all items in turn
 
     $contents = get_records('data_content', 'fieldid', $fieldid);
-    
+
     echo '<Document>';
 
     foreach($contents as $content) {
@@ -144,9 +144,9 @@ function data_latlong_kml_bottom() {
 
 function data_latlong_kml_get_item_name($content, $field) {
     // $field->param2 contains the user-specified labelling method
-    
+
     $name = '';
-    
+
     if($field->param2 > 0) {
         $name = htmlspecialchars(get_field('data_content', 'content', 'fieldid', $field->param2, 'recordid', $content->recordid));
     }elseif($field->param2 == -2) {
@@ -155,7 +155,7 @@ function data_latlong_kml_get_item_name($content, $field) {
     if($name=='') { // Done this way so that "item #" is the default that catches any problems
         $name = get_string('entry', 'data') . " #$content->recordid";
     }
-    
-    
+
+
     return $name;
 }
index e6e54d775abc5dce58e2ada78eca1914e35bcc58..ca260223906d24deaeaeb617ef003d9e48f7c303 100755 (executable)
@@ -49,7 +49,7 @@ class data_field_menu extends data_field_base {
             }
         }
 
-        $str .= choose_from_menu($options, 'field_'.$this->field->id, $content, 
+        $str .= choose_from_menu($options, 'field_'.$this->field->id, $content,
                                  get_string('menuchoose', 'data'), '', '', true, false, 0, 'field_'.$this->field->id);
 
         $str .= '</div>';
index 4fe8dd353e7888b6b2897372c7919573fa850be6..28707e0b149f3a4b0e1dd82bee4a37801029ceea 100755 (executable)
 class data_field_multimenu extends data_field_base {
 
     var $type = 'multimenu';
-    
+
     function data_field_multimenu($field=0, $data=0) {
         parent::data_field_base($field, $data);
     }
-    
-    
+
+
     function display_add_field($recordid=0) {
 
         if ($recordid){
@@ -42,7 +42,7 @@ class data_field_multimenu extends data_field_base {
 
         $str = '<div title="'.s($this->field->description).'">';
         $str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
-        
+
         foreach (explode("\n",$this->field->param1) as $option) {
             $option = trim($option);
             $str .= '<option value="' . s($option) . '"';
@@ -57,7 +57,7 @@ class data_field_multimenu extends data_field_base {
         }
         $str .= '</select>';
         $str .= '</div>';
-        
+
         return $str;
     }
 
@@ -74,7 +74,7 @@ class data_field_multimenu extends data_field_base {
             return insert_record('data_content', $content);
         }
     }
-    
+
     function format_data_field_multimenu_content($content) {
         if (!is_array($content)) {
             $str = $content;
@@ -88,8 +88,8 @@ class data_field_multimenu extends data_field_base {
         $str = clean_param($str, PARAM_NOTAGS);
         return $str;
     }
-    
-    
+
+
     function display_browse_field($recordid, $template) {
 
         if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)){
index 78600b4ff90da663cffad504e4be503f01d5427b..3d5a019d4e68d57399d0ae3edd68c8c4f3b77a55 100755 (executable)
@@ -35,7 +35,7 @@ class data_field_number extends data_field_base {
         $content->fieldid = $this->field->id;
         $content->recordid = $recordid;
         $content->content = (float)$value;
-        
+
         if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) {
             $content->id = $oldcontent->id;
             return update_record('data_content', $content);
@@ -49,10 +49,10 @@ class data_field_number extends data_field_base {
 
         switch ($CFG->dbtype) {
             case 'mysql':   // string in an arithmetic operation is converted to a floating-point number
-                return '('.$fieldname.'+0.0)';  
+                return '('.$fieldname.'+0.0)';
 
             default:
-                return 'CAST('.$fieldname.' AS REAL)';  
+                return 'CAST('.$fieldname.' AS REAL)';
         }
     }
 
index a23768076f5abc0fecfb36cd878a55df4cedaed5..6335079635b9dd7d5864ea80502093f6044cba58 100755 (executable)
@@ -24,7 +24,7 @@
 
 require_once($CFG->dirroot.'/mod/data/field/file/field.class.php'); // Base class is 'file'
 
-class data_field_picture extends data_field_file { 
+class data_field_picture extends data_field_file {
 
     var $type = 'picture';
 
@@ -58,7 +58,7 @@ class data_field_picture extends data_field_file {
         }
 
         $str = '<div title="'.s($this->field->description).'">';
-        $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>'; 
+        $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
         $str .= '<input type="hidden" name ="field_'.$this->field->id.'_file" id="field_'.$this->field->id.'_file"  value="fakevalue" />';
         $str .= '<label for="field_'.$this->field->id.'">'.get_string('picture','data'). '</label>&nbsp;<input type="file" name ="field_'.$this->field->id.'" id="field_'.$this->field->id.'" /><br />';
         $str .= '<label for="field_'.$this->field->id.'_filename">'.get_string('alttext','data') .'</label>&nbsp;<input type="text" name="field_'
@@ -67,14 +67,14 @@ class data_field_picture extends data_field_file {
         if ($filepath){
             $str .= '<img width="'.s($this->previewwidth).'" height="'.s($this->previewheight).'" src="'.$filepath.'" alt="" />';
         }
-        $str .= '</fieldset>'; 
+        $str .= '</fieldset>';
         $str .= '</div>';
         return $str;
     }
 
     function display_browse_field($recordid, $template) {
         global $CFG;
-        
+
         if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)){
             if (isset($content->content)){
                 $contents[0] = $content->content;
@@ -129,7 +129,7 @@ class data_field_picture extends data_field_file {
         if ($oldfield && ($oldfield->param4 != $this->field->param4 || $oldfield->param5 != $this->field->param5)) {
 
             // Check through all existing records and update the thumbnail
-            if ($contents = get_records('data_content', 'fieldid', $this->field->id)) { 
+            if ($contents = get_records('data_content', 'fieldid', $this->field->id)) {
                 if (count($contents) > 20) {
                     notify(get_string('resizingimages', 'data'), 'notifysuccess');
                     echo "\n\n";   // To make sure that ob_flush() has the desired effect
@@ -182,23 +182,23 @@ class data_field_picture extends data_field_file {
         }
 
         switch ($image->type) {
-            case 1: 
+            case 1:
                 if (function_exists('ImageCreateFromGIF')) {
-                    $im = ImageCreateFromGIF($originalfile); 
+                    $im = ImageCreateFromGIF($originalfile);
                 } else {
                     return;
                 }
                 break;
-            case 2: 
+            case 2:
                 if (function_exists('ImageCreateFromJPEG')) {
-                    $im = ImageCreateFromJPEG($originalfile); 
+                    $im = ImageCreateFromJPEG($originalfile);
                 } else {
                     return;
                 }
                 break;
             case 3:
                 if (function_exists('ImageCreateFromPNG')) {
-                    $im = ImageCreateFromPNG($originalfile); 
+                    $im = ImageCreateFromPNG($originalfile);
                 } else {
                     return;
                 }
@@ -208,12 +208,12 @@ class data_field_picture extends data_field_file {
         // fix for MDL-7270
         $thumbwidth  = isset($this->field->param4)?$this->field->param4:'';
         $thumbheight = isset($this->field->param5)?$this->field->param5:'';
-        
+
         if ($thumbwidth || $thumbheight) { // Only if either width OR height specified do we want a thumbnail
-            
+
             $wcrop = $image->width;
             $hcrop = $image->height;
-            
+
             if ($thumbwidth && !$thumbheight) {
                 $thumbheight = $image->height * $thumbwidth / $image->width;
             } else if($thumbheight && !$thumbwidth) {
@@ -227,7 +227,7 @@ class data_field_picture extends data_field_file {
                     $hcrop = intval($thumbheight * $wratio);
                 }
             }
-            
+
             // At this point both $thumbwidth and $thumbheight are set, and $wcrop and $hcrop
             if (function_exists('ImageCreateTrueColor') and $CFG->gdversion >= 2) {
                 $im1 = ImageCreateTrueColor($thumbwidth,$thumbheight);
@@ -236,21 +236,21 @@ class data_field_picture extends data_field_file {
             }
             $cx = $image->width  / 2;
             $cy = $image->height / 2;
-    
+
             // These "half" measurements use the "crop" values rather than the actual dimensions
             $halfwidth  = floor($wcrop * 0.5);
             $halfheight = floor($hcrop * 0.5);
-            
-            ImageCopyBicubic($im1, $im, 0, 0, $cx-$halfwidth, $cy-$halfheight, 
+
+            ImageCopyBicubic($im1, $im, 0, 0, $cx-$halfwidth, $cy-$halfheight,
                              $thumbwidth, $thumbheight, $halfwidth*2, $halfheight*2);
-    
+
             if (function_exists('ImageJpeg')) {
                 @touch($thumbnaillocation);  // Helps in Safe mode
                 if (ImageJpeg($im1, $thumbnaillocation, 90)) {
                     @chmod($thumbnaillocation, 0666);
                 }
             }
-            
+
         } else { // Try and remove the thumbnail - we don't want thumbnailing active
             @unlink($thumbnaillocation);
         }
index cd1a4005a2c58ef555d39728088035c9fa73d188..9b40e9cff1fbef61fad0cefa63a24cf83d7e55ce 100755 (executable)
 class data_field_radiobutton extends data_field_base {
 
     var $type = 'radiobutton';
-    
+
     function data_field_radiobutton($field=0, $data=0) {
         parent::data_field_base($field, $data);
     }
-    
-    
+
+
     function display_add_field($recordid=0) {
         global $CFG;
 
@@ -42,7 +42,7 @@ class data_field_radiobutton extends data_field_base {
 
         $str = '<div title="'.s($this->field->description).'">';
         $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
+
         $i = 0;
         foreach (explode("\n",$this->field->param1) as $radio) {
             $radio = trim($radio);
@@ -62,7 +62,7 @@ class data_field_radiobutton extends data_field_base {
             $str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$radio.'</label><br />';
             $i++;
         }
-        $str .= '</fieldset>'; 
+        $str .= '</fieldset>';
         $str .= '</div>';
         return $str;
     }
index 3d35af99ded620d8ae37dc6eb8c4d72ced6c246d..44ebf79798086b98e4563eb9a95e1d2845a4dd37 100755 (executable)
 class data_field_textarea extends data_field_base {
 
     var $type = 'textarea';
-    
+
     function data_field_textarea($field=0, $data=0) {
         parent::data_field_base($field, $data);
     }
-    
-    
+
+
     function display_add_field($recordid=0) {
         global $CFG;
 
@@ -45,7 +45,7 @@ class data_field_textarea extends data_field_base {
         }
 
         $str = '<div title="'.$this->field->description.'">';
-        
+
         if (can_use_richtext_editor()) {
             // Show a rich text html editor.
             $str .= $this->gen_textarea(true, $text);
@@ -59,8 +59,8 @@ class data_field_textarea extends data_field_base {
             // Get the available text formats for this field.
             $formatsForField = format_text_menu();
             $str .= '<br />';
-            
-            $str .= choose_from_menu($formatsForField, 'field_' . $this->field->id . 
+
+            $str .= choose_from_menu($formatsForField, 'field_' . $this->field->id .
                                      '_content1', $format, 'choose', '', '', true);
 
             $str .= helpbutton('textformat', get_string('helpformatting'), 'moodle', true, false, '', true);
@@ -68,21 +68,21 @@ class data_field_textarea extends data_field_base {
         $str .= '</div>';
         return $str;
     }
-    
-    
+
+
     function gen_textarea($usehtmleditor, $text='') {
-        return print_textarea($usehtmleditor, $this->field->param3, $this->field->param2, 
+        return print_textarea($usehtmleditor, $this->field->param3, $this->field->param2,
                               '', '', 'field_'.$this->field->id, $text, '', true, 'field_' . $this->field->id);
     }
-    
-    
+
+
     function print_after_form() {
         if (can_use_richtext_editor()) {
             use_html_editor('field_' . $this->field->id, '', 'field_' . $this->field->id);
         }
     }
-    
-    
+
+
     function update_content($recordid, $value, $name='') {
         $content = new object;
         $content->fieldid = $this->field->id;
index 538dcd6f3a521faea14facb2ab84a8dcecaa7901..124d9e3c0dcb5c406fd8ff06dc2f4f28c71220d1 100755 (executable)
@@ -54,7 +54,7 @@ class data_field_url extends data_field_base {
             $str .= '<input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.s($url).'" size="60" />';
         }
         $str .= '</div>';
-        
+
         return $str;
     }
 
@@ -70,7 +70,7 @@ class data_field_url extends data_field_base {
             if (!empty($this->field->param2)) { // param2 forces the text to something
                 $text = $this->field->param2;
             }
-            
+
             if ($this->field->param1) { // param1 defines whether we want to autolink the url.
                 if (!empty($text)) {
                     $str = '<a href="'.$url.'">'.$text.'</a>';
@@ -101,7 +101,7 @@ class data_field_url extends data_field_base {
             default:
                 break;
         }
-        
+
         if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) {
             $content->id = $oldcontent->id;
             return update_record('data_content', $content);
@@ -109,7 +109,7 @@ class data_field_url extends data_field_base {
             return insert_record('data_content', $content);
         }
     }
-    
+
     function notemptyfield($value, $name){
         $names = explode('_',$name);
         $value = clean_param($value, PARAM_URL);    //clean first
index d0e9cc6c4d9b6d3f98e29eff79f7f69ebfbd3068..840a7002e95db5b3fbd89a7513b34b92148acd24 100644 (file)
@@ -20,7 +20,7 @@
         if (empty($courseid)) {
             return $text;
         }
-        
+
         // Create a list of all the resources to search for. It may be cached already.
         if (empty($contentlist)) {
             // We look for text field contents only, and only if the field has
                             'AND dr.id = dc.recordid ' .
                             "AND df.type = 'text' " .
                             'AND df.param1 = 1';
-            
+
             if (!$datacontents = get_records_sql($sql)) {
                 return $text;
             }
-            
+
             $contentlist = array();
-            
+
             foreach ($datacontents as $datacontent) {
                 $currentcontent = trim($datacontent->content);
                 $strippedcontent = strip_tags($currentcontent);
-                
+
                 if (!empty($strippedcontent)) {
                     $contentlist[] = new filterobject(
                                             $currentcontent,
index 77c59daa4effdfd82cdf810c30f492dc52956a8e..ef0f929eea5d892e4ad4636939136bf5417013a0 100755 (executable)
@@ -33,7 +33,7 @@
     $rid             = optional_param('rid', 0, PARAM_INT); // record id
     $fielddelimiter  = optional_param('fielddelimiter', ',', PARAM_CLEANHTML); // characters used as field delimiters for csv file import
     $fieldenclosure = optional_param('fieldenclosure', '', PARAM_CLEANHTML);   // characters used as record delimiters for csv file import
-        
+
     if ($id) {
         if (! $cm = get_coursemodule_from_id('data', $id)) {
             error('Course Module ID was incorrect');
             error('Course Module ID was incorrect');
         }
     }
-    
+
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     require_capability('mod/data:uploadentries', $context);
-    
+
     if (has_capability('mod/data:managetemplates', $context)) {
         if (!count_records('data_fields','dataid',$data->id)) {      // Brand new database!
             redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id);  // Redirect to field entry
@@ -71,7 +71,7 @@
             error (get_string('noaccess','data'));
         }
     }
-  
+
 
 /// Print the page header
     $strdata = get_string('modulenameplural','data');
 /// Print the tabs
     $currenttab = 'add';
     include('tabs.php');
-    
-    
+
+
     $um = new upload_manager('recordsfile', false, false, null, false, 0);
-    
+
     if ($um->preprocess_files() && confirm_sesskey()) {
         $filename = $um->files['recordsfile']['tmp_name'];
-        
+
         // Large files are likely to take their time and memory. Let PHP know
         // that we'll take longer, and that the process should be recycled soon
         // to free up memory.
         if (function_exists('apache_child_terminate')) {
             @apache_child_terminate();
         }
-        
+
         //Fix mac/dos newlines
         $text = my_file_get_contents($filename);
         $text = preg_replace('!\r\n?!',"\n",$text);
         $fp = fopen($filename, "w");
         fwrite($fp, $text);
         fclose($fp);
-        
+
         $recordsadded = 0;
-        
+
         if (!$records = data_get_records_csv($filename, $fielddelimiter, $fieldenclosure)) {
             error('get_records_csv failed to read data from the uploaded file. Please check file for field name typos and formatting errors.');
         } else {
             //$db->debug = true;
             $fieldnames = array_shift($records);
-            
+
             foreach ($records as $record) {
                 if ($recordid = data_add_record($data, 0)) {  // add instance to data_record
                     $fields = get_records('data_fields', 'dataid', $data->id, '', 'name, id, type');
-                    
+
                     // do a manual round of inserting, to make sure even empty contents get stored
                     foreach ($fields as $field) {
                         $content->recordid = $recordid;
@@ -179,14 +179,14 @@ function my_file_get_contents($filename, $use_include_path = 0) {
 // Perform a simple field count check for each record.
 function data_get_records_csv($filename, $fielddelimiter=',', $fieldenclosure="\n") {
     global $db;
-    
+
     if (empty($fielddelimiter)) {
         $fielddelimiter = ',';
     }
     if (empty($fieldenclosure)) {
         $fieldenclosure = "\n";
     }
-    
+
     if (!$fp = fopen($filename, "r")) {
         error('get_records_csv failed to open '.$filename);
     }
@@ -194,13 +194,13 @@ function data_get_records_csv($filename, $fielddelimiter=',', $fieldenclosure="\
     $rows = array();
 
     $fieldnames = fgetcsv($fp, 4096, $fielddelimiter, $fieldenclosure);
-    
+
     if (empty($fieldnames)) {
         fclose($fp);
         return false;
     }
     $rows[] = $fieldnames;
-    
+
     while (($data = fgetcsv($fp, 4096, $fielddelimiter, $fieldenclosure)) !== false) {
         if (count($data) > count($fieldnames)) {
             // For any given record, we can't have more data entities than the number of fields.
@@ -209,7 +209,7 @@ function data_get_records_csv($filename, $fielddelimiter=',', $fieldenclosure="\
         }
         $rows[] = $data;
     }
-    
+
     fclose($fp);
     return $rows;
 }
index 4624c921708d335c14db5a5939fe00d952a2c140..516b328fce2415b1ee75057d55b0269e0d6e4de6 100755 (executable)
@@ -43,7 +43,7 @@
     $strdata = get_string('modulename','data');
 
     print_header_simple($strdata, '', $strdata, '', '', true, "", navmenu($course));
-  
+
     if (! $datas = get_all_instances_in_course("data", $course)) {
         notice("There are no databases", "$CFG->wwwroot/course/view.php?id=$course->id");
     }
         } else {
             $numunapprovedrecords = '-';
         }
-        
+
         $rsslink = '';
         if ($rss && $data->rssarticles > 0) {
             $rsslink = rss_get_link($course->id, $USER->id, 'data', $data->id, 'RSS');
                 $currentsection = $data->section;
             }
             $row = array ($printsection, $link, $data->intro, $numrecords, $numunapprovedrecords);
-    
+
         } else {
             $row = array ($link, $data->intro, $numrecords, $numunapprovedrecords);
         }
     echo "<br />";
     print_table($table);
     print_footer($course);
-    
+
 ?>
index d05a4c53267c7680a3242589686c5911f5fe3b0c..6972acf6412a76503a0ac4d69f950d2e3534ebab 100644 (file)
@@ -37,4 +37,4 @@
         header('Content-type: text/css');  // Correct MIME type
 
         echo $data->jstemplate;
-    } 
+    }
index b2dfa494982d9cdb96d67041941a46848fdb6705..fa308e9606471dbe5deea3e1c478d282e88d824c 100755 (executable)
@@ -370,7 +370,7 @@ function data_generate_default_template(&$data, $template, $recordid=0, $form=fa
         }
 
         if ($update) {
-            $newdata = new object(); 
+            $newdata = new object();
             $newdata->id = $data->id;
             $newdata->{$template} = $str;
             if (!update_record('data', $newdata)) {
index eda4b9cde4b238f2f3f6adda400e6e2870a2e1ee..7f7116a143c04939c09b0ede08e119b85c43dca4 100644 (file)
@@ -3,22 +3,22 @@ require_once ('moodleform_mod.php');
 
 class data_mod_form extends moodleform_mod {
 
-       function definition() {
+    function definition() {
 
-               global $CFG;
-               $mform    =& $this->_form;
-               $renderer =& $mform->defaultRenderer();
+        global $CFG;
+        $mform    =& $this->_form;
+        $renderer =& $mform->defaultRenderer();
 
 //-------------------------------------------------------------------------------
         $mform->addElement('header', 'general', get_string('general', 'form'));
 
         $mform->addElement('text', 'name', get_string('name'));
-               $mform->setType('name', PARAM_TEXT);
-               $mform->addRule('name', null, 'required', null, 'client');
+        $mform->setType('name', PARAM_TEXT);
+        $mform->addRule('name', null, 'required', null, 'client');
 
-               $mform->addElement('htmleditor', 'intro', get_string('intro', 'data'));
-               $mform->setType('intro', PARAM_RAW);
-               $mform->addRule('intro', null, 'required', null, 'client');
+        $mform->addElement('htmleditor', 'intro', get_string('intro', 'data'));
+        $mform->setType('intro', PARAM_RAW);
+        $mform->addRule('intro', null, 'required', null, 'client');
 
         $mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));
 
@@ -33,20 +33,20 @@ class data_mod_form extends moodleform_mod {
                         (array_combine(range(1, DATA_MAX_ENTRIES),//keys
                                         range(1, DATA_MAX_ENTRIES)));//values
         $mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions);
-               $mform->setHelpButton('requiredentries', array('requiredentries', get_string('requiredentries', 'data'), 'data'));
+        $mform->setHelpButton('requiredentries', array('requiredentries', get_string('requiredentries', 'data'), 'data'));
 
         $mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions);
-               $mform->setHelpButton('requiredentriestoview', array('requiredentriestoview', get_string('requiredentriestoview', 'data'), 'data'));
+        $mform->setHelpButton('requiredentriestoview', array('requiredentriestoview', get_string('requiredentriestoview', 'data'), 'data'));
 
         $mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions);
-               $mform->setHelpButton('maxentries', array('maxentries', get_string('maxentries', 'data'), 'data'));
+        $mform->setHelpButton('maxentries', array('maxentries', get_string('maxentries', 'data'), 'data'));
 
         $ynoptions = array( 0 => get_string('no'), 1 => get_string('yes'));
         $mform->addElement('select', 'comments', get_string('comments', 'data'), $ynoptions);
-               $mform->setHelpButton('comments', array('comments', get_string('allowcomments', 'data'), 'data'));
+        $mform->setHelpButton('comments', array('comments', get_string('allowcomments', 'data'), 'data'));
 
         $mform->addElement('select', 'approval', get_string('requireapproval', 'data'), $ynoptions);
-               $mform->setHelpButton('approval', array('requireapproval', get_string('requireapproval', 'data'), 'data'));
+        $mform->setHelpButton('approval', array('requireapproval', get_string('requireapproval', 'data'), 'data'));
 
         $mform->addElement('select', 'numberrssarticles', get_string('numberrssarticles', 'data') , $countoptions);
 
@@ -63,8 +63,8 @@ class data_mod_form extends moodleform_mod {
         $buttonarray[] = &$mform->createElement('reset', 'resetbutton', get_string('revert'));
         $buttonarray[] = &$mform->createElement('cancel');
         $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
-               $renderer->addStopFieldsetElements('buttonar');
-       }
+        $renderer->addStopFieldsetElements('buttonar');
+    }
 
 
 }
index f97754e8ef83b1cda80261f2a7dd3318ee18936f..aee8b984a8c6dee96d76466a2dc19a05d7a64963 100755 (executable)
@@ -79,7 +79,7 @@ class page_data extends page_generic_activity {
             $buttons = '&nbsp;';
         }
         print_header($title, $this->courserecord->fullname, $crumbtext, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord));
-        
+
     }
 
     function get_type() {
index f0bf413b6a66dabd932552a59780c0adad5e0685..773dbaa3267351e71dc3a09cdc79fbfb5e8f2ea5 100644 (file)
@@ -11,7 +11,7 @@ function list() {
     for (i=0; i < imageDivs.length; i++) {
         currentHeight = imageDivs[i].offsetHeight;
         currentWidth = imageDivs[i].offsetWidth;
-        
+
         if (currentHeight > maxListHeight) {
             ratio = maxListHeight / currentHeight;
             imageDivs[i].style.width = (currentWidth*ratio) + 'px';
@@ -28,12 +28,12 @@ function single() {
     if (imageDiv) {
         currentHeight = imageDiv.offsetHeight;
         currentWidth  = imageDiv.offsetWidth;
-        
+
         if (currentHeight > maxHeight) {
             ratio = maxHeight / currentHeight;
             imageDiv.style.width = (currentWidth*ratio) + 'px';
             imageDiv.style.height = (currentHeight*ratio) + 'px';
-        
+
         }
     }
 }
index bd11f1e67860a7cde5dcd233935b28fdbc2787a5..aad90cc3912fa53280c913af23f75bd4feb630ff 100644 (file)
@@ -92,14 +92,14 @@ function data_restore_mods($mod,$restore) {
         if (isset($info['MOD']['#']['ASSESSPUBLIC']['0']['#'])) {
             $database->assesspublic = backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
         }
-        
+
         $newid = insert_record ('data', $database);
 
         //Do some output
         if (!defined('RESTORE_SILENTLY')) {
             echo "<li>".get_string("modulename","data")." \"".format_string(stripslashes($database->name),true)."\"</li>";
         }
-        
+
         if ($newid) {
             //We have the newid, update backup_ids
             backup_putid($restore->backup_unique_code,$mod->modtype,
@@ -112,10 +112,10 @@ function data_restore_mods($mod,$restore) {
                 // Moodle 1.5
                 $restore_userdata_selected = $restore->mods['data']->userinfo;
             }
-            
+
             //Restore data_fields first!!! need to hold an array of [oldid]=>newid due to double dependencies
             $status = $status and data_fields_restore_mods ($mod->id, $newid, $info, $restore);
-            
+
             if ($restore_userdata_selected) {
                 $status = $status and data_records_restore_mods ($mod->id, $newid, $info, $restore);
             }
@@ -125,7 +125,7 @@ function data_restore_mods($mod,$restore) {
             // It means the backup was made pre Moodle 1.7. We check the
             // backup_version to make sure.
             if (isset($database->participants) && isset($database->assesspublic)) {
-                            
+
                 if (!$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {
                       notice('Default teacher role was not found. Roles and permissions '.
                              'for your database modules will have to be manually set.');
@@ -142,29 +142,29 @@ function data_restore_mods($mod,$restore) {
                 data_convert_to_roles($database, $teacherroles, $studentroles,
                                       $restore->mods['data']->instances[$mod->id]->restored_as_course_module);
             }
-            
+
         } else {
             $status = false;
         }
     } else {
         $status = false;
     }
-    
+
     return $status;
 }
 
 function data_fields_restore_mods ($old_data_id, $new_data_id, $info, $restore) {
 
     global $CFG, $fieldids;
-    
-    
+
+
     $fields = $info['MOD']['#']['FIELDS']['0']['#']['FIELD'];
 
     for ($i = 0; $i < sizeof($fields); $i++) {
-        
+
         $fie_info = $fields[$i];
         $oldid = backup_todb($fie_info['#']['ID']['0']['#']);
-        
+
         $field -> dataid = $new_data_id;
         $field -> type = backup_todb($fie_info['#']['TYPE']['0']['#']);
         $field -> name = backup_todb($fie_info['#']['NAME']['0']['#']);
@@ -179,9 +179,9 @@ function data_fields_restore_mods ($old_data_id, $new_data_id, $info, $restore)
         $field -> param8 = backup_todb($fie_info['#']['PARAM8']['0']['#']);
         $field -> param9 = backup_todb($fie_info['#']['PARAM9']['0']['#']);
         $field -> param10 = backup_todb($fie_info['#']['PARAM10']['0']['#']);
-        
+
         $newid = insert_record ("data_fields",$field);
-        
+
         $fieldids[$oldid] = $newid;    //so we can use them in sub tables that depends on both fieldid and recordid
 
         //Do some output
@@ -194,14 +194,14 @@ function data_fields_restore_mods ($old_data_id, $new_data_id, $info, $restore)
             }
             backup_flush(300);
         }
-        
+
         if ($newid) {
             //We have the newid, update backup_ids
             $status = backup_putid($restore->backup_unique_code,"data_fields",$oldid, $newid);
         } else {
             $status = false;
         }
-        
+
     }
     return $status;
 
@@ -231,7 +231,7 @@ function data_records_restore_mods ($old_data_id, $new_data_id, $info, $restore)
         if ($user) {
             $record->userid = $user->new_id;
         }
-        
+
         $newid = insert_record ("data_records",$record);
 
         //Do some output
@@ -322,7 +322,7 @@ function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_fie
     //in CFG->dataroot
     $dest_dir = $CFG->dataroot."/".$restore->course_id;
     $status = check_dir_exists($dest_dir,true);
-    
+
     //Now, locate course's moddata directory
     $moddata_path = $CFG->dataroot."/".$restore->course_id."/".$CFG->moddata;
 
@@ -355,7 +355,7 @@ function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_fie
         $this_record_path = $this_field_path = $this_field_path."/".$new_record_id;
         $status = check_dir_exists($this_record_path,true);
         //And now, copy temp_path to user_data_path
-        
+
         $status = @backup_copy_file($temp_path, $this_record_path);
     }
 
index cf874ca0a35e32d8894a26313732b02096011006..9ed28ca95cae9a2f971264fd7c92a39a189c3d0e 100644 (file)
@@ -24,7 +24,7 @@
             // Iterate over all data.
             if ($datas = get_records('data')) {
                 foreach ($datas as $data) {
-                    
+
                     if ($data->rssarticles > 0) {
 
                         // Get the first field in the list  (a hack for now until we have a selector)
@@ -41,7 +41,7 @@
                                     "FROM {$CFG->prefix}data_records dr " .
                                     "WHERE dr.dataid = {$data->id} " .$approved.
                                     'ORDER BY dr.timecreated DESC';
-                        
+
                         if (!$records = get_records_sql($sql, 0, $data->rssarticles)) {
                             continue;
                         }
@@ -55,7 +55,7 @@
                                 continue;
                             }
                         }
-                        
+
                         // Now create all the articles
                         mtrace('Creating feed for '.$data->name);
 
@@ -66,7 +66,7 @@
                             array_push($recordarray, $record);
 
                             $item = null;
-                            
+
                             // guess title or not
                             if ($data->rsstitletemplate) {
                                 $item->title = data_print_template('rsstitletemplate', $recordarray, $data, '', 0, true);
                             $item->description = data_print_template('rsstemplate', $recordarray, $data, '', 0, true);
                             $item->pubdate = $record->timecreated;
                             $item->link = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id;
-                            
+
                             array_push($items, $item);
                         }
                         $course = get_record('course', 'id', $data->course);
-                        
+
                         // First all rss feeds common headers.
                         $header = rss_standard_header($course->shortname.': '.format_string($data->name,true),
                                                       $CFG->wwwroot."/mod/data/view.php?d=".$data->id,
                                                       format_string($data->intro,true));
-                        
+
                         if (!empty($header)) {
                             $articles = rss_add_items($items);
                         }
-                        
+
                         // Now all rss feeds common footers.
                         if (!empty($header) && !empty($articles)) {
                             $footer = rss_standard_footer();
@@ -98,7 +98,7 @@
                         // Now, if everything is ok, concatenate it.
                         if (!empty($header) && !empty($articles) && !empty($footer)) {
                             $rss = $header.$articles.$footer;
-                            
+
                             //Save the XML contents to file.
                             $status = rss_save_file('data', $data, $rss);
                         }
index f592e72d183cd6f4f41d93f3f5b271bce4118383..f17d53a8dfb034893533e8abbdcb318a5e9a584c 100755 (executable)
     if (empty($currenttab) or empty($data) or empty($course)) {
         error('You cannot call this script in that way');
     }
-    
+
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
     $inactive = NULL;
     $row = array();
-    
+
     $row[] = new tabobject('list', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id, get_string('list','data'), '', true);
 
     if (isset($record)) {
             } else {
                 $defaultemplate = 'singletemplate';
             }
-    
-            $row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&amp;mode='.$defaultemplate, 
+
+            $row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&amp;mode='.$defaultemplate,
                          get_string('templates','data'));
-            $row[] = new tabobject('fields', $CFG->wwwroot.'/mod/data/field.php?d='.$data->id, 
+            $row[] = new tabobject('fields', $CFG->wwwroot.'/mod/data/field.php?d='.$data->id,
                          get_string('fields','data'), '', true);
-            $row[] = new tabobject('presets', $CFG->wwwroot.'/mod/data/preset.php?d='.$data->id, 
+            $row[] = new tabobject('presets', $CFG->wwwroot.'/mod/data/preset.php?d='.$data->id,
                          get_string('presets', 'data'), '', true);
         }
     }
         }
         $tabs[] = $row;
     }
-    
+
 
 /// Print out the tabs and continue!
 
     print_tabs($tabs, $currenttab, $inactive);
-    
+
 ?>
index c79e1d6bfe443b3091aec75388d96e0fecadf374..d87be18732d75bad645bd21dc7563bd035f2417f 100755 (executable)
@@ -25,7 +25,7 @@
     require_once('../../config.php');
     require_once('lib.php');
     require_once($CFG->libdir.'/blocklib.php');
-    
+
     require_login();
 
     $id    = optional_param('id', 0, PARAM_INT);  // course module id
 /// Print the page header
 
     $strdata = get_string('modulenameplural','data');
-    
+
     // For the javascript for inserting template tags: initialise the default textarea to
     // 'edit_template' - it is always present in all different possible views.
 
     $editorobj = 'editor_'.md5('template');
-    
+
     $bodytag = 'onload="';
     $bodytag .= 'if (typeof('.$editorobj.') != \'undefined\') { currEditor = '.$editorobj.'; } ';
     $bodytag .= 'currTextarea = document.tempform.template;';
     $bodytag .= '" ';
-    
+
     print_header_simple($data->name, '', "<a href='index.php?id=$course->id'>$strdata</a> -> $data->name",
-                        '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), 
+                        '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
                         navmenu($course, $cm), '', $bodytag);
-    
+
     print_heading(format_string($data->name));
 
 /// Groups needed for Add entry tab
 
 /// Print the tabs.
     $currenttab = 'templates';
-    include('tabs.php'); 
+    include('tabs.php');
 
 
 /// Processing submitted data, i.e updating form.
     $resettemplate = false;
 
 /// html editor is by default disabled
-    $editor = isset($SESSION->data_use_editor) ? $SESSION->data_use_editor : (can_use_html_editor() ? 1 : 0); 
+    $editor = isset($SESSION->data_use_editor) ? $SESSION->data_use_editor : (can_use_html_editor() ? 1 : 0);
 
     if (($mytemplate = data_submitted($CFG->wwwroot.'/mod/data/templates.php')) && confirm_sesskey()) {
         $newtemplate->id = $data->id;
         $newtemplate->{$mode} = $mytemplate->template;
-        
+
         if (!empty($mytemplate->switcheditor)) {
             $editor = $editor ? 0 : 1;
             $SESSION->data_use_editor = $editor;
     }
 
 /// If everything is empty then generate some defaults
-    if (empty($data->addtemplate) and empty($data->singletemplate) and 
+    if (empty($data->addtemplate) and empty($data->singletemplate) and
         empty($data->listtemplate) and empty($data->rsstemplate)) {
         data_generate_default_template($data, 'singletemplate');
         data_generate_default_template($data, 'listtemplate');
         echo '</td>';
         echo '</tr>';
     }
-    
+
     // Print the main template.
 
     echo '<tr><td valign="top">';
         echo '<label for="availabletags">'.get_string('availabletags','data').'</label>';
         helpbutton('tags', get_string('tags','data'), 'data');
         echo '<br />';
-        
+
         echo '<select name="fields1[]" id="availabletags" size="10" ';
-        
+
         // Javascript to insert the field tags into the textarea.
         echo 'onclick="';
         echo 'if (typeof(currEditor) != \'undefined\' && currEditor._editMode == \'wysiwyg\') {';
         echo 'insertAtCursor(currTextarea, this.options[selectedIndex].value);';   // For inserting when in HTMLArea code view or for normal textareas.
         echo '}';
         echo '">';
-        
+
         $fields = get_records('data_fields', 'dataid', $data->id);
         echo '<optgroup label="'.get_string('fields', 'data').'">';
         foreach ($fields as $field) {
             }
             echo '</optgroup>';
         }
-        
+
         // Print special tags. fix for MDL-7031
         if ($mode != 'addtemplate') {
             echo '<optgroup label="'.get_string('buttons', 'data').'">';
         echo '<br /><br /><br /><br /><input type="submit" name="defaultform" value="'.get_string('resettemplate','data').'" />';
     }
     echo '</td>';
-    
+
     echo '<td>';
     if ($mode == 'listtemplate'){
-        echo '<div align="center"><label for="edit-template">'.get_string('multientry','data').'</label></div>';        
+        echo '<div align="center"><label for="edit-template">'.get_string('multientry','data').'</label></div>';
     } else {
         echo '<div align="center"><label for="edit-template">'.get_string($mode,'data').'</label></div>';
     }
     print_textarea($usehtmleditor, 20, 72, 0, 0, 'template', $data->{$mode});
     echo '</td>';
     echo '</tr>';
-    
+
     if ($mode == 'listtemplate'){
         echo '<tr>';
         echo '<td>&nbsp;</td>';
 
     echo '<tr><td align="center" colspan="2">';
     echo '<input type="submit" value="'.get_string('savetemplate','data').'" />&nbsp;';
-    
+
     echo '</td></tr></table>';
-    
-    
+
+
     print_simple_box_end();
     echo '</form>';
     if ($usehtmleditor) {
-        use_html_editor('template');        
+        use_html_editor('template');
         if ($mode == 'listtemplate'){
             use_html_editor('listtemplateheader');
             use_html_editor('listtemplatefooter');
index 9842208dd4230167c99ea7231a15f95091e82389..754d2d397d65bb623d00dba5bcfb09d0a3831546 100755 (executable)
@@ -28,7 +28,7 @@
     require_once("$CFG->libdir/rsslib.php");
 
     require_once('pagelib.php');
-    
+
 
 /// One of these is necessary!
     $id    = optional_param('id', 0, PARAM_INT);  // course module id
@@ -42,7 +42,7 @@
 /// These can be added to perform an action on a record
     $approve = optional_param('approve', 0, PARAM_INT);    //approval recordid
     $delete = optional_param('delete', 0, PARAM_INT);    //delete recordid
-    
+
     if ($id) {
         if (! $cm = get_coursemodule_from_id('data', $id)) {
             error('Course Module ID was incorrect');
@@ -82,7 +82,7 @@
     }
 
     require_course_login($course, true, $cm);
-    
+
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     require_capability('mod/data:viewentry', $context);
 
         $meta .= '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/data/js.php?d='.$data->id.'"></script>';
     }
 
-    
+
 /// Print the page header
     $PAGE->print_header($course->shortname.': %fullname%', '', $meta);
-    
+
 
 /// If we have blocks, then print the left side here
     if (!empty($CFG->showblocksonmodpages)) {
     }
 
     print_heading(format_string($data->name));
-    
+
     // Do we need to show a link to the RSS feed for the records?
     if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
         echo '<div style="float:right;">';
         echo '</div>';
         echo '<div style="clear:both;"></div>';
     }
-    
+
     if ($data->intro and empty($page) and empty($record) and $mode != 'single') {
         print_simple_box(format_text($data->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
     }
 
 /// Check to see if groups are being used here
     if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
-        $currentgroup = setup_and_print_groups($course, $groupmode, 
+        $currentgroup = setup_and_print_groups($course, $groupmode,
                                             'view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).
                                             '&amp;order='.s($order).'&amp;');
     } else {
         } else {   // Print a confirmation page
             if ($deleterecord = get_record('data_records', 'id', $delete)) {   // Need to check this is valid
                 if ($deleterecord->dataid == $data->id) {                       // Must be from this database
-                    notice_yesno(get_string('confirmdeleterecord','data'), 
+                    notice_yesno(get_string('confirmdeleterecord','data'),
                             'view.php?d='.$data->id.'&amp;delete='.$delete.'&amp;confirm=1&amp;sesskey='.sesskey(),
                             'view.php?d='.$data->id);
 
     } else {
         $currenttab = 'list';
     }
-    include('tabs.php'); 
+    include('tabs.php');
 
 
 /// Approve any requested records
         $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname, c.'.$sortcontent.' ';
         $count = ' COUNT(DISTINCT c.recordid) ';
         $tables = $CFG->prefix.'data_content c,'.$CFG->prefix.'data_records r,'.$CFG->prefix.'data_content c1, '.$CFG->prefix.'user u ';
-        $where =  'WHERE c.recordid = r.id 
-                     AND c.fieldid = '.$sort.' 
-                     AND r.dataid = '.$data->id.' 
-                     AND r.userid = u.id 
+        $where =  'WHERE c.recordid = r.id
+                     AND c.fieldid = '.$sort.'
+                     AND r.dataid = '.$data->id.'
+                     AND r.userid = u.id
                      AND c1.recordid = r.id ';
         $sortorder = ' ORDER BY '.$sortcontentfull.' '.$order.' , r.id ASC ';
         if ($search) {
             $searchselect = ' ';
         }
 
-    } else if ($search) { 
+    } else if ($search) {
         $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname ';
         $count = ' COUNT(DISTINCT c.recordid) ';
         $tables = $CFG->prefix.'data_content c,'.$CFG->prefix.'data_records r, '.$CFG->prefix.'user u ';
-        $where =  'WHERE c.recordid = r.id 
-                     AND r.userid = u.id 
+        $where =  'WHERE c.recordid = r.id
+                     AND r.userid = u.id
                      AND r.dataid = '.$data->id;
         $sortorder = ' ORDER BY r.id ASC ';
         $searchselect = " AND (c.content LIKE '%$search%') ";
 /// To actually fetch the records
 
     $fromsql = ' FROM '.$tables.$where.$groupselect.$approveselect.$searchselect;
-     
+
     $sqlselect = 'SELECT '.$what.$fromsql.$sortorder;
 
     $sqlcount  = 'SELECT '.$count.$fromsql;   // Total number of records
 #            if ($content = get_field('data_content', 'content', 'recordid', $record->id, 'fieldid', $sort)) {
 #                $content = addslashes($content);
 #                if ($order == 'ASC') {
-#                    $lessthan = " AND $sortcontentfull < '$content' 
+#                    $lessthan = " AND $sortcontentfull < '$content'
 #                                   OR ($sortcontentfull = '$content' AND r.id < '$record->id') ";
 #                } else {
-#                    $lessthan = " AND $sortcontentfull > '$content' 
+#                    $lessthan = " AND $sortcontentfull > '$content'
 #                                   OR ($sortcontentfull = '$content' AND r.id < '$record->id') ";
 #                }
 #            } else {   // Failed to find data (shouldn't happen), so fall back to something easy
 
     if (empty($records)) {     // Nothing to show!
         if ($record) {         // Something was requested so try to show that at least (bug 5132)
-            if (has_capability('mod/data:manageentries', $context) || empty($data->approval) || 
+            if (has_capability('mod/data:manageentries', $context) || empty($data->approval) ||
                      $record->approved || (isloggedin() && $record->userid == $USER->id)) {
                 if (!$currentgroup || $record->groupid == $currentgroup || $record->groupid == 0) {
                     $records[] = $record;