Exemple #1
0
 /**
  * Method to get the user group field input markup.
  *
  * @return  string  The field input markup.
  */
 protected function getInput()
 {
     // Initialize variables.
     $options = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Iterate through the children and build an array of options.
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = Dropdown::option((string) $option['value'], trim((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     return Access::usergroup($this->name, $this->value, $attr, $options, $this->id);
 }
 /**
  * Fetch a calendar element
  *
  * @param   string  $name          Element name
  * @param   string  $value         Element value
  * @param   object  &$node         XMLElement node object containing the settings for the element
  * @param   string  $control_name  Control name
  * @return  string
  */
 public function fetchElement($name, $value, &$node, $control_name)
 {
     $ctrl = $control_name . '[' . $name . ']';
     $attribs = ' ';
     if ($v = $node['size']) {
         $attribs .= 'size="' . (string) $v . '"';
     }
     if ($v = $node['class']) {
         $attribs .= 'class="' . (string) $v . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if ($m = $node['multiple']) {
         $attribs .= 'multiple="multiple"';
         $ctrl .= '[]';
     }
     return Access::usergroup($ctrl, $value, $attribs, false);
 }