|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ajax\semantic\html\collections\form; |
|
4
|
|
|
|
|
5
|
|
|
use Ajax\semantic\html\collections\form\HtmlFormField; |
|
6
|
|
|
use Ajax\semantic\html\modules\HtmlDropdown; |
|
7
|
|
|
|
|
8
|
|
|
class HtmlFormDropdown extends HtmlFormField { |
|
9
|
|
|
|
|
10
|
|
|
public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
11
|
|
|
parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
public function setItems($items){ |
|
15
|
|
|
return $this->getField()->setItems($items); |
|
16
|
|
|
} |
|
17
|
|
|
public function addItem($item,$value=NULL,$image=NULL){ |
|
18
|
|
|
return $this->getField()->addItem($item,$value,$image); |
|
19
|
|
|
} |
|
20
|
|
|
public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
21
|
|
|
return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function getDataField(){ |
|
25
|
|
|
return $this->getField()->getInput(); |
|
26
|
|
|
} |
|
27
|
|
|
public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
28
|
|
|
$this->getField()->asSelect($name,$multiple,$selection); |
|
29
|
|
|
return $this; |
|
30
|
|
|
} |
|
31
|
|
|
} |