@@ -45,70 +45,70 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @param string $identifier |
47 | 47 | */ |
48 | - public function __construct($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
49 | - parent::__construct($identifier,"ul"); |
|
48 | + public function __construct($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
49 | + parent::__construct($identifier, "ul"); |
|
50 | 50 | $this->setProperty("class", "pagination"); |
51 | 51 | $this->active=$active; |
52 | 52 | $this->from=$from; |
53 | 53 | $this->to=$to; |
54 | 54 | $this->urlMask="%page%"; |
55 | - if(!isset($countVisible)) |
|
55 | + if (!isset($countVisible)) |
|
56 | 56 | $this->countVisible=$to-$from+1; |
57 | 57 | else |
58 | 58 | $this->countVisible=$countVisible; |
59 | 59 | $this->createContent(); |
60 | 60 | } |
61 | 61 | |
62 | - private function createElement($num,$content,$disabled=false,$current=false){ |
|
62 | + private function createElement($num, $content, $disabled=false, $current=false) { |
|
63 | 63 | $count=sizeof($this->content)+1; |
64 | - $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count,"li"); |
|
65 | - if($disabled){ |
|
64 | + $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count, "li"); |
|
65 | + if ($disabled) { |
|
66 | 66 | $elem->setProperty("class", "disabled"); |
67 | 67 | } |
68 | - if($current){ |
|
68 | + if ($current) { |
|
69 | 69 | $content.="<span class='sr-only'>(current)</span>"; |
70 | 70 | $elem->setProperty("class", "active"); |
71 | 71 | } |
72 | - if(!$disabled){ |
|
72 | + if (!$disabled) { |
|
73 | 73 | $url=$this->getUrl($num); |
74 | - $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
|
74 | + $href=new HtmlLink("a-".$this->identifier."-".$count, $url, $content); |
|
75 | 75 | $href->setProperty($this->attr, $url); |
76 | 76 | $elem->setContent($href); |
77 | - }else{ |
|
77 | + } else { |
|
78 | 78 | $elem->setContent($content); |
79 | 79 | } |
80 | 80 | $this->content[]=$elem; |
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | |
84 | - protected function createContent(){ |
|
84 | + protected function createContent() { |
|
85 | 85 | $this->content=array(); |
86 | - $this->createElement($this->active-1,"<span aria-hidden='true'>«</span>",$this->active===1); |
|
86 | + $this->createElement($this->active-1, "<span aria-hidden='true'>«</span>", $this->active===1); |
|
87 | 87 | $start=$this->getStart(); |
88 | - $end=min($start+$this->countVisible-1,$this->to); |
|
89 | - for($index=$start;$index<=$end;$index++){ |
|
90 | - $this->createElement($index,$index,false,$index===$this->active); |
|
88 | + $end=min($start+$this->countVisible-1, $this->to); |
|
89 | + for ($index=$start; $index<=$end; $index++) { |
|
90 | + $this->createElement($index, $index, false, $index===$this->active); |
|
91 | 91 | } |
92 | - $this->createElement($this->active+1,"<span aria-hidden='true'>»</span>",$this->active===$this->to); |
|
92 | + $this->createElement($this->active+1, "<span aria-hidden='true'>»</span>", $this->active===$this->to); |
|
93 | 93 | } |
94 | 94 | |
95 | - protected function half(){ |
|
95 | + protected function half() { |
|
96 | 96 | return (int)($this->countVisible/2); |
97 | 97 | } |
98 | 98 | |
99 | - protected function getStart(){ |
|
99 | + protected function getStart() { |
|
100 | 100 | $result=1; |
101 | - if($this->countVisible!==$this->to-$this->from+1){ |
|
102 | - $result=max($this->active-$this->half(),$result); |
|
101 | + if ($this->countVisible!==$this->to-$this->from+1) { |
|
102 | + $result=max($this->active-$this->half(), $result); |
|
103 | 103 | } |
104 | 104 | return $result; |
105 | 105 | } |
106 | 106 | |
107 | 107 | public function _addEvent($event, $jsCode) { |
108 | - foreach ($this->content as $li){ |
|
108 | + foreach ($this->content as $li) { |
|
109 | 109 | $content=$li->getContent(); |
110 | - if($content instanceof BaseHtml) |
|
111 | - $content->_addEvent($event,$jsCode); |
|
110 | + if ($content instanceof BaseHtml) |
|
111 | + $content->_addEvent($event, $jsCode); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | /** |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | * @param object $dispatcher the request dispatcher |
118 | 118 | * @return \Ajax\bootstrap\html\HtmlPagination |
119 | 119 | */ |
120 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
120 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
121 | 121 | $items=$js->fromDispatcher($dispatcher); |
122 | 122 | $url=implode("/", $items); |
123 | - if($this->urlMask==="%page%"){ |
|
123 | + if ($this->urlMask==="%page%") { |
|
124 | 124 | $this->urlMask=preg_replace("/[0-9]/", "%page%", $url); |
125 | 125 | } |
126 | - for($index=$this->from;$index<=$this->to;$index++){ |
|
127 | - if($this->getUrl($index)==$url){ |
|
126 | + for ($index=$this->from; $index<=$this->to; $index++) { |
|
127 | + if ($this->getUrl($index)==$url) { |
|
128 | 128 | $this->setActive($index); |
129 | 129 | break; |
130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return $this; |
133 | 133 | } |
134 | 134 | |
135 | - public function getUrl($index){ |
|
135 | + public function getUrl($index) { |
|
136 | 136 | return str_ireplace("%page%", $index, $this->urlMask); |
137 | 137 | } |
138 | 138 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if (is_int($size)) { |
147 | 147 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
148 | 148 | } |
149 | - if(!JString::startsWith($size, "pagination-") && $size!=="") |
|
149 | + if (!JString::startsWith($size, "pagination-") && $size!=="") |
|
150 | 150 | $size="pagination-".$size; |
151 | 151 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
152 | 152 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return $this->from; |
156 | 156 | } |
157 | 157 | public function setFrom($from) { |
158 | - $this->from = $from; |
|
158 | + $this->from=$from; |
|
159 | 159 | $this->createContent(); |
160 | 160 | return $this; |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return $this->to; |
164 | 164 | } |
165 | 165 | public function setTo($to) { |
166 | - $this->to = $to; |
|
166 | + $this->to=$to; |
|
167 | 167 | $this->createContent(); |
168 | 168 | return $this; |
169 | 169 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | return $this->active; |
172 | 172 | } |
173 | 173 | public function setActive($active) { |
174 | - $this->active = $active; |
|
174 | + $this->active=$active; |
|
175 | 175 | $this->createContent(); |
176 | 176 | return $this; |
177 | 177 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return $this->urlMask; |
180 | 180 | } |
181 | 181 | public function setUrlMask($urlMask) { |
182 | - $this->urlMask = $urlMask; |
|
182 | + $this->urlMask=$urlMask; |
|
183 | 183 | $this->createContent(); |
184 | 184 | return $this; |
185 | 185 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return $this->countVisible; |
188 | 188 | } |
189 | 189 | public function setCountVisible($countVisible) { |
190 | - $this->countVisible = $countVisible; |
|
190 | + $this->countVisible=$countVisible; |
|
191 | 191 | $this->createContent(); |
192 | 192 | return $this; |
193 | 193 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->setClass("panel-group"); |
20 | 20 | $this->setRole("tablist"); |
21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
22 | - $this->content=array (); |
|
22 | + $this->content=array(); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addPanel($title, $content) { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param string $viewName |
46 | 46 | * @param array $params The parameters to pass to the view |
47 | 47 | */ |
48 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
49 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
48 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
49 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * @param string $action a Phalcon action |
59 | 59 | * @param array $params |
60 | 60 | */ |
61 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
62 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
61 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
62 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function run(JsUtils $js) { |
66 | - foreach ( $this->content as $content ) { |
|
66 | + foreach ($this->content as $content) { |
|
67 | 67 | $content->run($js); |
68 | 68 | } |
69 | 69 | } |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | $this->parameters["immediatly"]=false; |
24 | 24 | extract($this->parameters); |
25 | 25 | $result=$this->_eventPreparing($preventDefault, $stopPropagation); |
26 | - switch($this->method) { |
|
26 | + switch ($this->method) { |
|
27 | 27 | case "get": |
28 | 28 | $result.=$js->getDeferred($url, $responseElement, $this->parameters); |
29 | 29 | break; |
30 | 30 | case "post": |
31 | - $result.=$js->postDeferred($url, $params,$responseElement, $this->parameters); |
|
31 | + $result.=$js->postDeferred($url, $params, $responseElement, $this->parameters); |
|
32 | 32 | break; |
33 | 33 | case "postForm": |
34 | 34 | $result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters); |
35 | 35 | break; |
36 | 36 | case "json": |
37 | - $result.=$js->jsonDeferred($url,$method,$this->parameters); |
|
37 | + $result.=$js->jsonDeferred($url, $method, $this->parameters); |
|
38 | 38 | break; |
39 | 39 | case "jsonArray": |
40 | - $result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$this->parameters); |
|
40 | + $result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters); |
|
41 | 41 | break; |
42 | 42 | default: |
43 | 43 | break; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $result; |
46 | 46 | } |
47 | 47 | |
48 | - protected function _eventPreparing($preventDefault,$stopPropagation){ |
|
48 | + protected function _eventPreparing($preventDefault, $stopPropagation) { |
|
49 | 49 | $result=""; |
50 | 50 | if ($preventDefault===true) { |
51 | 51 | $result.=Javascript::$preventDefault; |
@@ -3,11 +3,11 @@ |
||
3 | 3 | namespace Ajax\common\html\html5; |
4 | 4 | |
5 | 5 | class HtmlUtils { |
6 | - public static function javascriptInclude($url){ |
|
6 | + public static function javascriptInclude($url) { |
|
7 | 7 | return '<script src="'.$url.'"></script>'; |
8 | 8 | } |
9 | 9 | |
10 | - public static function stylesheetInclude($url){ |
|
10 | + public static function stylesheetInclude($url) { |
|
11 | 11 | return '<link rel="stylesheet" type="text/css" href="'.$url.'">'; |
12 | 12 | } |
13 | 13 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | * @author jc |
9 | 9 | * @property BaseWidget $_self |
10 | 10 | */ |
11 | -trait BaseHtmlPropertiesTrait{ |
|
11 | +trait BaseHtmlPropertiesTrait { |
|
12 | 12 | |
13 | - protected $properties=array (); |
|
13 | + protected $properties=array(); |
|
14 | 14 | abstract protected function ctrl($name, $value, $typeCtrl); |
15 | 15 | abstract protected function removeOldValues(&$oldValue, $allValues); |
16 | - abstract protected function _getElementBy($callback,$elements); |
|
16 | + abstract protected function _getElementBy($callback, $elements); |
|
17 | 17 | public function getProperties() { |
18 | 18 | return $this->_self->properties; |
19 | 19 | } |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function addToProperty($name, $value, $separator=" ") { |
47 | 47 | if (\is_array($value)) { |
48 | - foreach ( $value as $v ) { |
|
48 | + foreach ($value as $v) { |
|
49 | 49 | $this->_self->addToProperty($name, $v, $separator); |
50 | 50 | } |
51 | - } else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) { |
|
52 | - if(isset($this->_self->properties[$name])){ |
|
51 | + } else if ($value!=="" && $this->_self->propertyContains($name, $value)===false) { |
|
52 | + if (isset($this->_self->properties[$name])) { |
|
53 | 53 | $v=$this->_self->properties[$name]; |
54 | - if (isset($v) && $v !== "") |
|
55 | - $v=$v . $separator . $value; |
|
54 | + if (isset($v) && $v!=="") |
|
55 | + $v=$v.$separator.$value; |
|
56 | 56 | else |
57 | 57 | $v=$value; |
58 | 58 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
94 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
94 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) { |
|
95 | 95 | return $this->_self->addToProperty($name, $value); |
96 | 96 | } |
97 | 97 | return $this; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
115 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
115 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) |
|
116 | 116 | return $this->_self->setProperty($name, $value); |
117 | 117 | return $this; |
118 | 118 | } |
119 | 119 | |
120 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
121 | - return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements); |
|
120 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
121 | + return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements); |
|
122 | 122 | } |
123 | 123 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function __construct($identifier, $brand="Brand", $brandHref="#") { |
33 | 33 | parent::__construct($identifier); |
34 | 34 | $this->_template=include 'templates/tplNavbar.php'; |
35 | - $this->navZones=array (); |
|
35 | + $this->navZones=array(); |
|
36 | 36 | $this->class="navbar-default"; |
37 | 37 | $this->brand=$brand; |
38 | 38 | $this->brandHref=$brandHref; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function setBrandImage($imageSrc) { |
63 | - $this->brandImage=new HtmlImg("brand-img-".$this->_identifier,$imageSrc,$this->brand); |
|
63 | + $this->brandImage=new HtmlImg("brand-img-".$this->_identifier, $imageSrc, $this->brand); |
|
64 | 64 | $this->brand=""; |
65 | 65 | return $this; |
66 | 66 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | public function setNavZones($navZones) { |
106 | 106 | if (\is_array($navZones)) { |
107 | - foreach ( $navZones as $zoneType => $zoneArray ) { |
|
107 | + foreach ($navZones as $zoneType => $zoneArray) { |
|
108 | 108 | if (is_string($zoneType)) { |
109 | 109 | $zone=$this->addZone($zoneType); |
110 | 110 | $zone->fromArray($zoneArray); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | if ($index<$nb) |
145 | 145 | $zone=$this->navZones [$index]; |
146 | 146 | } else { |
147 | - for($i=0; $i<$nb; $i++) { |
|
147 | + for ($i=0; $i<$nb; $i++) { |
|
148 | 148 | if ($this->navZones [$i]->getIdentifier()===$index) { |
149 | 149 | $zone=$this->navZones [$i]; |
150 | 150 | break; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function run(JsUtils $js) { |
158 | - foreach ( $this->navZones as $zone ) { |
|
158 | + foreach ($this->navZones as $zone) { |
|
159 | 159 | $zone->run($js); |
160 | 160 | } |
161 | 161 | if ($this->hasScrollspy) { |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | public function setFluid($fluid) { |
180 | - if($fluid===true){ |
|
180 | + if ($fluid===true) { |
|
181 | 181 | $this->fluid="container-fluid"; |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | $this->fluid="container"; |
184 | 184 | } |
185 | 185 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | trait JsUtilsActionsTrait { |
13 | 13 | |
14 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
14 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
15 | 15 | /** |
16 | 16 | * show or hide with effect |
17 | 17 | * |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param boolean $immediatly defers the execution if set to false |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) { |
|
25 | + protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) { |
|
26 | 26 | $element=Javascript::prep_element($element); |
27 | 27 | $speed=$this->_validate_speed($speed); |
28 | 28 | if ($callback!='') { |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * @return string |
40 | 40 | */ |
41 | 41 | private function _validate_speed($speed) { |
42 | - if (in_array($speed, array ( |
|
43 | - 'slow','normal','fast' |
|
42 | + if (in_array($speed, array( |
|
43 | + 'slow', 'normal', 'fast' |
|
44 | 44 | ))) { |
45 | 45 | $speed='"'.$speed.'"'; |
46 | 46 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string $param |
58 | 58 | * @param boolean $immediatly delayed if false |
59 | 59 | */ |
60 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
60 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
61 | 61 | $element=Javascript::prep_element($element); |
62 | 62 | if (isset($param)) { |
63 | 63 | $param=Javascript::prep_value($param); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param boolean $immediatly delayed if false |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
80 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
81 | 81 | $to=Javascript::prep_element($to); |
82 | 82 | $element=Javascript::prep_element($element); |
83 | 83 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return string |
95 | 95 | */ |
96 | 96 | public function addClass($element='this', $class='', $immediatly=false) { |
97 | - return $this->_genericCallValue('addClass',$element, $class, $immediatly); |
|
97 | + return $this->_genericCallValue('addClass', $element, $class, $immediatly); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param boolean $immediatly defers the execution if set to false |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public function after($to, $element, $immediatly=false){ |
|
108 | - return $this->_genericCallElement('after',$to, $element, $immediatly); |
|
107 | + public function after($to, $element, $immediatly=false) { |
|
108 | + return $this->_genericCallElement('after', $to, $element, $immediatly); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @param boolean $immediatly defers the execution if set to false |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function before($to, $element, $immediatly=false){ |
|
119 | - return $this->_genericCallElement('before',$to, $element, $immediatly); |
|
118 | + public function before($to, $element, $immediatly=false) { |
|
119 | + return $this->_genericCallElement('before', $to, $element, $immediatly); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @param string $value |
145 | 145 | * @param boolean $immediatly defers the execution if set to false |
146 | 146 | */ |
147 | - public function val($element='this',$value='',$immediatly=false){ |
|
148 | - return $this->_genericCallValue('val',$element,$value,$immediatly); |
|
147 | + public function val($element='this', $value='', $immediatly=false) { |
|
148 | + return $this->_genericCallValue('val', $element, $value, $immediatly); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param boolean $immediatly defers the execution if set to false |
156 | 156 | */ |
157 | 157 | public function html($element='this', $value='', $immediatly=false) { |
158 | - return $this->_genericCallValue('html',$element, $value, $immediatly); |
|
158 | + return $this->_genericCallValue('html', $element, $value, $immediatly); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | $animations="\t\t\t"; |
176 | 176 | if (\is_array($params)) { |
177 | - foreach ( $params as $param => $value ) { |
|
177 | + foreach ($params as $param => $value) { |
|
178 | 178 | $animations.=$param.': \''.$value.'\', '; |
179 | 179 | } |
180 | 180 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | */ |
205 | 205 | public function append($to, $element, $immediatly=false) { |
206 | - return $this->_genericCallElement('append',$to, $element, $immediatly); |
|
206 | + return $this->_genericCallElement('append', $to, $element, $immediatly); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return string |
215 | 215 | */ |
216 | 216 | public function prepend($to, $element, $immediatly=false) { |
217 | - return $this->_genericCallElement('prepend',$to, $element, $immediatly); |
|
217 | + return $this->_genericCallElement('prepend', $to, $element, $immediatly); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return string |
228 | 228 | */ |
229 | 229 | public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) { |
230 | - return $this->_showHideWithEffect("fadeIn",$element,$speed,$callback,$immediatly); |
|
230 | + return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @return string |
241 | 241 | */ |
242 | 242 | public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) { |
243 | - return $this->_showHideWithEffect("fadeOut",$element,$speed,$callback,$immediatly); |
|
243 | + return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @return string |
254 | 254 | */ |
255 | 255 | public function slideUp($element='this', $speed='', $callback='', $immediatly=false) { |
256 | - return $this->_showHideWithEffect("slideUp",$element,$speed,$callback,$immediatly); |
|
256 | + return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @return string |
266 | 266 | */ |
267 | 267 | public function removeClass($element='this', $class='', $immediatly=false) { |
268 | - return $this->_genericCallValue('removeClass',$element, $class, $immediatly); |
|
268 | + return $this->_genericCallValue('removeClass', $element, $class, $immediatly); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return string |
279 | 279 | */ |
280 | 280 | public function slideDown($element='this', $speed='', $callback='', $immediatly=false) { |
281 | - return $this->_showHideWithEffect("slideDown",$element,$speed,$callback,$immediatly); |
|
281 | + return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @return string |
292 | 292 | */ |
293 | 293 | public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) { |
294 | - return $this->_showHideWithEffect("slideToggle",$element,$speed,$callback,$immediatly); |
|
294 | + return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @return string |
305 | 305 | */ |
306 | 306 | public function hide($element='this', $speed='', $callback='', $immediatly=false) { |
307 | - return $this->_showHideWithEffect("hide",$element,$speed,$callback,$immediatly); |
|
307 | + return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @return string |
318 | 318 | */ |
319 | 319 | public function toggle($element='this', $speed='', $callback='', $immediatly=false) { |
320 | - return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly); |
|
320 | + return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return string |
330 | 330 | */ |
331 | 331 | public function toggleClass($element='this', $class='', $immediatly=false) { |
332 | - return $this->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
332 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * @return string |
358 | 358 | */ |
359 | 359 | public function show($element='this', $speed='', $callback='', $immediatly=false) { |
360 | - return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly); |
|
360 | + return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function sortable($element, $options=array()) { |
371 | 371 | if (count($options)>0) { |
372 | - $sort_options=array (); |
|
373 | - foreach ( $options as $k => $v ) { |
|
372 | + $sort_options=array(); |
|
373 | + foreach ($options as $k => $v) { |
|
374 | 374 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
375 | 375 | } |
376 | 376 | $sort_options=implode(",", $sort_options); |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | * @param boolean $immediatly |
468 | 468 | * @return string |
469 | 469 | */ |
470 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
471 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
470 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
471 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $preventDefault=false; |
487 | 487 | $immediatly=true; |
488 | 488 | extract($parameters); |
489 | - return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
489 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $preventDefault=false; |
528 | 528 | $immediatly=true; |
529 | 529 | extract($parameters); |
530 | - $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
530 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
531 | 531 | return $script; |
532 | 532 | } |
533 | 533 | |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | * @param string $element The element selector |
537 | 537 | * @param array $parameters default : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true) |
538 | 538 | */ |
539 | - public function setDraggable($element,$parameters=[]){ |
|
539 | + public function setDraggable($element, $parameters=[]) { |
|
540 | 540 | $attr="id"; |
541 | 541 | extract($parameters); |
542 | - $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart",$parameters); |
|
542 | + $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart", $parameters); |
|
543 | 543 | return $script; |
544 | 544 | } |
545 | 545 | |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | * @param array $parameters default : array("attr"=>"id","stopPropagation"=>false,"immediatly"=>true,"jqueryDone"=>"append") |
550 | 550 | * @param string $jsCallback the js script to call when element is dropped |
551 | 551 | */ |
552 | - public function asDropZone($element,$jsCallback="",$parameters=[]){ |
|
552 | + public function asDropZone($element, $jsCallback="", $parameters=[]) { |
|
553 | 553 | $stopPropagation=false; |
554 | 554 | $immediatly=true; |
555 | 555 | $jqueryDone="append"; |
556 | - $script=$this->_add_event($element, '', "dragover",true,$stopPropagation,$immediatly); |
|
556 | + $script=$this->_add_event($element, '', "dragover", true, $stopPropagation, $immediatly); |
|
557 | 557 | extract($parameters); |
558 | - $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone,$jsCallback), "drop",true,$stopPropagation,$immediatly); |
|
558 | + $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone, $jsCallback), "drop", true, $stopPropagation, $immediatly); |
|
559 | 559 | return $script; |
560 | 560 | } |
561 | 561 | } |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct($identifier) { |
22 | 22 | parent::__construct($identifier, "tr", ""); |
23 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
23 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function setColCount($colCount) { |
27 | 27 | $count=$this->count(); |
28 | - for($i=$count; $i < $colCount; $i++) { |
|
28 | + for ($i=$count; $i<$colCount; $i++) { |
|
29 | 29 | $item=$this->addItem(NULL); |
30 | 30 | $item->setTagName($this->_tdTagName); |
31 | 31 | } |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | - public function getColCount(){ |
|
35 | + public function getColCount() { |
|
36 | 36 | return $this->count(); |
37 | 37 | } |
38 | 38 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return HtmlTD |
54 | 54 | */ |
55 | - public function getItem($index){ |
|
55 | + public function getItem($index) { |
|
56 | 56 | return parent::getItem($index); |
57 | 57 | } |
58 | 58 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param mixed $values |
76 | 76 | */ |
77 | 77 | public function setValues($values=array()) { |
78 | - return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);}); |
|
78 | + return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->setValue($value); }); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | * @param mixed $values |
84 | 84 | */ |
85 | 85 | public function addValues($values=array()) { |
86 | - return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);}); |
|
86 | + return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->addValue($value); }); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Sets or adds values to the row cols |
91 | 91 | * @param mixed $values |
92 | 92 | */ |
93 | - protected function _addOrSetValues($values,$callback) { |
|
93 | + protected function _addOrSetValues($values, $callback) { |
|
94 | 94 | $count=$this->count(); |
95 | 95 | if (!\is_array($values)) { |
96 | 96 | $values=\array_fill(0, $count, $values); |
97 | 97 | } else { |
98 | - if (JArray::isAssociative($values) === true) { |
|
98 | + if (JArray::isAssociative($values)===true) { |
|
99 | 99 | $values=\array_values($values); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | $count=\min(\sizeof($values), $count); |
103 | 103 | |
104 | - for($i=0; $i < $count; $i++) { |
|
104 | + for ($i=0; $i<$count; $i++) { |
|
105 | 105 | $cell=$this->content[$i]; |
106 | - $callback($cell,$values[$i]); |
|
106 | + $callback($cell, $values[$i]); |
|
107 | 107 | } |
108 | 108 | return $this; |
109 | 109 | } |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | public function getColPosition($colIndex) { |
130 | - if($this->_container->_isMerged()!==true) |
|
130 | + if ($this->_container->_isMerged()!==true) |
|
131 | 131 | return $colIndex; |
132 | 132 | $pos=0; |
133 | 133 | $rows=$this->_container->getContent(); |
134 | - for($i=0; $i < $this->_row; $i++) { |
|
134 | + for ($i=0; $i<$this->_row; $i++) { |
|
135 | 135 | $max=\min($colIndex, $rows[$i]->count()); |
136 | - for($j=0; $j < $max; $j++) { |
|
136 | + for ($j=0; $j<$max; $j++) { |
|
137 | 137 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
138 | - if ($rowspan + $i > $this->_row) |
|
138 | + if ($rowspan+$i>$this->_row) |
|
139 | 139 | $pos++; |
140 | 140 | } |
141 | 141 | } |
142 | - if ($pos > $colIndex) |
|
142 | + if ($pos>$colIndex) |
|
143 | 143 | return NULL; |
144 | 144 | $count=$this->count(); |
145 | - for($i=0; $i < $count; $i++) { |
|
145 | + for ($i=0; $i<$count; $i++) { |
|
146 | 146 | $pos+=$this->content[$i]->getColspan(); |
147 | - if ($pos >= $colIndex + 1) |
|
147 | + if ($pos>=$colIndex+1) |
|
148 | 148 | return $i; |
149 | 149 | } |
150 | 150 | return null; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | public function conditionalCellFormat($callback, $format) { |
154 | 154 | $cells=$this->content; |
155 | - foreach ( $cells as $cell ) { |
|
155 | + foreach ($cells as $cell) { |
|
156 | 156 | $cell->conditionalCellFormat($callback, $format); |
157 | 157 | } |
158 | 158 | return $this; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | |
168 | 168 | public function containsStr($needle) { |
169 | 169 | $cells=$this->content; |
170 | - foreach ( $cells as $cell ) { |
|
171 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
170 | + foreach ($cells as $cell) { |
|
171 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | return false; |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | |
182 | 182 | public function applyCells($callback) { |
183 | 183 | $cells=$this->content; |
184 | - foreach ( $cells as $cell ) { |
|
184 | + foreach ($cells as $cell) { |
|
185 | 185 | $cell->apply($callback); |
186 | 186 | } |
187 | 187 | return $this; |
188 | 188 | } |
189 | 189 | |
190 | - public function toDelete($colIndex){ |
|
190 | + public function toDelete($colIndex) { |
|
191 | 191 | $this->getItem($colIndex)->toDelete(); |
192 | 192 | return $this; |
193 | 193 | } |
@@ -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 (HtmlSemDoubleElement $e) { |
|
55 | + $this->_hrefFunction=function(HtmlSemDoubleElement $e) { |
|
56 | 56 | return $e->getContent(); |
57 | 57 | }; |
58 | 58 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumb |
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 object $dispatcher the request dispatcher |
97 | 97 | * @return HtmlBreadcrumb |
98 | 98 | */ |
99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
100 | 100 | $this->startIndex=$startIndex; |
101 | 101 | return $this->addItems($js->fromDispatcher($dispatcher)); |
102 | 102 | } |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | if (!isset($index)) { |
112 | 112 | $index=sizeof($this->content); |
113 | 113 | } |
114 | - if ($this->absolutePaths === true) { |
|
114 | + if ($this->absolutePaths===true) { |
|
115 | 115 | return $this->_hrefFunction($this->content[$index]); |
116 | 116 | } else { |
117 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
117 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
118 | 118 | return $this->_hrefFunction($e); |
119 | - }, $this->content), $this->startIndex, $index + 1)); |
|
119 | + }, $this->content), $this->startIndex, $index+1)); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | $this->setActive(); |
151 | 151 | } |
152 | 152 | $count=$this->count(); |
153 | - for($i=1; $i < $count; $i++) { |
|
154 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
153 | + for ($i=1; $i<$count; $i++) { |
|
154 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
155 | 155 | } |
156 | 156 | return parent::compile($js, $view); |
157 | 157 | } |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
162 | 162 | */ |
163 | 163 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
164 | - foreach ( $this->content as $element ) { |
|
164 | + foreach ($this->content as $element) { |
|
165 | 165 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
166 | 166 | } |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | 170 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
171 | - foreach ( $this->content as $element ) { |
|
172 | - if ($element->getProperty($this->attr) != NULL){ |
|
171 | + foreach ($this->content as $element) { |
|
172 | + if ($element->getProperty($this->attr)!=NULL) { |
|
173 | 173 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
174 | 174 | } |
175 | 175 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function createItem($value) { |
186 | 186 | $count=$this->count(); |
187 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
187 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
188 | 188 | if (\is_array($value)) |
189 | 189 | $itemO->fromArray($value); |
190 | 190 | else { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function addIconAt($icon, $index) { |
197 | 197 | $item=$this->getItem($index); |
198 | 198 | if (isset($item)) { |
199 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
199 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
200 | 200 | $item->wrapContent($icon); |
201 | 201 | } |
202 | 202 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | public function addItem($item) { |
205 | 205 | $count=$this->count(); |
206 | 206 | $itemO=parent::addItem($item); |
207 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
207 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
208 | 208 | $itemO->setProperty($this->attr, $this->getHref($count)); |
209 | 209 | return $itemO; |
210 | 210 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public function setAbsolutePaths($absolutePaths) { |
221 | 221 | $this->absolutePaths=$absolutePaths; |
222 | 222 | $size=\sizeof($this->content); |
223 | - for($i=0;$i<$size;$i++){ |
|
223 | + for ($i=0; $i<$size; $i++) { |
|
224 | 224 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
225 | 225 | } |
226 | 226 | return $this; |