Added richtext support for textarea, plus relevant help buttons. Made fields
use column content1, content 2, etc. instead of packing everything into content.
This commit is contained in:
+16
-3
@@ -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 '</td></tr></table>';
|
||||
|
||||
|
||||
|
||||
// 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);
|
||||
|
||||
?>
|
||||
?>
|
||||
+18
-2
@@ -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 '</td></tr></table>';
|
||||
echo '</form>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
+1
-1
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user