From: moodler Date: Wed, 22 Mar 2006 08:44:26 +0000 (+0000) Subject: Fixing silly stuff X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=423bd918b59d943cbd1eb9cf46b04f2b285879bf;p=moodle.git Fixing silly stuff --- diff --git a/mod/data/add.php b/mod/data/add.php index 470fe8b242..a6da935c1a 100755 --- a/mod/data/add.php +++ b/mod/data/add.php @@ -104,16 +104,12 @@ 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 @@ -200,8 +196,9 @@ } // 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); diff --git a/mod/data/field/checkbox/field.class.php b/mod/data/field/checkbox/field.class.php index 81f8f76a01..d81a986738 100755 --- a/mod/data/field/checkbox/field.class.php +++ b/mod/data/field/checkbox/field.class.php @@ -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 = '
'; + $str = '
'; - foreach (explode("\n", $field->param1) as $checkbox) { - $checkbox = ltrim(rtrim($checkbox)); - $str .= 'field->param1) as $checkbox) { + $checkbox = trim($checkbox); + $str .= '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 = '
'; + $str = '
'; if (can_use_richtext_editor()) { // Show a rich text html editor. diff --git a/mod/data/fields.php b/mod/data/fields.php index 89fdb8d014..248dcabb40 100755 --- a/mod/data/fields.php +++ b/mod/data/fields.php @@ -27,13 +27,12 @@ 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) { @@ -235,7 +234,7 @@ foreach ($fff as $ff) { $field = data_get_field($ff, $data); - ///Print Action Column + /// Print Action Column echo ''; echo ''; @@ -245,14 +244,14 @@ echo ''.get_string('delete').''; echo ''; - ///Print Fieldname Column + /// Print Fieldname Column echo ''; echo ''.$field->field->name.''; echo ''; - ///Print Type Column + /// Print Type Column echo ''; echo $field->image(); //print type icon