Hi,
I managed to create almost all of the inputs that i needed, but when i tried to create an input html(editor).
It worked, but when i tried to save the course, a error apeared.
So i want to confirm, Can i really use an input html(editor) ?
The input coursestart its where i have the problem.
The code :
public function course_format_options($foreditform = false) {
static $courseformatoptions = false;
if ($courseformatoptions === false) {
$courseconfig = get_config('moodlecourse');
$courseformatoptions = array(
'hiddensections' => array(
'default' => $courseconfig->hiddensections,
'type' => PARAM_INT
),
'coursedisplay' => array(
'default' => $courseconfig->coursedisplay,
'type' => PARAM_INT
),
'courseappearinfrontpage' => array (
'default' => get_config('format_ead', 'courseappearinfrontpage'),
'type' => PARAM_BOOL
),
'courseorderinfrontpage' => array (
'default' => get_config('format_ead', 'courseorderinfrontpage'),
'type' => PARAM_INT
),
'coursetype' => array (
'default' => get_config('format_ead', 'coursetype'),
'type' => PARAM_INT
),
'courseshowroomimage' => array(
'default' => get_config('format_ead', 'coursesampleimage'),
'type' => PARAM_FILE,
),
'coursetargetaudience' => array (
'default' => get_config('format_ead', 'coursetargetaudience'),
'type' => PARAM_TEXT
),
'courseobjective' => array (
'default' => get_config('format_ead', 'courseobjective'),
'type' => PARAM_TEXT
),
'courseworkload' => array (
'default' => get_config('format_ead', 'courseworkload'),
'type' => PARAM_TEXT
),
'coursestart' => array (
'default' => get_config('format_ead', 'coursestart'),
'type' => PARAM_CLEANHTML
),
'coursecertification' => array (
'default' => get_config('format_ead', 'coursecertification'),
'type' => PARAM_TEXT
),
);
}
if ($foreditform && !isset($courseformatoptions['coursedisplay']['label'])) {
$courseformatoptionsedit = array(
'hiddensections' => array(
'label' => new lang_string('hiddensections'),
'help' => 'hiddensections',
'help_component' => 'moodle',
'element_type' => 'select',
'element_attributes' => array(
array(
0 => new lang_string('hiddensectionscollapsed'),
1 => new lang_string('hiddensectionsinvisible')
)
)
),
'coursedisplay' => array(
'label' => new lang_string('coursedisplay'),
'element_type' => 'select',
'element_attributes' => array(
array(
COURSE_DISPLAY_SINGLEPAGE => new lang_string('coursedisplay_single'),
COURSE_DISPLAY_MULTIPAGE => new lang_string('coursedisplay_multi')
)
)
),
'courseappearinfrontpage' => array (
'label' => new lang_string('courseappearinfrontpage', 'format_ead'),
'element_type' => 'checkbox',
),
'courseorderinfrontpage' => array (
'label' => new lang_string('courseorderinfrontpage', 'format_ead'),
'element_type' => 'select',
'element_attributes' => array (
array (
0 => '1º',
1 => '2º',
2 => '3º',
3 => '4º',
4 => '5º',
5 => '6º',
6 => '7º',
7 => '8º',
8 => '9º',
9 => '10º'
)
)
),
'coursetype' => array (
'label' => new lang_string('coursetype', 'format_ead'),
'element_type' => 'select',
'element_attributes' => array(
array(
0 => new lang_string('coursetypegraduation', 'format_ead'),
1 => new lang_string('coursetypeposgraduation', 'format_ead'),
2 => new lang_string('coursetypeextension', 'format_ead')
)
)
),
'courseshowroomimage' => array(
'label' => new lang_string('courseshowroomimage', 'format_ead'),
'element_type' => 'filemanager',
'element_attributes' => array(null,
array(
'subdirs' => 0,
'maxfiles' => 1,
'accepted_types' => array('.jpg', '.gif', '.png')
)
)
),
'coursetargetaudience' => array (
'label' => new lang_string('coursetargetaudience', 'format_ead'),
'element_type' => 'text'
),
'courseobjective' => array (
'label' => new lang_string('courseobjective', 'format_ead'),
'element_type' => 'text'
),
'courseworkload' => array (
'label' => new lang_string('courseworkload', 'format_ead'),
'element_type' => 'text'
),
'coursestart' => array (
'label' => new lang_string('coursestart', 'format_ead'),
'element_type' => 'editor'
),
'coursecertification' => array (
'label' => new lang_string('coursecertification', 'format_ead'),
'element_type' => 'text'
),
);
$courseformatoptions = array_merge_recursive($courseformatoptions, $courseformatoptionsedit);
}
return $courseformatoptions;
}
When I try to save the following error appears:
Coding error detected, it must be fixed by a programmer: clean_param() can not process arrays, please use clean_param_array() instead.
I have done a var dump, and i discovered that only the input html(editor) coursestart pass an array not a string or int.
Output buffer: array(50) { ["returnto"]=> string(1) "0" ["returnurl"]=> object(moodle_url)#86 (9) {
["scheme":protected]=> string(5) "https" ["host":protected]=> string(31) "ava.alpha.redeinterna.toledo.br"
["port":protected]=> string(0) "" ["user":protected]=> string(0) "" ["pass":protected]=> string(0) ""
["path":protected]=> string(16) "/course/view.php" ["slashargument":protected]=> string(0) ""
["anchor":protected]=> NULL ["params":protected]=> array(1) { ["id"]=> string(1) "6" } }
["fullname"]=> string(3) "asd" ["shortname"]=> string(2) "as" ["category"]=> string(1) "1"
["visible"]=> string(1) "1" ["startdate"]=> int(1558494000) ["enddate"]=> int(1590030000)
["idnumber"]=> string(0) "" ["mform_isexpanded_id_descriptionhdr"]=> int(1) ["summary_editor"]=> array(3) {
["text"]=> string(0) "" ["format"]=> string(1) "1" ["itemid"]=> int(600770070) }
["overviewfiles_filemanager"]=> int(374904918) ["format"]=> string(3) "ead" ["hiddensections"]=> string(1) "0"
["coursedisplay"]=> string(1) "0" ["courseorderinfrontpage"]=> string(1) "0"
["coursetype"]=> string(1) "0" ["courseshowroomimage"]=> string(9) "130528568" ["coursetargetaudience"]=> string(8) "Audience"
["courseobjective"]=> string(9) "Objective" ["courseworkload"]=> string(8) "Workload"
["coursestart"]=> array(2) { ["text"]=> string(12) "<p>Start</p>" ["format"]=> string(1) "1" }
["coursecertification"]=> string(13) "Certification" ["addcourseformatoptionshere"]=> int(0) ["lang"]=> string(0) ""
["newsitems"]=> string(1) "5" ["showgrades"]=> string(1) "1" ["showreports"]=> string(1) "0" ["maxbytes"]=> string(1) "0"
["enablecompletion"]=> string(1) "1" ["groupmode"]=> string(1) "0" ["groupmodeforce"]=> string(1) "0" ["defaultgroupingid"]=> string(1) "0"
["role_1"]=> string(0) "" ["role_2"]=> string(0) "" ["role_3"]=> string(0) "" ["role_4"]=> string(0) "" ["role_5"]=> string(0) ""
["role_6"]=> string(0) "" ["role_7"]=> string(0) "" ["role_8"]=> string(0) "" ["tags"]=> array(0) { }
["saveandreturn"]=> string(15) "Save and return" ["id"]=> int(6) ["timemodified"]=> int(1558465610)
["summarytrust"]=> int(0) ["summary"]=> string(0) "" ["summaryformat"]=> string(1) "1" ["overviewfiles"]=> string(0) ""
["courseappearinfrontpage"]=> int(0) }
Can someone help ?