NOMDL Workshop: adding explicit type declaration for hidden form elements

This commit is contained in:
David Mudrak
2010-08-18 16:41:58 +00:00
parent b2214c5a80
commit ca7b6997a6
12 changed files with 28 additions and 0 deletions
+1
View File
@@ -57,6 +57,7 @@ class workshop_feedbackauthor_form extends moodleform {
$mform->setType('feedbackauthor_editor', PARAM_RAW);
$mform->addElement('hidden', 'submissionid');
$mform->setType('submissionid', PARAM_INT);
$mform->addElement('submit', 'save', get_string('saveandclose', 'workshop'));
+1
View File
@@ -58,6 +58,7 @@ class workshop_feedbackreviewer_form extends moodleform {
}
$mform->addElement('hidden', 'asid');
$mform->setType('asid', PARAM_INT);
$mform->addElement('submit', 'save', get_string('saveandclose', 'workshop'));
@@ -47,6 +47,7 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form {
$nodims = $this->_customdata['nodims']; // number of assessment dimensions
$mform->addElement('hidden', 'nodims', $nodims);
$mform->setType('nodims', PARAM_INT);
for ($i = 0; $i < $nodims; $i++) {
// dimension header
@@ -55,9 +56,11 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form {
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i});
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
// grade id
$mform->addElement('hidden', 'gradeid__idx_'.$i); // value set by set_data() later
$mform->setType('gradeid__idx_'.$i, PARAM_INT);
// dimension description
$desc = '<div id="id_dim_'.$fields->{'dimensionid__idx_'.$i}.'_desc" class="fitem description accumulative">'."\n";
@@ -49,6 +49,7 @@ class workshop_edit_accumulative_strategy_form extends workshop_edit_strategy_fo
$current = $this->_customdata['current']; // current data to be set
$mform->addElement('hidden', 'norepeats', $norepeats);
$mform->setType('norepeats', PARAM_INT);
// value not to be overridden by submitted value
$mform->setConstants(array('norepeats' => $norepeats));
+2
View File
@@ -62,6 +62,8 @@ class workshop_assessment_form extends moodleform {
// add the data common for all subplugins
$mform->addElement('hidden', 'strategy', $this->workshop->strategy);
$mform->setType('strategy', PARAM_SAFEDIR);
if (!empty($this->options['editableweight']) and !$mform->isFrozen()) {
$mform->addElement('header', 'assessmentsettings', get_string('assessmentweight', 'workshop'));
$mform->addElement('select', 'weight',
@@ -47,6 +47,7 @@ class workshop_comments_assessment_form extends workshop_assessment_form {
$nodims = $this->_customdata['nodims']; // number of assessment dimensions
$mform->addElement('hidden', 'nodims', $nodims);
$mform->setType('nodims', PARAM_INT);
for ($i = 0; $i < $nodims; $i++) {
// dimension header
@@ -55,9 +56,11 @@ class workshop_comments_assessment_form extends workshop_assessment_form {
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i});
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
// grade id
$mform->addElement('hidden', 'gradeid__idx_'.$i); // value set by set_data() later
$mform->setType('gradeid__idx_'.$i, PARAM_INT);
// dimension description
$desc = '<div id="id_dim_'.$fields->{'dimensionid__idx_'.$i}.'_desc" class="fitem description comments">'."\n";
+2
View File
@@ -49,12 +49,14 @@ class workshop_edit_comments_strategy_form extends workshop_edit_strategy_form {
$current = $this->_customdata['current']; // current data to be set
$mform->addElement('hidden', 'norepeats', $norepeats);
$mform->setType('norepeats', PARAM_INT);
// value not to be overridden by submitted value
$mform->setConstants(array('norepeats' => $norepeats));
for ($i = 0; $i < $norepeats; $i++) {
$mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_comments', $i+1));
$mform->addElement('hidden', 'dimensionid__idx_'.$i);
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
$mform->addElement('editor', 'description__idx_'.$i.'_editor',
get_string('dimensiondescription', 'workshopform_comments'), '', $descriptionopts);
}
+3
View File
@@ -59,7 +59,10 @@ class workshop_edit_strategy_form extends moodleform {
$this->strategy = $this->_customdata['strategy'];
$mform->addElement('hidden', 'workshopid', $this->workshop->id); // workshopid
$mform->setType('workshopid', PARAM_INT);
$mform->addElement('hidden', 'strategy', $this->workshop->strategy); // strategy name
$mform->setType('strategy', PARAM_SAFEDIR);
$this->definition_inner($mform);
@@ -47,6 +47,7 @@ class workshop_numerrors_assessment_form extends workshop_assessment_form {
$nodims = $this->_customdata['nodims']; // number of assessment dimensions
$mform->addElement('hidden', 'nodims', $nodims);
$mform->setType('nodims', PARAM_INT);
for ($i = 0; $i < $nodims; $i++) {
// dimension header
@@ -55,9 +56,11 @@ class workshop_numerrors_assessment_form extends workshop_assessment_form {
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i});
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
// grade id
$mform->addElement('hidden', 'gradeid__idx_'.$i); // value set by set_data() later
$mform->setType('gradeid__idx_'.$i, PARAM_INT);
// dimension description
$desc = '<div id="id_dim_'.$fields->{'dimensionid__idx_'.$i}.'_desc" class="fitem description numerrors">'."\n";
@@ -51,12 +51,14 @@ class workshop_edit_numerrors_strategy_form extends workshop_edit_strategy_form
$current = $this->_customdata['current']; // current data to be set
$mform->addElement('hidden', 'norepeats', $norepeats);
$mform->setType('norepeats', PARAM_INT);
// value not to be overridden by submitted value
$mform->setConstants(array('norepeats' => $norepeats));
for ($i = 0; $i < $norepeats; $i++) {
$mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_numerrors', $i+1));
$mform->addElement('hidden', 'dimensionid__idx_'.$i); // the id in workshop_forms
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
$mform->addElement('editor', 'description__idx_'.$i.'_editor',
get_string('dimensiondescription', 'workshopform_numerrors'), '', $descriptionopts);
$mform->addElement('text', 'grade0__idx_'.$i, get_string('grade0', 'workshopform_numerrors'), array('size'=>'15'));
@@ -73,9 +73,11 @@ class workshop_rubric_list_assessment_form extends workshop_rubric_assessment_fo
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i});
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
// grade id
$mform->addElement('hidden', 'gradeid__idx_'.$i); // value set by set_data() later
$mform->setType('gradeid__idx_'.$i, PARAM_INT);
// dimension description
$desc = '<div id="id_dim_'.$fields->{'dimensionid__idx_'.$i}.'_desc" class="fitem description rubric">'."\n";
@@ -137,9 +139,11 @@ class workshop_rubric_grid_assessment_form extends workshop_rubric_assessment_fo
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i});
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
// given grade id
$mform->addElement('hidden', 'gradeid__idx_'.$i); // value set by set_data() later
$mform->setType('gradeid__idx_'.$i, PARAM_INT);
// dimension description
$desc = format_text($fields->{'description__idx_'.$i}, $fields->{'description__idx_'.$i.'format'});
+3
View File
@@ -51,6 +51,7 @@ class workshop_edit_rubric_strategy_form extends workshop_edit_strategy_form {
$current = $this->_customdata['current']; // current data to be set
$mform->addElement('hidden', 'norepeats', $norepeats);
$mform->setType('norepeats', PARAM_INT);
// value not to be overridden by submitted value
$mform->setConstants(array('norepeats' => $norepeats));
@@ -62,6 +63,7 @@ class workshop_edit_rubric_strategy_form extends workshop_edit_strategy_form {
for ($i = 0; $i < $norepeats; $i++) {
$mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_rubric', $i+1));
$mform->addElement('hidden', 'dimensionid__idx_'.$i);
$mform->setType('dimensionid__idx_'.$i, PARAM_INT);
$mform->addElement('editor', 'description__idx_'.$i.'_editor',
get_string('dimensiondescription', 'workshopform_rubric'), '', $descriptionopts);
if (isset($current->{'numoflevels__idx_' . $i})) {
@@ -72,6 +74,7 @@ class workshop_edit_rubric_strategy_form extends workshop_edit_strategy_form {
$prevlevel = -1;
for ($j = 0; $j < $numoflevels; $j++) {
$mform->addElement('hidden', 'levelid__idx_' . $i . '__idy_' . $j);
$mform->setType('levelid__idx_' . $i . '__idy_' . $j, PARAM_INT);
$levelgrp = array();
$levelgrp[] = $mform->createElement('select', 'grade__idx_'.$i.'__idy_'.$j,'', $levelgrades);
$levelgrp[] = $mform->createElement('textarea', 'definition__idx_'.$i.'__idy_'.$j, '', array('cols' => 60, 'rows' => 3));