@@ -67,6 +67,9 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | + /** |
|
71 | + * @param HtmlForm $form |
|
72 | + */ |
|
70 | 73 | protected function _generateFields($form,$values,$headers,$sepFirst,$sepLast,$wrappers){ |
71 | 74 | $wrapper=null; |
72 | 75 | $fields=\array_slice($values, $sepFirst+1,$sepLast-$sepFirst); |
@@ -132,12 +135,20 @@ discard block |
||
132 | 135 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
133 | 136 | } |
134 | 137 | |
138 | + /** |
|
139 | + * @param integer $index |
|
140 | + * @param string $title |
|
141 | + */ |
|
135 | 142 | public function addDividerBefore($index,$title){ |
136 | 143 | $index=$this->_getIndex($index); |
137 | 144 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
138 | 145 | return $this; |
139 | 146 | } |
140 | 147 | |
148 | + /** |
|
149 | + * @param string $index |
|
150 | + * @param string $contentAfter |
|
151 | + */ |
|
141 | 152 | public function addWrapper($index,$contentBefore,$contentAfter=null){ |
142 | 153 | $index=$this->_getIndex($index); |
143 | 154 | $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
@@ -19,81 +19,81 @@ discard block |
||
19 | 19 | class DataForm extends Widget { |
20 | 20 | |
21 | 21 | public function __construct($identifier, $modelInstance=NULL) { |
22 | - parent::__construct($identifier, null,$modelInstance); |
|
22 | + parent::__construct($identifier, null, $modelInstance); |
|
23 | 23 | $this->_form=new HtmlForm($identifier); |
24 | 24 | $this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true); |
25 | 25 | } |
26 | 26 | |
27 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
27 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
28 | 28 | return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier(); |
29 | 29 | } |
30 | 30 | |
31 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
32 | - if(!$this->_generated){ |
|
31 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
32 | + if (!$this->_generated) { |
|
33 | 33 | $this->_instanceViewer->setInstance($this->_modelInstance); |
34 | 34 | |
35 | 35 | $form=$this->content["form"]; |
36 | 36 | $this->_generateContent($form); |
37 | 37 | |
38 | - if(isset($this->_toolbar)){ |
|
38 | + if (isset($this->_toolbar)) { |
|
39 | 39 | $this->_setToolbarPosition($form); |
40 | 40 | } |
41 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]); |
|
41 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]); |
|
42 | 42 | $this->_generated=true; |
43 | 43 | } |
44 | - return parent::compile($js,$view); |
|
44 | + return parent::compile($js, $view); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @param HtmlForm $form |
49 | 49 | */ |
50 | - protected function _generateContent($form){ |
|
51 | - $values= $this->_instanceViewer->getValues(); |
|
50 | + protected function _generateContent($form) { |
|
51 | + $values=$this->_instanceViewer->getValues(); |
|
52 | 52 | $count=$this->_instanceViewer->count(); |
53 | 53 | $separators=$this->_instanceViewer->getSeparators(); |
54 | 54 | $headers=$this->_instanceViewer->getHeaders(); |
55 | 55 | $wrappers=$this->_instanceViewer->getWrappers(); |
56 | 56 | \sort($separators); |
57 | 57 | $size=\sizeof($separators); |
58 | - if($size===1){ |
|
59 | - foreach ($values as $v){ |
|
58 | + if ($size===1) { |
|
59 | + foreach ($values as $v) { |
|
60 | 60 | $form->addField($v); |
61 | 61 | } |
62 | - }else{ |
|
62 | + } else { |
|
63 | 63 | $separators[]=$count; |
64 | - for($i=0;$i<$size;$i++){ |
|
64 | + for ($i=0; $i<$size; $i++) { |
|
65 | 65 | $this->_generateFields($form, $values, $headers, $separators[$i], $separators[$i+1], $wrappers); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - protected function _generateFields($form,$values,$headers,$sepFirst,$sepLast,$wrappers){ |
|
70 | + protected function _generateFields($form, $values, $headers, $sepFirst, $sepLast, $wrappers) { |
|
71 | 71 | $wrapper=null; |
72 | - $fields=\array_slice($values, $sepFirst+1,$sepLast-$sepFirst); |
|
73 | - if(isset($headers[$sepFirst+1])) |
|
74 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
75 | - if(isset($wrappers[$sepFirst+1])){ |
|
72 | + $fields=\array_slice($values, $sepFirst+1, $sepLast-$sepFirst); |
|
73 | + if (isset($headers[$sepFirst+1])) |
|
74 | + $form->addHeader($headers[$sepFirst+1], 4, true); |
|
75 | + if (isset($wrappers[$sepFirst+1])) { |
|
76 | 76 | $wrapper=$wrappers[$sepFirst+1]; |
77 | 77 | } |
78 | 78 | //TODO check why $fields is empty |
79 | - if(\sizeof($fields)===1){ |
|
79 | + if (\sizeof($fields)===1) { |
|
80 | 80 | $added=$form->addField($fields[0]); |
81 | - }elseif(\sizeof($fields)>1){ |
|
81 | + }elseif (\sizeof($fields)>1) { |
|
82 | 82 | $added=$form->addFields($fields); |
83 | 83 | } |
84 | - if(isset($wrapper)) |
|
85 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
84 | + if (isset($wrapper)) |
|
85 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * {@inheritDoc} |
90 | 90 | * @see \Ajax\common\Widget::getForm() |
91 | 91 | */ |
92 | - public function getForm(){ |
|
92 | + public function getForm() { |
|
93 | 93 | return $this->content["form"]; |
94 | 94 | } |
95 | 95 | |
96 | - public function addSeparatorAfter($fieldNum){ |
|
96 | + public function addSeparatorAfter($fieldNum) { |
|
97 | 97 | $fieldNum=$this->_getIndex($fieldNum); |
98 | 98 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
99 | 99 | return $this; |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | return $this; |
109 | 109 | } |
110 | 110 | |
111 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
112 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
113 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
111 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
112 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
113 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
114 | 114 | $button->setProperty("type", "reset"); |
115 | 115 | return $button; |
116 | - }, $index,$attributes); |
|
116 | + }, $index, $attributes); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -132,19 +132,19 @@ discard block |
||
132 | 132 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
133 | 133 | } |
134 | 134 | |
135 | - public function addDividerBefore($index,$title){ |
|
135 | + public function addDividerBefore($index, $title) { |
|
136 | 136 | $index=$this->_getIndex($index); |
137 | 137 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
138 | 138 | return $this; |
139 | 139 | } |
140 | 140 | |
141 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
141 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
142 | 142 | $index=$this->_getIndex($index); |
143 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
143 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
144 | 144 | return $this; |
145 | 145 | } |
146 | 146 | |
147 | - public function run(JsUtils $js){ |
|
147 | + public function run(JsUtils $js) { |
|
148 | 148 | return parent::run($js); |
149 | 149 | } |
150 | 150 | } |
151 | 151 | \ No newline at end of file |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | foreach ($values as $v){ |
60 | 60 | $form->addField($v); |
61 | 61 | } |
62 | - }else{ |
|
62 | + } else{ |
|
63 | 63 | $separators[]=$count; |
64 | 64 | for($i=0;$i<$size;$i++){ |
65 | 65 | $this->_generateFields($form, $values, $headers, $separators[$i], $separators[$i+1], $wrappers); |
@@ -70,19 +70,21 @@ discard block |
||
70 | 70 | protected function _generateFields($form,$values,$headers,$sepFirst,$sepLast,$wrappers){ |
71 | 71 | $wrapper=null; |
72 | 72 | $fields=\array_slice($values, $sepFirst+1,$sepLast-$sepFirst); |
73 | - if(isset($headers[$sepFirst+1])) |
|
74 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
73 | + if(isset($headers[$sepFirst+1])) { |
|
74 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
75 | + } |
|
75 | 76 | if(isset($wrappers[$sepFirst+1])){ |
76 | 77 | $wrapper=$wrappers[$sepFirst+1]; |
77 | 78 | } |
78 | 79 | //TODO check why $fields is empty |
79 | 80 | if(\sizeof($fields)===1){ |
80 | 81 | $added=$form->addField($fields[0]); |
81 | - }elseif(\sizeof($fields)>1){ |
|
82 | + } elseif(\sizeof($fields)>1){ |
|
82 | 83 | $added=$form->addFields($fields); |
83 | 84 | } |
84 | - if(isset($wrapper)) |
|
85 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
85 | + if(isset($wrapper)) { |
|
86 | + $added->wrap($wrapper[0],$wrapper[1]); |
|
87 | + } |
|
86 | 88 | } |
87 | 89 | |
88 | 90 | /** |
@@ -3,25 +3,25 @@ discard block |
||
3 | 3 | namespace Ajax\service; |
4 | 4 | |
5 | 5 | class JReflection { |
6 | - public static function shortClassName($object){ |
|
7 | - $classNameWithNamespace = get_class($object); |
|
6 | + public static function shortClassName($object) { |
|
7 | + $classNameWithNamespace=get_class($object); |
|
8 | 8 | return substr($classNameWithNamespace, strrpos($classNameWithNamespace, '\\')+1); |
9 | 9 | } |
10 | 10 | |
11 | - public static function jsonObject($classname){ |
|
11 | + public static function jsonObject($classname) { |
|
12 | 12 | $object=new $classname(); |
13 | - $class = new \ReflectionClass($classname); |
|
13 | + $class=new \ReflectionClass($classname); |
|
14 | 14 | $methods=$class->getMethods(\ReflectionMethod::IS_PUBLIC); |
15 | - foreach ($methods as $method){ |
|
15 | + foreach ($methods as $method) { |
|
16 | 16 | $name=$method->getName(); |
17 | - if(JString::startswith($name, "set")){ |
|
17 | + if (JString::startswith($name, "set")) { |
|
18 | 18 | $property=\strtolower(JString::replaceAtFirst($name, "set", "")); |
19 | 19 | $value="__".$property."__"; |
20 | - try{ |
|
21 | - if($class->getProperty($property)!==null){ |
|
22 | - \call_user_func_array([$object,$name],[$value]); |
|
20 | + try { |
|
21 | + if ($class->getProperty($property)!==null) { |
|
22 | + \call_user_func_array([$object, $name], [$value]); |
|
23 | 23 | } |
24 | - }catch(\Exception $e){ |
|
24 | + }catch (\Exception $e) { |
|
25 | 25 | //Nothing to do |
26 | 26 | } |
27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return $object; |
30 | 30 | } |
31 | 31 | |
32 | - public static function callMethod($object,$callback,array $values){ |
|
33 | - return \call_user_func_array([$object,$callback],$values); |
|
32 | + public static function callMethod($object, $callback, array $values) { |
|
33 | + return \call_user_func_array([$object, $callback], $values); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | if($class->getProperty($property)!==null){ |
22 | 22 | \call_user_func_array([$object,$name],[$value]); |
23 | 23 | } |
24 | - }catch(\Exception $e){ |
|
24 | + } catch(\Exception $e){ |
|
25 | 25 | //Nothing to do |
26 | 26 | } |
27 | 27 | } |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | class HtmlLink extends HtmlSemDoubleElement { |
11 | 11 | use HtmlLinkTrait; |
12 | 12 | |
13 | - public function __construct($identifier, $href="#", $content="Link",$target=NULL) { |
|
13 | + public function __construct($identifier, $href="#", $content="Link", $target=NULL) { |
|
14 | 14 | parent::__construct($identifier, "a", ""); |
15 | 15 | $this->setHref($href); |
16 | - if(isset($target)) |
|
16 | + if (isset($target)) |
|
17 | 17 | $this->setTarget($target); |
18 | 18 | $this->content=$content; |
19 | 19 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::run() |
24 | 24 | */ |
25 | 25 | public function run(JsUtils $js) { |
26 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
26 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
27 | 27 | $this->addEventsOnRun($js); |
28 | 28 | return $this->_bsComponent; |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function addIcon($icon, $before=true) { |
32 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
32 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public static function icon($identifier, $icon, $href="#", $label=NULL) { |
@@ -13,8 +13,9 @@ |
||
13 | 13 | public function __construct($identifier, $href="#", $content="Link",$target=NULL) { |
14 | 14 | parent::__construct($identifier, "a", ""); |
15 | 15 | $this->setHref($href); |
16 | - if(isset($target)) |
|
17 | - $this->setTarget($target); |
|
16 | + if(isset($target)) { |
|
17 | + $this->setTarget($target); |
|
18 | + } |
|
18 | 19 | $this->content=$content; |
19 | 20 | } |
20 | 21 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public function setFocusable($value=true) { |
58 | - if ($value === true) |
|
58 | + if ($value===true) |
|
59 | 59 | $this->setProperty("tabindex", "0"); |
60 | 60 | else { |
61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | |
66 | 66 | public function setAnimated($content, $animation="") { |
67 | 67 | $this->setTagName("div"); |
68 | - $this->addToProperty("class", "animated " . $animation); |
|
69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
68 | + $this->addToProperty("class", "animated ".$animation); |
|
69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
70 | 70 | $visible->setClass("visible content"); |
71 | 71 | $visible->setContent($this->content); |
72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
73 | 73 | $hidden->setClass("hidden content"); |
74 | 74 | $hidden->setContent($content); |
75 | - $this->content=array ($visible,$hidden ); |
|
75 | + $this->content=array($visible, $hidden); |
|
76 | 76 | return $hidden; |
77 | 77 | } |
78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function asIcon($icon) { |
85 | 85 | $iconO=$icon; |
86 | 86 | if (\is_string($icon)) { |
87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
88 | 88 | } |
89 | 89 | $this->addToProperty("class", "icon"); |
90 | 90 | $this->content=$iconO; |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
107 | 107 | $this->tagName="div"; |
108 | 108 | $this->addToProperty("class", "labeled"); |
109 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
109 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
110 | 110 | $this->content->setTagName("div"); |
111 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
111 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
112 | 112 | $label->setBasic(); |
113 | 113 | $this->addContent($label, $before); |
114 | 114 | return $label; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function fromArray($array) { |
122 | 122 | $array=parent::fromArray($array); |
123 | - foreach ( $array as $key => $value ) { |
|
123 | + foreach ($array as $key => $value) { |
|
124 | 124 | $this->setProperty($key, $value); |
125 | 125 | } |
126 | 126 | return $array; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | public static function social($identifier, $social, $value=NULL) { |
179 | - if ($value === NULL) |
|
179 | + if ($value===NULL) |
|
180 | 180 | $value=\ucfirst($social); |
181 | 181 | $return=new HtmlButton($identifier, $value); |
182 | 182 | $return->addIcon($social); |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | return $result; |
196 | 196 | } |
197 | 197 | |
198 | - public function asLink($href=NULL,$target=NULL) { |
|
199 | - $lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content,$target); |
|
198 | + public function asLink($href=NULL, $target=NULL) { |
|
199 | + $lnk=new HtmlLink("lnk-".$this->identifier, $href, $this->content, $target); |
|
200 | 200 | $this->content=$lnk; |
201 | 201 | return $this; |
202 | 202 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | use BaseTrait; |
23 | 23 | protected $_popup=NULL; |
24 | 24 | protected $_dimmer=NULL; |
25 | - protected $_params=array (); |
|
25 | + protected $_params=array(); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function addDimmer($params=array(), $content=NULL) { |
55 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
55 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
56 | 56 | $dimmer->setParams($params); |
57 | 57 | $dimmer->setContainer($this); |
58 | 58 | $this->addContent($dimmer); |
@@ -61,20 +61,20 @@ discard block |
||
61 | 61 | |
62 | 62 | public function addLabel($label, $before=false, $icon=NULL) { |
63 | 63 | $labelO=$label; |
64 | - if (\is_object($label) === false) { |
|
65 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
64 | + if (\is_object($label)===false) { |
|
65 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
66 | 66 | if (isset($icon)) |
67 | 67 | $labelO->addIcon($icon); |
68 | 68 | } else { |
69 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
69 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
70 | 70 | } |
71 | 71 | $this->addContent($labelO, $before); |
72 | 72 | return $labelO; |
73 | 73 | } |
74 | 74 | |
75 | - public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){ |
|
76 | - $label=$this->addLabel($label,true,$icon); |
|
77 | - $label->setAttached($side,$direction); |
|
75 | + public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) { |
|
76 | + $label=$this->addLabel($label, true, $icon); |
|
77 | + $label->setAttached($side, $direction); |
|
78 | 78 | return $this; |
79 | 79 | } |
80 | 80 | |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
84 | 84 | */ |
85 | - public function asLink($href=NULL,$target=NULL) { |
|
85 | + public function asLink($href=NULL, $target=NULL) { |
|
86 | 86 | if (isset($href)) |
87 | 87 | $this->setProperty("href", $href); |
88 | - if(isset($target)) |
|
88 | + if (isset($target)) |
|
89 | 89 | $this->setProperty("target", $target); |
90 | 90 | return $this->setTagName("a"); |
91 | 91 | } |
92 | 92 | |
93 | 93 | public function jsShowDimmer($show=true) { |
94 | 94 | $status="hide"; |
95 | - if ($show === true) |
|
95 | + if ($show===true) |
|
96 | 96 | $status="show"; |
97 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
97 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | public function run(JsUtils $js) { |
107 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
107 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
108 | 108 | parent::run($js); |
109 | 109 | $this->addEventsOnRun($js); |
110 | 110 | if (isset($this->_popup)) { |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
38 | - if (isset($this->_popup)) |
|
39 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
38 | + if (isset($this->_popup)) { |
|
39 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
@@ -63,8 +64,9 @@ discard block |
||
63 | 64 | $labelO=$label; |
64 | 65 | if (\is_object($label) === false) { |
65 | 66 | $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
66 | - if (isset($icon)) |
|
67 | - $labelO->addIcon($icon); |
|
67 | + if (isset($icon)) { |
|
68 | + $labelO->addIcon($icon); |
|
69 | + } |
|
68 | 70 | } else { |
69 | 71 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
70 | 72 | } |
@@ -83,23 +85,27 @@ discard block |
||
83 | 85 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
84 | 86 | */ |
85 | 87 | public function asLink($href=NULL,$target=NULL) { |
86 | - if (isset($href)) |
|
87 | - $this->setProperty("href", $href); |
|
88 | - if(isset($target)) |
|
89 | - $this->setProperty("target", $target); |
|
88 | + if (isset($href)) { |
|
89 | + $this->setProperty("href", $href); |
|
90 | + } |
|
91 | + if(isset($target)) { |
|
92 | + $this->setProperty("target", $target); |
|
93 | + } |
|
90 | 94 | return $this->setTagName("a"); |
91 | 95 | } |
92 | 96 | |
93 | 97 | public function jsShowDimmer($show=true) { |
94 | 98 | $status="hide"; |
95 | - if ($show === true) |
|
96 | - $status="show"; |
|
99 | + if ($show === true) { |
|
100 | + $status="show"; |
|
101 | + } |
|
97 | 102 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
98 | 103 | } |
99 | 104 | |
100 | 105 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
101 | - if (isset($this->_popup)) |
|
102 | - $this->_popup->compile($js); |
|
106 | + if (isset($this->_popup)) { |
|
107 | + $this->_popup->compile($js); |
|
108 | + } |
|
103 | 109 | return parent::compile($js, $view); |
104 | 110 | } |
105 | 111 |
@@ -11,29 +11,29 @@ discard block |
||
11 | 11 | * @property string identifier |
12 | 12 | * @property array $_compileParts |
13 | 13 | */ |
14 | -trait HasCheckboxesTrait{ |
|
14 | +trait HasCheckboxesTrait { |
|
15 | 15 | protected $_hasCheckboxes; |
16 | 16 | protected $_hasCheckedMessage=false; |
17 | 17 | protected $_checkedMessage; |
18 | 18 | protected $_checkedClass; |
19 | 19 | |
20 | - abstract public function addInToolbar($element,$callback=NULL); |
|
20 | + abstract public function addInToolbar($element, $callback=NULL); |
|
21 | 21 | |
22 | - protected function _runCheckboxes(JsUtils $js){ |
|
22 | + protected function _runCheckboxes(JsUtils $js) { |
|
23 | 23 | $js->execOn("change", "#".$this->identifier." [name='selection[]']:not(._jsonArrayChecked)", $this->_getCheckedChange($js)); |
24 | - if(\sizeof($this->_compileParts)<3){ |
|
25 | - $js->trigger("#".$this->identifier." [name='selection[]']","change",true); |
|
24 | + if (\sizeof($this->_compileParts)<3) { |
|
25 | + $js->trigger("#".$this->identifier." [name='selection[]']", "change", true); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | - protected function _getCheckedChange(JsUtils $js=NULL){ |
|
29 | + protected function _getCheckedChange(JsUtils $js=NULL) { |
|
30 | 30 | $callback="var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true; |
31 | 31 | \$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}}); |
32 | 32 | if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$this->_getCheckedMessageCall($js); |
33 | 33 | return $callback; |
34 | 34 | } |
35 | 35 | |
36 | - protected function _getCheckedMessageFunction(){ |
|
36 | + protected function _getCheckedMessageFunction() { |
|
37 | 37 | $msg=$this->getCheckedMessage(); |
38 | 38 | $checkedMessageFunction="$('#{$this->identifier}').bind('updateChecked',function() {var msg='".$msg[0]."',count=\$('#{$this->identifier} [name=\"selection[]\"]:checked').length,all=\$('#{$this->identifier} [name=\"selection[]\"]').length; |
39 | 39 | if(count==1) msg='".$msg[1]."'; |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | return $checkedMessageFunction; |
44 | 44 | } |
45 | 45 | |
46 | - protected function _getCheckedMessageCall(JsUtils $js=NULL){ |
|
46 | + protected function _getCheckedMessageCall(JsUtils $js=NULL) { |
|
47 | 47 | $checkedMessageCall=""; |
48 | - if($this->_hasCheckedMessage){ |
|
48 | + if ($this->_hasCheckedMessage) { |
|
49 | 49 | $checkedMessageCall="$('#{$this->identifier}').trigger('updateChecked');"; |
50 | - if(isset($this->_checkedClass)){ |
|
50 | + if (isset($this->_checkedClass)) { |
|
51 | 51 | $checkedMessageCall.="$(this).closest('tr').toggleClass('".$this->_checkedClass."',$(this).prop('checked'));"; |
52 | 52 | } |
53 | - if(isset($js)) |
|
54 | - $js->exec($this->_getCheckedMessageFunction(),true); |
|
53 | + if (isset($js)) |
|
54 | + $js->exec($this->_getCheckedMessageFunction(), true); |
|
55 | 55 | } |
56 | 56 | return $checkedMessageCall; |
57 | 57 | } |
58 | 58 | |
59 | - protected function _generateMainCheckbox(&$captions){ |
|
60 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
59 | + protected function _generateMainCheckbox(&$captions) { |
|
60 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
61 | 61 | $checkedMessageCall=""; |
62 | - if($this->_hasCheckedMessage) |
|
62 | + if ($this->_hasCheckedMessage) |
|
63 | 63 | $checkedMessageCall="$('#{$this->identifier}').trigger('updateChecked');"; |
64 | 64 | |
65 | 65 | $ck->setOnChecked($this->_setAllChecked("true").$checkedMessageCall); |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | \array_unshift($captions, $ck); |
68 | 68 | } |
69 | 69 | |
70 | - protected function _setAllChecked($checked){ |
|
70 | + protected function _setAllChecked($checked) { |
|
71 | 71 | $result="$('#".$this->identifier." [name=%quote%selection[]%quote%]:not(._jsonArrayChecked)').prop('checked',".$checked.");"; |
72 | - if(isset($this->_checkedClass)){ |
|
72 | + if (isset($this->_checkedClass)) { |
|
73 | 73 | $result.="$('#".$this->identifier." tr').toggleClass('".$this->_checkedClass."',".$checked.");"; |
74 | 74 | } |
75 | 75 | return $result; |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | protected function getCheckedMessage() { |
88 | - $result= $this->_checkedMessage; |
|
89 | - if(!isset($result)){ |
|
90 | - $result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"]; |
|
88 | + $result=$this->_checkedMessage; |
|
89 | + if (!isset($result)) { |
|
90 | + $result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"]; |
|
91 | 91 | } |
92 | 92 | return $result; |
93 | 93 | } |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | * @param array $checkedMessage |
108 | 108 | * @param callable $callback |
109 | 109 | */ |
110 | - public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){ |
|
111 | - if(isset($checkedMessage)) |
|
110 | + public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) { |
|
111 | + if (isset($checkedMessage)) |
|
112 | 112 | $this->_checkedMessage=$checkedMessage; |
113 | 113 | $checkedMessage=$this->getCheckedMessage(); |
114 | 114 | $this->_hasCheckboxes=true; |
115 | 115 | $this->_hasCheckedMessage=true; |
116 | - $element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]); |
|
117 | - $this->addInToolbar($element,$callback); |
|
116 | + $element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]); |
|
117 | + $this->addInToolbar($element, $callback); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public function setCheckedClass($_checkedClass) { |