@@ -24,39 +24,39 @@ discard block |
||
24 | 24 | private $_inverted; |
25 | 25 | |
26 | 26 | public function __construct($identifier, $modelInstance=NULL) { |
27 | - parent::__construct($identifier, null,$modelInstance); |
|
27 | + parent::__construct($identifier, null, $modelInstance); |
|
28 | 28 | $this->_form=new HtmlForm($identifier); |
29 | 29 | $this->_init(new FormInstanceViewer($identifier), 'form', $this->_form, true); |
30 | 30 | } |
31 | 31 | |
32 | - protected function _getFieldIdentifier($prefix,$name=''){ |
|
32 | + protected function _getFieldIdentifier($prefix, $name='') { |
|
33 | 33 | return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier(); |
34 | 34 | } |
35 | 35 | |
36 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
37 | - if(!$this->_generated){ |
|
36 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
37 | + if (!$this->_generated) { |
|
38 | 38 | $this->_instanceViewer->setInstance($this->_modelInstance); |
39 | 39 | |
40 | 40 | $form=$this->content['form']; |
41 | 41 | $this->_generateContent($form); |
42 | 42 | |
43 | - if(isset($this->_toolbar)){ |
|
43 | + if (isset($this->_toolbar)) { |
|
44 | 44 | $this->_setToolbarPosition($form); |
45 | 45 | } |
46 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,'form',PositionInTable::AFTERTABLE]); |
|
47 | - if($this->_inverted){ |
|
46 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, 'form', PositionInTable::AFTERTABLE]); |
|
47 | + if ($this->_inverted) { |
|
48 | 48 | $this->content['form']->setInverted(true); |
49 | 49 | } |
50 | 50 | $this->_generated=true; |
51 | 51 | } |
52 | - return parent::compile($js,$view); |
|
52 | + return parent::compile($js, $view); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @param HtmlForm $form |
57 | 57 | */ |
58 | - protected function _generateContent($form){ |
|
59 | - $values= $this->_instanceViewer->getValues(); |
|
58 | + protected function _generateContent($form) { |
|
59 | + $values=$this->_instanceViewer->getValues(); |
|
60 | 60 | $count=$this->_instanceViewer->count(); |
61 | 61 | $separators=$this->_instanceViewer->getSeparators(); |
62 | 62 | $headers=$this->_instanceViewer->getHeaders(); |
@@ -65,42 +65,42 @@ discard block |
||
65 | 65 | \sort($separators); |
66 | 66 | $size=\count($separators); |
67 | 67 | $nb=0; |
68 | - if($size===1){ |
|
68 | + if ($size===1) { |
|
69 | 69 | $i=-1; |
70 | - foreach ($values as $k=>$v){ |
|
71 | - $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++,$names[$k]??''); |
|
70 | + foreach ($values as $k=>$v) { |
|
71 | + $this->_generateFields($form, [$v], $headers, $i, $wrappers, $nb++, $names[$k] ?? ''); |
|
72 | 72 | $i++; |
73 | 73 | } |
74 | - }else{ |
|
74 | + } else { |
|
75 | 75 | $separators[]=$count; |
76 | - for($i=0;$i<$size;$i++){ |
|
77 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
78 | - $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers,$nb++,$names[$i]??''); |
|
76 | + for ($i=0; $i<$size; $i++) { |
|
77 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
78 | + $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers, $nb++, $names[$i] ?? ''); |
|
79 | 79 | } |
80 | 80 | } |
81 | - if($this->_hasRules && !$this->getForm()->hasValidationParams()){ |
|
81 | + if ($this->_hasRules && !$this->getForm()->hasValidationParams()) { |
|
82 | 82 | $this->setValidationParams(['inline'=>true]); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name){ |
|
86 | + protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name) { |
|
87 | 87 | $wrapper=null; |
88 | - if(isset($headers[$sepFirst+1])) |
|
89 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
90 | - if(isset($wrappers[$sepFirst+1])){ |
|
88 | + if (isset($headers[$sepFirst+1])) |
|
89 | + $form->addHeader($headers[$sepFirst+1], 4, true); |
|
90 | + if (isset($wrappers[$sepFirst+1])) { |
|
91 | 91 | $wrapper=$wrappers[$sepFirst+1]; |
92 | 92 | } |
93 | 93 | $count=\count($values); |
94 | - if($count===1){ |
|
94 | + if ($count===1) { |
|
95 | 95 | $added=$form->addField($values[0]); |
96 | - }elseif($count>1){ |
|
96 | + }elseif ($count>1) { |
|
97 | 97 | $added=$form->addFields($values); |
98 | - }else |
|
98 | + } else |
|
99 | 99 | return; |
100 | - if(isset($wrapper)){ |
|
101 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
100 | + if (isset($wrapper)) { |
|
101 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
102 | 102 | } |
103 | - $this->execHook('onGenerateFields',$added,$nb,$name); |
|
103 | + $this->execHook('onGenerateFields', $added, $nb, $name); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | * the generated field is the first parameter |
109 | 109 | * @param callable $callback the fonction to call when a field is generated |
110 | 110 | */ |
111 | - public function onGenerateField($callback){ |
|
112 | - $this->addHook('onGenerateFields',$callback); |
|
111 | + public function onGenerateField($callback) { |
|
112 | + $this->addHook('onGenerateFields', $callback); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @return HtmlForm |
117 | 117 | */ |
118 | - public function getForm(){ |
|
118 | + public function getForm() { |
|
119 | 119 | return $this->content['form']; |
120 | 120 | } |
121 | 121 | |
122 | - public function addSeparatorAfter($fieldNum){ |
|
122 | + public function addSeparatorAfter($fieldNum) { |
|
123 | 123 | $fieldNum=$this->_getIndex($fieldNum); |
124 | 124 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
125 | 125 | return $this; |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | return $this; |
135 | 135 | } |
136 | 136 | |
137 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
138 | - return $this->_fieldAs(function($id,$name,$value) use ($cssStyle){ |
|
139 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
137 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
138 | + return $this->_fieldAs(function($id, $name, $value) use ($cssStyle){ |
|
139 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
140 | 140 | $button->setProperty('type', 'reset'); |
141 | 141 | return $button; |
142 | - }, $index,$attributes); |
|
142 | + }, $index, $attributes); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
159 | 159 | } |
160 | 160 | |
161 | - public function addDividerBefore($index,$title){ |
|
161 | + public function addDividerBefore($index, $title) { |
|
162 | 162 | $index=$this->_getIndex($index); |
163 | 163 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
167 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
168 | 168 | $index=$this->_getIndex($index); |
169 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
169 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
170 | 170 | return $this; |
171 | 171 | } |
172 | 172 | |
173 | - public function run(JsUtils $js){ |
|
173 | + public function run(JsUtils $js) { |
|
174 | 174 | parent::run($js); |
175 | 175 | } |
176 | 176 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++,$names[$k]??''); |
72 | 72 | $i++; |
73 | 73 | } |
74 | - }else{ |
|
74 | + } else{ |
|
75 | 75 | $separators[]=$count; |
76 | 76 | for($i=0;$i<$size;$i++){ |
77 | 77 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -85,18 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name){ |
87 | 87 | $wrapper=null; |
88 | - if(isset($headers[$sepFirst+1])) |
|
89 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
88 | + if(isset($headers[$sepFirst+1])) { |
|
89 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
90 | + } |
|
90 | 91 | if(isset($wrappers[$sepFirst+1])){ |
91 | 92 | $wrapper=$wrappers[$sepFirst+1]; |
92 | 93 | } |
93 | 94 | $count=\count($values); |
94 | 95 | if($count===1){ |
95 | 96 | $added=$form->addField($values[0]); |
96 | - }elseif($count>1){ |
|
97 | + } elseif($count>1){ |
|
97 | 98 | $added=$form->addFields($values); |
98 | - }else |
|
99 | - return; |
|
99 | + } else { |
|
100 | + return; |
|
101 | + } |
|
100 | 102 | if(isset($wrapper)){ |
101 | 103 | $added->wrap($wrapper[0],$wrapper[1]); |
102 | 104 | } |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier, $items = array(), $label = NULL, $value = "", $multiple = false, $associative = true) { |
|
11 | - parent::__construct("field-" . $identifier, (new HtmlDropdown("dropdown-" . $identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | - $this->_identifier = $identifier; |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value="", $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | + $this->_identifier=$identifier; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setItems($items) { |
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | 18 | |
19 | - public function addItem($item, $value = NULL, $image = NULL) { |
|
19 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
20 | 20 | return $this->getField()->addItem($item, $value, $image); |
21 | 21 | } |
22 | 22 | |
23 | - public static function multipleDropdown($identifier, $items = array(), $label = NULL, $value = "", $associative = true) { |
|
23 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value="", $associative=true) { |
|
24 | 24 | return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return $this->getField()->getInput(); |
33 | 33 | } |
34 | 34 | |
35 | - public function asSelect($name = NULL, $multiple = false, $selection = true) { |
|
35 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
36 | 36 | $this->getField()->asSelect($name, $multiple, $selection); |
37 | 37 | return $this; |
38 | 38 | } |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param boolean $floating |
43 | 43 | * @return HtmlDropdown |
44 | 44 | */ |
45 | - public function asButton($floating = false) { |
|
46 | - $field = $this->content["field"]; |
|
47 | - $label = $this->content["label"]; |
|
45 | + public function asButton($floating=false) { |
|
46 | + $field=$this->content["field"]; |
|
47 | + $label=$this->content["label"]; |
|
48 | 48 | $field->addContent($label); |
49 | - $this->content = [ |
|
49 | + $this->content=[ |
|
50 | 50 | "field" => $field |
51 | 51 | ]; |
52 | 52 | $this->content["field"]->asButton($floating); |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | * @param boolean $labeled |
62 | 62 | * @return mixed|HtmlButton |
63 | 63 | */ |
64 | - public function addAction($action, $direction = Direction::RIGHT, $icon = NULL, $labeled = false) { |
|
64 | + public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
|
65 | 65 | $this->getField()->setStyle('display:inline-block; width: auto'); |
66 | - $actionO = $action; |
|
67 | - if (\is_object($action) === false) { |
|
68 | - $actionO = new HtmlButton("action-" . $this->identifier, $action); |
|
66 | + $actionO=$action; |
|
67 | + if (\is_object($action)===false) { |
|
68 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
69 | 69 | if (isset($icon)) |
70 | 70 | $actionO->addIcon($icon, true, $labeled); |
71 | 71 | } |
72 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
72 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
73 | 73 | return $actionO; |
74 | 74 | } |
75 | 75 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | $actionO = $action; |
67 | 67 | if (\is_object($action) === false) { |
68 | 68 | $actionO = new HtmlButton("action-" . $this->identifier, $action); |
69 | - if (isset($icon)) |
|
70 | - $actionO->addIcon($icon, true, $labeled); |
|
69 | + if (isset($icon)) { |
|
70 | + $actionO->addIcon($icon, true, $labeled); |
|
71 | + } |
|
71 | 72 | } |
72 | 73 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
73 | 74 | return $actionO; |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @var string|array |
31 | 31 | */ |
32 | - protected $_contentSeparator = ""; |
|
32 | + protected $_contentSeparator=""; |
|
33 | 33 | |
34 | 34 | public function __construct($identifier, $tagName, $baseClass) { |
35 | 35 | parent::__construct($identifier, $tagName, $baseClass); |
36 | - $this->root = ""; |
|
37 | - $this->attr = "data-ajax"; |
|
36 | + $this->root=""; |
|
37 | + $this->attr="data-ajax"; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | return JArray::implode($this->_contentSeparator, $this->content); |
55 | 55 | } |
56 | 56 | |
57 | - public function setContentDivider($divider, $index = NULL) { |
|
58 | - $divider = "<div class='divider'> {$divider} </div>"; |
|
57 | + public function setContentDivider($divider, $index=NULL) { |
|
58 | + $divider="<div class='divider'> {$divider} </div>"; |
|
59 | 59 | return $this->setDivider($divider, $index); |
60 | 60 | } |
61 | 61 | |
62 | - public function setIconContentDivider($iconContentDivider, $index = NULL) { |
|
63 | - $contentDivider = "<i class='" . $iconContentDivider . " icon divider'></i>"; |
|
62 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
63 | + $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
|
64 | 64 | return $this->setDivider($contentDivider, $index); |
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function setDivider($divider, $index) { |
68 | 68 | if (isset($index)) { |
69 | - if (! \is_array($this->_contentSeparator)) |
|
70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
71 | - $this->_contentSeparator[$index] = $divider; |
|
69 | + if (!\is_array($this->_contentSeparator)) |
|
70 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
71 | + $this->_contentSeparator[$index]=$divider; |
|
72 | 72 | } else { |
73 | - $this->_contentSeparator = $divider; |
|
73 | + $this->_contentSeparator=$divider; |
|
74 | 74 | } |
75 | 75 | return $this; |
76 | 76 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | |
67 | 67 | protected function setDivider($divider, $index) { |
68 | 68 | if (isset($index)) { |
69 | - if (! \is_array($this->_contentSeparator)) |
|
70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
69 | + if (! \is_array($this->_contentSeparator)) { |
|
70 | + $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
71 | + } |
|
71 | 72 | $this->_contentSeparator[$index] = $divider; |
72 | 73 | } else { |
73 | 74 | $this->_contentSeparator = $divider; |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class HtmlModal extends HtmlSemDoubleElement { |
18 | 18 | |
19 | - protected $_params = []; |
|
19 | + protected $_params=[]; |
|
20 | 20 | |
21 | - protected $_paramParts = []; |
|
21 | + protected $_paramParts=[]; |
|
22 | 22 | |
23 | - public function __construct($identifier, $header = '', $content = '', $actions = null) { |
|
23 | + public function __construct($identifier, $header='', $content='', $actions=null) { |
|
24 | 24 | parent::__construct($identifier, 'div', 'ui modal'); |
25 | 25 | if (isset($header)) { |
26 | 26 | $this->setHeader($header); |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function setHeader($value) { |
37 | - $this->content['header'] = new HtmlSemDoubleElement('header-' . $this->identifier, 'a', 'header', $value); |
|
37 | + $this->content['header']=new HtmlSemDoubleElement('header-'.$this->identifier, 'a', 'header', $value); |
|
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function setContent($value) { |
42 | - $this->content['content'] = new HtmlSemDoubleElement('content-' . $this->identifier, 'div', 'content', $value); |
|
42 | + $this->content['content']=new HtmlSemDoubleElement('content-'.$this->identifier, 'div', 'content', $value); |
|
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * @return HtmlButton[] |
51 | 51 | */ |
52 | 52 | public function setActions($actions): array { |
53 | - $this->content['actions'] = new HtmlSemDoubleElement('content-' . $this->identifier, 'div', 'actions'); |
|
54 | - $r = []; |
|
53 | + $this->content['actions']=new HtmlSemDoubleElement('content-'.$this->identifier, 'div', 'actions'); |
|
54 | + $r=[]; |
|
55 | 55 | if (\is_array($actions)) { |
56 | 56 | foreach ($actions as $action) { |
57 | - $r[] = $this->addAction($action); |
|
57 | + $r[]=$this->addAction($action); |
|
58 | 58 | } |
59 | 59 | } else { |
60 | - $r[] = $this->addAction($actions); |
|
60 | + $r[]=$this->addAction($actions); |
|
61 | 61 | } |
62 | 62 | return $r; |
63 | 63 | } |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | * @return HtmlButton |
69 | 69 | */ |
70 | 70 | public function addAction($action) { |
71 | - if (! $action instanceof BaseHtml) { |
|
72 | - $class = ''; |
|
71 | + if (!$action instanceof BaseHtml) { |
|
72 | + $class=''; |
|
73 | 73 | if (\array_search($action, [ |
74 | 74 | 'Okay', |
75 | 75 | 'Yes', |
76 | 76 | 'Validate' |
77 | - ]) !== false) { |
|
78 | - $class = 'approve'; |
|
77 | + ])!==false) { |
|
78 | + $class='approve'; |
|
79 | 79 | } |
80 | 80 | if (\array_search($action, [ |
81 | 81 | 'Close', |
82 | 82 | 'Cancel', |
83 | 83 | 'No' |
84 | - ]) !== false) { |
|
85 | - $class = 'cancel'; |
|
84 | + ])!==false) { |
|
85 | + $class='cancel'; |
|
86 | 86 | } |
87 | - $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
|
88 | - if ($class !== '') |
|
87 | + $action=new HtmlButton('action-'.$this->identifier.'-'.JArray::count($this->content['actions']->getContent()), $action); |
|
88 | + if ($class!=='') |
|
89 | 89 | $action->addToProperty('class', $class); |
90 | 90 | } |
91 | 91 | return $this->addElementInPart($action, 'actions'); |
@@ -100,33 +100,33 @@ discard block |
||
100 | 100 | return $this->content['actions']->getContent()[$index]; |
101 | 101 | } |
102 | 102 | |
103 | - public function addContent($content, $before = false) { |
|
103 | + public function addContent($content, $before=false) { |
|
104 | 104 | $this->content['content']->addContent($content, $before); |
105 | 105 | return $this; |
106 | 106 | } |
107 | 107 | |
108 | - public function addImageContent($image, $description = NULL) { |
|
109 | - $content = $this->content['content']; |
|
108 | + public function addImageContent($image, $description=NULL) { |
|
109 | + $content=$this->content['content']; |
|
110 | 110 | if (isset($description)) { |
111 | - $description = new HtmlSemDoubleElement('description-' . $this->identifier, 'div', 'description', $description); |
|
111 | + $description=new HtmlSemDoubleElement('description-'.$this->identifier, 'div', 'description', $description); |
|
112 | 112 | $content->addContent($description, true); |
113 | 113 | } |
114 | - if ($image !== '') { |
|
115 | - $img = new HtmlImage('image-' . $this->identifier, $image, '', 'medium'); |
|
114 | + if ($image!=='') { |
|
115 | + $img=new HtmlImage('image-'.$this->identifier, $image, '', 'medium'); |
|
116 | 116 | $content->addContent($img, true); |
117 | 117 | $content->addToProperty('class', 'image'); |
118 | 118 | } |
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | - public function addIconContent($icon, $description = NULL) { |
|
123 | - $content = $this->content['content']; |
|
122 | + public function addIconContent($icon, $description=NULL) { |
|
123 | + $content=$this->content['content']; |
|
124 | 124 | if (isset($description)) { |
125 | - $description = new HtmlSemDoubleElement('description-' . $this->identifier, 'div', 'description', $description); |
|
125 | + $description=new HtmlSemDoubleElement('description-'.$this->identifier, 'div', 'description', $description); |
|
126 | 126 | $content->addContent($description, true); |
127 | 127 | } |
128 | - if ($icon !== '') { |
|
129 | - $img = new HtmlIcon('image-' . $this->identifier, $icon); |
|
128 | + if ($icon!=='') { |
|
129 | + $img=new HtmlIcon('image-'.$this->identifier, $icon); |
|
130 | 130 | $content->addContent($img, true); |
131 | 131 | $content->addToProperty('class', 'image'); |
132 | 132 | } |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | public function showDimmer($value) { |
142 | - $value = $value ? 'show' : 'hide'; |
|
143 | - $this->_paramParts[] = [ |
|
144 | - "'" . $value . " dimmer'" |
|
142 | + $value=$value ? 'show' : 'hide'; |
|
143 | + $this->_paramParts[]=[ |
|
144 | + "'".$value." dimmer'" |
|
145 | 145 | ]; |
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | - public function setInverted($recursive = true) { |
|
150 | - $this->_params['inverted'] = true; |
|
149 | + public function setInverted($recursive=true) { |
|
150 | + $this->_params['inverted']=true; |
|
151 | 151 | return $this; |
152 | 152 | } |
153 | 153 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | public function setTransition($value) { |
159 | - $this->_paramParts[] = [ |
|
159 | + $this->_paramParts[]=[ |
|
160 | 160 | "'setting'", |
161 | 161 | "'transition'", |
162 | - "'" . $value . "'" |
|
162 | + "'".$value."'" |
|
163 | 163 | ]; |
164 | 164 | } |
165 | 165 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param array $params |
173 | 173 | * The parameters to pass to the view |
174 | 174 | */ |
175 | - public function renderView(JsUtils $js, $initialController, $viewName, $params = array()) { |
|
175 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
176 | 176 | return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
177 | 177 | } |
178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * the action name |
188 | 188 | * @param array $params |
189 | 189 | */ |
190 | - public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params = NULL) { |
|
190 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
191 | 191 | return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
192 | 192 | } |
193 | 193 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
199 | 199 | */ |
200 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
201 | - $this->content = JArray::sortAssociative($this->content, [ |
|
200 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
201 | + $this->content=JArray::sortAssociative($this->content, [ |
|
202 | 202 | 'header', |
203 | 203 | 'content', |
204 | 204 | 'actions' |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | * @see BaseHtml::run() |
215 | 215 | */ |
216 | 216 | public function run(JsUtils $js) { |
217 | - if (isset($this->_bsComponent) === false) |
|
218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
217 | + if (isset($this->_bsComponent)===false) |
|
218 | + $this->_bsComponent=$js->semantic()->modal('#'.$this->identifier, $this->_params, $this->_paramParts); |
|
219 | 219 | $this->addEventsOnRun($js); |
220 | 220 | return $this->_bsComponent; |
221 | 221 | } |
222 | 222 | |
223 | 223 | public function jsDo($behavior) { |
224 | - return "$('#" . $this->identifier . "').modal('" . $behavior . "');"; |
|
224 | + return "$('#".$this->identifier."').modal('".$behavior."');"; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | public function jsHide() { |
@@ -229,6 +229,6 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | public function onHidden($js) { |
232 | - $this->_params['onHidden'] = $js; |
|
232 | + $this->_params['onHidden']=$js; |
|
233 | 233 | } |
234 | 234 | } |
@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | $class = 'cancel'; |
86 | 86 | } |
87 | 87 | $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
88 | - if ($class !== '') |
|
89 | - $action->addToProperty('class', $class); |
|
88 | + if ($class !== '') { |
|
89 | + $action->addToProperty('class', $class); |
|
90 | + } |
|
90 | 91 | } |
91 | 92 | return $this->addElementInPart($action, 'actions'); |
92 | 93 | } |
@@ -214,8 +215,9 @@ discard block |
||
214 | 215 | * @see BaseHtml::run() |
215 | 216 | */ |
216 | 217 | public function run(JsUtils $js) { |
217 | - if (isset($this->_bsComponent) === false) |
|
218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
218 | + if (isset($this->_bsComponent) === false) { |
|
219 | + $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
220 | + } |
|
219 | 221 | $this->addEventsOnRun($js); |
220 | 222 | return $this->_bsComponent; |
221 | 223 | } |