diff --git a/mod/data/add.php b/mod/data/add.php index a6f68fce42d..e0e370e023f 100755 --- a/mod/data/add.php +++ b/mod/data/add.php @@ -218,11 +218,13 @@ ******************************************/ if ($data->addtemplate){ $possiblefields = get_records('data_fields','dataid',$data->id); + ///then we generate strings to replace foreach ($possiblefields as $cfield){ $patterns[]="/\[\[".$cfield->name."\]\]/i"; $g = data_get_field($cfield); $replacements[] = $g->display_add_field($cfield->id, $rid); + unset($g); } $newtext = preg_replace($patterns, $replacements, $data->{$mode}); @@ -243,7 +245,18 @@ /// Finish the page echo ''; - + + + // Print the stuff that need to come after the form fields. + $storedFields = get_records('data_fields', 'dataid', $data->id); + foreach ($storedFields as $sf) { + $fieldClass = 'data_field_' . $sf->type; + $fieldObj = new $fieldClass($sf->id); + + echo "\n\n"; + $fieldObj->print_after_form(); + } + + print_footer($course); - -?> +?> \ No newline at end of file diff --git a/mod/data/lib.php b/mod/data/lib.php index 54e7add2070..e1a1a0df5c1 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -136,7 +136,7 @@ class data_field_base { //base class (text field) function display_browse_field($fieldid, $recordid){ if ($content = get_record('data_content', 'fieldid', $fieldid, 'recordid', $recordid)){ if (isset($content->content)){ - $str = $content->content; + $str = format_text($content->content, $content->content1); } else { $str = ''; } @@ -204,6 +204,17 @@ class data_field_base { //base class (text field) function delete_data_content_files($dataid, $recordid, $content){ //does nothing } + + + /************************************************************************* + * This function prints anything that the field wants to output after * + * the html form. This is handy for the javascript rich text editor * + *************************************************************************/ + function print_after_form() { + // Overridden as needed in sub classes. + } + + }//end of class data_field_base @@ -642,6 +653,7 @@ function data_get_coursemodule_info($coursemodule) { ************************************************************************/ function data_print_template($records, $data, $search, $listmode){ global $CFG; + foreach ($records as $record){ //only 1 record for single mode //replacing tags $patterns = array(); @@ -717,4 +729,8 @@ function data_print_preference_form($data, $perpage, $search){ echo ''; echo ''; } -?> + + + + +?> \ No newline at end of file diff --git a/mod/data/view.php b/mod/data/view.php index 77c8d1df82e..b4f8b48cd06 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -41,7 +41,7 @@ $page = optional_param('page', 0, PARAM_INT); //offset of the current record $rid = optional_param('rid', 0, PARAM_INT); //record id $perpagemenu = optional_param('perpage1', 0, PARAM_INT); //value from drop down - + if ($id) { if (! $cm = get_record('course_modules', 'id', $id)) { error('Course Module ID was incorrect');