/** * constructor * * @param string $elementName Select name attribute * @param mixed $elementLabel Label(s) for the select * @param mixed $options Data to be used to populate options * @param mixed $attributes Either a typical HTML attribute string or an associative array. Special options * "tags", "placeholder", "ajax", "multiple", "casesensitive" are supported. */ public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) { // Even if the constructor gets called twice we do not really want 2x options (crazy forms!). $this->_options = array(); if ($attributes === null) { $attributes = array(); } if (isset($attributes['tags'])) { $this->tags = $attributes['tags']; unset($attributes['tags']); } if (isset($attributes['showsuggestions'])) { $this->showsuggestions = $attributes['showsuggestions']; unset($attributes['showsuggestions']); } $this->placeholder = get_string('search'); if (isset($attributes['placeholder'])) { $this->placeholder = $attributes['placeholder']; unset($attributes['placeholder']); } if (isset($attributes['ajax'])) { $this->ajax = $attributes['ajax']; unset($attributes['ajax']); } if (isset($attributes['casesensitive'])) { $this->casesensitive = $attributes['casesensitive'] ? true : false; unset($attributes['casesensitive']); } parent::__construct($elementName, $elementLabel, $options, $attributes); $this->_type = 'autocomplete'; }
/** * Constructor * * @param string $elementName Select name attribute * @param mixed $elementLabel Label(s) for the select * @param array $options additional options. * @param mixed $attributes Either a typical HTML attribute string or an associative array */ public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) { //set size default to 12 if (empty($attributes) || empty($attributes['size'])) { $attributes['size'] = 12; } parent::__construct($elementName, $elementLabel, $options, $attributes); }
/** * Constructor * * @param string $elementName Element name * @param mixed $elementLabel Label(s) for an element * @param array $options Options to control the element's display * @param mixed $attributes Either a typical HTML attribute string or an associative array. */ public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { if ($elementName == null) { // This is broken quickforms messing with the constructors. return; } if (!empty($options['cmid'])) { $cmid = $options['cmid']; $current = \core_competency\api::list_course_module_competencies_in_course_module($cmid); // Note: We just pick the outcome set on the first course_module_competency - because in our UI are are // forcing them to be all the same for each activity. if (!empty($current)) { $one = array_pop($current); $this->setValue($one->get_ruleoutcome()); } } $validoptions = course_module_competency::get_ruleoutcome_list(); parent::__construct($elementName, $elementLabel, $validoptions, $attributes); }