public function build_editform($item, $evaluation, $cm,$classid) { global $DB, $CFG; require_once('numeric_form.php'); //get the lastposition number of the evaluation_items $position = $item->position; $lastposition = $DB->count_records('evaluation_item', array('evaluation'=>$evaluation->id)); if ($position == -1) { $i_formselect_last = $lastposition + 1; $i_formselect_value = $lastposition + 1; $item->position = $lastposition + 1; } else { $i_formselect_last = $lastposition; $i_formselect_value = $item->position; } //the elements for position dropdownlist $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true); $item->presentation = empty($item->presentation) ? '' : $item->presentation; $range_from_to = explode('|', $item->presentation); if (isset($range_from_to[0]) AND is_numeric($range_from_to[0])) { $range_from = str_replace(EVALUATION_DECIMAL, $this->sep_dec, floatval($range_from_to[0])); } else { $range_from = '-'; } if (isset($range_from_to[1]) AND is_numeric($range_from_to[1])) { $range_to = str_replace(EVALUATION_DECIMAL, $this->sep_dec, floatval($range_from_to[1])); } else { $range_to = '-'; } $item->rangefrom = $range_from; $item->rangeto = $range_to; //all items for dependitem $evaluationitems = evaluation_get_depend_candidates_for_item($evaluation, $item); $commonparams = array('cmid'=>$cm, 'id'=>isset($item->id) ? $item->id : null, 'clid'=>$classid, 'typ'=>$item->typ, 'items'=>$evaluationitems, 'evaluation'=>$evaluation->id); //build the form $customdata = array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position); $this->item_form = new evaluation_numeric_form('edit_item.php', $customdata); }
public function build_editform($item, $evaluation, $cm,$classid) { global $DB, $CFG; require_once('label_form.php'); //get the lastposition number of the evaluation_items $position = $item->position; $lastposition = $DB->count_records('evaluation_item', array('evaluation'=>$evaluation->id)); if ($position == -1) { $i_formselect_last = $lastposition + 1; $i_formselect_value = $lastposition + 1; $item->position = $lastposition + 1; } else { $i_formselect_last = $lastposition; $i_formselect_value = $item->position; } //the elements for position dropdownlist $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true); //all items for dependitem $evaluationitems = evaluation_get_depend_candidates_for_item($evaluation, $item); $commonparams = array('cmid'=>$cm, 'clid'=>$classid, 'id'=>isset($item->id) ? $item->id : null, 'typ'=>$item->typ, 'items'=>$evaluationitems, 'evaluation'=>$evaluation->id); // $this->context = context_localule::instance($cm->id); //preparing the editor for new file-api $item->presentationformat = FORMAT_HTML; $item->presentationtrust = 1; // Append editor context to presentation options, giving preference to existing context. $this->presentationoptions = array_merge(array('context' => $this->context), $this->presentationoptions); $item = file_prepare_standard_editor($item, 'presentation', //name of the form element $this->presentationoptions, $this->context, 'local_evaluations', 'item', //the filearea $item->id); //build the form $customdata = array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position, 'presentationoptions' => $this->presentationoptions); $this->item_form = new evaluation_label_form('edit_item.php', $customdata); }
public function build_editform($item, $evaluation, $cm,$classid) { global $DB, $CFG; require_once('textarea_form.php'); //get the lastposition number of the evaluation_items $position = $item->position; $lastposition = $DB->count_records('evaluation_item', array('evaluation'=>$evaluation->id)); if ($position == -1) { $i_formselect_last = $lastposition + 1; $i_formselect_value = $lastposition + 1; $item->position = $lastposition + 1; } else { $i_formselect_last = $lastposition; $i_formselect_value = $item->position; } //the elements for position dropdownlist $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true); $item->presentation = empty($item->presentation) ? '' : $item->presentation; $width_and_height = explode('|', $item->presentation); if (isset($width_and_height[0]) AND $width_and_height[0] >= 5) { $itemwidth = $width_and_height[0]; } else { $itemwidth = 30; } if (isset($width_and_height[1])) { $itemheight = $width_and_height[1]; } else { $itemheight = 5; } $item->itemwidth = $itemwidth; $item->itemheight = $itemheight; //all items for dependitem $evaluationitems = evaluation_get_depend_candidates_for_item($evaluation, $item); $commonparams = array('cmid'=>$cm, 'id'=>isset($item->id) ? $item->id : null, 'clid'=>$classid, 'typ'=>$item->typ, 'items'=>$evaluationitems, 'evaluation'=>$evaluation->id); //build the form $customdata = array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position); $this->item_form = new evaluation_textarea_form('edit_item.php', $customdata); }
public function build_editform($item, $evaluation, $cm,$classid) { global $DB, $CFG; require_once('multichoicerated_form.php'); //get the lastposition number of the evaluation_items $position = $item->position; $lastposition = $DB->count_records('evaluation_item', array('evaluation'=>$evaluation->id)); if ($position == -1) { $i_formselect_last = $lastposition + 1; $i_formselect_value = $lastposition + 1; $item->position = $lastposition + 1; } else { $i_formselect_last = $lastposition; $i_formselect_value = $item->position; } //the elements for position dropdownlist $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true); $item->presentation = empty($item->presentation) ? '' : $item->presentation; $info = $this->get_info($item); $item->ignoreempty = $this->ignoreempty($item); $item->hidenoselect = $this->hidenoselect($item); //all items for dependitem $evaluationitems = evaluation_get_depend_candidates_for_item($evaluation, $item); $commonparams = array('cmid'=>$cm, 'id'=>isset($item->id) ? $item->id : null, 'clid'=>$classid, 'typ'=>$item->typ, 'items'=>$evaluationitems, 'evaluation'=>$evaluation->id); //build the form $customdata = array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position, 'info' => $info); $this->item_form = new evaluation_multichoicerated_form('edit_item.php', $customdata); }