]> git.mjollnir.org Git - moodle.git/commitdiff
Fixing silly stuff
authormoodler <moodler>
Wed, 22 Mar 2006 08:44:26 +0000 (08:44 +0000)
committermoodler <moodler>
Wed, 22 Mar 2006 08:44:26 +0000 (08:44 +0000)
mod/data/add.php
mod/data/field/checkbox/field.class.php
mod/data/field/picture/field.class.php
mod/data/field/textarea/field.class.php
mod/data/fields.php

index 470fe8b242404e02ae1af9e1ffea47274c8d32a9..a6da935c1a23f56fbdd071a7987c325591b3185e 100755 (executable)
     include('tabs.php');
 
 
-/********************************************
- * code to handle form processing           *
- * add individual data_content              *
- ********************************************/
-    $entrysaved = false;    //flag for displaying entry saved msg
-
-    $ignorenames = array('MAX_FILE_SIZE','sesskey','d','rid');  // strings to be ignored in input data
+/// Process incoming data for adding/updating records
 
     if ($datarecord = data_submitted($CFG->wwwroot.'/mod/data/add.php') and confirm_sesskey()) {
 
+        $ignorenames = array('MAX_FILE_SIZE','sesskey','d','rid');  // strings to be ignored in input data
+
         if ($rid) {                                          /// Update some records
 
             /// All student edits are marked unapproved by default
     }  // End of form processing
    
 
-///Check if maximum number of entry as specified by this database is reached
-///Of course, you can't be stopped if you are an editting teacher! =)
+/// Check if maximum number of entry as specified by this database is reached
+/// Of course, you can't be stopped if you are an editting teacher! =)
+
     if (data_atmaxentries($data) and !isteacheredit($course->id)){
         notify (get_string('atmaxentry','data'));
         print_footer($course);
index 81f8f76a01d65f9e7ee3f564dc393c61f988cd55..d81a986738b6d8d0d69484f21a196d1761c2d2e5 100755 (executable)
@@ -30,7 +30,6 @@ class data_field_checkbox extends data_field_base {
         parent::data_field_base($field, $data);
     }
     
-    
     function display_add_field($recordid=0) {
         global $CFG;
        
@@ -41,11 +40,11 @@ class data_field_checkbox extends data_field_base {
             $content = explode('##', $content);
         }
 
-        $str = '<div title="'.$field->description.'">';
+        $str = '<div title="'.$this->field->description.'">';
         
-        foreach (explode("\n", $field->param1) as $checkbox) {
-            $checkbox = ltrim(rtrim($checkbox));
-            $str .= '<input type="checkbox" name="field_' . $field->id . '[]" ';
+        foreach (explode("\n", $this->field->param1) as $checkbox) {
+            $checkbox = trim($checkbox);
+            $str .= '<input type="checkbox" name="field_' . $this->field->id . '[]" ';
             $str .= 'value="' . $checkbox . '" ';
             
             if (array_search($checkbox, $content) !== false) {
index 4fd0e5454e2dbf661c8107cbec702178c1ff7fcd..1689642d694491b83756cc64db5c63a2f5218d78 100755 (executable)
@@ -39,6 +39,7 @@ class data_field_picture extends data_field_file {
         global $CFG;
 
         $filepath = '';
+        $filename = '';
         $description = '';
 
         if ($recordid){
index f6e39a14ab27ab29828836df26125e01e908a7a9..b4a0bc353c33896466f5a309e545866d6978f0ae 100755 (executable)
@@ -34,16 +34,17 @@ class data_field_textarea extends data_field_base {
     function display_add_field($recordid=0) {
         global $CFG;
 
+        $text   = '';
+        $format = 0;
+
         if ($recordid){
-            $content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid);
-            $text   = $content->content;
-            $format = $content->content1;
-        } else {
-            $text   = '';
-            $format = '';
+            if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)) {
+                $text   = $content->content;
+                $format = $content->content1;
+            }
         }
 
-        $str = '<div title="'.$thisfield->description.'">';
+        $str = '<div title="'.$this->field->description.'">';
         
         if (can_use_richtext_editor()) {
             // Show a rich text html editor.
index 89fdb8d014facb30ab23b728738021e30f103293..248dcabb409a8da88e6f866ed8b17a4d731722b4 100755 (executable)
 
     require_login();
     
-    $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
-    $newtype = optional_param('fieldmenu','',PARAM_ALPHA);    //type of the new field
-
-    //action specifies what action is performed when data is submitted
-    $mode = optional_param('mode','',PARAM_ALPHA);
+    $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
+    $newtype = optional_param('fieldmenu','',PARAM_ALPHA);    // type of the new field
+    $mode    = optional_param('mode','',PARAM_ALPHA);
+    
     $displaynotice = '';    //str to print after an operation,
     
     if ($id) {
                 foreach ($fff as $ff) {
                     $field = data_get_field($ff, $data);
 
-                    ///Print Action Column
+                    /// Print Action Column
 
                     echo '<tr><td align="center">';
                     echo '<a href="fields.php?d='.$data->id.'&amp;mode=display&amp;fid='.$field->field->id.'&amp;sesskey='.sesskey().'">';
                     echo '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>';
                     echo '</td>';
 
-                    ///Print Fieldname Column
+                    /// Print Fieldname Column
 
                     echo '<td>';
                     echo '<a href="fields.php?mode=display&amp;d='.$data->id;
                     echo '&amp;fid='.$field->field->id.'&amp;sesskey='.sesskey().'">'.$field->field->name.'</a>';
                     echo '</td>';
 
-                    ///Print Type Column
+                    /// Print Type Column
 
                     echo '<td align="center">';
                     echo $field->image();    //print type icon