/** * Gets submitted data from the edit form and saves it in $this->item * * @return bool */ public function get_data() { if ($this->item = $this->item_form->get_data()) { return true; } return false; }
public function get_data() { if (!$item = parent::get_data()) { return false; } $itemobj = new feedback_item_numeric(); $num1 = str_replace($itemobj->sep_dec, FEEDBACK_DECIMAL, $item->rangefrom); if (is_numeric($num1)) { $num1 = floatval($num1); } else { $num1 = '-'; } $num2 = str_replace($itemobj->sep_dec, FEEDBACK_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']; $context = get_context_instance(CONTEXT_MODULE, $common['cmid']); $mform =& $this->_form; $mform->addElement('hidden', 'required', 0); $mform->setType('required', 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, 'feedback')); $mform->addElement('editor', 'presentation_editor', '', null, $presentationoptions); $mform->setType('presentation_editor', PARAM_CLEANHTML); parent::definition(); $this->set_data($item); }
public function definition() { $item = $this->_customdata['item']; $common = $this->_customdata['common']; $positionlist = $this->_customdata['positionlist']; $position = $this->_customdata['position']; $mform =& $this->_form; $mform->addElement('header', 'general', get_string($this->type, 'feedback')); $mform->addElement('checkbox', 'required', get_string('required', 'feedback')); $mform->addElement('text', 'name', get_string('item_name', 'feedback'), array('size'=>FEEDBACK_ITEM_NAME_TEXTBOX_SIZE, 'maxlength'=>255)); $mform->addElement('text', 'label', get_string('item_label', 'feedback'), array('size'=>FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE, 'maxlength'=>255)); $mform->addElement('select', 'presentation', get_string('count_of_nums', 'feedback').' ', array_slice(range(0, 10), 3, 10, true)); parent::definition(); $this->set_data($item); }
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; }
function get_data() { if (!($item = parent::get_data())) { return false; } $presentation = str_replace("\n", FEEDBACK_MULTICHOICE_LINE_SEP, trim($item->values)); 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 .= FEEDBACK_MULTICHOICE_ADJUST_SEP . '1'; } $item->presentation = $subtype . FEEDBACK_MULTICHOICE_TYPE_SEP . $presentation; return $item; }
public function definition() { $item = $this->_customdata['item']; $common = $this->_customdata['common']; $positionlist = $this->_customdata['positionlist']; $position = $this->_customdata['position']; $presentationoptions = $this->_customdata['presentationoptions']; $mform =& $this->_form; $mform->addElement('header', 'general', get_string($this->type, 'feedback')); $mform->addElement('hidden', 'required', 0); $mform->setType('required', PARAM_INT); $mform->addElement('text', 'name', get_string('item_name', 'feedback'), array('size' => FEEDBACK_ITEM_NAME_TEXTBOX_SIZE, 'maxlength' => 255)); $mform->addElement('text', 'label', get_string('item_label', 'feedback'), array('size' => FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE, 'maxlength' => 255)); $this->infotype =& $mform->addElement('select', 'presentation', get_string('infotype', 'feedback'), $presentationoptions); parent::definition(); $this->set_data($item); }
public function get_data() { if (!($item = parent::get_data())) { return false; } $itemobj = new feedback_item_multichoicerated(); $presentation = $itemobj->prepare_presentation_values_save(trim($item->values), FEEDBACK_MULTICHOICERATED_VALUE_SEP2, FEEDBACK_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 .= FEEDBACK_MULTICHOICERATED_ADJUST_SEP . '1'; } $item->presentation = $subtype . FEEDBACK_MULTICHOICERATED_TYPE_SEP . $presentation; return $item; }
function definition() { $item = $this->_customdata['item']; $common = $this->_customdata['common']; $positionlist = $this->_customdata['positionlist']; $position = $this->_customdata['position']; $mform =& $this->_form; $mform->addElement('header', 'general', get_string($this->type, 'feedback')); $mform->addElement('hidden', 'required', 0); $mform->setType('required', PARAM_INT); $mform->addElement('text', 'name', get_string('item_name', 'feedback'), array('size="' . FEEDBACK_ITEM_NAME_TEXTBOX_SIZE . '"', 'maxlength="255"')); $mform->addElement('text', 'label', get_string('item_label', 'feedback'), array('size="' . FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE . '"', 'maxlength="255"')); $options = array(); $options[1] = get_string('responsetime', 'feedback'); $options[2] = get_string('course'); $options[3] = get_string('coursecategory'); $this->infotype =& $mform->addElement('select', 'presentation', get_string('infotype', 'feedback'), $options); parent::definition(); $this->set_data($item); }
public function get_data() { if (!($item = parent::get_data())) { return false; } $num1 = unformat_float($item->rangefrom, true); if ($num1 === false || $num1 === null) { $num1 = '-'; } $num2 = unformat_float($item->rangeto, true); if ($num2 === false || $num2 === null) { $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; }