@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
39 | 39 | } |
40 | 40 | |
41 | - public function getField(){ |
|
41 | + public function getField() { |
|
42 | 42 | //TODO check getField() ? |
43 | 43 | return $this->content["field"]; |
44 | 44 | } |
45 | 45 | |
46 | - public function getHtmlCk(){ |
|
46 | + public function getHtmlCk() { |
|
47 | 47 | return $this->content["field"]; |
48 | 48 | } |
49 | 49 | |
50 | - public function getDataField(){ |
|
51 | - $field= $this->getField(); |
|
52 | - if($field instanceof AbstractCheckbox) |
|
50 | + public function getDataField() { |
|
51 | + $field=$this->getField(); |
|
52 | + if ($field instanceof AbstractCheckbox) |
|
53 | 53 | $field=$field->getField(); |
54 | 54 | return $field; |
55 | 55 | } |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @param boolean $value |
60 | 60 | * @return HtmlFormField |
61 | 61 | */ |
62 | - public function setChecked($value=true){ |
|
63 | - if($value===true){ |
|
62 | + public function setChecked($value=true) { |
|
63 | + if ($value===true) { |
|
64 | 64 | $this->getDataField()->setProperty("checked", "checked"); |
65 | - }else{ |
|
65 | + } else { |
|
66 | 66 | $this->getDataField()->removeProperty("checked"); |
67 | 67 | } |
68 | 68 | return $this; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->startIndex=$startIndex; |
53 | 53 | $this->autoActive=$autoActive; |
54 | 54 | $this->_contentSeparator="<div class='divider'> / </div>"; |
55 | - $this->_hrefFunction=function ($e) { |
|
55 | + $this->_hrefFunction=function($e) { |
|
56 | 56 | return $e->getContent(); |
57 | 57 | }; |
58 | 58 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setActive($index=null) { |
85 | 85 | if (!isset($index)) { |
86 | - $index=sizeof($this->content) - 1; |
|
86 | + $index=sizeof($this->content)-1; |
|
87 | 87 | } |
88 | 88 | $activeItem=$this->content[$index]; |
89 | 89 | $activeItem->addToProperty("class", "active"); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param Dispatcher $dispatcher the request dispatcher |
97 | 97 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
98 | 98 | */ |
99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
100 | 100 | return $this->addItems($js->fromDispatcher($dispatcher)); |
101 | 101 | } |
102 | 102 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | if (!isset($index)) { |
111 | 111 | $index=sizeof($this->content); |
112 | 112 | } |
113 | - if ($this->absolutePaths === true) { |
|
113 | + if ($this->absolutePaths===true) { |
|
114 | 114 | return $this->_hrefFunction($this->content[$index]); |
115 | 115 | } else { |
116 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
116 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
117 | 117 | return $this->_hrefFunction($e); |
118 | - }, $this->content), $this->startIndex, $index + 1)); |
|
118 | + }, $this->content), $this->startIndex, $index+1)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $this->setActive(); |
150 | 150 | } |
151 | 151 | $count=$this->count(); |
152 | - for($i=1; $i < $count; $i++) { |
|
153 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
152 | + for ($i=1; $i<$count; $i++) { |
|
153 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
154 | 154 | } |
155 | 155 | return parent::compile($js, $view); |
156 | 156 | } |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
161 | 161 | */ |
162 | 162 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
163 | - foreach ( $this->content as $element ) { |
|
163 | + foreach ($this->content as $element) { |
|
164 | 164 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
165 | 165 | } |
166 | 166 | return $this; |
167 | 167 | } |
168 | 168 | |
169 | 169 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
170 | - foreach ( $this->content as $element ) { |
|
171 | - if ($element->getProperty($this->attr) != NULL){ |
|
170 | + foreach ($this->content as $element) { |
|
171 | + if ($element->getProperty($this->attr)!=NULL) { |
|
172 | 172 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
173 | 173 | } |
174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function createItem($value) { |
185 | 185 | $count=$this->count(); |
186 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
186 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
187 | 187 | if (\is_array($value)) |
188 | 188 | $itemO->fromArray($value); |
189 | 189 | else { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function addIconAt($icon, $index) { |
196 | 196 | $item=$this->getItem($index); |
197 | 197 | if (isset($item)) { |
198 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
198 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
199 | 199 | $item->wrapContent($icon); |
200 | 200 | } |
201 | 201 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | public function addItem($item) { |
204 | 204 | $count=$this->count(); |
205 | 205 | $itemO=parent::addItem($item); |
206 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
206 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
207 | 207 | $itemO->setProperty($this->attr, $this->getHref($count)); |
208 | 208 | return $itemO; |
209 | 209 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | public function setAbsolutePaths($absolutePaths) { |
220 | 220 | $this->absolutePaths=$absolutePaths; |
221 | 221 | $size=\sizeof($this->content); |
222 | - for($i=0;$i<$size;$i++){ |
|
222 | + for ($i=0; $i<$size; $i++) { |
|
223 | 223 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
224 | 224 | } |
225 | 225 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
13 | 13 | private $_container; |
14 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
14 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
15 | 15 | parent::__construct($identifier, "div"); |
16 | 16 | $this->_container=$container; |
17 | 17 | $this->setClass("ui popup"); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | $this->_params=array("on"=>"hover"); |
20 | 20 | } |
21 | 21 | |
22 | - public function addList($items=array(),$header=NULL){ |
|
23 | - if(!$this->content instanceof HtmlGrid){ |
|
24 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
22 | + public function addList($items=array(), $header=NULL) { |
|
23 | + if (!$this->content instanceof HtmlGrid) { |
|
24 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
25 | 25 | } |
26 | 26 | $grid=$this->content; |
27 | 27 | |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | $colCount++; |
30 | 30 | $grid->setColsCount($colCount); |
31 | 31 | |
32 | - $list=new HtmlList("",$items); |
|
32 | + $list=new HtmlList("", $items); |
|
33 | 33 | $list->asLink(); |
34 | - if(isset($header)){ |
|
35 | - $list->addHeader(4,$header); |
|
34 | + if (isset($header)) { |
|
35 | + $list->addHeader(4, $header); |
|
36 | 36 | } |
37 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
37 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
38 | 38 | $grid->setDivided()->setRelaxed(true); |
39 | 39 | return $list; |
40 | 40 | } |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * A popup can have no maximum width and continue to flow to fit its content |
44 | 44 | */ |
45 | - public function setFlowing(){ |
|
45 | + public function setFlowing() { |
|
46 | 46 | return $this->addToProperty("class", "flowing"); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * A popup can provide more basic formatting |
51 | 51 | */ |
52 | - public function setBasic(){ |
|
52 | + public function setBasic() { |
|
53 | 53 | return $this->addToProperty("class", "basic"); |
54 | 54 | } |
55 | 55 | |
@@ -57,22 +57,22 @@ discard block |
||
57 | 57 | * {@inheritDoc} |
58 | 58 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
59 | 59 | */ |
60 | - public function run(JsUtils $js){ |
|
60 | + public function run(JsUtils $js) { |
|
61 | 61 | $this->_params["popup"]="#".$this->identifier; |
62 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
62 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
63 | 63 | } |
64 | 64 | |
65 | - public function setOn($event="click"){ |
|
65 | + public function setOn($event="click") { |
|
66 | 66 | $this->_params["on"]=$event; |
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function setInline($value=true){ |
|
70 | + public function setInline($value=true) { |
|
71 | 71 | $this->_params["inline"]=$value; |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function setPosition($position){ |
|
75 | + public function setPosition($position) { |
|
76 | 76 | $this->_params["position"]=$position; |
77 | 77 | return $this; |
78 | 78 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | use Ajax\semantic\traits\SemanticWidgetsTrait; |
12 | 12 | |
13 | 13 | class Semantic extends BaseGui { |
14 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
15 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait,SemanticWidgetsTrait; |
|
14 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
15 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait, SemanticWidgetsTrait; |
|
16 | 16 | |
17 | 17 | private $language; |
18 | 18 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | - public function setLanguage($language){ |
|
25 | - if($language!==$this->language){ |
|
24 | + public function setLanguage($language) { |
|
25 | + if ($language!==$this->language) { |
|
26 | 26 | $file=\realpath(dirname(__FILE__)."/semantic/components/validation/languages/".$language.".js"); |
27 | - if(\file_exists($file)){ |
|
27 | + if (\file_exists($file)) { |
|
28 | 28 | $script=\file_get_contents($file); |
29 | - $this->js->exec($script,true); |
|
29 | + $this->js->exec($script, true); |
|
30 | 30 | $this->language=$language; |
31 | 31 | } |
32 | 32 | } |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | use Ajax\semantic\html\base\constants\Sens; |
8 | 8 | use Ajax\JsUtils; |
9 | 9 | |
10 | -class HtmlSegmentGroups extends HtmlSemCollection{ |
|
10 | +class HtmlSegmentGroups extends HtmlSemCollection { |
|
11 | 11 | |
12 | 12 | |
13 | - public function __construct( $identifier, $items=array()){ |
|
14 | - parent::__construct( $identifier, "div","ui segments"); |
|
13 | + public function __construct($identifier, $items=array()) { |
|
14 | + parent::__construct($identifier, "div", "ui segments"); |
|
15 | 15 | $this->addItems($items); |
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | - protected function createItem($value){ |
|
20 | - return new HtmlSegment("segment-".$this->count(),$value); |
|
19 | + protected function createItem($value) { |
|
20 | + return new HtmlSegment("segment-".$this->count(), $value); |
|
21 | 21 | } |
22 | 22 | |
23 | - protected function createCondition($value){ |
|
23 | + protected function createCondition($value) { |
|
24 | 24 | return !($value instanceof HtmlSegment); |
25 | 25 | } |
26 | 26 | |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | * @param string $type one of "raised","stacked","piled" default : "" |
30 | 30 | * @return \Ajax\semantic\html\elements\HtmlSegmentGroups |
31 | 31 | */ |
32 | - public function setType($type){ |
|
32 | + public function setType($type) { |
|
33 | 33 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
34 | 34 | } |
35 | 35 | |
36 | - public function setSens($sens=Sens::VERTICAL){ |
|
36 | + public function setSens($sens=Sens::VERTICAL) { |
|
37 | 37 | return $this->addToPropertyCtrl("class", $sens, Sens::getConstants()); |
38 | 38 | } |
39 | 39 | |
40 | - public function run(JsUtils $js){ |
|
41 | - $result= parent::run($js); |
|
40 | + public function run(JsUtils $js) { |
|
41 | + $result=parent::run($js); |
|
42 | 42 | return $result->setItemSelector(".ui.segment"); |
43 | 43 | } |
44 | 44 | |
45 | - public static function group($identifier,$items=array(),$type="",$sens=Sens::VERTICAL){ |
|
46 | - $group=new HtmlSegmentGroups($identifier,$items); |
|
45 | + public static function group($identifier, $items=array(), $type="", $sens=Sens::VERTICAL) { |
|
46 | + $group=new HtmlSegmentGroups($identifier, $items); |
|
47 | 47 | $group->setSens($sens); |
48 | 48 | return $group->setType($type); |
49 | 49 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $icon=JArray::getValue($value, "icon", 0); |
27 | 27 | $size=JArray::getValue($value, "size", 1); |
28 | 28 | } |
29 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
29 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
30 | 30 | if (isset($size)) { |
31 | 31 | $iconO->setSize($size); |
32 | 32 | } |
@@ -34,15 +34,15 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | protected function createCondition($value) { |
37 | - return ($value instanceof HtmlIcon) === false; |
|
37 | + return ($value instanceof HtmlIcon)===false; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function getIcon($index) { |
41 | 41 | return $this->content[$index]; |
42 | 42 | } |
43 | 43 | |
44 | - public function run(JsUtils $js){ |
|
45 | - $result= parent::run($js); |
|
44 | + public function run(JsUtils $js) { |
|
45 | + $result=parent::run($js); |
|
46 | 46 | return $result->setItemSelector("i"); |
47 | 47 | } |
48 | 48 |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | return $this->content; |
28 | 28 | } |
29 | 29 | |
30 | - public function addContent($content,$before=false) { |
|
30 | + public function addContent($content, $before=false) { |
|
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
32 | + if (isset($this->content)) |
|
33 | + $this->content=array($this->content); |
|
34 | 34 | else |
35 | 35 | $this->content=array(); |
36 | 36 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
37 | + if ($before) |
|
38 | + array_unshift($this->content, $content); |
|
39 | 39 | else |
40 | 40 | $this->content []=$content; |
41 | 41 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
51 | 51 | $this->content->run($js); |
52 | 52 | } else if (\is_array($this->content)) { |
53 | - foreach ( $this->content as $itemContent ) { |
|
53 | + foreach ($this->content as $itemContent) { |
|
54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
55 | 55 | $itemContent->run($js); |
56 | 56 | } |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function getContentInstances($class){ |
|
71 | - return $this->_getContentInstances($class,$this->content); |
|
70 | + public function getContentInstances($class) { |
|
71 | + return $this->_getContentInstances($class, $this->content); |
|
72 | 72 | } |
73 | 73 | |
74 | - protected function _getContentInstances($class,$content){ |
|
74 | + protected function _getContentInstances($class, $content) { |
|
75 | 75 | $instances=[]; |
76 | - if($content instanceof $class){ |
|
76 | + if ($content instanceof $class) { |
|
77 | 77 | $instances[]=$content; |
78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
79 | - $instances=\array_merge($instances,$content->getContentInstances($class)); |
|
80 | - }elseif (\is_array($content)){ |
|
81 | - foreach ($content as $element){ |
|
82 | - $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
|
78 | + }elseif ($content instanceof HtmlDoubleElement) { |
|
79 | + $instances=\array_merge($instances, $content->getContentInstances($class)); |
|
80 | + }elseif (\is_array($content)) { |
|
81 | + foreach ($content as $element) { |
|
82 | + $instances=\array_merge($instances, $this->_getContentInstances($class, $element)); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | return $instances; |
@@ -6,8 +6,8 @@ |
||
6 | 6 | public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n"; |
7 | 7 | public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n"; |
8 | 8 | |
9 | - public static function containsCode($expression){ |
|
10 | - return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false; |
|
9 | + public static function containsCode($expression) { |
|
10 | + return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setClass($classNames) { |
16 | - if(\is_array($classNames)){ |
|
16 | + if (\is_array($classNames)) { |
|
17 | 17 | $classNames=implode(" ", $classNames); |
18 | 18 | } |
19 | 19 | $this->setProperty("class", $classNames); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | public function addClass($classNames) { |
24 | - if(\is_array($classNames)){ |
|
24 | + if (\is_array($classNames)) { |
|
25 | 25 | $classNames=implode(" ", $classNames); |
26 | 26 | } |
27 | 27 | $this->addToProperty("class", $classNames); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function fromArray($array) { |
54 | 54 | $array=parent::fromArray($array); |
55 | - foreach ( $array as $key => $value ) { |
|
55 | + foreach ($array as $key => $value) { |
|
56 | 56 | $this->setProperty($key, $value); |
57 | 57 | } |
58 | 58 | return $array; |