Exemplo n.º 1
0
 /**
  * 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.
  */
 function MoodleQuickForm_autocomplete($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']);
     }
     $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::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes);
     $this->_type = 'autocomplete';
 }