@@ -15,15 +15,28 @@ discard block |
||
| 15 | 15 | * @property InstanceViewer $_instanceViewer |
| 16 | 16 | */ |
| 17 | 17 | trait DataTableFieldAsTrait{ |
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * @param \Closure $field |
|
| 21 | + */ |
|
| 18 | 22 | abstract public function addField($field); |
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @param integer $index |
|
| 26 | + * @param \Closure $field |
|
| 27 | + */ |
|
| 19 | 28 | abstract public function insertField($index,$field); |
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @param \Closure $field |
|
| 32 | + */ |
|
| 20 | 33 | abstract public function insertInField($index,$field); |
| 21 | 34 | abstract public function fieldAs($index,$type,$attributes=NULL); |
| 22 | 35 | /** |
| 23 | 36 | * @param string $caption |
| 24 | 37 | * @param callable $callback |
| 25 | 38 | * @param boolean $visibleHover |
| 26 | - * @return callable |
|
| 39 | + * @return \Closure |
|
| 27 | 40 | */ |
| 28 | 41 | private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
| 29 | 42 | return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
@@ -33,7 +46,7 @@ discard block |
||
| 33 | 46 | * @param callable $thisCallback |
| 34 | 47 | * @param array $parameters |
| 35 | 48 | * @param callable $callback |
| 36 | - * @return callable |
|
| 49 | + * @return \Closure |
|
| 37 | 50 | */ |
| 38 | 51 | private function getCallable($thisCallback,$parameters,$callback=null){ |
| 39 | 52 | $result=function($instance) use($thisCallback,$parameters,$callback){ |
@@ -103,7 +116,7 @@ discard block |
||
| 103 | 116 | * @param string $caption |
| 104 | 117 | * @param callable $callback |
| 105 | 118 | * @param boolean $visibleHover |
| 106 | - * @return DataTable |
|
| 119 | + * @return DataTableFieldAsTrait |
|
| 107 | 120 | */ |
| 108 | 121 | public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
| 109 | 122 | $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
@@ -115,7 +128,7 @@ discard block |
||
| 115 | 128 | * @param array $buttons |
| 116 | 129 | * @param callable $callback |
| 117 | 130 | * @param boolean $visibleHover |
| 118 | - * @return DataTable |
|
| 131 | + * @return DataTableFieldAsTrait |
|
| 119 | 132 | */ |
| 120 | 133 | public function addFieldButtons($buttons,$visibleHover=true,$callback=null){ |
| 121 | 134 | $this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback)); |
@@ -127,7 +140,7 @@ discard block |
||
| 127 | 140 | * @param int $index |
| 128 | 141 | * @param string $caption |
| 129 | 142 | * @param callable $callback |
| 130 | - * @return DataTable |
|
| 143 | + * @return DataTableFieldAsTrait |
|
| 131 | 144 | */ |
| 132 | 145 | public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
| 133 | 146 | $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
@@ -139,18 +152,27 @@ discard block |
||
| 139 | 152 | * @param int $index |
| 140 | 153 | * @param string $caption |
| 141 | 154 | * @param callable $callback |
| 142 | - * @return DataTable |
|
| 155 | + * @return DataTableFieldAsTrait |
|
| 143 | 156 | */ |
| 144 | 157 | public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
| 145 | 158 | $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
| 146 | 159 | return $this; |
| 147 | 160 | } |
| 148 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $icon |
|
| 164 | + * @param string $class |
|
| 165 | + * @param callable $callback |
|
| 166 | + */ |
|
| 149 | 167 | private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
| 150 | 168 | $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
| 151 | 169 | return $this; |
| 152 | 170 | } |
| 153 | 171 | |
| 172 | + /** |
|
| 173 | + * @param string $icon |
|
| 174 | + * @param string $class |
|
| 175 | + */ |
|
| 154 | 176 | private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
| 155 | 177 | $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
| 156 | 178 | return $this; |
@@ -169,7 +191,7 @@ discard block |
||
| 169 | 191 | * @param boolean $visibleHover |
| 170 | 192 | * @param array $deleteBehavior default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"data-ajax","params"=>"{}","method"=>"get") |
| 171 | 193 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 172 | - * @return DataTable |
|
| 194 | + * @return DataTableFieldAsTrait |
|
| 173 | 195 | */ |
| 174 | 196 | public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
| 175 | 197 | $this->_deleteBehavior=$deleteBehavior; |
@@ -181,7 +203,7 @@ discard block |
||
| 181 | 203 | * @param string $visibleHover |
| 182 | 204 | * @param array $editBehavior default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"data-ajax","params"=>"{}","method"=>"get") |
| 183 | 205 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 184 | - * @return DataTable |
|
| 206 | + * @return DataTableFieldAsTrait |
|
| 185 | 207 | */ |
| 186 | 208 | public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
| 187 | 209 | $this->_editBehavior=$editBehavior; |
@@ -194,7 +216,7 @@ discard block |
||
| 194 | 216 | * @param array $behavior default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"data-ajax","params"=>"{}","method"=>"get") |
| 195 | 217 | * @param callable $callbackEdit this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 196 | 218 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 197 | - * @return DataTable |
|
| 219 | + * @return DataTableFieldAsTrait |
|
| 198 | 220 | */ |
| 199 | 221 | public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
| 200 | 222 | $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
@@ -203,6 +225,9 @@ discard block |
||
| 203 | 225 | return $this; |
| 204 | 226 | } |
| 205 | 227 | |
| 228 | + /** |
|
| 229 | + * @param callable $callback |
|
| 230 | + */ |
|
| 206 | 231 | public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
| 207 | 232 | $this->_deleteBehavior=$deleteBehavior; |
| 208 | 233 | return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback); |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | * @property boolean $_visibleHover |
| 15 | 15 | * @property InstanceViewer $_instanceViewer |
| 16 | 16 | */ |
| 17 | -trait DataTableFieldAsTrait{ |
|
| 17 | +trait DataTableFieldAsTrait { |
|
| 18 | 18 | abstract public function addField($field); |
| 19 | - abstract public function insertField($index,$field); |
|
| 20 | - abstract public function insertInField($index,$field); |
|
| 21 | - abstract public function fieldAs($index,$type,$attributes=NULL); |
|
| 19 | + abstract public function insertField($index, $field); |
|
| 20 | + abstract public function insertInField($index, $field); |
|
| 21 | + abstract public function fieldAs($index, $type, $attributes=NULL); |
|
| 22 | 22 | /** |
| 23 | 23 | * @param string $caption |
| 24 | 24 | * @param callable $callback |
| 25 | 25 | * @param boolean $visibleHover |
| 26 | 26 | * @return callable |
| 27 | 27 | */ |
| 28 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
| 29 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
| 28 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
| 29 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,20 +35,20 @@ discard block |
||
| 35 | 35 | * @param callable $callback |
| 36 | 36 | * @return callable |
| 37 | 37 | */ |
| 38 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 39 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 40 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 41 | - if(isset($callback)){ |
|
| 42 | - if(\is_callable($callback)){ |
|
| 43 | - $callback($object,$instance,$this->_instanceViewer->count()+1); |
|
| 38 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 39 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 40 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 41 | + if (isset($callback)) { |
|
| 42 | + if (\is_callable($callback)) { |
|
| 43 | + $callback($object, $instance, $this->_instanceViewer->count()+1); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 46 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 47 | 47 | $id=$this->_instanceViewer->getIdentifier(); |
| 48 | - $object->setProperty("data-ajax",$id); |
|
| 49 | - if($object->propertyContains("class","visibleover")){ |
|
| 48 | + $object->setProperty("data-ajax", $id); |
|
| 49 | + if ($object->propertyContains("class", "visibleover")) { |
|
| 50 | 50 | $this->_visibleHover=true; |
| 51 | - $object->setProperty("style","visibility:hidden;"); |
|
| 51 | + $object->setProperty("style", "visibility:hidden;"); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | return $object; |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | * @param string $caption |
| 61 | 61 | * @return HtmlButton |
| 62 | 62 | */ |
| 63 | - private function getFieldButton($caption,$visibleHover=true){ |
|
| 64 | - $bt= new HtmlButton($this->cleanIdentifier($caption),$caption); |
|
| 65 | - if($visibleHover) |
|
| 63 | + private function getFieldButton($caption, $visibleHover=true) { |
|
| 64 | + $bt=new HtmlButton($this->cleanIdentifier($caption), $caption); |
|
| 65 | + if ($visibleHover) |
|
| 66 | 66 | $this->_visibleOver($bt); |
| 67 | 67 | return $bt; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - private function getFieldButtons($buttons,$visibleHover=true){ |
|
| 71 | - $bts=new HtmlButtonGroups("",$buttons); |
|
| 72 | - if($visibleHover) |
|
| 70 | + private function getFieldButtons($buttons, $visibleHover=true) { |
|
| 71 | + $bts=new HtmlButtonGroups("", $buttons); |
|
| 72 | + if ($visibleHover) |
|
| 73 | 73 | $this->_visibleOver($bts); |
| 74 | 74 | return $bts; |
| 75 | 75 | } |
@@ -83,19 +83,19 @@ discard block |
||
| 83 | 83 | * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
| 84 | 84 | * @return DataTable |
| 85 | 85 | */ |
| 86 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
| 87 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
|
| 88 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 89 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
|
| 90 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 86 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 87 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){ |
|
| 88 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 89 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]); |
|
| 90 | + if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 91 | 91 | $this->_visibleOver($button); |
| 92 | 92 | return $button; |
| 93 | - }, $index,$attributes); |
|
| 93 | + }, $index, $attributes); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - protected function _visibleOver(BaseHtml $element){ |
|
| 96 | + protected function _visibleOver(BaseHtml $element) { |
|
| 97 | 97 | $this->_visibleHover=true; |
| 98 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
| 98 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * @param boolean $visibleHover |
| 106 | 106 | * @return DataTable |
| 107 | 107 | */ |
| 108 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
| 109 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
| 108 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
| 109 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
| 110 | 110 | return $this; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * @param boolean $visibleHover |
| 118 | 118 | * @return DataTable |
| 119 | 119 | */ |
| 120 | - public function addFieldButtons($buttons,$visibleHover=true,$callback=null){ |
|
| 121 | - $this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback)); |
|
| 120 | + public function addFieldButtons($buttons, $visibleHover=true, $callback=null) { |
|
| 121 | + $this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback)); |
|
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param callable $callback |
| 130 | 130 | * @return DataTable |
| 131 | 131 | */ |
| 132 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
| 133 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
| 132 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
| 133 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
| 134 | 134 | return $this; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -141,25 +141,25 @@ discard block |
||
| 141 | 141 | * @param callable $callback |
| 142 | 142 | * @return DataTable |
| 143 | 143 | */ |
| 144 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
| 145 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
| 144 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
| 145 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
| 146 | 146 | return $this; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
|
| 150 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
| 149 | + private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) { |
|
| 150 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
|
| 155 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
| 154 | + private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) { |
|
| 155 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
| 156 | 156 | return $this; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
| 160 | - $bt=$this->getFieldButton("",$visibleHover); |
|
| 159 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
| 160 | + $bt=$this->getFieldButton("", $visibleHover); |
|
| 161 | 161 | $bt->asIcon($icon); |
| 162 | - if(isset($class)) |
|
| 162 | + if (isset($class)) |
|
| 163 | 163 | $bt->addClass($class); |
| 164 | 164 | return $bt; |
| 165 | 165 | } |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 172 | 172 | * @return DataTable |
| 173 | 173 | */ |
| 174 | - public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
| 174 | + public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
| 175 | 175 | $this->_deleteBehavior=$deleteBehavior; |
| 176 | - return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback); |
|
| 176 | + return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 184 | 184 | * @return DataTable |
| 185 | 185 | */ |
| 186 | - public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
|
| 186 | + public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) { |
|
| 187 | 187 | $this->_editBehavior=$editBehavior; |
| 188 | - return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback); |
|
| 188 | + return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -196,20 +196,20 @@ discard block |
||
| 196 | 196 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 197 | 197 | * @return DataTable |
| 198 | 198 | */ |
| 199 | - public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
|
| 200 | - $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
|
| 199 | + public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) { |
|
| 200 | + $this->addEditButton($visibleHover, $behavior, $callbackEdit); |
|
| 201 | 201 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 202 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
| 202 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
| 203 | 203 | return $this; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
| 206 | + public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
| 207 | 207 | $this->_deleteBehavior=$deleteBehavior; |
| 208 | - return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback); |
|
| 208 | + return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){ |
|
| 211 | + public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) { |
|
| 212 | 212 | $this->_editBehavior=$editBehavior; |
| 213 | - return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback); |
|
| 213 | + return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback); |
|
| 214 | 214 | } |
| 215 | 215 | } |
@@ -62,15 +62,17 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | private function getFieldButton($caption,$visibleHover=true){ |
| 64 | 64 | $bt= new HtmlButton($this->cleanIdentifier($caption),$caption); |
| 65 | - if($visibleHover) |
|
| 66 | - $this->_visibleOver($bt); |
|
| 65 | + if($visibleHover) { |
|
| 66 | + $this->_visibleOver($bt); |
|
| 67 | + } |
|
| 67 | 68 | return $bt; |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | private function getFieldButtons($buttons,$visibleHover=true){ |
| 71 | 72 | $bts=new HtmlButtonGroups("",$buttons); |
| 72 | - if($visibleHover) |
|
| 73 | - $this->_visibleOver($bts); |
|
| 73 | + if($visibleHover) { |
|
| 74 | + $this->_visibleOver($bts); |
|
| 75 | + } |
|
| 74 | 76 | return $bts; |
| 75 | 77 | } |
| 76 | 78 | |
@@ -87,8 +89,9 @@ discard block |
||
| 87 | 89 | return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
| 88 | 90 | $button=new HtmlButton($id,$value,$cssStyle); |
| 89 | 91 | $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
| 90 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 91 | - $this->_visibleOver($button); |
|
| 92 | + if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) { |
|
| 93 | + $this->_visibleOver($button); |
|
| 94 | + } |
|
| 92 | 95 | return $button; |
| 93 | 96 | }, $index,$attributes); |
| 94 | 97 | } |
@@ -159,8 +162,9 @@ discard block |
||
| 159 | 162 | private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
| 160 | 163 | $bt=$this->getFieldButton("",$visibleHover); |
| 161 | 164 | $bt->asIcon($icon); |
| 162 | - if(isset($class)) |
|
| 163 | - $bt->addClass($class); |
|
| 165 | + if(isset($class)) { |
|
| 166 | + $bt->addClass($class); |
|
| 167 | + } |
|
| 164 | 168 | return $bt; |
| 165 | 169 | } |
| 166 | 170 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * define the button style |
| 50 | - * @param string|int $cssStyle |
|
| 50 | + * @param string $cssStyle |
|
| 51 | 51 | * @return HtmlButton default : "" |
| 52 | 52 | */ |
| 53 | 53 | public function setStyle($cssStyle) { |
@@ -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; |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | * @return HtmlLabel |
| 105 | 105 | */ |
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | - $this->tagName="div";$prefix=""; |
|
| 108 | - if($before) |
|
| 107 | + $this->tagName="div"; $prefix=""; |
|
| 108 | + if ($before) |
|
| 109 | 109 | $prefix="left "; |
| 110 | 110 | $this->addToProperty("class", $prefix."labeled"); |
| 111 | 111 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
| 112 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 113 | - if($isIcon){ |
|
| 112 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 113 | + if ($isIcon) { |
|
| 114 | 114 | $this->content->addClass("icon"); |
| 115 | 115 | } |
| 116 | 116 | $this->content->setTagName("div"); |
| 117 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
| 117 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
| 118 | 118 | $label->setBasic(); |
| 119 | 119 | $this->addContent($label, $before); |
| 120 | 120 | return $label; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function fromArray($array) { |
| 128 | 128 | $array=parent::fromArray($array); |
| 129 | - foreach ( $array as $key => $value ) { |
|
| 129 | + foreach ($array as $key => $value) { |
|
| 130 | 130 | $this->setProperty($key, $value); |
| 131 | 131 | } |
| 132 | 132 | return $array; |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | return $this->addToProperty("class", "positive"); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function setColor($color){ |
|
| 144 | - if(\is_array($this->content)){ |
|
| 145 | - foreach ($this->content as $content){ |
|
| 146 | - if($content instanceof HtmlButton) |
|
| 143 | + public function setColor($color) { |
|
| 144 | + if (\is_array($this->content)) { |
|
| 145 | + foreach ($this->content as $content) { |
|
| 146 | + if ($content instanceof HtmlButton) |
|
| 147 | 147 | $content->setColor($color); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @return HtmlButton |
| 202 | 202 | */ |
| 203 | 203 | public static function social($identifier, $social, $value=NULL) { |
| 204 | - if ($value === NULL) |
|
| 204 | + if ($value===NULL) |
|
| 205 | 205 | $value=\ucfirst($social); |
| 206 | 206 | $return=new HtmlButton($identifier, $value); |
| 207 | 207 | $return->addIcon($social); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | * {@inheritDoc} |
| 239 | 239 | * @see HtmlSemDoubleElement::asLink() |
| 240 | 240 | */ |
| 241 | - public function asLink($href=NULL,$target=NULL) { |
|
| 242 | - parent::asLink($href,$target); |
|
| 241 | + public function asLink($href=NULL, $target=NULL) { |
|
| 242 | + parent::asLink($href, $target); |
|
| 243 | 243 | return $this; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | * @param string $icon |
| 253 | 253 | * @return HtmlButtonGroups |
| 254 | 254 | */ |
| 255 | - public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
| 256 | - $result=new HtmlButtonGroups($identifier,[$value]); |
|
| 257 | - $result->addDropdown($items,$asCombo); |
|
| 258 | - if(isset($icon)) |
|
| 255 | + public static function dropdown($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
| 256 | + $result=new HtmlButtonGroups($identifier, [$value]); |
|
| 257 | + $result->addDropdown($items, $asCombo); |
|
| 258 | + if (isset($icon)) |
|
| 259 | 259 | $result->setIcon($icon); |
| 260 | 260 | return $result; |
| 261 | 261 | } |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 59 | - $this->setProperty("tabindex", "0"); |
|
| 60 | - else { |
|
| 58 | + if ($value === true) { |
|
| 59 | + $this->setProperty("tabindex", "0"); |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removeProperty("tabindex"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -105,8 +105,9 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | 107 | $this->tagName="div";$prefix=""; |
| 108 | - if($before) |
|
| 109 | - $prefix="left "; |
|
| 108 | + if($before) { |
|
| 109 | + $prefix="left "; |
|
| 110 | + } |
|
| 110 | 111 | $this->addToProperty("class", $prefix."labeled"); |
| 111 | 112 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
| 112 | 113 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
@@ -143,12 +144,13 @@ discard block |
||
| 143 | 144 | public function setColor($color){ |
| 144 | 145 | if(\is_array($this->content)){ |
| 145 | 146 | foreach ($this->content as $content){ |
| 146 | - if($content instanceof HtmlButton) |
|
| 147 | - $content->setColor($color); |
|
| 147 | + if($content instanceof HtmlButton) { |
|
| 148 | + $content->setColor($color); |
|
| 149 | + } |
|
| 148 | 150 | } |
| 151 | + } else { |
|
| 152 | + parent::setColor($color); |
|
| 149 | 153 | } |
| 150 | - else |
|
| 151 | - parent::setColor($color); |
|
| 152 | 154 | return $this; |
| 153 | 155 | } |
| 154 | 156 | |
@@ -201,8 +203,9 @@ discard block |
||
| 201 | 203 | * @return HtmlButton |
| 202 | 204 | */ |
| 203 | 205 | public static function social($identifier, $social, $value=NULL) { |
| 204 | - if ($value === NULL) |
|
| 205 | - $value=\ucfirst($social); |
|
| 206 | + if ($value === NULL) { |
|
| 207 | + $value=\ucfirst($social); |
|
| 208 | + } |
|
| 206 | 209 | $return=new HtmlButton($identifier, $value); |
| 207 | 210 | $return->addIcon($social); |
| 208 | 211 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -255,8 +258,9 @@ discard block |
||
| 255 | 258 | public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
| 256 | 259 | $result=new HtmlButtonGroups($identifier,[$value]); |
| 257 | 260 | $result->addDropdown($items,$asCombo); |
| 258 | - if(isset($icon)) |
|
| 259 | - $result->setIcon($icon); |
|
| 261 | + if(isset($icon)) { |
|
| 262 | + $result->setIcon($icon); |
|
| 263 | + } |
|
| 260 | 264 | return $result; |
| 261 | 265 | } |
| 262 | 266 | } |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 10 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 11 | |
| 12 | -class HtmlStep extends HtmlSemCollection{ |
|
| 12 | +class HtmlStep extends HtmlSemCollection { |
|
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | protected $_startStep; |
| 15 | 15 | |
| 16 | - public function __construct( $identifier,$steps=array()){ |
|
| 17 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 16 | + public function __construct($identifier, $steps=array()) { |
|
| 17 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 18 | 18 | $this->addItems($steps); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 25 | 25 | */ |
| 26 | 26 | protected function createItem($value) { |
| 27 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 27 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 28 | 28 | return $itemO; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,50 +32,50 @@ discard block |
||
| 32 | 32 | * @param string|array $step |
| 33 | 33 | * @return HtmlStepItem |
| 34 | 34 | */ |
| 35 | - public function addStep($step){ |
|
| 35 | + public function addStep($step) { |
|
| 36 | 36 | return $this->addItem($step); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function setOrdered(){ |
|
| 39 | + public function setOrdered() { |
|
| 40 | 40 | return $this->addToProperty("class", "ordered"); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function isOrdered(){ |
|
| 43 | + public function isOrdered() { |
|
| 44 | 44 | return $this->propertyContains("class", "ordered"); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function setVertical(){ |
|
| 47 | + public function setVertical() { |
|
| 48 | 48 | return $this->addToProperty("class", "vertical"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - protected function defineActiveStep(){ |
|
| 51 | + protected function defineActiveStep() { |
|
| 52 | 52 | $activestep=$this->_activeStep; |
| 53 | 53 | $count=$this->count(); |
| 54 | - if(!$this->isOrdered()){ |
|
| 55 | - for($i=$this->_startStep;$i<$count;$i++){ |
|
| 54 | + if (!$this->isOrdered()) { |
|
| 55 | + for ($i=$this->_startStep; $i<$count; $i++) { |
|
| 56 | 56 | $step=$this->content[$i]; |
| 57 | 57 | $step->removeStatus(); |
| 58 | - if($i<$activestep) |
|
| 58 | + if ($i<$activestep) |
|
| 59 | 59 | $step->setCompleted(); |
| 60 | 60 | elseif ($i===$activestep) |
| 61 | 61 | $step->setActive(); |
| 62 | 62 | else |
| 63 | 63 | $step->setDisabled(); |
| 64 | 64 | } |
| 65 | - }else{ |
|
| 66 | - foreach ($this->content as $step){ |
|
| 65 | + } else { |
|
| 66 | + foreach ($this->content as $step) { |
|
| 67 | 67 | $step->removeStatus(); |
| 68 | 68 | } |
| 69 | - if($activestep<$count) |
|
| 69 | + if ($activestep<$count) |
|
| 70 | 70 | $this->content[$activestep]->setActive(); |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 76 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 77 | 77 | $this->defineActiveStep(); |
| 78 | - return parent::compile($js,$view); |
|
| 78 | + return parent::compile($js, $view); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function setActiveStep($_activeStep) { |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 87 | - if(isset($toElement)){ |
|
| 88 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 86 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 87 | + if (isset($toElement)) { |
|
| 88 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 89 | 89 | } |
| 90 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 90 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function asLink(){ |
|
| 94 | - foreach ($this->content as $step){ |
|
| 93 | + public function asLink() { |
|
| 94 | + foreach ($this->content as $step) { |
|
| 95 | 95 | $step->asLink(); |
| 96 | 96 | } |
| 97 | 97 | return $this; |
@@ -55,26 +55,29 @@ |
||
| 55 | 55 | for($i=$this->_startStep;$i<$count;$i++){ |
| 56 | 56 | $step=$this->content[$i]; |
| 57 | 57 | $step->removeStatus(); |
| 58 | - if($i<$activestep) |
|
| 59 | - $step->setCompleted(); |
|
| 60 | - elseif ($i===$activestep) |
|
| 61 | - $step->setActive(); |
|
| 62 | - else |
|
| 63 | - $step->setDisabled(); |
|
| 58 | + if($i<$activestep) { |
|
| 59 | + $step->setCompleted(); |
|
| 60 | + } elseif ($i===$activestep) { |
|
| 61 | + $step->setActive(); |
|
| 62 | + } else { |
|
| 63 | + $step->setDisabled(); |
|
| 64 | + } |
|
| 64 | 65 | } |
| 65 | - }else{ |
|
| 66 | + } else{ |
|
| 66 | 67 | foreach ($this->content as $step){ |
| 67 | 68 | $step->removeStatus(); |
| 68 | 69 | } |
| 69 | - if($activestep<$count) |
|
| 70 | - $this->content[$activestep]->setActive(); |
|
| 70 | + if($activestep<$count) { |
|
| 71 | + $this->content[$activestep]->setActive(); |
|
| 72 | + } |
|
| 71 | 73 | } |
| 72 | 74 | return $this; |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 76 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 77 | - $this->defineActiveStep(); |
|
| 78 | + if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) { |
|
| 79 | + $this->defineActiveStep(); |
|
| 80 | + } |
|
| 78 | 81 | return parent::compile($js,$view); |
| 79 | 82 | } |
| 80 | 83 | |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | protected $image; |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $content=NULL) { |
| 12 | - parent::__construct($identifier,"item",$content); |
|
| 12 | + parent::__construct($identifier, "item", $content); |
|
| 13 | 13 | } |
| 14 | - protected function initContent($content){ |
|
| 15 | - if(\is_array($content)){ |
|
| 16 | - if(JArray::isAssociative($content)===false){ |
|
| 14 | + protected function initContent($content) { |
|
| 15 | + if (\is_array($content)) { |
|
| 16 | + if (JArray::isAssociative($content)===false) { |
|
| 17 | 17 | $icon=@$content[0]; |
| 18 | 18 | $title=@$content[1]; |
| 19 | 19 | $desc=@$content[2]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $image=@$content["image"]; |
| 23 | 23 | $title=@$content["title"]; |
@@ -25,38 +25,38 @@ discard block |
||
| 25 | 25 | $desc=@$content["description"]; |
| 26 | 26 | $items=@$content["items"]; |
| 27 | 27 | } |
| 28 | - if(isset($icon)){ |
|
| 28 | + if (isset($icon)) { |
|
| 29 | 29 | $this->setIcon($icon); |
| 30 | 30 | } |
| 31 | - if(isset($image)){ |
|
| 31 | + if (isset($image)) { |
|
| 32 | 32 | $this->setImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($title)){ |
|
| 35 | - $this->setTitle($title,$desc); |
|
| 36 | - }elseif (isset($header)){ |
|
| 37 | - $this->setTitle($header,$desc,"header"); |
|
| 34 | + if (isset($title)) { |
|
| 35 | + $this->setTitle($title, $desc); |
|
| 36 | + }elseif (isset($header)) { |
|
| 37 | + $this->setTitle($header, $desc, "header"); |
|
| 38 | 38 | } |
| 39 | - if(isset($items)){ |
|
| 39 | + if (isset($items)) { |
|
| 40 | 40 | $this->addList($items); |
| 41 | 41 | } |
| 42 | - }else{ |
|
| 42 | + } else { |
|
| 43 | 43 | $this->setContent($content); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - public function addList($items=array(),$ordered=false) { |
|
| 46 | + public function addList($items=array(), $ordered=false) { |
|
| 47 | 47 | $list=new HtmlList("", $items); |
| 48 | - if($ordered) |
|
| 48 | + if ($ordered) |
|
| 49 | 49 | $list->setOrdered(); |
| 50 | 50 | $list->setClass("list"); |
| 51 | 51 | $this->content["list"]=$list; |
| 52 | 52 | return $list; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function getList(){ |
|
| 55 | + public function getList() { |
|
| 56 | 56 | return $this->content["list"]; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function getItem($index){ |
|
| 59 | + public function getItem($index) { |
|
| 60 | 60 | return $this->getList()->getItem($index); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $icon=@$content[0]; |
| 18 | 18 | $title=@$content[1]; |
| 19 | 19 | $desc=@$content[2]; |
| 20 | - }else{ |
|
| 20 | + } else{ |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $image=@$content["image"]; |
| 23 | 23 | $title=@$content["title"]; |
@@ -33,20 +33,21 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | if(isset($title)){ |
| 35 | 35 | $this->setTitle($title,$desc); |
| 36 | - }elseif (isset($header)){ |
|
| 36 | + } elseif (isset($header)){ |
|
| 37 | 37 | $this->setTitle($header,$desc,"header"); |
| 38 | 38 | } |
| 39 | 39 | if(isset($items)){ |
| 40 | 40 | $this->addList($items); |
| 41 | 41 | } |
| 42 | - }else{ |
|
| 42 | + } else{ |
|
| 43 | 43 | $this->setContent($content); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | public function addList($items=array(),$ordered=false) { |
| 47 | 47 | $list=new HtmlList("", $items); |
| 48 | - if($ordered) |
|
| 49 | - $list->setOrdered(); |
|
| 48 | + if($ordered) { |
|
| 49 | + $list->setOrdered(); |
|
| 50 | + } |
|
| 50 | 51 | $list->setClass("list"); |
| 51 | 52 | $this->content["list"]=$list; |
| 52 | 53 | return $list; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
| 13 | 13 | private $_container; |
| 14 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
| 14 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
| 15 | 15 | parent::__construct($identifier, "div"); |
| 16 | 16 | $this->_container=$container; |
| 17 | 17 | $this->setClass("ui popup"); |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::addList() |
| 25 | 25 | */ |
| 26 | - public function addList($items=array(),$header=NULL){ |
|
| 27 | - if(!$this->content instanceof HtmlGrid){ |
|
| 28 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
| 26 | + public function addList($items=array(), $header=NULL) { |
|
| 27 | + if (!$this->content instanceof HtmlGrid) { |
|
| 28 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
| 29 | 29 | } |
| 30 | 30 | $grid=$this->content; |
| 31 | 31 | |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | $colCount++; |
| 34 | 34 | $grid->setColsCount($colCount); |
| 35 | 35 | |
| 36 | - $list=new HtmlList("",$items); |
|
| 36 | + $list=new HtmlList("", $items); |
|
| 37 | 37 | $list->asLink(); |
| 38 | - if(isset($header)){ |
|
| 39 | - $list->addHeader(4,$header); |
|
| 38 | + if (isset($header)) { |
|
| 39 | + $list->addHeader(4, $header); |
|
| 40 | 40 | } |
| 41 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
| 41 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
| 42 | 42 | $grid->setDivided()->setRelaxed(true); |
| 43 | 43 | return $list; |
| 44 | 44 | } |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * A popup can have no maximum width and continue to flow to fit its content |
| 48 | 48 | */ |
| 49 | - public function setFlowing(){ |
|
| 49 | + public function setFlowing() { |
|
| 50 | 50 | return $this->addToProperty("class", "flowing"); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * A popup can provide more basic formatting |
| 55 | 55 | */ |
| 56 | - public function setBasic(){ |
|
| 56 | + public function setBasic() { |
|
| 57 | 57 | return $this->addToProperty("class", "basic"); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -61,23 +61,23 @@ discard block |
||
| 61 | 61 | * {@inheritDoc} |
| 62 | 62 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 63 | 63 | */ |
| 64 | - public function run(JsUtils $js){ |
|
| 64 | + public function run(JsUtils $js) { |
|
| 65 | 65 | parent::run($js); |
| 66 | 66 | $this->_params["popup"]="#".$this->identifier; |
| 67 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
| 67 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function setOn($event="click"){ |
|
| 70 | + public function setOn($event="click") { |
|
| 71 | 71 | $this->_params["on"]=$event; |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setInline($value=true){ |
|
| 75 | + public function setInline($value=true) { |
|
| 76 | 76 | $this->_params["inline"]=$value; |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setPosition($position){ |
|
| 80 | + public function setPosition($position) { |
|
| 81 | 81 | $this->_params["position"]=$position; |
| 82 | 82 | return $this; |
| 83 | 83 | } |
@@ -7,29 +7,29 @@ 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); |
|
| 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 | 12 | $this->_identifier=$identifier; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function setItems($items){ |
|
| 15 | + public function setItems($items) { |
|
| 16 | 16 | return $this->getField()->setItems($items); |
| 17 | 17 | } |
| 18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 19 | - return $this->getField()->addItem($item,$value,$image); |
|
| 18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 19 | + return $this->getField()->addItem($item, $value, $image); |
|
| 20 | 20 | } |
| 21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value="",$associative=true){ |
|
| 22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
| 21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value="", $associative=true) { |
|
| 22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @return HtmlDropdown |
| 27 | 27 | */ |
| 28 | - public function getDataField(){ |
|
| 28 | + public function getDataField() { |
|
| 29 | 29 | return $this->getField()->getInput(); |
| 30 | 30 | } |
| 31 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 32 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
| 31 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 32 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
| 33 | 33 | return $this; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param boolean $floating |
| 38 | 38 | * @return HtmlDropdown |
| 39 | 39 | */ |
| 40 | - public function asButton($floating=false){ |
|
| 40 | + public function asButton($floating=false) { |
|
| 41 | 41 | $field=$this->content["field"]; |
| 42 | 42 | $label=$this->content["label"]; |
| 43 | 43 | $field->addContent($label); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @version 1.001 |
| 16 | 16 | */ |
| 17 | 17 | class HtmlMessage extends HtmlSemDoubleElement { |
| 18 | - use AttachedTrait,HasTimeoutTrait; |
|
| 18 | + use AttachedTrait, HasTimeoutTrait; |
|
| 19 | 19 | protected $icon; |
| 20 | 20 | protected $close; |
| 21 | 21 | |
@@ -32,39 +32,39 @@ discard block |
||
| 32 | 32 | * @param string|HtmlSemDoubleElement $header |
| 33 | 33 | * @return \Ajax\semantic\html\collections\HtmlMessage |
| 34 | 34 | */ |
| 35 | - public function addHeader($header){ |
|
| 35 | + public function addHeader($header) { |
|
| 36 | 36 | $headerO=$header; |
| 37 | - if(\is_string($header)){ |
|
| 38 | - $headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div"); |
|
| 37 | + if (\is_string($header)) { |
|
| 38 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
| 39 | 39 | $headerO->setClass("header"); |
| 40 | 40 | $headerO->setContent($header); |
| 41 | 41 | } |
| 42 | - return $this->addContent($headerO,true); |
|
| 42 | + return $this->addContent($headerO, true); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function setHeader($header){ |
|
| 45 | + public function setHeader($header) { |
|
| 46 | 46 | return $this->addHeader($header); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setIcon($icon){ |
|
| 49 | + public function setIcon($icon) { |
|
| 50 | 50 | $this->addToProperty("class", "icon"); |
| 51 | - $this->wrapContent("<div class='content'>","</div>"); |
|
| 52 | - if(\is_string($icon)){ |
|
| 51 | + $this->wrapContent("<div class='content'>", "</div>"); |
|
| 52 | + if (\is_string($icon)) { |
|
| 53 | 53 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
| 54 | - }else{ |
|
| 54 | + } else { |
|
| 55 | 55 | $this->icon=$icon; |
| 56 | 56 | } |
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function addLoader($loaderIcon="notched circle"){ |
|
| 60 | + public function addLoader($loaderIcon="notched circle") { |
|
| 61 | 61 | $this->setIcon($loaderIcon); |
| 62 | 62 | $this->icon->addToIcon("loading"); |
| 63 | 63 | return $this; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function setDismissable($dismiss=true){ |
|
| 67 | - if($dismiss===true) |
|
| 66 | + public function setDismissable($dismiss=true) { |
|
| 67 | + if ($dismiss===true) |
|
| 68 | 68 | $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
| 69 | 69 | else |
| 70 | 70 | $this->close=NULL; |
@@ -75,43 +75,43 @@ discard block |
||
| 75 | 75 | * {@inheritDoc} |
| 76 | 76 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 77 | 77 | */ |
| 78 | - public function run(JsUtils $js){ |
|
| 79 | - if(!isset($this->_bsComponent)){ |
|
| 80 | - if(isset($this->close)){ |
|
| 78 | + public function run(JsUtils $js) { |
|
| 79 | + if (!isset($this->_bsComponent)) { |
|
| 80 | + if (isset($this->close)) { |
|
| 81 | 81 | $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition})"); |
| 82 | 82 | } |
| 83 | - if(isset($this->_timeout)){ |
|
| 84 | - $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true); |
|
| 83 | + if (isset($this->_timeout)) { |
|
| 84 | + $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | return parent::run($js); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function setState($visible=true){ |
|
| 91 | - $visible=($visible===true)?"visible":"hidden"; |
|
| 92 | - return $this->addToPropertyCtrl("class", $visible, array("visible","hidden")); |
|
| 90 | + public function setState($visible=true) { |
|
| 91 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
| 92 | + return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden")); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function setVariation($value="floating"){ |
|
| 96 | - return $this->addToPropertyCtrl("class", $value, array("floating","compact")); |
|
| 95 | + public function setVariation($value="floating") { |
|
| 96 | + return $this->addToPropertyCtrl("class", $value, array("floating", "compact")); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function setStyle($style){ |
|
| 99 | + public function setStyle($style) { |
|
| 100 | 100 | return $this->addToPropertyCtrl("class", $style, Style::getConstants()); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function setError(){ |
|
| 103 | + public function setError() { |
|
| 104 | 104 | return $this->setStyle("error"); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function setWarning(){ |
|
| 107 | + public function setWarning() { |
|
| 108 | 108 | return $this->setStyle("warning"); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function setMessage($message){ |
|
| 112 | - if(\is_array($this->content)){ |
|
| 111 | + public function setMessage($message) { |
|
| 112 | + if (\is_array($this->content)) { |
|
| 113 | 113 | $this->content[\sizeof($this->content)-1]=$message; |
| 114 | - }else |
|
| 114 | + } else |
|
| 115 | 115 | $this->setContent($message); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->wrapContent("<div class='content'>","</div>"); |
| 52 | 52 | if(\is_string($icon)){ |
| 53 | 53 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
| 54 | - }else{ |
|
| 54 | + } else{ |
|
| 55 | 55 | $this->icon=$icon; |
| 56 | 56 | } |
| 57 | 57 | return $this; |
@@ -64,10 +64,11 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function setDismissable($dismiss=true){ |
| 67 | - if($dismiss===true) |
|
| 68 | - $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
| 69 | - else |
|
| 70 | - $this->close=NULL; |
|
| 67 | + if($dismiss===true) { |
|
| 68 | + $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
| 69 | + } else { |
|
| 70 | + $this->close=NULL; |
|
| 71 | + } |
|
| 71 | 72 | return $this; |
| 72 | 73 | } |
| 73 | 74 | |
@@ -111,8 +112,9 @@ discard block |
||
| 111 | 112 | public function setMessage($message){ |
| 112 | 113 | if(\is_array($this->content)){ |
| 113 | 114 | $this->content[\sizeof($this->content)-1]=$message; |
| 114 | - }else |
|
| 115 | - $this->setContent($message); |
|
| 115 | + } else { |
|
| 116 | + $this->setContent($message); |
|
| 117 | + } |
|
| 116 | 118 | } |
| 117 | 119 | |
| 118 | 120 | } |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n"; |
| 7 | 7 | public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n"; |
| 8 | 8 | |
| 9 | - public static function containsCode($expression){ |
|
| 10 | - return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false; |
|
| 9 | + public static function containsCode($expression) { |
|
| 10 | + return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | return $value; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public static function prep_jquery_selector($value){ |
|
| 47 | - if(JString::startswith($value, '$(')===false){ |
|
| 46 | + public static function prep_jquery_selector($value) { |
|
| 47 | + if (JString::startswith($value, '$(')===false) { |
|
| 48 | 48 | return '$('.$value.')'; |
| 49 | 49 | } |
| 50 | 50 | return $value; |
@@ -3,26 +3,26 @@ |
||
| 3 | 3 | use Ajax\semantic\html\base\constants\Transition; |
| 4 | 4 | |
| 5 | 5 | class AjaxTransition { |
| 6 | - public static function none($responseElement,$jqueryDone="html"){ |
|
| 6 | + public static function none($responseElement, $jqueryDone="html") { |
|
| 7 | 7 | return $responseElement.".".$jqueryDone."( data )"; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - public static function jqFade($responseElement,$jqueryDone="html"){ |
|
| 10 | + public static function jqFade($responseElement, $jqueryDone="html") { |
|
| 11 | 11 | return $responseElement.".hide().{$jqueryDone}( data ).fadeIn()"; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public static function jqSlide($responseElement,$jqueryDone="html"){ |
|
| 14 | + public static function jqSlide($responseElement, $jqueryDone="html") { |
|
| 15 | 15 | return $responseElement.".hide().{$jqueryDone}( data ).slideDown()"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public static function random($responseElement,$jqueryDone="html"){ |
|
| 18 | + public static function random($responseElement, $jqueryDone="html") { |
|
| 19 | 19 | $transitions=Transition::getConstantValues(); |
| 20 | - $transition=$transitions[\rand(0,\sizeof($transitions)-1)]; |
|
| 21 | - return self::__callStatic($transition, [$responseElement,$jqueryDone]); |
|
| 20 | + $transition=$transitions[\rand(0, \sizeof($transitions)-1)]; |
|
| 21 | + return self::__callStatic($transition, [$responseElement, $jqueryDone]); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public static function __callStatic($name, $arguments){ |
|
| 25 | - if(\sizeof($arguments)==2){ |
|
| 24 | + public static function __callStatic($name, $arguments) { |
|
| 25 | + if (\sizeof($arguments)==2) { |
|
| 26 | 26 | $responseElement=$arguments[0]; |
| 27 | 27 | $jqueryDone=$arguments[1]; |
| 28 | 28 | $name=JString::camelCaseToSeparated($name); |