@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @return $this |
28 | 28 | */ |
29 | 29 | public function setOnShow($jsCode) { |
30 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
30 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
31 | 31 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
32 | 32 | } |
33 | 33 | |
34 | - public function setExclusive($value){ |
|
34 | + public function setExclusive($value) { |
|
35 | 35 | return $this->setParam("exclusive", $value); |
36 | 36 | } |
37 | 37 | |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | * @param string $popup the css selector of the popup |
41 | 41 | * @return \Ajax\semantic\components\Popup |
42 | 42 | */ |
43 | - public function setPopup($popup){ |
|
43 | + public function setPopup($popup) { |
|
44 | 44 | return $this->setParam("popup", $popup); |
45 | 45 | } |
46 | 46 | |
47 | - public function setInline($value){ |
|
47 | + public function setInline($value) { |
|
48 | 48 | return $this->setParam("inline", $value); |
49 | 49 | } |
50 | 50 | |
51 | - public function setPosition($value){ |
|
51 | + public function setPosition($value) { |
|
52 | 52 | return $this->setParam("position", $value); |
53 | 53 | } |
54 | 54 | |
55 | - public function setSetFluidWidth($value){ |
|
55 | + public function setSetFluidWidth($value) { |
|
56 | 56 | return $this->setParam("setFluidWidth", $value); |
57 | 57 | } |
58 | 58 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @param array $instances |
19 | 19 | * @return DataTable |
20 | 20 | */ |
21 | - public function dataTable($identifier,$model, $instances){ |
|
22 | - return $this->addHtmlComponent(new DataTable($identifier,$model,$instances)); |
|
21 | + public function dataTable($identifier, $model, $instances) { |
|
22 | + return $this->addHtmlComponent(new DataTable($identifier, $model, $instances)); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param array $instances |
29 | 29 | * @return JsonDataTable |
30 | 30 | */ |
31 | - public function jsonDataTable($identifier,$model, $instances){ |
|
32 | - return $this->addHtmlComponent(new JsonDataTable($identifier,$model,$instances)); |
|
31 | + public function jsonDataTable($identifier, $model, $instances) { |
|
32 | + return $this->addHtmlComponent(new JsonDataTable($identifier, $model, $instances)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @param object $instance |
38 | 38 | * @return DataElement |
39 | 39 | */ |
40 | - public function dataElement($identifier, $instance){ |
|
41 | - return $this->addHtmlComponent(new DataElement($identifier,$instance)); |
|
40 | + public function dataElement($identifier, $instance) { |
|
41 | + return $this->addHtmlComponent(new DataElement($identifier, $instance)); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * @param object $instance |
47 | 47 | * @return DataForm |
48 | 48 | */ |
49 | - public function dataForm($identifier, $instance){ |
|
50 | - return $this->addHtmlComponent(new DataForm($identifier,$instance)); |
|
49 | + public function dataForm($identifier, $instance) { |
|
50 | + return $this->addHtmlComponent(new DataForm($identifier, $instance)); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param object $instance |
56 | 56 | * @return FormLogin |
57 | 57 | */ |
58 | - public function defaultLogin($identifier,$instance=null){ |
|
59 | - return $this->addHtmlComponent(FormLogin::regular($identifier,$instance)); |
|
58 | + public function defaultLogin($identifier, $instance=null) { |
|
59 | + return $this->addHtmlComponent(FormLogin::regular($identifier, $instance)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param object $instance |
65 | 65 | * @return FormLogin |
66 | 66 | */ |
67 | - public function smallLogin($identifier,$instance=null){ |
|
68 | - return $this->addHtmlComponent(FormLogin::small($identifier,$instance)); |
|
67 | + public function smallLogin($identifier, $instance=null) { |
|
68 | + return $this->addHtmlComponent(FormLogin::small($identifier, $instance)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param object $instance |
74 | 74 | * @return FormLogin |
75 | 75 | */ |
76 | - public function segmentedLogin($identifier,$instance=null){ |
|
77 | - return $this->addHtmlComponent(FormLogin::attachedSegment($identifier,$instance)); |
|
76 | + public function segmentedLogin($identifier, $instance=null) { |
|
77 | + return $this->addHtmlComponent(FormLogin::attachedSegment($identifier, $instance)); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param object $instance |
83 | 83 | * @return FormAccount |
84 | 84 | */ |
85 | - public function defaultAccount($identifier,$instance=null){ |
|
86 | - return $this->addHtmlComponent(FormAccount::regular($identifier,$instance)); |
|
85 | + public function defaultAccount($identifier, $instance=null) { |
|
86 | + return $this->addHtmlComponent(FormAccount::regular($identifier, $instance)); |
|
87 | 87 | } |
88 | 88 | } |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value="",$multiple=false,$associative=true) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value="", $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | $this->_identifier=$identifier; |
13 | 13 | } |
14 | 14 | |
15 | - public function setItems($items){ |
|
15 | + public function setItems($items) { |
|
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
19 | - return $this->getField()->addItem($item,$value,$image); |
|
18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
19 | + return $this->getField()->addItem($item, $value, $image); |
|
20 | 20 | } |
21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value="",$associative=true){ |
|
22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value="", $associative=true) { |
|
22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function getDataField(){ |
|
25 | + public function getDataField() { |
|
26 | 26 | return $this->getField()->getInput(); |
27 | 27 | } |
28 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
29 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
28 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
29 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | } |
@@ -10,61 +10,61 @@ |
||
10 | 10 | * @param string $identifier |
11 | 11 | * @param object $modelInstance |
12 | 12 | */ |
13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
15 | 15 | } |
16 | 16 | |
17 | - protected function getDefaultModelInstance(){ |
|
17 | + protected function getDefaultModelInstance() { |
|
18 | 18 | return new UserModel(); |
19 | 19 | } |
20 | 20 | |
21 | - public static function regular($identifier,$modelInstance=null){ |
|
22 | - return new FormAccount($identifier,$modelInstance, |
|
23 | - ["message","login","password","passwordConf","email","submit","error"], |
|
21 | + public static function regular($identifier, $modelInstance=null) { |
|
22 | + return new FormAccount($identifier, $modelInstance, |
|
23 | + ["message", "login", "password", "passwordConf", "email", "submit", "error"], |
|
24 | 24 | ["message"=>[["icon"=>"sign in"]], |
25 | 25 | "input0"=>[["rules"=>"empty"]], |
26 | - "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
|
27 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
26 | + "input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]], |
|
27 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
28 | 28 | "input3"=>[["rules"=>"email"]], |
29 | 29 | "submit"=>["green fluid"], |
30 | 30 | "message2"=>[["error"=>true]]], |
31 | - ["Account","login","password","passwordConf","email","submit","error"], |
|
32 | - ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
|
33 | - [0,1,3,4,5,6]); |
|
31 | + ["Account", "login", "password", "passwordConf", "email", "submit", "error"], |
|
32 | + ["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
33 | + [0, 1, 3, 4, 5, 6]); |
|
34 | 34 | } |
35 | 35 | |
36 | - public static function smallInline($identifier,$modelInstance=null){ |
|
37 | - $result=new FormAccount($identifier,$modelInstance, |
|
38 | - ["login","password","submit"], |
|
39 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
40 | - ["login","password","submit"], |
|
41 | - ["","","Connection"], |
|
36 | + public static function smallInline($identifier, $modelInstance=null) { |
|
37 | + $result=new FormAccount($identifier, $modelInstance, |
|
38 | + ["login", "password", "submit"], |
|
39 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
40 | + ["login", "password", "submit"], |
|
41 | + ["", "", "Connection"], |
|
42 | 42 | [2]); |
43 | 43 | $result->addDividerBefore(0, "Connection"); |
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - public static function small($identifier,$modelInstance=null){ |
|
48 | - $result=new FormAccount($identifier,$modelInstance, |
|
49 | - ["login","password","passwordConf","email","submit"], |
|
47 | + public static function small($identifier, $modelInstance=null) { |
|
48 | + $result=new FormAccount($identifier, $modelInstance, |
|
49 | + ["login", "password", "passwordConf", "email", "submit"], |
|
50 | 50 | [ |
51 | 51 | "input0"=>[["rules"=>"empty"]], |
52 | - "input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]], |
|
53 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
52 | + "input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]], |
|
53 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
54 | 54 | "input3"=>[["rules"=>"email"]], |
55 | 55 | "submit"=>["green basic"]], |
56 | - ["login","password","passwordConf","email","submit"], |
|
57 | - ["Login","Password","Password confirmation","Email address","Creation"], |
|
58 | - [1,2]); |
|
56 | + ["login", "password", "passwordConf", "email", "submit"], |
|
57 | + ["Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
58 | + [1, 2]); |
|
59 | 59 | $result->addDividerBefore(0, "Creation"); |
60 | 60 | return $result; |
61 | 61 | } |
62 | 62 | |
63 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
64 | - $result=self::regular($identifier,$modelInstance); |
|
65 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
66 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
67 | - $result->addWrapper("error", null,"</div>"); |
|
63 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
64 | + $result=self::regular($identifier, $modelInstance); |
|
65 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
66 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
67 | + $result->addWrapper("error", null, "</div>"); |
|
68 | 68 | return $result; |
69 | 69 | } |
70 | 70 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | trait LabeledIconTrait { |
14 | 14 | |
15 | 15 | abstract public function addToProperty($name, $value, $separator=" "); |
16 | - abstract public function addContent($content,$before=false); |
|
16 | + abstract public function addContent($content, $before=false); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Adds an icon before or after |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | * @param boolean $labeled |
23 | 23 | * @return \Ajax\semantic\html\elements\HtmlIcon |
24 | 24 | */ |
25 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
25 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
26 | 26 | $iconO=$icon; |
27 | - if(\is_string($icon)){ |
|
27 | + if (\is_string($icon)) { |
|
28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
29 | 29 | } |
30 | - if($labeled!==false){ |
|
31 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
30 | + if ($labeled!==false) { |
|
31 | + $direction=($before===true) ?Direction::LEFT : Direction::RIGHT; |
|
32 | 32 | $this->addToProperty("class", $direction." labeled icon"); |
33 | 33 | $this->tagName="div"; |
34 | 34 | } |
35 | - $this->addContent($iconO,$before); |
|
35 | + $this->addContent($iconO, $before); |
|
36 | 36 | return $iconO; |
37 | 37 | } |
38 | 38 | } |
@@ -16,16 +16,16 @@ |
||
16 | 16 | return $this; |
17 | 17 | } |
18 | 18 | |
19 | - public function showDimmer(){ |
|
19 | + public function showDimmer() { |
|
20 | 20 | return $this->setBehavior("hide dimmer"); |
21 | 21 | } |
22 | 22 | |
23 | - public function setInverted(){ |
|
23 | + public function setInverted() { |
|
24 | 24 | $this->params["inverted"]=true; |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function setOnHidden($jsCode) { |
28 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
28 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
29 | 29 | return $this->setParam("onHidden", "%function(){".$jsCode."}%"); |
30 | 30 | } |
31 | 31 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Ajax\JsUtils; |
13 | 13 | |
14 | 14 | class HtmlTD extends HtmlSemDoubleElement { |
15 | - use TextAlignmentTrait,TableElementTrait; |
|
15 | + use TextAlignmentTrait, TableElementTrait; |
|
16 | 16 | private $_container; |
17 | 17 | private $_row; |
18 | 18 | private $_col; |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct($identifier, $content=NULL, $tagName="td") { |
30 | 30 | parent::__construct($identifier, $tagName, "", $content); |
31 | - $this->_variations=[ Variation::COLLAPSING ]; |
|
32 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
31 | + $this->_variations=[Variation::COLLAPSING]; |
|
32 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContainer($container, $row, $col) { |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function setRowspan($rowspan) { |
52 | - $to=min($this->_container->count(), $this->_row + $rowspan - 1); |
|
53 | - for($i=$to; $i > $this->_row; $i--) { |
|
52 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
53 | + for ($i=$to; $i>$this->_row; $i--) { |
|
54 | 54 | $this->_container->toDelete($i, $this->_col); |
55 | 55 | } |
56 | 56 | $this->setProperty("rowspan", $rowspan); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | public function mergeRow() { |
61 | - if(!$this->_rowMerged){ |
|
61 | + if (!$this->_rowMerged) { |
|
62 | 62 | $this->_rowMerged=true; |
63 | 63 | return $this->setRowspan($this->_container->count()); |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public function mergeCol() { |
69 | - if(!$this->_colMerged){ |
|
69 | + if (!$this->_colMerged) { |
|
70 | 70 | $this->_colMerged=true; |
71 | 71 | return $this->setColspan($this->_container->getRow($this->_row)->count()); |
72 | 72 | } |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | public function setColspan($colspan) { |
77 | - $to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1); |
|
78 | - for($i=$to; $i > $this->_col; $i--) { |
|
79 | - $this->_container->toDelete($this->_row, $this->_col + 1); |
|
77 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
78 | + for ($i=$to; $i>$this->_col; $i--) { |
|
79 | + $this->_container->toDelete($this->_row, $this->_col+1); |
|
80 | 80 | } |
81 | 81 | $this->setProperty("colspan", $colspan); |
82 | 82 | return $this->_container; |
@@ -115,21 +115,21 @@ discard block |
||
115 | 115 | return $this->addToProperty("class", "selectable"); |
116 | 116 | } |
117 | 117 | |
118 | - public function setWidth($width){ |
|
118 | + public function setWidth($width) { |
|
119 | 119 | if (\is_int($width)) { |
120 | - $width=Wide::getConstants()["W" . $width]; |
|
120 | + $width=Wide::getConstants()["W".$width]; |
|
121 | 121 | } |
122 | 122 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
123 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
123 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
124 | 124 | } |
125 | 125 | |
126 | - public function toDelete(){ |
|
126 | + public function toDelete() { |
|
127 | 127 | $this->_deleted=true; |
128 | 128 | return $this; |
129 | 129 | } |
130 | 130 | |
131 | 131 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
132 | - if(!$this->_deleted) |
|
132 | + if (!$this->_deleted) |
|
133 | 133 | return parent::compile(); |
134 | 134 | return; |
135 | 135 | } |
@@ -84,15 +84,17 @@ discard block |
||
84 | 84 | |
85 | 85 | public function getColspan() { |
86 | 86 | $colspan=1; |
87 | - if (\array_key_exists("colspan", $this->properties)) |
|
88 | - $colspan=$this->getProperty("colspan"); |
|
87 | + if (\array_key_exists("colspan", $this->properties)) { |
|
88 | + $colspan=$this->getProperty("colspan"); |
|
89 | + } |
|
89 | 90 | return $colspan; |
90 | 91 | } |
91 | 92 | |
92 | 93 | public function getRowspan() { |
93 | 94 | $rowspan=1; |
94 | - if (\array_key_exists("rowspan", $this->properties)) |
|
95 | - $rowspan=$this->getProperty("rowspan"); |
|
95 | + if (\array_key_exists("rowspan", $this->properties)) { |
|
96 | + $rowspan=$this->getProperty("rowspan"); |
|
97 | + } |
|
96 | 98 | return $rowspan; |
97 | 99 | } |
98 | 100 | |
@@ -129,8 +131,9 @@ discard block |
||
129 | 131 | } |
130 | 132 | |
131 | 133 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
132 | - if(!$this->_deleted) |
|
133 | - return parent::compile(); |
|
134 | + if(!$this->_deleted) { |
|
135 | + return parent::compile(); |
|
136 | + } |
|
134 | 137 | return; |
135 | 138 | } |
136 | 139 | } |
@@ -25,6 +25,9 @@ discard block |
||
25 | 25 | protected $_associative; |
26 | 26 | protected $_multiple; |
27 | 27 | |
28 | + /** |
|
29 | + * @param string $identifier |
|
30 | + */ |
|
28 | 31 | public function __construct($identifier, $value="", $items=array(),$associative=true) { |
29 | 32 | parent::__construct($identifier, "div"); |
30 | 33 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
@@ -78,7 +81,7 @@ discard block |
||
78 | 81 | /** |
79 | 82 | * Insert an item at a position |
80 | 83 | * @param mixed $item |
81 | - * @param number $position |
|
84 | + * @param integer $position |
|
82 | 85 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
83 | 86 | */ |
84 | 87 | public function insertItem($item,$position=0){ |
@@ -190,7 +193,7 @@ discard block |
||
190 | 193 | * Sets the values of a property for each item in the collection |
191 | 194 | * @param string $property |
192 | 195 | * @param array $values |
193 | - * @return HtmlCollection |
|
196 | + * @return HtmlDropdown |
|
194 | 197 | */ |
195 | 198 | public function setPropertyValues($property,$values){ |
196 | 199 | $i=0; |
@@ -209,6 +212,9 @@ discard block |
||
209 | 212 | return $this; |
210 | 213 | } |
211 | 214 | |
215 | + /** |
|
216 | + * @param integer $index |
|
217 | + */ |
|
212 | 218 | public function getItem($index){ |
213 | 219 | return $this->items[$index]; |
214 | 220 | } |
@@ -302,6 +308,9 @@ discard block |
||
302 | 308 | return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
303 | 309 | } |
304 | 310 | |
311 | + /** |
|
312 | + * @param string $value |
|
313 | + */ |
|
305 | 314 | public function setValue($value){ |
306 | 315 | $this->value=$value; |
307 | 316 | return $this; |
@@ -338,6 +347,9 @@ discard block |
||
338 | 347 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
339 | 348 | } |
340 | 349 | |
350 | + /** |
|
351 | + * @param string $action |
|
352 | + */ |
|
341 | 353 | public function setAction($action){ |
342 | 354 | $this->_params["action"]=$action; |
343 | 355 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | if(isset($value)){ |
35 | 35 | if($value instanceof HtmlSemDoubleElement){ |
36 | 36 | $text=$value; |
37 | - }else{ |
|
37 | + } else{ |
|
38 | 38 | $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
39 | 39 | $text->setClass("text"); |
40 | 40 | $this->setValue($value); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | if(!$item instanceof HtmlDropdownItem){ |
109 | 109 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
110 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
110 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
111 | 111 | $this->addToProperty("class", "vertical"); |
112 | 112 | } |
113 | 113 | return $itemO; |
@@ -121,8 +121,9 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | public function addInput($name){ |
124 | - if(!isset($name)) |
|
125 | - $name="input-".$this->identifier; |
|
124 | + if(!isset($name)) { |
|
125 | + $name="input-".$this->identifier; |
|
126 | + } |
|
126 | 127 | $this->setAction("activate"); |
127 | 128 | $this->input=new HtmlInput($name,"hidden"); |
128 | 129 | } |
@@ -179,7 +180,7 @@ discard block |
||
179 | 180 | foreach ($items as $k=>$v){ |
180 | 181 | $this->addItem($v)->setData($k); |
181 | 182 | } |
182 | - }else{ |
|
183 | + } else{ |
|
183 | 184 | foreach ($items as $item){ |
184 | 185 | $this->addItem($item); |
185 | 186 | } |
@@ -201,8 +202,7 @@ discard block |
||
201 | 202 | $c=$this->items[$i++]; |
202 | 203 | if(isset($c)){ |
203 | 204 | $c->setProperty($property,$value); |
204 | - } |
|
205 | - else{ |
|
205 | + } else{ |
|
206 | 206 | return $this; |
207 | 207 | } |
208 | 208 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if($dropdown===false){ |
227 | 227 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
228 | 228 | $dropdown="menu"; |
229 | - }else{ |
|
229 | + } else{ |
|
230 | 230 | $dropdown="dropdown"; |
231 | 231 | $this->mClass="menu"; |
232 | 232 | } |
@@ -247,22 +247,25 @@ discard block |
||
247 | 247 | |
248 | 248 | public function asButton($floating=false){ |
249 | 249 | $this->removeArrow(); |
250 | - if($floating) |
|
251 | - $this->addToProperty("class", "floating"); |
|
250 | + if($floating) { |
|
251 | + $this->addToProperty("class", "floating"); |
|
252 | + } |
|
252 | 253 | $this->removePropertyValue("class", "selection"); |
253 | 254 | return $this->addToProperty("class", "button"); |
254 | 255 | } |
255 | 256 | |
256 | 257 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
257 | 258 | $this->_multiple=$multiple; |
258 | - if(isset($name)) |
|
259 | - $this->addInput($name); |
|
259 | + if(isset($name)) { |
|
260 | + $this->addInput($name); |
|
261 | + } |
|
260 | 262 | if($multiple){ |
261 | 263 | $this->addToProperty("class", "multiple"); |
262 | 264 | } |
263 | 265 | if ($selection){ |
264 | - if($this->propertyContains("class", "button")===false) |
|
265 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
266 | + if($this->propertyContains("class", "button")===false) { |
|
267 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
268 | + } |
|
266 | 269 | } |
267 | 270 | return $this; |
268 | 271 | } |
@@ -273,8 +276,9 @@ discard block |
||
273 | 276 | } |
274 | 277 | |
275 | 278 | public function setSelect($name=NULL,$multiple=false){ |
276 | - if(!isset($name)) |
|
277 | - $name="select-".$this->identifier; |
|
279 | + if(!isset($name)) { |
|
280 | + $name="select-".$this->identifier; |
|
281 | + } |
|
278 | 282 | $this->input=null; |
279 | 283 | if($multiple){ |
280 | 284 | $this->setProperty("multiple", true); |
@@ -310,12 +314,13 @@ discard block |
||
310 | 314 | $value=$this->value; |
311 | 315 | if(isset($this->input) && isset($value)){ |
312 | 316 | $this->input->setProperty("value", $value); |
313 | - }else{ |
|
317 | + } else{ |
|
314 | 318 | $this->setProperty("value", $value); |
315 | 319 | } |
316 | 320 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
317 | - if(isset($textElement) && !$this->_multiple) |
|
318 | - $textElement->setContent($value); |
|
321 | + if(isset($textElement) && !$this->_multiple) { |
|
322 | + $textElement->setContent($value); |
|
323 | + } |
|
319 | 324 | return $this; |
320 | 325 | } |
321 | 326 |
@@ -13,29 +13,29 @@ discard block |
||
13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
14 | 14 | |
15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
16 | - use FieldTrait,LabeledIconTrait { |
|
16 | + use FieldTrait, LabeledIconTrait { |
|
17 | 17 | addIcon as addIconP; |
18 | 18 | } |
19 | 19 | protected $mClass="menu"; |
20 | 20 | protected $mTagName="div"; |
21 | - protected $items=array (); |
|
22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
21 | + protected $items=array(); |
|
22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
23 | 23 | protected $input; |
24 | 24 | protected $value; |
25 | 25 | protected $_associative; |
26 | 26 | protected $_multiple; |
27 | 27 | |
28 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
28 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
29 | 29 | parent::__construct($identifier, "div"); |
30 | 30 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
31 | 31 | $this->setProperty("class", "ui dropdown"); |
32 | 32 | $this->_multiple=false; |
33 | 33 | $content=[]; |
34 | - if(isset($value)){ |
|
35 | - if($value instanceof HtmlSemDoubleElement){ |
|
34 | + if (isset($value)) { |
|
35 | + if ($value instanceof HtmlSemDoubleElement) { |
|
36 | 36 | $text=$value; |
37 | - }else{ |
|
38 | - $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
37 | + } else { |
|
38 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
39 | 39 | $text->setClass("text"); |
40 | 40 | $this->setValue($value); |
41 | 41 | } |
@@ -48,29 +48,29 @@ discard block |
||
48 | 48 | $this->addItems($items); |
49 | 49 | } |
50 | 50 | |
51 | - public function getField(){ |
|
51 | + public function getField() { |
|
52 | 52 | return $this->input; |
53 | 53 | } |
54 | 54 | |
55 | - public function getDataField(){ |
|
55 | + public function getDataField() { |
|
56 | 56 | return $this->input; |
57 | 57 | } |
58 | 58 | |
59 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
60 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
59 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
60 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
61 | 61 | $this->items[]=$itemO; |
62 | 62 | return $itemO; |
63 | 63 | } |
64 | 64 | |
65 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
65 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
66 | 66 | $this->removeArrow(); |
67 | - $this->addIconP($icon,$before,$labeled); |
|
67 | + $this->addIconP($icon, $before, $labeled); |
|
68 | 68 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
69 | 69 | } |
70 | 70 | |
71 | - public function addIcons($icons){ |
|
71 | + public function addIcons($icons) { |
|
72 | 72 | $count=$this->count(); |
73 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
73 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
74 | 74 | $this->getItem($i)->addIcon($icons[$i]); |
75 | 75 | } |
76 | 76 | } |
@@ -81,33 +81,33 @@ discard block |
||
81 | 81 | * @param number $position |
82 | 82 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
83 | 83 | */ |
84 | - public function insertItem($item,$position=0){ |
|
84 | + public function insertItem($item, $position=0) { |
|
85 | 85 | $itemO=$this->beforeAddItem($item); |
86 | - $start = array_slice($this->items, 0, $position); |
|
87 | - $end = array_slice($this->items, $position); |
|
88 | - $start[] = $item; |
|
86 | + $start=array_slice($this->items, 0, $position); |
|
87 | + $end=array_slice($this->items, $position); |
|
88 | + $start[]=$item; |
|
89 | 89 | $this->items=array_merge($start, $end); |
90 | 90 | return $itemO; |
91 | 91 | } |
92 | 92 | |
93 | - protected function removeArrow(){ |
|
94 | - if(\sizeof($this->content)>1){ |
|
93 | + protected function removeArrow() { |
|
94 | + if (\sizeof($this->content)>1) { |
|
95 | 95 | unset($this->content["arrow"]); |
96 | 96 | $this->content=\array_values($this->content); |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
100 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
101 | 101 | $itemO=$item; |
102 | - if(\is_array($item)){ |
|
102 | + if (\is_array($item)) { |
|
103 | 103 | $description=JArray::getValue($item, "description", 3); |
104 | 104 | $value=JArray::getValue($item, "value", 1); |
105 | 105 | $image=JArray::getValue($item, "image", 2); |
106 | 106 | $item=JArray::getValue($item, "item", 0); |
107 | 107 | } |
108 | - if(!$item instanceof HtmlDropdownItem){ |
|
109 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
110 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
108 | + if (!$item instanceof HtmlDropdownItem) { |
|
109 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
110 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
111 | 111 | $this->addToProperty("class", "vertical"); |
112 | 112 | } |
113 | 113 | return $itemO; |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | $this->addItem($function($object)); |
121 | 121 | } |
122 | 122 | |
123 | - public function addInput($name){ |
|
124 | - if(!isset($name)) |
|
123 | + public function addInput($name) { |
|
124 | + if (!isset($name)) |
|
125 | 125 | $name="input-".$this->identifier; |
126 | 126 | $this->setAction("activate"); |
127 | - $this->input=new HtmlInput($name,"hidden"); |
|
127 | + $this->input=new HtmlInput($name, "hidden"); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | * @param string $icon |
134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
135 | 135 | */ |
136 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
137 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
136 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
137 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Adds a divider item |
142 | 142 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
143 | 143 | */ |
144 | - public function addDividerItem(){ |
|
144 | + public function addDividerItem() { |
|
145 | 145 | return $this->addItem(HtmlDropdownItem::divider()); |
146 | 146 | } |
147 | 147 | |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * @param string $icon |
152 | 152 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
153 | 153 | */ |
154 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
155 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
154 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
155 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param string $color |
162 | 162 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
163 | 163 | */ |
164 | - public function addCircularLabelItem($caption,$color){ |
|
164 | + public function addCircularLabelItem($caption, $color) { |
|
165 | 165 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
166 | 166 | } |
167 | 167 | |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | * @param string $image |
171 | 171 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
172 | 172 | */ |
173 | - public function addMiniAvatarImageItem($caption,$image){ |
|
173 | + public function addMiniAvatarImageItem($caption, $image) { |
|
174 | 174 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
175 | 175 | } |
176 | 176 | |
177 | - public function addItems($items){ |
|
178 | - if(\is_array($items) && $this->_associative){ |
|
179 | - foreach ($items as $k=>$v){ |
|
177 | + public function addItems($items) { |
|
178 | + if (\is_array($items) && $this->_associative) { |
|
179 | + foreach ($items as $k=>$v) { |
|
180 | 180 | $this->addItem($v)->setData($k); |
181 | 181 | } |
182 | - }else{ |
|
183 | - foreach ($items as $item){ |
|
182 | + } else { |
|
183 | + foreach ($items as $item) { |
|
184 | 184 | $this->addItem($item); |
185 | 185 | } |
186 | 186 | } |
@@ -192,98 +192,98 @@ discard block |
||
192 | 192 | * @param array $values |
193 | 193 | * @return HtmlCollection |
194 | 194 | */ |
195 | - public function setPropertyValues($property,$values){ |
|
195 | + public function setPropertyValues($property, $values) { |
|
196 | 196 | $i=0; |
197 | - if(\is_array($values)===false){ |
|
198 | - $values=\array_fill(0, $this->count(),$values); |
|
197 | + if (\is_array($values)===false) { |
|
198 | + $values=\array_fill(0, $this->count(), $values); |
|
199 | 199 | } |
200 | - foreach ($values as $value){ |
|
200 | + foreach ($values as $value) { |
|
201 | 201 | $c=$this->items[$i++]; |
202 | - if(isset($c)){ |
|
203 | - $c->setProperty($property,$value); |
|
202 | + if (isset($c)) { |
|
203 | + $c->setProperty($property, $value); |
|
204 | 204 | } |
205 | - else{ |
|
205 | + else { |
|
206 | 206 | return $this; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | return $this; |
210 | 210 | } |
211 | 211 | |
212 | - public function each($callBack){ |
|
213 | - foreach ($this->items as $index=>$value){ |
|
214 | - $callBack($index,$value); |
|
212 | + public function each($callBack) { |
|
213 | + foreach ($this->items as $index=>$value) { |
|
214 | + $callBack($index, $value); |
|
215 | 215 | } |
216 | 216 | return $this; |
217 | 217 | } |
218 | 218 | |
219 | - public function getItem($index){ |
|
219 | + public function getItem($index) { |
|
220 | 220 | return $this->items[$index]; |
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | 224 | * @return int |
225 | 225 | */ |
226 | - public function count(){ |
|
226 | + public function count() { |
|
227 | 227 | return \sizeof($this->items); |
228 | 228 | } |
229 | 229 | /** |
230 | 230 | * @param boolean $dropdown |
231 | 231 | */ |
232 | - public function asDropdown($dropdown){ |
|
233 | - if($dropdown===false){ |
|
232 | + public function asDropdown($dropdown) { |
|
233 | + if ($dropdown===false) { |
|
234 | 234 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
235 | 235 | $dropdown="menu"; |
236 | - }else{ |
|
236 | + } else { |
|
237 | 237 | $dropdown="dropdown"; |
238 | 238 | $this->mClass="menu"; |
239 | 239 | } |
240 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
240 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
241 | 241 | } |
242 | 242 | |
243 | - public function setVertical(){ |
|
244 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
243 | + public function setVertical() { |
|
244 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
245 | 245 | } |
246 | 246 | |
247 | - public function setInline(){ |
|
248 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
247 | + public function setInline() { |
|
248 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
249 | 249 | } |
250 | 250 | |
251 | - public function setSimple(){ |
|
252 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
251 | + public function setSimple() { |
|
252 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
253 | 253 | } |
254 | 254 | |
255 | - public function asButton($floating=false){ |
|
255 | + public function asButton($floating=false) { |
|
256 | 256 | $this->removeArrow(); |
257 | - if($floating) |
|
257 | + if ($floating) |
|
258 | 258 | $this->addToProperty("class", "floating"); |
259 | 259 | $this->removePropertyValue("class", "selection"); |
260 | 260 | return $this->addToProperty("class", "button"); |
261 | 261 | } |
262 | 262 | |
263 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
263 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
264 | 264 | $this->_multiple=$multiple; |
265 | - if(isset($name)) |
|
265 | + if (isset($name)) |
|
266 | 266 | $this->addInput($name); |
267 | - if($multiple){ |
|
267 | + if ($multiple) { |
|
268 | 268 | $this->addToProperty("class", "multiple"); |
269 | 269 | } |
270 | - if ($selection){ |
|
271 | - if($this->propertyContains("class", "button")===false) |
|
272 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
270 | + if ($selection) { |
|
271 | + if ($this->propertyContains("class", "button")===false) |
|
272 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
273 | 273 | } |
274 | 274 | return $this; |
275 | 275 | } |
276 | 276 | |
277 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
278 | - $this->asSelect($name,$multiple,$selection); |
|
277 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
278 | + $this->asSelect($name, $multiple, $selection); |
|
279 | 279 | return $this->addToProperty("class", "search"); |
280 | 280 | } |
281 | 281 | |
282 | - public function setSelect($name=NULL,$multiple=false){ |
|
283 | - if(!isset($name)) |
|
282 | + public function setSelect($name=NULL, $multiple=false) { |
|
283 | + if (!isset($name)) |
|
284 | 284 | $name="select-".$this->identifier; |
285 | 285 | $this->input=null; |
286 | - if($multiple){ |
|
286 | + if ($multiple) { |
|
287 | 287 | $this->setProperty("multiple", true); |
288 | 288 | $this->addToProperty("class", "multiple"); |
289 | 289 | } |
@@ -291,37 +291,37 @@ discard block |
||
291 | 291 | $this->tagName="select"; |
292 | 292 | $this->setProperty("name", $name); |
293 | 293 | $this->content=null; |
294 | - foreach ($this->items as $item){ |
|
294 | + foreach ($this->items as $item) { |
|
295 | 295 | $item->asOption(); |
296 | 296 | } |
297 | 297 | return $this; |
298 | 298 | } |
299 | 299 | |
300 | - public function asSubmenu($pointing=NULL){ |
|
300 | + public function asSubmenu($pointing=NULL) { |
|
301 | 301 | $this->setClass("ui dropdown link item"); |
302 | - if(isset($pointing)){ |
|
302 | + if (isset($pointing)) { |
|
303 | 303 | $this->setPointing($pointing); |
304 | 304 | } |
305 | 305 | return $this; |
306 | 306 | } |
307 | 307 | |
308 | - public function setPointing($value=Direction::NONE){ |
|
309 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
308 | + public function setPointing($value=Direction::NONE) { |
|
309 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
310 | 310 | } |
311 | 311 | |
312 | - public function setValue($value){ |
|
312 | + public function setValue($value) { |
|
313 | 313 | $this->value=$value; |
314 | 314 | return $this; |
315 | 315 | } |
316 | - private function applyValue(){ |
|
316 | + private function applyValue() { |
|
317 | 317 | $value=$this->value; |
318 | - if(isset($this->input) && isset($value)){ |
|
318 | + if (isset($this->input) && isset($value)) { |
|
319 | 319 | $this->input->setProperty("value", $value); |
320 | - }else{ |
|
320 | + } else { |
|
321 | 321 | $this->setProperty("value", $value); |
322 | 322 | } |
323 | 323 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
324 | - if(isset($textElement) && !$this->_multiple) |
|
324 | + if (isset($textElement) && !$this->_multiple) |
|
325 | 325 | $textElement->setContent($value); |
326 | 326 | return $this; |
327 | 327 | } |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | * @see BaseHtml::run() |
332 | 332 | */ |
333 | 333 | public function run(JsUtils $js) { |
334 | - if($this->propertyContains("class", "simple")===false){ |
|
335 | - if(isset($this->_bsComponent)===false){ |
|
336 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
334 | + if ($this->propertyContains("class", "simple")===false) { |
|
335 | + if (isset($this->_bsComponent)===false) { |
|
336 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
337 | 337 | $this->_bsComponent->setItemSelector(".item"); |
338 | 338 | } |
339 | 339 | $this->addEventsOnRun($js); |
@@ -341,36 +341,36 @@ discard block |
||
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
344 | - public function setCompact(){ |
|
344 | + public function setCompact() { |
|
345 | 345 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
346 | 346 | } |
347 | 347 | |
348 | - public function setAction($action){ |
|
348 | + public function setAction($action) { |
|
349 | 349 | $this->_params["action"]=$action; |
350 | 350 | } |
351 | 351 | |
352 | - public function setFullTextSearch($value){ |
|
352 | + public function setFullTextSearch($value) { |
|
353 | 353 | $this->_params["fullTextSearch"]=$value; |
354 | 354 | } |
355 | 355 | |
356 | 356 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
357 | 357 | $this->applyValue(); |
358 | - return parent::compile($js,$view); |
|
358 | + return parent::compile($js, $view); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | public function getInput() { |
362 | 362 | return $this->input; |
363 | 363 | } |
364 | 364 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
365 | - return $this->_addAction($this, $action,$direction,$icon,$labeled); |
|
365 | + return $this->_addAction($this, $action, $direction, $icon, $labeled); |
|
366 | 366 | } |
367 | 367 | |
368 | - public function setIcon($icon="dropdown"){ |
|
368 | + public function setIcon($icon="dropdown") { |
|
369 | 369 | $this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon); |
370 | 370 | return $this; |
371 | 371 | } |
372 | 372 | |
373 | - public function jsAddItem($caption){ |
|
373 | + public function jsAddItem($caption) { |
|
374 | 374 | $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')"; |
375 | 375 | return $js; |
376 | 376 | } |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | foreach ($actions as $action){ |
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | - } |
|
47 | - else{ |
|
46 | + } else{ |
|
48 | 47 | $this->addAction($actions); |
49 | 48 | } |
50 | 49 | return $this; |
@@ -64,8 +63,9 @@ discard block |
||
64 | 63 | $class="cancel"; |
65 | 64 | } |
66 | 65 | $action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()),$action); |
67 | - if($class!=="") |
|
68 | - $action->addToProperty("class", $class); |
|
66 | + if($class!=="") { |
|
67 | + $action->addToProperty("class", $class); |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | return $this->addElementInPart($action, "actions"); |
71 | 71 | } |
@@ -174,8 +174,9 @@ discard block |
||
174 | 174 | * @see BaseHtml::run() |
175 | 175 | */ |
176 | 176 | public function run(JsUtils $js) { |
177 | - if(isset($this->_bsComponent)===false) |
|
178 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
177 | + if(isset($this->_bsComponent)===false) { |
|
178 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
179 | + } |
|
179 | 180 | $this->addEventsOnRun($js); |
180 | 181 | return $this->_bsComponent; |
181 | 182 | } |
@@ -15,36 +15,36 @@ discard block |
||
15 | 15 | protected $_paramParts=array(); |
16 | 16 | |
17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
18 | - parent::__construct($identifier, "div","ui modal"); |
|
19 | - if(isset($header)){ |
|
18 | + parent::__construct($identifier, "div", "ui modal"); |
|
19 | + if (isset($header)) { |
|
20 | 20 | $this->setHeader($header); |
21 | 21 | } |
22 | - if(isset($content)){ |
|
22 | + if (isset($content)) { |
|
23 | 23 | $this->setContent($content); |
24 | 24 | } |
25 | - if(isset($actions)){ |
|
25 | + if (isset($actions)) { |
|
26 | 26 | $this->setActions($actions); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setHeader($value) { |
31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContent($value) { |
36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActions($actions) { |
41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
42 | - if(\is_array($actions)){ |
|
43 | - foreach ($actions as $action){ |
|
41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
42 | + if (\is_array($actions)) { |
|
43 | + foreach ($actions as $action) { |
|
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | 46 | } |
47 | - else{ |
|
47 | + else { |
|
48 | 48 | $this->addAction($actions); |
49 | 49 | } |
50 | 50 | return $this; |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | * @param string|BaseHtml $action |
55 | 55 | * @return HtmlButton |
56 | 56 | */ |
57 | - public function addAction($action){ |
|
58 | - if(!$action instanceof BaseHtml){ |
|
57 | + public function addAction($action) { |
|
58 | + if (!$action instanceof BaseHtml) { |
|
59 | 59 | $class=""; |
60 | - if(\array_search($action, ["Okay","Yes","Validate"])!==false){ |
|
60 | + if (\array_search($action, ["Okay", "Yes", "Validate"])!==false) { |
|
61 | 61 | $class="approve"; |
62 | 62 | } |
63 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
63 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
64 | 64 | $class="cancel"; |
65 | 65 | } |
66 | - $action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()),$action); |
|
67 | - if($class!=="") |
|
66 | + $action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()), $action); |
|
67 | + if ($class!=="") |
|
68 | 68 | $action->addToProperty("class", $class); |
69 | 69 | } |
70 | 70 | return $this->addElementInPart($action, "actions"); |
@@ -74,66 +74,66 @@ discard block |
||
74 | 74 | * @param int $index |
75 | 75 | * @return HtmlButton |
76 | 76 | */ |
77 | - public function getAction($index){ |
|
77 | + public function getAction($index) { |
|
78 | 78 | return $this->content["actions"]->getContent()[$index]; |
79 | 79 | } |
80 | 80 | |
81 | - public function addContent($content,$before=false){ |
|
82 | - $this->content["content"]->addContent($content,$before); |
|
81 | + public function addContent($content, $before=false) { |
|
82 | + $this->content["content"]->addContent($content, $before); |
|
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function addImageContent($image,$description=NULL){ |
|
86 | + public function addImageContent($image, $description=NULL) { |
|
87 | 87 | $content=$this->content["content"]; |
88 | - if(isset($description)){ |
|
89 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
90 | - $content->addContent($description,true); |
|
88 | + if (isset($description)) { |
|
89 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
90 | + $content->addContent($description, true); |
|
91 | 91 | } |
92 | - if($image!==""){ |
|
93 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
94 | - $content->addContent($img,true); |
|
95 | - $content->addToProperty("class","image"); |
|
92 | + if ($image!=="") { |
|
93 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
94 | + $content->addContent($img, true); |
|
95 | + $content->addToProperty("class", "image"); |
|
96 | 96 | } |
97 | 97 | return $this; |
98 | 98 | } |
99 | 99 | |
100 | - public function addIconContent($icon,$description=NULL){ |
|
100 | + public function addIconContent($icon, $description=NULL) { |
|
101 | 101 | $content=$this->content["content"]; |
102 | - if(isset($description)){ |
|
103 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
104 | - $content->addContent($description,true); |
|
102 | + if (isset($description)) { |
|
103 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
104 | + $content->addContent($description, true); |
|
105 | 105 | } |
106 | - if($icon!==""){ |
|
107 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
108 | - $content->addContent($img,true); |
|
109 | - $content->addToProperty("class","image"); |
|
106 | + if ($icon!=="") { |
|
107 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
108 | + $content->addContent($img, true); |
|
109 | + $content->addToProperty("class", "image"); |
|
110 | 110 | } |
111 | 111 | return $this; |
112 | 112 | } |
113 | 113 | |
114 | - private function addElementInPart($element,$part) { |
|
114 | + private function addElementInPart($element, $part) { |
|
115 | 115 | $this->content[$part]->addContent($element); |
116 | 116 | return $element; |
117 | 117 | } |
118 | 118 | |
119 | - public function showDimmer($value){ |
|
120 | - $value=$value?"show":"hide"; |
|
119 | + public function showDimmer($value) { |
|
120 | + $value=$value ? "show" : "hide"; |
|
121 | 121 | $this->_paramParts[]=["'".$value." dimmer'"]; |
122 | 122 | return $this; |
123 | 123 | } |
124 | 124 | |
125 | - public function setInverted($recursive=true){ |
|
125 | + public function setInverted($recursive=true) { |
|
126 | 126 | $this->_params["inverted"]=true; |
127 | 127 | return $this; |
128 | 128 | } |
129 | 129 | |
130 | - public function setBasic(){ |
|
130 | + public function setBasic() { |
|
131 | 131 | return $this->addToProperty("class", "basic"); |
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | - public function setTransition($value){ |
|
136 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
135 | + public function setTransition($value) { |
|
136 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @param string $viewName |
144 | 144 | * @param $params The parameters to pass to the view |
145 | 145 | */ |
146 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
147 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
146 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
147 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @param string $actionName the action name |
156 | 156 | * @param array $params |
157 | 157 | */ |
158 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
159 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
158 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
159 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
167 | 167 | */ |
168 | 168 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
169 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
169 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
170 | 170 | return parent::compile($js, $view); |
171 | 171 | } |
172 | 172 | /* |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @see BaseHtml::run() |
175 | 175 | */ |
176 | 176 | public function run(JsUtils $js) { |
177 | - if(isset($this->_bsComponent)===false) |
|
178 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
177 | + if (isset($this->_bsComponent)===false) |
|
178 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
179 | 179 | $this->addEventsOnRun($js); |
180 | 180 | return $this->_bsComponent; |
181 | 181 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return $this->jsDo("hide"); |
189 | 189 | } |
190 | 190 | |
191 | - public function onHidden($js){ |
|
191 | + public function onHidden($js) { |
|
192 | 192 | $this->_params["onHidden"]=$js; |
193 | 193 | } |
194 | 194 | } |