@@ -11,22 +11,22 @@ |
||
11 | 11 | */ |
12 | 12 | class HtmlIconGroups extends HtmlSemDoubleElement { |
13 | 13 | |
14 | - public function __construct($identifier,$size="") { |
|
14 | + public function __construct($identifier, $size="") { |
|
15 | 15 | parent::__construct($identifier, "i"); |
16 | 16 | $this->setProperty("class", "icons"); |
17 | 17 | $this->setSize($size); |
18 | 18 | } |
19 | 19 | |
20 | - public function add($icon,$size=""){ |
|
20 | + public function add($icon, $size="") { |
|
21 | 21 | $iconO=$icon; |
22 | - if(\is_string($icon)){ |
|
22 | + if (\is_string($icon)) { |
|
23 | 23 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
24 | 24 | $iconO->setSize($size); |
25 | 25 | } |
26 | 26 | $this->addContent($iconO); |
27 | 27 | } |
28 | 28 | |
29 | - public function getIcon($index){ |
|
29 | + public function getIcon($index) { |
|
30 | 30 | return $this->content[$index]; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | * @return \Ajax\semantic\html\HtmlButton default : "" |
48 | 48 | */ |
49 | 49 | public function setStyle($cssStyle) { |
50 | - return $this->addToProperty("class",$cssStyle); |
|
50 | + return $this->addToProperty("class", $cssStyle); |
|
51 | 51 | } |
52 | 52 | |
53 | - public function setFocusable(){ |
|
53 | + public function setFocusable() { |
|
54 | 54 | $this->setProperty("tabindex", "0"); |
55 | 55 | } |
56 | 56 | |
57 | - public function setAnimated($content,$animation=""){ |
|
57 | + public function setAnimated($content, $animation="") { |
|
58 | 58 | $this->setTagName("div"); |
59 | 59 | $this->addToProperty("class", "animated ".$animation); |
60 | - $visible=new HtmlSemDoubleElement("visible-".$this->identifier,"div"); |
|
60 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
61 | 61 | $visible->setClass("visible content"); |
62 | 62 | $visible->setContent($this->content); |
63 | - $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier,"div"); |
|
63 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
64 | 64 | $hidden->setClass("hidden content"); |
65 | 65 | $hidden->setContent($content); |
66 | 66 | $this->content=$visible.$hidden; |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @param string|HtmlIcon $icon |
71 | 71 | * @return \Ajax\semantic\html\elements\HtmlButton |
72 | 72 | */ |
73 | - public function asIcon($icon){ |
|
73 | + public function asIcon($icon) { |
|
74 | 74 | $iconO=$icon; |
75 | - if(\is_string($icon)){ |
|
75 | + if (\is_string($icon)) { |
|
76 | 76 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
77 | 77 | } |
78 | 78 | $this->addToProperty("class", "icon"); |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * @param string $before |
87 | 87 | * @return \Ajax\semantic\html\elements\HtmlLabel |
88 | 88 | */ |
89 | - public function addLabel($caption,$before=false){ |
|
89 | + public function addLabel($caption, $before=false) { |
|
90 | 90 | $this->tagName="div"; |
91 | 91 | $this->addToProperty("class", "labeled"); |
92 | - $this->content=new HtmlButton("button-".$this->identifier,$this->content); |
|
92 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
93 | 93 | $this->content->setTagName("div"); |
94 | - $label=new HtmlLabel("label-".$this->identifier,$caption,"a"); |
|
94 | + $label=new HtmlLabel("label-".$this->identifier, $caption, "a"); |
|
95 | 95 | $label->setBasic(); |
96 | - $this->addContent($label,$before); |
|
96 | + $this->addContent($label, $before); |
|
97 | 97 | return $label; |
98 | 98 | } |
99 | 99 | /* |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function fromArray($array) { |
104 | 104 | $array=parent::fromArray($array); |
105 | - foreach ( $array as $key => $value ) { |
|
105 | + foreach ($array as $key => $value) { |
|
106 | 106 | $this->setProperty($key, $value); |
107 | 107 | } |
108 | 108 | return $array; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * can be formatted to appear on dark backgrounds |
113 | 113 | * @return \Ajax\semantic\html\elements\HtmlButton |
114 | 114 | */ |
115 | - public function setInverted(){ |
|
115 | + public function setInverted() { |
|
116 | 116 | return $this->addToProperty("class", "inverted"); |
117 | 117 | } |
118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * show it is currently the active user selection |
121 | 121 | * @return \Ajax\semantic\html\elements\HtmlButton |
122 | 122 | */ |
123 | - public function setActive(){ |
|
123 | + public function setActive() { |
|
124 | 124 | return $this->addToProperty("class", "active"); |
125 | 125 | } |
126 | 126 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * show a loading indicator |
129 | 129 | * @return \Ajax\semantic\html\elements\HtmlButton |
130 | 130 | */ |
131 | - public function asLoader(){ |
|
131 | + public function asLoader() { |
|
132 | 132 | return $this->addToProperty("class", "loading"); |
133 | 133 | } |
134 | 134 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * hint towards a positive consequence |
137 | 137 | * @return \Ajax\semantic\html\elements\HtmlButton |
138 | 138 | */ |
139 | - public function setPositive(){ |
|
139 | + public function setPositive() { |
|
140 | 140 | return $this->addToProperty("class", "positive"); |
141 | 141 | } |
142 | 142 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * hint towards a negative consequence |
145 | 145 | * @return \Ajax\semantic\html\elements\HtmlButton |
146 | 146 | */ |
147 | - public function setNegative(){ |
|
147 | + public function setNegative() { |
|
148 | 148 | return $this->addToProperty("class", "negative"); |
149 | 149 | } |
150 | 150 | |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | * formatted to toggle on/off |
153 | 153 | * @return \Ajax\semantic\html\elements\HtmlButton |
154 | 154 | */ |
155 | - public function setToggle(){ |
|
155 | + public function setToggle() { |
|
156 | 156 | return $this->addToProperty("class", "toggle"); |
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | 160 | * @return \Ajax\semantic\html\elements\HtmlButton |
161 | 161 | */ |
162 | - public function setCircular(){ |
|
162 | + public function setCircular() { |
|
163 | 163 | return $this->addToProperty("class", "circular"); |
164 | 164 | } |
165 | 165 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * button is less pronounced |
168 | 168 | * @return \Ajax\semantic\html\elements\HtmlButton |
169 | 169 | */ |
170 | - public function setBasic(){ |
|
170 | + public function setBasic() { |
|
171 | 171 | return $this->addToProperty("class", "basic"); |
172 | 172 | } |
173 | 173 | } |
174 | 174 | \ No newline at end of file |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * {@inheritDoc} |
21 | 21 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
22 | 22 | */ |
23 | - public function setSize($size){ |
|
23 | + public function setSize($size) { |
|
24 | 24 | return $this->addToPropertyCtrl("class", $size, Size::getConstants()); |
25 | 25 | } |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * show it is currently unable to be interacted with |
29 | 29 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
30 | 30 | */ |
31 | - public function setDisabled(){ |
|
31 | + public function setDisabled() { |
|
32 | 32 | return $this->addToProperty("class", "disabled"); |
33 | 33 | } |
34 | 34 | |
@@ -36,28 +36,28 @@ discard block |
||
36 | 36 | * @param string $color |
37 | 37 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
38 | 38 | */ |
39 | - public function setColor($color){ |
|
40 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
39 | + public function setColor($color) { |
|
40 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
|
44 | - if(isset($this->_popup)) |
|
45 | - $this->_popup->setAttributes($variation,$popupEvent); |
|
43 | + public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
|
44 | + if (isset($this->_popup)) |
|
45 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
|
49 | - $this->_popup=new InternalPopup($this,$title,$content,$variation,$params); |
|
48 | + public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
|
49 | + $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); |
|
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function addPopupHtml($html="",$variation=NULL,$params=array()){ |
|
53 | + public function addPopupHtml($html="", $variation=NULL, $params=array()) { |
|
54 | 54 | $this->_popup=new InternalPopup($this); |
55 | 55 | $this->_popup->setHtml($html); |
56 | - $this->_popup->setAttributes($variation,$params); |
|
56 | + $this->_popup->setAttributes($variation, $params); |
|
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | |
60 | - public function setFluid(){ |
|
60 | + public function setFluid() { |
|
61 | 61 | $this->addToProperty("class", "fluid"); |
62 | 62 | } |
63 | 63 | |
@@ -68,27 +68,27 @@ discard block |
||
68 | 68 | * @param boolean $labeled |
69 | 69 | * @return \Ajax\semantic\html\elements\HtmlIcon |
70 | 70 | */ |
71 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
71 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
72 | 72 | $iconO=$icon; |
73 | - if(\is_string($icon)){ |
|
73 | + if (\is_string($icon)) { |
|
74 | 74 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
75 | 75 | } |
76 | - if($labeled!==false){ |
|
76 | + if ($labeled!==false) { |
|
77 | 77 | $this->addToProperty("class", "labeled icon"); |
78 | 78 | $this->tagName="div"; |
79 | 79 | } |
80 | - $this->addContent($iconO,$before); |
|
80 | + $this->addContent($iconO, $before); |
|
81 | 81 | return $iconO; |
82 | 82 | } |
83 | 83 | |
84 | - public function compile(JsUtils $js=NULL, View $view=NULL){ |
|
85 | - if(isset($this->_popup)) |
|
84 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
85 | + if (isset($this->_popup)) |
|
86 | 86 | $this->_popup->compile(); |
87 | - return parent::compile($js,$view); |
|
87 | + return parent::compile($js, $view); |
|
88 | 88 | } |
89 | - public function run(JsUtils $js){ |
|
89 | + public function run(JsUtils $js) { |
|
90 | 90 | parent::run($js); |
91 | - if(isset($this->_popup)){ |
|
91 | + if (isset($this->_popup)) { |
|
92 | 92 | $this->_popup->run($js); |
93 | 93 | //$this->addEventsOnRun($js); |
94 | 94 | //return $this->_bsComponent; |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | protected $variation; |
12 | 12 | protected $params; |
13 | 13 | protected $semElement; |
14 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
14 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
15 | 15 | $this->semElement=$semElement; |
16 | 16 | $this->title=$title; |
17 | 17 | $this->content=$content; |
18 | - $this->setAttributes($variation,$params); |
|
18 | + $this->setAttributes($variation, $params); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setHtml($html) { |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | - public function setAttributes($variation=NULL,$params=array()){ |
|
26 | + public function setAttributes($variation=NULL, $params=array()) { |
|
27 | 27 | $this->variation=$variation; |
28 | 28 | $this->params=$params; |
29 | 29 | } |
30 | 30 | |
31 | - public function onShow($jsCode){ |
|
31 | + public function onShow($jsCode) { |
|
32 | 32 | $this->params["onShow"]=$jsCode; |
33 | 33 | } |
34 | 34 | |
35 | - public function compile(){ |
|
36 | - if(JString::isNotNull($this->title)){ |
|
35 | + public function compile() { |
|
36 | + if (JString::isNotNull($this->title)) { |
|
37 | 37 | $this->semElement->addToProperty("data-title", $this->title); |
38 | 38 | } |
39 | - if(JString::isNotNull($this->content)){ |
|
39 | + if (JString::isNotNull($this->content)) { |
|
40 | 40 | $this->semElement->addToProperty("data-content", $this->content); |
41 | 41 | } |
42 | - if(JString::isNotNull($this->html)){ |
|
42 | + if (JString::isNotNull($this->html)) { |
|
43 | 43 | $this->semElement->addToProperty("data-html", $this->html); |
44 | 44 | } |
45 | - if(JString::isNotNull($this->variation)){ |
|
45 | + if (JString::isNotNull($this->variation)) { |
|
46 | 46 | $this->semElement->addToProperty("data-variation", $this->variation); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - public function run(JsUtils $js){ |
|
51 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
50 | + public function run(JsUtils $js) { |
|
51 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
30 | 30 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
31 | 31 | } |
32 | 32 | |
33 | - public function setExclusive($value){ |
|
33 | + public function setExclusive($value) { |
|
34 | 34 | return $this->setParam("exclusive", $value); |
35 | 35 | } |
36 | 36 | //TODO other events implementation |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
18 | 18 | * @return \Ajax\semantic\components\Dropdown |
19 | 19 | */ |
20 | - public function setAction($action){ |
|
21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
20 | + public function setAction($action) { |
|
21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -10,30 +10,30 @@ discard block |
||
10 | 10 | |
11 | 11 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
12 | 12 | |
13 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
|
13 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL) { |
|
14 | 14 | parent::__construct($identifier, "div"); |
15 | 15 | $this->setClass("item"); |
16 | 16 | $this->setContent($content); |
17 | - if($value!==NULL) |
|
17 | + if ($value!==NULL) |
|
18 | 18 | $this->setData($value); |
19 | - if($image!==NULL) |
|
19 | + if ($image!==NULL) |
|
20 | 20 | $this->asMiniAvatar($image); |
21 | 21 | } |
22 | 22 | |
23 | - public function setDescription($description){ |
|
24 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
23 | + public function setDescription($description) { |
|
24 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
25 | 25 | $descO->setClass("description"); |
26 | 26 | $descO->setContent($description); |
27 | - return $this->addContent($descO,true); |
|
27 | + return $this->addContent($descO, true); |
|
28 | 28 | } |
29 | 29 | |
30 | - public function setData($value){ |
|
30 | + public function setData($value) { |
|
31 | 31 | $this->setProperty("data-value", $value); |
32 | 32 | } |
33 | 33 | |
34 | - public function asOption(){ |
|
34 | + public function asOption() { |
|
35 | 35 | $this->tagName="option"; |
36 | - if($this->getProperty("data-value")!==null) |
|
36 | + if ($this->getProperty("data-value")!==null) |
|
37 | 37 | $this->setProperty("value", $this->getProperty("data-value")); |
38 | 38 | } |
39 | 39 | |
@@ -41,58 +41,58 @@ discard block |
||
41 | 41 | * @param string $image the image src |
42 | 42 | * @return \Ajax\common\html\html5\HtmlImg |
43 | 43 | */ |
44 | - public function asMiniAvatar($image){ |
|
44 | + public function asMiniAvatar($image) { |
|
45 | 45 | $this->tagName="div"; |
46 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
46 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
47 | 47 | $img->setClass("ui mini avatar image"); |
48 | - $this->addContent($img,true); |
|
48 | + $this->addContent($img, true); |
|
49 | 49 | return $img; |
50 | 50 | } |
51 | 51 | |
52 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
52 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
53 | 53 | $this->setClass("ui icon search input"); |
54 | 54 | $input=new HtmlInput("search-".$this->identifier); |
55 | - if(isset($placeholder)) |
|
55 | + if (isset($placeholder)) |
|
56 | 56 | $input->setProperty("placeholder", $placeholder); |
57 | 57 | $this->content=$input; |
58 | - if(isset($icon)) |
|
58 | + if (isset($icon)) |
|
59 | 59 | $this->addIcon($icon); |
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setContent($content){ |
|
64 | - if($content==="-"){ |
|
63 | + public function setContent($content) { |
|
64 | + if ($content==="-") { |
|
65 | 65 | $this->asDivider(); |
66 | - }elseif($content==="-search-"){ |
|
67 | - $values=\explode(",",$content,-1); |
|
68 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
66 | + }elseif ($content==="-search-") { |
|
67 | + $values=\explode(",", $content, -1); |
|
68 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
69 | 69 | }else |
70 | 70 | parent::setContent($content); |
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function asDivider(){ |
|
74 | + public function asDivider() { |
|
75 | 75 | $this->content=NULL; |
76 | 76 | $this->setClass("divider"); |
77 | 77 | } |
78 | 78 | |
79 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
79 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
80 | 80 | $this->setClass("header"); |
81 | 81 | $this->content=$caption; |
82 | - if(isset($icon)) |
|
83 | - $this->addIcon($icon,true); |
|
82 | + if (isset($icon)) |
|
83 | + $this->addIcon($icon, true); |
|
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
88 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
87 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
88 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
89 | 89 | } |
90 | 90 | |
91 | - public static function divider($placeholder=NULL,$icon=NULL){ |
|
91 | + public static function divider($placeholder=NULL, $icon=NULL) { |
|
92 | 92 | return (new HtmlDropdownItem(""))->asDivider(); |
93 | 93 | } |
94 | 94 | |
95 | - public static function header($caption=NULL,$icon=NULL){ |
|
96 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
95 | + public static function header($caption=NULL, $icon=NULL) { |
|
96 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | class HtmlDropdown extends HtmlSemDoubleElement { |
14 | 14 | protected $mClass="menu"; |
15 | 15 | protected $mTagName="div"; |
16 | - protected $items=array (); |
|
16 | + protected $items=array(); |
|
17 | 17 | protected $params=array("action"=>"select"); |
18 | 18 | protected $input; |
19 | 19 | |
@@ -21,40 +21,40 @@ discard block |
||
21 | 21 | parent::__construct($identifier, "div"); |
22 | 22 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
23 | 23 | $this->setProperty("class", "ui dropdown"); |
24 | - $content=new HtmlSemDoubleElement("","div"); |
|
24 | + $content=new HtmlSemDoubleElement("", "div"); |
|
25 | 25 | $content->setClass("text"); |
26 | 26 | $content->setContent($value); |
27 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
27 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
28 | 28 | $this->content=array($content); |
29 | 29 | $this->tagName="div"; |
30 | 30 | $this->addItems($items); |
31 | 31 | } |
32 | 32 | |
33 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
33 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
34 | 34 | $itemO=$item; |
35 | - if(\is_object($item)===false){ |
|
36 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
35 | + if (\is_object($item)===false) { |
|
36 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
37 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
38 | 38 | $this->addToProperty("class", "vertical"); |
39 | 39 | } |
40 | 40 | $this->items[]=$itemO; |
41 | 41 | return $itemO; |
42 | 42 | } |
43 | 43 | |
44 | - public function addInput($name){ |
|
45 | - if(!isset($name)) |
|
44 | + public function addInput($name) { |
|
45 | + if (!isset($name)) |
|
46 | 46 | $name="input-".$this->identifier; |
47 | 47 | $this->setAction("activate"); |
48 | - $this->input=new HtmlInput($name,"hidden"); |
|
48 | + $this->input=new HtmlInput($name, "hidden"); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function addItems($items){ |
|
52 | - if(JArray::isAssociative($items)){ |
|
53 | - foreach ($items as $k=>$v){ |
|
51 | + public function addItems($items) { |
|
52 | + if (JArray::isAssociative($items)) { |
|
53 | + foreach ($items as $k=>$v) { |
|
54 | 54 | $this->addItem($v)->setData($k); |
55 | 55 | } |
56 | - }else{ |
|
57 | - foreach ($items as $item){ |
|
56 | + }else { |
|
57 | + foreach ($items as $item) { |
|
58 | 58 | $this->addItem($item); |
59 | 59 | } |
60 | 60 | } |
@@ -63,51 +63,51 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @param boolean $dropdown |
65 | 65 | */ |
66 | - public function asDropdown($dropdown){ |
|
67 | - if($dropdown===false){ |
|
66 | + public function asDropdown($dropdown) { |
|
67 | + if ($dropdown===false) { |
|
68 | 68 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
69 | 69 | $dropdown="menu"; |
70 | - }else{ |
|
70 | + }else { |
|
71 | 71 | $dropdown="dropdown"; |
72 | 72 | $this->mClass="menu"; |
73 | 73 | } |
74 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
74 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
75 | 75 | } |
76 | 76 | |
77 | - public function setVertical(){ |
|
78 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
77 | + public function setVertical() { |
|
78 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
79 | 79 | } |
80 | 80 | |
81 | - public function setSimple(){ |
|
82 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
81 | + public function setSimple() { |
|
82 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
83 | 83 | } |
84 | 84 | |
85 | - public function asButton($floating=false){ |
|
86 | - if($floating) |
|
85 | + public function asButton($floating=false) { |
|
86 | + if ($floating) |
|
87 | 87 | $this->addToProperty("class", "floating"); |
88 | 88 | return $this->addToProperty("class", "button"); |
89 | 89 | } |
90 | 90 | |
91 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
92 | - if(isset($name)) |
|
91 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
92 | + if (isset($name)) |
|
93 | 93 | $this->addInput($name); |
94 | - if($multiple) |
|
94 | + if ($multiple) |
|
95 | 95 | $this->addToProperty("class", "multiple"); |
96 | 96 | if ($selection) |
97 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
97 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
98 | 98 | return $this; |
99 | 99 | } |
100 | 100 | |
101 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
102 | - $this->asSelect($name,$multiple,$selection); |
|
101 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
102 | + $this->asSelect($name, $multiple, $selection); |
|
103 | 103 | return $this->addToProperty("class", "search"); |
104 | 104 | } |
105 | 105 | |
106 | - public function setSelect($name=NULL,$multiple=false){ |
|
107 | - if(!isset($name)) |
|
106 | + public function setSelect($name=NULL, $multiple=false) { |
|
107 | + if (!isset($name)) |
|
108 | 108 | $name="select-".$this->identifier; |
109 | 109 | $this->input=null; |
110 | - if($multiple){ |
|
110 | + if ($multiple) { |
|
111 | 111 | $this->setProperty("multiple", true); |
112 | 112 | $this->addToProperty("class", "multiple"); |
113 | 113 | } |
@@ -115,31 +115,31 @@ discard block |
||
115 | 115 | $this->tagName="select"; |
116 | 116 | $this->setProperty("name", $name); |
117 | 117 | $this->content=null; |
118 | - foreach ($this->items as $item){ |
|
118 | + foreach ($this->items as $item) { |
|
119 | 119 | $item->asOption(); |
120 | 120 | } |
121 | 121 | return $this; |
122 | 122 | } |
123 | 123 | |
124 | - public function asSubmenu($pointing=false,$sens=""){ |
|
124 | + public function asSubmenu($pointing=false, $sens="") { |
|
125 | 125 | $this->setClass("ui dropdown link item"); |
126 | - if($pointing===true){ |
|
126 | + if ($pointing===true) { |
|
127 | 127 | $this->setPointing($sens); |
128 | 128 | } |
129 | 129 | return $this; |
130 | 130 | } |
131 | 131 | |
132 | - public function setPointing($sens=""){ |
|
132 | + public function setPointing($sens="") { |
|
133 | 133 | $this->addToProperty("class", "pointing"); |
134 | - if(JString::isNotNull($sens)) |
|
135 | - $this->addToPropertyCtrl("class", $sens, array("left","right")); |
|
134 | + if (JString::isNotNull($sens)) |
|
135 | + $this->addToPropertyCtrl("class", $sens, array("left", "right")); |
|
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
139 | - public function setValue($value){ |
|
140 | - if(isset($this->input)){ |
|
139 | + public function setValue($value) { |
|
140 | + if (isset($this->input)) { |
|
141 | 141 | $this->input->setProperty("value", $value); |
142 | - }else{ |
|
142 | + }else { |
|
143 | 143 | $this->setProperty("value", $value); |
144 | 144 | } |
145 | 145 | return $this; |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | * @see BaseHtml::run() |
151 | 151 | */ |
152 | 152 | public function run(JsUtils $js) { |
153 | - if($this->propertyContains("class", "simple")===false){ |
|
154 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
153 | + if ($this->propertyContains("class", "simple")===false) { |
|
154 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->params); |
|
155 | 155 | $this->addEventsOnRun($js); |
156 | 156 | return $this->_bsComponent; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - public function setAction($action){ |
|
160 | + public function setAction($action) { |
|
161 | 161 | $this->params["action"]=$action; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | \ No newline at end of file |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | abstract class BaseHtml extends BaseWidget { |
17 | 17 | protected $_template; |
18 | 18 | protected $tagName; |
19 | - protected $properties=array (); |
|
20 | - protected $events=array (); |
|
19 | + protected $properties=array(); |
|
20 | + protected $events=array(); |
|
21 | 21 | protected $wrapBefore=""; |
22 | 22 | protected $wrapAfter=""; |
23 | 23 | protected $_bsComponent; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
58 | 58 | $v=@$this->properties[$name]; |
59 | - if (isset($v)&&$v!=="") |
|
59 | + if (isset($v) && $v!=="") |
|
60 | 60 | $v=$v.$separator.$value; |
61 | 61 | else |
62 | 62 | $v=$value; |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | |
72 | 72 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
73 | 73 | $result=$this->getTemplate(); |
74 | - foreach ( $this as $key => $value ) { |
|
75 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
74 | + foreach ($this as $key => $value) { |
|
75 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
76 | 76 | if (is_array($value)) { |
77 | 77 | $v=PropertyWrapper::wrap($value, $js); |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $v=$value; |
80 | 80 | } |
81 | 81 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if (isset($view)===true) { |
88 | 88 | $controls=$view->getVar("q"); |
89 | 89 | if (isset($controls)===false) { |
90 | - $controls=array (); |
|
90 | + $controls=array(); |
|
91 | 91 | } |
92 | 92 | $controls [$this->identifier]=$result; |
93 | 93 | $view->setVar("q", $controls); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if (array_search($value, $typeCtrl)===false) { |
101 | 101 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
102 | 102 | } |
103 | - } else { |
|
103 | + }else { |
|
104 | 104 | if (!$typeCtrl($value)) { |
105 | 105 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
106 | 106 | } |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | |
111 | - protected function propertyContains($propertyName,$value){ |
|
111 | + protected function propertyContains($propertyName, $value) { |
|
112 | 112 | $values=$this->getProperty($propertyName); |
113 | - if(isset($values)){ |
|
113 | + if (isset($values)) { |
|
114 | 114 | return JString::contains($values, $value); |
115 | 115 | } |
116 | 116 | return false; |
@@ -185,28 +185,28 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | public function fromArray($array) { |
188 | - foreach ( $this as $key => $value ) { |
|
188 | + foreach ($this as $key => $value) { |
|
189 | 189 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
190 | 190 | $setter="set".ucfirst($key); |
191 | 191 | $this->$setter($array [$key]); |
192 | 192 | unset($array [$key]); |
193 | 193 | } |
194 | 194 | } |
195 | - foreach ( $array as $key => $value ) { |
|
195 | + foreach ($array as $key => $value) { |
|
196 | 196 | if (method_exists($this, $key)) { |
197 | 197 | try { |
198 | 198 | $this->$key($value); |
199 | 199 | unset($array [$key]); |
200 | - } catch ( \Exception $e ) { |
|
200 | + } catch (\Exception $e) { |
|
201 | 201 | // Nothing to do |
202 | 202 | } |
203 | - } else { |
|
203 | + }else { |
|
204 | 204 | $setter="set".ucfirst($key); |
205 | 205 | if (method_exists($this, $setter)) { |
206 | 206 | try { |
207 | 207 | $this->$setter($value); |
208 | 208 | unset($array [$key]); |
209 | - } catch ( \Exception $e ) { |
|
209 | + } catch (\Exception $e) { |
|
210 | 210 | // Nothing to do |
211 | 211 | } |
212 | 212 | } |
@@ -215,21 +215,21 @@ discard block |
||
215 | 215 | return $array; |
216 | 216 | } |
217 | 217 | |
218 | - public function fromDatabaseObjects($objects,$function) { |
|
219 | - if(isset($objects)){ |
|
220 | - foreach ($objects as $object){ |
|
221 | - $this->fromDatabaseObject($object,$function); |
|
218 | + public function fromDatabaseObjects($objects, $function) { |
|
219 | + if (isset($objects)) { |
|
220 | + foreach ($objects as $object) { |
|
221 | + $this->fromDatabaseObject($object, $function); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | return $this; |
225 | 225 | } |
226 | 226 | |
227 | - public function fromDatabaseObject($object,$function){ |
|
227 | + public function fromDatabaseObject($object, $function) { |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | |
231 | 231 | public function wrap($before, $after="") { |
232 | - if(isset($before)){ |
|
232 | + if (isset($before)) { |
|
233 | 233 | $this->wrapBefore.=$before; |
234 | 234 | } |
235 | 235 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -251,13 +251,13 @@ discard block |
||
251 | 251 | if (array_key_exists($event, $this->events)) { |
252 | 252 | if (is_array($this->events [$event])) { |
253 | 253 | $this->events [$event] []=$jsCode; |
254 | - } else { |
|
255 | - $this->events [$event]=array ( |
|
254 | + }else { |
|
255 | + $this->events [$event]=array( |
|
256 | 256 | $this->events [$event], |
257 | 257 | $jsCode |
258 | 258 | ); |
259 | 259 | } |
260 | - } else { |
|
260 | + }else { |
|
261 | 261 | $this->events [$event]=$jsCode; |
262 | 262 | } |
263 | 263 | } |
@@ -276,14 +276,14 @@ discard block |
||
276 | 276 | |
277 | 277 | public function addEventsOnRun(JsUtils $js) { |
278 | 278 | if (isset($this->_bsComponent)) { |
279 | - foreach ( $this->events as $event => $jsCode ) { |
|
279 | + foreach ($this->events as $event => $jsCode) { |
|
280 | 280 | $code=$jsCode; |
281 | 281 | if (is_array($jsCode)) { |
282 | 282 | $code=""; |
283 | - foreach ( $jsCode as $jsC ) { |
|
283 | + foreach ($jsCode as $jsC) { |
|
284 | 284 | if ($jsC instanceof AjaxCall) { |
285 | 285 | $code.="\n".$jsC->compile($js); |
286 | - } else { |
|
286 | + }else { |
|
287 | 287 | $code.="\n".$jsC; |
288 | 288 | } |
289 | 289 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
300 | - $params=array ( |
|
300 | + $params=array( |
|
301 | 301 | "url" => $url, |
302 | 302 | "responseElement" => $responseElement |
303 | 303 | ); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | if (is_array($elements)) { |
337 | 337 | $flag=false; |
338 | 338 | $index=0; |
339 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
339 | + while (!$flag && $index<sizeof($elements)) { |
|
340 | 340 | if ($elements [$index] instanceof BaseHtml) |
341 | 341 | $flag=($elements [$index]->getIdentifier()===$identifier); |
342 | 342 | $index++; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | return null; |
351 | 351 | } |
352 | 352 | |
353 | - public function __toString(){ |
|
353 | + public function __toString() { |
|
354 | 354 | return $this->compile(); |
355 | 355 | } |
356 | 356 | |
@@ -366,25 +366,25 @@ discard block |
||
366 | 366 | if (is_array($value)) { |
367 | 367 | $value=implode(",", $value); |
368 | 368 | } |
369 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
369 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
370 | 370 | $value='"'.$value.'"'; |
371 | 371 | } |
372 | 372 | return $value; |
373 | 373 | } |
374 | 374 | |
375 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
375 | + public function jsDoJquery($jqueryCall, $param="") { |
|
376 | 376 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
377 | 377 | } |
378 | 378 | |
379 | - public function jsHtml($content=""){ |
|
380 | - return $this->jsDoJquery("html",$content); |
|
379 | + public function jsHtml($content="") { |
|
380 | + return $this->jsDoJquery("html", $content); |
|
381 | 381 | } |
382 | 382 | |
383 | - public function jsShow(){ |
|
383 | + public function jsShow() { |
|
384 | 384 | return $this->jsDoJquery("show"); |
385 | 385 | } |
386 | 386 | |
387 | - public function jsHide(){ |
|
387 | + public function jsHide() { |
|
388 | 388 | return $this->jsDoJquery("hide"); |
389 | 389 | } |
390 | 390 | } |
391 | 391 | \ No newline at end of file |