';
- }
-
-
- public function check_value($value, $item) {
- global $SESSION, $CFG, $USER;
- require_once($CFG->libdir.'/recaptchalib.php');
-
- //is recaptcha configured in moodle?
- if (empty($CFG->recaptchaprivatekey) OR empty($CFG->recaptchapublickey)) {
return true;
- }
- $challenge = optional_param('recaptcha_challenge_field', '', PARAM_RAW);
+ });
- if ($value == $USER->sesskey AND $challenge == '') {
- return true;
- }
- $remoteip = getremoteaddr(null);
- $response = recaptcha_check_answer($CFG->recaptchaprivatekey, $remoteip, $challenge, $value);
- if ($response->is_valid) {
- $SESSION->feedback->captchacheck = $USER->sesskey;
- return true;
- }
- unset($SESSION->feedback->captchacheck);
-
- return false;
}
public function create_value($data) {
@@ -309,20 +156,6 @@ class feedback_item_captcha extends feedback_item_base {
return $USER->sesskey;
}
- //compares the dbvalue with the dependvalue
- //dbvalue is value stored in the db
- //dependvalue is the value to check
- public function compare_value($item, $dbvalue, $dependvalue) {
- if ($dbvalue == $dependvalue) {
- return true;
- }
- return false;
- }
-
- public function get_presentation($data) {
- return '';
- }
-
public function get_hasvalue() {
global $CFG;
@@ -337,11 +170,17 @@ class feedback_item_captcha extends feedback_item_base {
return false;
}
- public function value_type() {
- return PARAM_RAW;
- }
-
- public function clean_input_value($value) {
- return clean_param($value, $this->value_type());
+ /**
+ * Returns the list of actions allowed on this item in the edit mode
+ *
+ * @param stdClass $item
+ * @param stdClass $feedback
+ * @param cm_info $cm
+ * @return action_menu_link[]
+ */
+ public function edit_actions($item, $feedback, $cm) {
+ $actions = parent::edit_actions($item, $feedback, $cm);
+ unset($actions['update']);
+ return $actions;
}
}
diff --git a/mod/feedback/item/feedback_item_class.php b/mod/feedback/item/feedback_item_class.php
index b001b4ec336..3b65affef7f 100644
--- a/mod/feedback/item/feedback_item_class.php
+++ b/mod/feedback/item/feedback_item_class.php
@@ -15,25 +15,45 @@
// along with Moodle. If not, see .
abstract class feedback_item_base {
+
+ /** @var string type of the element, should be overridden by each item type */
protected $type;
+ /** @var feedback_item_form */
+ protected $item_form;
+
+ /** @var stdClass */
+ protected $item;
+
/**
* constructor
- *
*/
public function __construct() {
- $this->init();
}
- //this function only can used after the call of build_editform()
+ /**
+ * Displays the form for editing an item
+ *
+ * this function only can used after the call of build_editform()
+ */
public function show_editform() {
$this->item_form->display();
}
+ /**
+ * Checks if the editing form was cancelled
+ *
+ * @return bool
+ */
public function is_cancelled() {
return $this->item_form->is_cancelled();
}
+ /**
+ * 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;
@@ -41,27 +61,62 @@ abstract class feedback_item_base {
return false;
}
- public function value_type() {
- return PARAM_RAW;
- }
-
- public function value_is_array() {
- return false;
- }
-
- abstract public function init();
+ /**
+ * Creates and returns an instance of the form for editing the item
+ *
+ * @param stdClass $item
+ * @param stdClass $feedback
+ * @param cm_info|stdClass $cm
+ */
abstract public function build_editform($item, $feedback, $cm);
- abstract public function save_item();
- abstract public function check_value($value, $item);
- abstract public function create_value($data);
- abstract public function compare_value($item, $dbvalue, $dependvalue);
- abstract public function get_presentation($data);
- abstract public function get_hasvalue();
- abstract public function can_switch_require();
/**
+ * Saves the item after it has been edited (or created)
+ */
+ abstract public function save_item();
+
+ /**
+ * Converts the value from complete_form data to the string value that is stored in the db.
+ * @param mixed $value element from mod_feedback_complete_form::get_data() with the name $item->typ.'_'.$item->id
+ * @return string
+ */
+ public function create_value($value) {
+ return strval($value);
+ }
+
+ /**
+ * Compares the dbvalue with the dependvalue
+ *
+ * @param stdClass $item
+ * @param string $dbvalue is the value input by user in the format as it is stored in the db
+ * @param string $dependvalue is the value that it needs to be compared against
+ */
+ public function compare_value($item, $dbvalue, $dependvalue) {
+ return strval($dbvalue) === strval($dependvalue);
+ }
+
+ /**
+ * Wether this item type has a value that is expected from the user and saved in the stored values.
+ * @return int
+ */
+ public function get_hasvalue() {
+ return 1;
+ }
+
+ /**
+ * Wether this item can be set as both required and not
+ * @return bool
+ */
+ public function can_switch_require() {
+ return true;
+ }
+
+ /**
+ * Adds summary information about an item to the Excel export file
+ *
* @param object $worksheet a reference to the pear_spreadsheet-object
* @param integer $row_offset
+ * @param stdClass $xls_formats see analysis_to_excel.php
* @param object $item the db-object from feedback_item
* @param integer $groupid
* @param integer $courseid
@@ -72,6 +127,8 @@ abstract class feedback_item_base {
$groupid, $courseid = false);
/**
+ * Prints analysis for the current item
+ *
* @param $item the db-object from feedback_item
* @param string $itemnr
* @param integer $groupid
@@ -81,6 +138,8 @@ abstract class feedback_item_base {
abstract public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false);
/**
+ * Prepares the value for exporting to Excel
+ *
* @param object $item the db-object from feedback_item
* @param string $value a item-related value from feedback_values
* @return string
@@ -88,54 +147,105 @@ abstract class feedback_item_base {
abstract public function get_printval($item, $value);
/**
- * returns an Array with three values(typ, name, XXX)
- * XXX is also an Array (count of responses on type $this->type)
- * each element is a structure (answertext, answercount)
- * @param $item the db-object from feedback_item
- * @param $groupid if given
- * @param $courseid if given
- * @return array
+ * Returns the formatted name of the item for the complete form or response view
+ *
+ * @param stdClass $item
+ * @param bool $withpostfix
+ * @return string
*/
- abstract public function get_analysed($item, $groupid = false, $courseid = false);
+ public function get_display_name($item, $withpostfix = true) {
+ return format_text($item->name, FORMAT_HTML, array('noclean' => true, 'para' => false)) .
+ ($withpostfix ? $this->get_display_name_postfix($item) : '');
+ }
/**
- * print the item at the edit-page of feedback
+ * Returns the postfix to be appended to the display name that is based on other settings
*
- * @global object
- * @param object $item
- * @return void
+ * @param stdClass $item
+ * @return string
*/
- abstract public function print_item_preview($item);
+ public function get_display_name_postfix($item) {
+ return '';
+ }
/**
- * print the item at the complete-page of feedback
+ * Adds an input element to the complete form
*
- * @global object
- * @param object $item
- * @param string $value
- * @param bool $highlightrequire
- * @return void
+ * This method is called:
+ * - to display the form when user completes feedback
+ * - to display existing elements when teacher edits the feedback items
+ * - to display the feedback preview (print.php)
+ * - to display the completed response
+ * - to preview a feedback template
+ *
+ * If it is important which mode the form is in, use $form->get_mode()
+ *
+ * Each item type must add a single form element with the name $item->typ.'_'.$item->id
+ * To add an element use either:
+ * $form->add_form_element() - adds a single element to the form
+ * $form->add_form_group_element() - adds a group element to the form
+ *
+ * Other useful methods:
+ * $form->get_item_value()
+ * $form->set_element_default()
+ * $form->add_validation_rule()
+ * $form->set_element_type()
+ *
+ * The element must support freezing so it can be used for viewing the response as well.
+ * If the desired form element does not support freezing, check $form->is_frozen()
+ * and create a static element instead.
+ *
+ * @param stdClass $item
+ * @param mod_feedback_complete_form $form
*/
- abstract public function print_item_complete($item, $value = '', $highlightrequire = false);
+ abstract public function complete_form_element($item, $form);
/**
- * print the item at the complete-page of feedback
+ * Returns the list of actions allowed on this item in the edit mode
*
- * @global object
- * @param object $item
- * @param string $value
- * @return void
+ * @param stdClass $item
+ * @param stdClass $feedback
+ * @param cm_info $cm
+ * @return action_menu_link[]
*/
- abstract public function print_item_show_value($item, $value = '');
+ public function edit_actions($item, $feedback, $cm) {
+ $actions = array();
- /**
- * cleans the userinput while submitting the form
- *
- * @param mixed $value
- * @return mixed
- */
- abstract public function clean_input_value($value);
+ $strupdate = get_string('edit_item', 'feedback');
+ $actions['update'] = new action_menu_link_secondary(
+ new moodle_url('/mod/feedback/edit_item.php', array('id' => $item->id)),
+ new pix_icon('t/edit', $strupdate, 'moodle', array('class' => 'iconsmall', 'title' => '')),
+ $strupdate,
+ array('class' => 'editing_update', 'data-action' => 'update')
+ );
+ if ($this->can_switch_require()) {
+ if ($item->required == 1) {
+ $buttontitle = get_string('switch_item_to_not_required', 'feedback');
+ $buttonimg = 'required';
+ } else {
+ $buttontitle = get_string('switch_item_to_required', 'feedback');
+ $buttonimg = 'notrequired';
+ }
+ $url = new moodle_url('/mod/feedback/edit.php', array('id' => $cm->id, 'do_show' => 'edit'));
+ $actions['required'] = new action_menu_link_secondary(
+ new moodle_url($url, array('switchitemrequired' => $item->id)),
+ new pix_icon($buttonimg, $buttontitle, 'feedback', array('class' => 'iconsmall', 'title' => '')),
+ $buttontitle,
+ array('class' => 'editing_togglerequired', 'data-action' => 'togglerequired')
+ );
+ }
+
+ $strdelete = get_string('delete_item', 'feedback');
+ $actions['delete'] = new action_menu_link_secondary(
+ new moodle_url('/mod/feedback/delete_item.php', array('deleteitem' => $item->id)),
+ new pix_icon('t/delete', $strdelete, 'moodle', array('class' => 'iconsmall', 'title' => '')),
+ $strdelete,
+ array('class' => 'editing_delete', 'data-action' => 'delete')
+ );
+
+ return $actions;
+ }
}
//a dummy class to realize pagebreaks
@@ -144,25 +254,23 @@ class feedback_item_pagebreak extends feedback_item_base {
public function show_editform() {
}
+
+ /**
+ * Checks if the editing form was cancelled
+ * @return bool
+ */
public function is_cancelled() {
}
public function get_data() {
}
- public function init() {
- }
public function build_editform($item, $feedback, $cm) {
}
public function save_item() {
}
- public function check_value($value, $item) {
- }
public function create_value($data) {
}
- public function compare_value($item, $dbvalue, $dependvalue) {
- }
- public function get_presentation($data) {
- }
public function get_hasvalue() {
+ return 0;
}
public function excelprint_item(&$worksheet, $row_offset,
$xls_formats, $item,
@@ -173,19 +281,38 @@ class feedback_item_pagebreak extends feedback_item_base {
}
public function get_printval($item, $value) {
}
- public function get_analysed($item, $groupid = false, $courseid = false) {
- }
- public function print_item_preview($item) {
- }
- public function print_item_complete($item, $value = '', $highlightrequire = false) {
- }
- public function print_item_show_value($item, $value = '') {
- }
public function can_switch_require() {
- }
- public function value_type() {
- }
- public function clean_input_value($value) {
+ return false;
}
+ /**
+ * Adds an input element to the complete form
+ *
+ * @param stdClass $item
+ * @param mod_feedback_complete_form $form
+ */
+ public function complete_form_element($item, $form) {
+ $form->add_form_element($item,
+ ['static', $item->typ.'_'.$item->id, '', '']);
+ }
+
+ /**
+ * Returns the list of actions allowed on this item in the edit mode
+ *
+ * @param stdClass $item
+ * @param stdClass $feedback
+ * @param cm_info $cm
+ * @return action_menu_link[]
+ */
+ public function edit_actions($item, $feedback, $cm) {
+ $actions = array();
+ $strdelete = get_string('delete_pagebreak', 'feedback');
+ $actions['delete'] = new action_menu_link_secondary(
+ new moodle_url('/mod/feedback/delete_item.php', array('deleteitem' => $item->id)),
+ new pix_icon('t/delete', $strdelete, 'moodle', array('class' => 'iconsmall', 'title' => '')),
+ $strdelete,
+ array('class' => 'editing_delete', 'data-action' => 'delete')
+ );
+ return $actions;
+ }
}
diff --git a/mod/feedback/item/feedback_item_form_class.php b/mod/feedback/item/feedback_item_form_class.php
index f9b16d8fd13..6efb6682b28 100644
--- a/mod/feedback/item/feedback_item_form_class.php
+++ b/mod/feedback/item/feedback_item_form_class.php
@@ -38,7 +38,7 @@ abstract class feedback_item_form extends moodleform {
$mform =& $this->_form;
- if ($common['items']) {
+ if (array_filter(array_keys($common['items']))) {
$mform->addElement('select',
'dependitem',
get_string('dependitem', 'feedback').' ',
@@ -49,6 +49,7 @@ abstract class feedback_item_form extends moodleform {
'dependvalue',
get_string('dependvalue', 'feedback'),
array('size'=>FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE, 'maxlength'=>255));
+ $mform->disabledIf('dependvalue', 'dependitem', 'eq', '0');
} else {
$mform->addElement('hidden', 'dependitem', 0);
$mform->addElement('hidden', 'dependvalue', '');
@@ -107,5 +108,20 @@ abstract class feedback_item_form extends moodleform {
$mform->addGroup($buttonarray, 'buttonar', ' ', array(' '), false);
}
+
+ /**
+ * Return submitted data if properly submitted or returns NULL if validation fails or
+ * if there is no submitted data.
+ *
+ * @return object submitted data; NULL if not valid or not submitted or cancelled
+ */
+ public function get_data() {
+ if ($item = parent::get_data()) {
+ if (!isset($item->dependvalue)) {
+ $item->dependvalue = '';
+ }
+ }
+ return $item;
+ }
}
diff --git a/mod/feedback/item/info/lib.php b/mod/feedback/item/info/lib.php
index 7583b79da02..dda6a2fe1fc 100644
--- a/mod/feedback/item/info/lib.php
+++ b/mod/feedback/item/info/lib.php
@@ -19,13 +19,13 @@ require_once($CFG->dirroot.'/mod/feedback/item/feedback_item_class.php');
class feedback_item_info extends feedback_item_base {
protected $type = "info";
- private $commonparams;
- private $item_form;
- private $item;
- public function init() {
-
- }
+ /** Mode recording response time (for non-anonymous feedbacks only) */
+ const MODE_RESPONSETIME = 1;
+ /** Mode recording current course */
+ const MODE_COURSE = 2;
+ /** Mode recording current course category */
+ const MODE_CATEGORY = 3;
public function build_editform($item, $feedback, $cm) {
global $DB, $CFG;
@@ -64,22 +64,6 @@ class feedback_item_info extends feedback_item_base {
'position' => $position));
}
- //this function only can used after the call of build_editform()
- public function show_editform() {
- $this->item_form->display();
- }
-
- public function is_cancelled() {
- return $this->item_form->is_cancelled();
- }
-
- public function get_data() {
- if ($this->item = $this->item_form->get_data()) {
- return true;
- }
- return false;
- }
-
public function save_item() {
global $DB;
@@ -102,8 +86,15 @@ class feedback_item_info extends feedback_item_base {
return $DB->get_record('feedback_item', array('id'=>$item->id));
}
- //liefert eine Struktur ->name, ->data = array(mit Antworten)
- public function get_analysed($item, $groupid = false, $courseid = false) {
+ /**
+ * Helper function for collected data, both for analysis page and export to excel
+ *
+ * @param stdClass $item the db-object from feedback_item
+ * @param int|false $groupid
+ * @param int $courseid
+ * @return stdClass
+ */
+ protected function get_analysed($item, $groupid = false, $courseid = false) {
$presentation = $item->presentation;
$analysed_val = new stdClass();
@@ -116,15 +107,15 @@ class feedback_item_info extends feedback_item_base {
$datavalue = new stdClass();
switch($presentation) {
- case 1:
+ case self::MODE_RESPONSETIME:
$datavalue->value = $value->value;
$datavalue->show = userdate($datavalue->value);
break;
- case 2:
+ case self::MODE_COURSE:
$datavalue->value = $value->value;
$datavalue->show = $datavalue->value;
break;
- case 3:
+ case self::MODE_CATEGORY:
$datavalue->value = $value->value;
$datavalue->show = $datavalue->value;
break;
@@ -142,7 +133,8 @@ class feedback_item_info extends feedback_item_base {
if (!isset($value->value)) {
return '';
}
- return $item->presentation == 1 ? userdate($value->value) : $value->value;
+ return $item->presentation == self::MODE_RESPONSETIME ?
+ userdate($value->value) : $value->value;
}
public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
@@ -187,236 +179,84 @@ class feedback_item_info extends feedback_item_base {
}
/**
- * print the item at the edit-page of feedback
+ * Calculates the value of the item (time, course, course category)
*
- * @global object
- * @param object $item
- * @return void
+ * @param stdClass $item
+ * @param stdClass $feedback
+ * @param int $courseid
+ * @return string
*/
- public function print_item_preview($item) {
- global $USER, $DB, $OUTPUT;
-
- $align = right_to_left() ? 'right' : 'left';
- $presentation = $item->presentation;
- $requiredmark = ($item->required == 1)?'':'';
-
- if ($item->feedback) {
- $courseid = $DB->get_field('feedback', 'course', array('id'=>$item->feedback));
- } else { // the item must be a template item
- $cmid = required_param('id', PARAM_INT);
- $courseid = $DB->get_field('course_modules', 'course', array('id'=>$cmid));
- }
- if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
- print_error('error');
- }
- if ($course->id !== SITEID) {
- $coursecategory = $DB->get_record('course_categories', array('id'=>$course->category));
- } else {
- $coursecategory = false;
- }
- switch($presentation) {
- case 1:
- $itemvalue = time();
- $itemshowvalue = userdate($itemvalue);
+ protected function get_current_value($item, $feedback, $courseid) {
+ global $DB;
+ switch ($item->presentation) {
+ case self::MODE_RESPONSETIME:
+ if ($feedback->anonymous != FEEDBACK_ANONYMOUS_YES) {
+ // Response time is not allowed in anonymous feedbacks.
+ return time();
+ }
break;
- case 2:
- $coursecontext = context_course::instance($course->id);
- $itemvalue = format_string($course->shortname,
- true,
- array('context' => $coursecontext));
-
- $itemshowvalue = $itemvalue;
+ case self::MODE_COURSE:
+ $course = get_course($courseid);
+ return format_string($course->shortname, true,
+ array('context' => context_course::instance($course->id)));
break;
- case 3:
- if ($coursecategory) {
- $category_context = context_coursecat::instance($coursecategory->id);
- $itemvalue = format_string($coursecategory->name,
- true,
- array('context' => $category_context));
-
- $itemshowvalue = $itemvalue;
- } else {
- $itemvalue = '';
- $itemshowvalue = '';
+ case self::MODE_CATEGORY:
+ if ($courseid !== SITEID) {
+ $coursecategory = $DB->get_record_sql('SELECT cc.id, cc.name FROM {course_categories} cc, {course} c '
+ . 'WHERE c.category = cc.id AND c.id = ?', array($courseid));
+ return format_string($coursecategory->name, true,
+ array('context' => context_coursecat::instance($coursecategory->id)));
}
break;
}
-
- //print the question and label
- echo '
';
@@ -300,310 +280,109 @@ class feedback_item_multichoice extends feedback_item_base {
}
/**
- * print the item at the edit-page of feedback
- *
- * @global object
- * @param object $item
- * @return void
+ * Options for the multichoice element
+ * @param stdClass $item
+ * @return array
*/
- public function print_item_preview($item) {
- global $OUTPUT, $DB;
+ protected function get_options($item) {
$info = $this->get_info($item);
- $align = right_to_left() ? 'right' : 'left';
-
$presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
- $strrequiredmark = '';
-
- //test if required and no value is set so we have to mark this item
- //we have to differ check and the other subtypes
- $requiredmark = ($item->required == 1) ? $strrequiredmark : '';
-
- //print the question and label
- echo '
';
+ return $options;
}
/**
- * print the item at the complete-page of feedback
+ * Adds an input element to the complete form
*
- * @global object
- * @param object $item
- * @param string $value
- * @param bool $highlightrequire
- * @return void
+ * This element has many options - it can be displayed as group or radio elements,
+ * group of checkboxes or a dropdown list.
+ *
+ * @param stdClass $item
+ * @param mod_feedback_complete_form $form
*/
- public function print_item_complete($item, $value = null, $highlightrequire = false) {
- global $OUTPUT;
+ public function complete_form_element($item, $form) {
$info = $this->get_info($item);
- $align = right_to_left() ? 'right' : 'left';
-
- if ($value == null) {
- $value = array();
- }
- $presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
- $strrequiredmark = '';
-
- //test if required and no value is set so we have to mark this item
- //we have to differ check and the other subtypes
- if (is_array($value)) {
- $values = $value;
- } else {
- $values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
- }
- $requiredmark = ($item->required == 1) ? $strrequiredmark : '';
-
- //print the question and label
+ $name = $this->get_display_name($item);
+ $class = 'multichoice-' . $info->subtype;
$inputname = $item->typ . '_' . $item->id;
- echo '
';
- if ($info->subtype == 'd') {
- echo '';
- } else {
- echo format_text($item->name . $requiredmark, FORMAT_HTML, array('noclean' => true, 'para' => false));
- if ($highlightrequire AND $item->required AND (count($values) == 0 OR $values[0] == '' OR $values[0] == 0)) {
- echo ' '.get_string('err_required', 'form').
- ' ';
- }
- }
- echo '
';
-
- if ($info->subtype == 'r' || $info->subtype == 'c') {
- // if (r)adio buttons or (c)heckboxes
- echo '';
- }
- echo '
';
}
/**
- * print the item at the complete-page of feedback
- *
- * @global object
- * @param object $item
- * @param string $value
- * @return void
+ * Prepares value that user put in the form for storing in DB
+ * @param array $value
+ * @return string
*/
- public function print_item_show_value($item, $value = null) {
- global $OUTPUT;
- $info = $this->get_info($item);
- $align = right_to_left() ? 'right' : 'left';
-
- if ($value == null) {
- $value = array();
- }
-
- $presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
-
- //test if required and no value is set so we have to mark this item
- //we have to differ check and the other subtypes
- if ($info->subtype == 'c') {
- if (is_array($value)) {
- $values = $value;
- } else {
- $values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
- }
- }
- $requiredmark = '';
- if ($item->required == 1) {
- $requiredmark = '';
- }
-
- //print the question and label
- echo '
';
}
/**
- * print the item at the complete-page of feedback
+ * Compares the dbvalue with the dependvalue
*
- * @global object
- * @param object $item
- * @param string $value
- * @return void
+ * @param stdClass $item
+ * @param string $dbvalue is the value input by user in the format as it is stored in the db
+ * @param string $dependvalue is the value that it needs to be compared against
*/
- public function print_item_show_value($item, $value = '') {
- global $OUTPUT;
- $align = right_to_left() ? 'right' : 'left';
- $info = $this->get_info($item);
-
- $lines = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
- $requiredmark = ($item->required == 1)?'':'';
-
- //print the question and label
- echo '
';
- echo $OUTPUT->box_start('generalbox boxalign'.$align);
- echo $value ? $value : ' ';
- echo $OUTPUT->box_end();
- }
-
- public function check_value($value, $item) {
- //if the item is not required, so the check is true if no value is given
- if ((!isset($value) OR $value == '') AND $item->required != 1) {
- return true;
- }
- if ($value == "") {
- return false;
- }
- return true;
- }
-
- public function create_value($data) {
- $data = s($data);
- return $data;
- }
-
- //compares the dbvalue with the dependvalue
- //dbvalue is the value put in by the user
- //dependvalue is the value that is compared
- public function compare_value($item, $dbvalue, $dependvalue) {
- if ($dbvalue == $dependvalue) {
- return true;
- }
- return false;
- }
-
- public function get_presentation($data) {
- return $data->itemsize . '|'. $data->itemmaxlength;
- }
-
- public function get_hasvalue() {
- return 1;
- }
-
- public function can_switch_require() {
- return true;
- }
-
- public function value_type() {
- return PARAM_RAW;
- }
-
- public function clean_input_value($value) {
+ public function create_value($value) {
return s($value);
}
}