1 <?php
2 3 4 5 6 7 8
9
10 defined('JPATH_PLATFORM') or die;
11
12 13 14 15 16 17 18 19
20 class JFormFieldUsergroup extends JFormField
21 {
22 23 24 25 26 27
28 protected $type = 'Usergroup';
29
30 31 32 33 34 35 36
37 protected function getInput()
38 {
39 JLog::add('JFormFieldUsergroup is deprecated. Use JFormFieldUserGroupList instead.', JLog::WARNING, 'deprecated');
40
41 $options = array();
42 $attr = '';
43
44
45 $attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
46 $attr .= $this->disabled ? ' disabled' : '';
47 $attr .= $this->size ? ' size="' . $this->size . '"' : '';
48 $attr .= $this->multiple ? ' multiple' : '';
49 $attr .= $this->required ? ' required aria-required="true"' : '';
50 $attr .= $this->autofocus ? ' autofocus' : '';
51
52
53 $attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
54 $attr .= !empty($this->onclick) ? ' onclick="' . $this->onclick . '"' : '';
55
56
57 foreach ($this->element->children() as $option)
58 {
59
60 if ($option->getName() != 'option')
61 {
62 continue;
63 }
64
65 $disabled = (string) $option['disabled'];
66 $disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');
67
68
69 $tmp = JHtml::_(
70 'select.option', (string) $option['value'], trim((string) $option), 'value', 'text',
71 $disabled
72 );
73
74
75 $tmp->class = (string) $option['class'];
76
77
78 $tmp->onclick = (string) $option['onclick'];
79
80
81 $options[] = $tmp;
82 }
83
84 return JHtml::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
85 }
86 }
87