public function get_data() { if (!$item = parent::get_data()) { return false; } $itemobj = new evaluation_item_numeric(); $num1 = str_replace($itemobj->sep_dec, EVALUATION_DECIMAL, $item->rangefrom); if (is_numeric($num1)) { $num1 = floatval($num1); } else { $num1 = '-'; } $num2 = str_replace($itemobj->sep_dec, EVALUATION_DECIMAL, $item->rangeto); if (is_numeric($num2)) { $num2 = floatval($num2); } else { $num2 = '-'; } if ($num1 === '-' OR $num2 === '-') { $item->presentation = $num1 . '|'. $num2; return $item; } if ($num1 > $num2) { $item->presentation = $num2 . '|'. $num1; } else { $item->presentation = $num1 . '|'. $num2; } return $item; }
public function definition() { global $CFG; $item = $this->_customdata['item']; $common = $this->_customdata['common']; $presentationoptions = $this->_customdata['presentationoptions']; $positionlist = $this->_customdata['positionlist']; $position = $this->_customdata['position']; // $classid = $this->_customdata['clid']; // $classid = $this->_customdata['cmid']; $mform =& $this->_form; $mform->addElement('hidden', 'required', 0); $mform->setType('required', PARAM_INT); $mform->addElement('hidden', 'clid', 0); $mform->setType('clid', PARAM_INT); $mform->addElement('hidden', 'cmid', 0); $mform->setType('cmid', PARAM_INT); $mform->addElement('hidden', 'name', 'label'); $mform->setType('template', PARAM_ALPHA); $mform->addElement('hidden', 'label', '-'); $mform->setType('label', PARAM_ALPHA); $mform->addElement('header', 'general', get_string($this->type, 'local_evaluations')); $mform->addElement('editor', 'presentation_editor', get_string('label_name', 'local_evaluations'), null, $presentationoptions); $mform->addRule('presentation_editor', get_string('missingmcname','local_evaluations'), 'required', null, 'client'); $mform->setType('presentation_editor', PARAM_RAW); parent::definition(); $this->set_data($item); }
public function get_data() { if (!$item = parent::get_data()) { return false; } $item->presentation = $item->itemsize . '|'. $item->itemmaxlength; return $item; }
public function get_data() { if (!$item = parent::get_data()) { return false; } $item->presentation = $item->itemwidth . '|'. $item->itemheight; return $item; }
public function get_data() { if (!$item = parent::get_data()) { return false; } $itemobj = new evaluation_item_multichoicerated(); $presentation = $itemobj->prepare_presentation_values_save(trim($item->values), EVALUATION_MULTICHOICERATED_VALUE_SEP2, EVALUATION_MULTICHOICERATED_VALUE_SEP); if (!isset($item->subtype)) { $subtype = 'r'; } else { $subtype = substr($item->subtype, 0, 1); } if (isset($item->horizontal) AND $item->horizontal == 1 AND $subtype != 'd') { $presentation .= EVALUATION_MULTICHOICERATED_ADJUST_SEP.'1'; } $item->presentation = $subtype.EVALUATION_MULTICHOICERATED_TYPE_SEP.$presentation; return $item; }