@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | * @property HtmlSemDoubleElement $_self |
| 16 | 16 | */ |
| 17 | 17 | trait BaseTrait { |
| 18 | - protected $_variations=[ ]; |
|
| 19 | - protected $_states=[ ]; |
|
| 18 | + protected $_variations=[]; |
|
| 19 | + protected $_states=[]; |
|
| 20 | 20 | protected $_baseClass; |
| 21 | 21 | |
| 22 | 22 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | abstract public function setProperty($name, $value); |
| 31 | 31 | |
| 32 | - abstract public function addContent($content,$before=false); |
|
| 32 | + abstract public function addContent($content, $before=false); |
|
| 33 | 33 | |
| 34 | 34 | abstract public function onCreate($jsCode); |
| 35 | 35 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->_self->setProperty("class", $this->_self->getBaseClass()); |
| 51 | 51 | if (\is_string($variations)) |
| 52 | 52 | $variations=\explode(" ", $variations); |
| 53 | - foreach ( $variations as $variation ) { |
|
| 53 | + foreach ($variations as $variation) { |
|
| 54 | 54 | $this->_self->addVariation($variation); |
| 55 | 55 | } |
| 56 | 56 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function addVariations($variations=array()) { |
| 65 | 65 | if (\is_string($variations)) |
| 66 | 66 | $variations=\explode(" ", $variations); |
| 67 | - foreach ( $variations as $variation ) { |
|
| 67 | + foreach ($variations as $variation) { |
|
| 68 | 68 | $this->_self->addVariation($variation); |
| 69 | 69 | } |
| 70 | 70 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function addStates($states=array()) { |
| 74 | 74 | if (\is_string($states)) |
| 75 | 75 | $states=\explode(" ", $states); |
| 76 | - foreach ( $states as $state ) { |
|
| 76 | + foreach ($states as $state) { |
|
| 77 | 77 | $this->_self->addState($state); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | $this->_self->setProperty("class", $this->_self->getBaseClass()); |
| 84 | 84 | if (\is_string($states)) |
| 85 | 85 | $states=\explode(" ", $states); |
| 86 | - foreach ( $states as $state ) { |
|
| 86 | + foreach ($states as $state) { |
|
| 87 | 87 | $this->_self->addState($state); |
| 88 | 88 | } |
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function addIcon($icon, $before=true) { |
| 93 | - return $this->_self->addContent(new HtmlIcon("icon-" . $this->_self->getIdentifier(), $icon), $before); |
|
| 93 | + return $this->_self->addContent(new HtmlIcon("icon-".$this->_self->getIdentifier(), $icon), $before); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function addSticky($context="body"){ |
|
| 96 | + public function addSticky($context="body") { |
|
| 97 | 97 | $this->_self->onCreate("$('#".$this->_self->getIdentifier()."').sticky({ context: '".$context."'});"); |
| 98 | 98 | return $this; |
| 99 | 99 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return HtmlSemDoubleElement |
| 115 | 115 | */ |
| 116 | 116 | public function setDisabled($disable=true) { |
| 117 | - if($disable) |
|
| 117 | + if ($disable) |
|
| 118 | 118 | $this->_self->addToProperty("class", "disabled"); |
| 119 | 119 | return $this; |
| 120 | 120 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return HtmlSemDoubleElement |
| 142 | 142 | */ |
| 143 | - public function asHeader(){ |
|
| 143 | + public function asHeader() { |
|
| 144 | 144 | return $this->_self->addToProperty("class", "header"); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | * show it is currently the active user selection |
| 149 | 149 | * @return HtmlSemDoubleElement |
| 150 | 150 | */ |
| 151 | - public function setActive($value=true){ |
|
| 152 | - if($value) |
|
| 151 | + public function setActive($value=true) { |
|
| 152 | + if ($value) |
|
| 153 | 153 | $this->_self->addToProperty("class", "active"); |
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function setAttached($value=true){ |
|
| 158 | - if($value) |
|
| 159 | - $this->_self->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 157 | + public function setAttached($value=true) { |
|
| 158 | + if ($value) |
|
| 159 | + $this->_self->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 160 | 160 | return $this; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | * can be formatted to appear on dark backgrounds |
| 165 | 165 | */ |
| 166 | 166 | public function setInverted($recursive=true) { |
| 167 | - if($recursive===true){ |
|
| 167 | + if ($recursive===true) { |
|
| 168 | 168 | $content=$this->_self->getContent(); |
| 169 | - if($content instanceof HtmlSemDoubleElement) |
|
| 169 | + if ($content instanceof HtmlSemDoubleElement) |
|
| 170 | 170 | $content->setInverted($recursive); |
| 171 | - elseif(\is_array($content) || $content instanceof \Traversable){ |
|
| 172 | - foreach ($content as $elm){ |
|
| 173 | - if($elm instanceof HtmlSemDoubleElement){ |
|
| 171 | + elseif (\is_array($content) || $content instanceof \Traversable) { |
|
| 172 | + foreach ($content as $elm) { |
|
| 173 | + if ($elm instanceof HtmlSemDoubleElement) { |
|
| 174 | 174 | $elm->setInverted($recursive); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function setFloated($direction="right") { |
| 187 | - return $this->_self->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
| 187 | + return $this->_self->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | public function floatRight() { |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | return $this->_baseClass; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - protected function addBehavior(&$array,$key,$value,$before="",$after=""){ |
|
| 203 | - if(\is_string($value)){ |
|
| 204 | - if(isset($array[$key])){ |
|
| 202 | + protected function addBehavior(&$array, $key, $value, $before="", $after="") { |
|
| 203 | + if (\is_string($value)) { |
|
| 204 | + if (isset($array[$key])) { |
|
| 205 | 205 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 206 | 206 | $array[$key]=$before.$p.$value.$after; |
| 207 | - }else |
|
| 207 | + } else |
|
| 208 | 208 | $array[$key]=$before.$value.$after; |
| 209 | - }else{ |
|
| 209 | + } else { |
|
| 210 | 210 | $array[$key]=$value; |
| 211 | 211 | } |
| 212 | 212 | return $this; |
@@ -48,8 +48,9 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function setVariations($variations) { |
| 50 | 50 | $this->_self->setProperty("class", $this->_self->getBaseClass()); |
| 51 | - if (\is_string($variations)) |
|
| 52 | - $variations=\explode(" ", $variations); |
|
| 51 | + if (\is_string($variations)) { |
|
| 52 | + $variations=\explode(" ", $variations); |
|
| 53 | + } |
|
| 53 | 54 | foreach ( $variations as $variation ) { |
| 54 | 55 | $this->_self->addVariation($variation); |
| 55 | 56 | } |
@@ -62,8 +63,9 @@ discard block |
||
| 62 | 63 | } |
| 63 | 64 | |
| 64 | 65 | public function addVariations($variations=array()) { |
| 65 | - if (\is_string($variations)) |
|
| 66 | - $variations=\explode(" ", $variations); |
|
| 66 | + if (\is_string($variations)) { |
|
| 67 | + $variations=\explode(" ", $variations); |
|
| 68 | + } |
|
| 67 | 69 | foreach ( $variations as $variation ) { |
| 68 | 70 | $this->_self->addVariation($variation); |
| 69 | 71 | } |
@@ -71,8 +73,9 @@ discard block |
||
| 71 | 73 | } |
| 72 | 74 | |
| 73 | 75 | public function addStates($states=array()) { |
| 74 | - if (\is_string($states)) |
|
| 75 | - $states=\explode(" ", $states); |
|
| 76 | + if (\is_string($states)) { |
|
| 77 | + $states=\explode(" ", $states); |
|
| 78 | + } |
|
| 76 | 79 | foreach ( $states as $state ) { |
| 77 | 80 | $this->_self->addState($state); |
| 78 | 81 | } |
@@ -81,8 +84,9 @@ discard block |
||
| 81 | 84 | |
| 82 | 85 | public function setStates($states) { |
| 83 | 86 | $this->_self->setProperty("class", $this->_self->getBaseClass()); |
| 84 | - if (\is_string($states)) |
|
| 85 | - $states=\explode(" ", $states); |
|
| 87 | + if (\is_string($states)) { |
|
| 88 | + $states=\explode(" ", $states); |
|
| 89 | + } |
|
| 86 | 90 | foreach ( $states as $state ) { |
| 87 | 91 | $this->_self->addState($state); |
| 88 | 92 | } |
@@ -114,8 +118,9 @@ discard block |
||
| 114 | 118 | * @return HtmlSemDoubleElement |
| 115 | 119 | */ |
| 116 | 120 | public function setDisabled($disable=true) { |
| 117 | - if($disable) |
|
| 118 | - $this->_self->addToProperty("class", "disabled"); |
|
| 121 | + if($disable) { |
|
| 122 | + $this->_self->addToProperty("class", "disabled"); |
|
| 123 | + } |
|
| 119 | 124 | return $this; |
| 120 | 125 | } |
| 121 | 126 | |
@@ -149,14 +154,16 @@ discard block |
||
| 149 | 154 | * @return HtmlSemDoubleElement |
| 150 | 155 | */ |
| 151 | 156 | public function setActive($value=true){ |
| 152 | - if($value) |
|
| 153 | - $this->_self->addToProperty("class", "active"); |
|
| 157 | + if($value) { |
|
| 158 | + $this->_self->addToProperty("class", "active"); |
|
| 159 | + } |
|
| 154 | 160 | return $this; |
| 155 | 161 | } |
| 156 | 162 | |
| 157 | 163 | public function setAttached($value=true){ |
| 158 | - if($value) |
|
| 159 | - $this->_self->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 164 | + if($value) { |
|
| 165 | + $this->_self->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 166 | + } |
|
| 160 | 167 | return $this; |
| 161 | 168 | } |
| 162 | 169 | |
@@ -166,9 +173,9 @@ discard block |
||
| 166 | 173 | public function setInverted($recursive=true) { |
| 167 | 174 | if($recursive===true){ |
| 168 | 175 | $content=$this->_self->getContent(); |
| 169 | - if($content instanceof HtmlSemDoubleElement) |
|
| 170 | - $content->setInverted($recursive); |
|
| 171 | - elseif(\is_array($content) || $content instanceof \Traversable){ |
|
| 176 | + if($content instanceof HtmlSemDoubleElement) { |
|
| 177 | + $content->setInverted($recursive); |
|
| 178 | + } elseif(\is_array($content) || $content instanceof \Traversable){ |
|
| 172 | 179 | foreach ($content as $elm){ |
| 173 | 180 | if($elm instanceof HtmlSemDoubleElement){ |
| 174 | 181 | $elm->setInverted($recursive); |
@@ -204,9 +211,10 @@ discard block |
||
| 204 | 211 | if(isset($array[$key])){ |
| 205 | 212 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 206 | 213 | $array[$key]=$before.$p.$value.$after; |
| 207 | - }else |
|
| 208 | - $array[$key]=$before.$value.$after; |
|
| 209 | - }else{ |
|
| 214 | + } else { |
|
| 215 | + $array[$key]=$before.$value.$after; |
|
| 216 | + } |
|
| 217 | + } else{ |
|
| 210 | 218 | $array[$key]=$value; |
| 211 | 219 | } |
| 212 | 220 | return $this; |
@@ -17,6 +17,6 @@ |
||
| 17 | 17 | if (isset($toElement) && \method_exists($toElement, "setAttached")) { |
| 18 | 18 | $toElement->setAttached(true); |
| 19 | 19 | } |
| 20 | - return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached")); |
|
| 20 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 21 | 21 | } |
| 22 | 22 | } |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | namespace Ajax\semantic\html\base\constants; |
| 3 | 3 | use Ajax\common\BaseEnum; |
| 4 | 4 | abstract class Social extends BaseEnum { |
| 5 | - const FACEBOOK="facebook", TWITTER="twitter",GOOGLEPLUS="google plus",VK="vk",LINKEDIN="linkedin",INSTAGRAM="instagram",YOUTUBE="youtube",GITHUB="github"; |
|
| 5 | + const FACEBOOK="facebook", TWITTER="twitter", GOOGLEPLUS="google plus", VK="vk", LINKEDIN="linkedin", INSTAGRAM="instagram", YOUTUBE="youtube", GITHUB="github"; |
|
| 6 | 6 | } |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | * @return $this |
| 28 | 28 | */ |
| 29 | 29 | public function setOnShow($jsCode) { |
| 30 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
| 30 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
| 31 | 31 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setExclusive($value){ |
|
| 34 | + public function setExclusive($value) { |
|
| 35 | 35 | return $this->setParam("exclusive", $value); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -40,19 +40,19 @@ discard block |
||
| 40 | 40 | * @param string $popup the css selector of the popup |
| 41 | 41 | * @return \Ajax\semantic\components\Popup |
| 42 | 42 | */ |
| 43 | - public function setPopup($popup){ |
|
| 43 | + public function setPopup($popup) { |
|
| 44 | 44 | return $this->setParam("popup", $popup); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function setInline($value){ |
|
| 47 | + public function setInline($value) { |
|
| 48 | 48 | return $this->setParam("inline", $value); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function setPosition($value){ |
|
| 51 | + public function setPosition($value) { |
|
| 52 | 52 | return $this->setParam("position", $value); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setSetFluidWidth($value){ |
|
| 55 | + public function setSetFluidWidth($value) { |
|
| 56 | 56 | return $this->setParam("setFluidWidth", $value); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | * @param array $instances |
| 19 | 19 | * @return DataTable |
| 20 | 20 | */ |
| 21 | - public function dataTable($identifier,$model, $instances){ |
|
| 22 | - return $this->addHtmlComponent(new DataTable($identifier,$model,$instances)); |
|
| 21 | + public function dataTable($identifier, $model, $instances) { |
|
| 22 | + return $this->addHtmlComponent(new DataTable($identifier, $model, $instances)); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * @param array $instances |
| 29 | 29 | * @return JsonDataTable |
| 30 | 30 | */ |
| 31 | - public function jsonDataTable($identifier,$model, $instances){ |
|
| 32 | - return $this->addHtmlComponent(new JsonDataTable($identifier,$model,$instances)); |
|
| 31 | + public function jsonDataTable($identifier, $model, $instances) { |
|
| 32 | + return $this->addHtmlComponent(new JsonDataTable($identifier, $model, $instances)); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | * @param object $instance |
| 38 | 38 | * @return DataElement |
| 39 | 39 | */ |
| 40 | - public function dataElement($identifier, $instance){ |
|
| 41 | - return $this->addHtmlComponent(new DataElement($identifier,$instance)); |
|
| 40 | + public function dataElement($identifier, $instance) { |
|
| 41 | + return $this->addHtmlComponent(new DataElement($identifier, $instance)); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | * @param object $instance |
| 47 | 47 | * @return DataForm |
| 48 | 48 | */ |
| 49 | - public function dataForm($identifier, $instance){ |
|
| 50 | - return $this->addHtmlComponent(new DataForm($identifier,$instance)); |
|
| 49 | + public function dataForm($identifier, $instance) { |
|
| 50 | + return $this->addHtmlComponent(new DataForm($identifier, $instance)); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * @param object $instance |
| 56 | 56 | * @return FormLogin |
| 57 | 57 | */ |
| 58 | - public function defaultLogin($identifier,$instance=null){ |
|
| 59 | - return $this->addHtmlComponent(FormLogin::regular($identifier,$instance)); |
|
| 58 | + public function defaultLogin($identifier, $instance=null) { |
|
| 59 | + return $this->addHtmlComponent(FormLogin::regular($identifier, $instance)); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | * @param object $instance |
| 65 | 65 | * @return FormLogin |
| 66 | 66 | */ |
| 67 | - public function smallLogin($identifier,$instance=null){ |
|
| 68 | - return $this->addHtmlComponent(FormLogin::small($identifier,$instance)); |
|
| 67 | + public function smallLogin($identifier, $instance=null) { |
|
| 68 | + return $this->addHtmlComponent(FormLogin::small($identifier, $instance)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * @param object $instance |
| 74 | 74 | * @return FormLogin |
| 75 | 75 | */ |
| 76 | - public function segmentedLogin($identifier,$instance=null){ |
|
| 77 | - return $this->addHtmlComponent(FormLogin::attachedSegment($identifier,$instance)); |
|
| 76 | + public function segmentedLogin($identifier, $instance=null) { |
|
| 77 | + return $this->addHtmlComponent(FormLogin::attachedSegment($identifier, $instance)); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param object $instance |
| 83 | 83 | * @return FormAccount |
| 84 | 84 | */ |
| 85 | - public function defaultAccount($identifier,$instance=null){ |
|
| 86 | - return $this->addHtmlComponent(FormAccount::regular($identifier,$instance)); |
|
| 85 | + public function defaultAccount($identifier, $instance=null) { |
|
| 86 | + return $this->addHtmlComponent(FormAccount::regular($identifier, $instance)); |
|
| 87 | 87 | } |
| 88 | 88 | } |
@@ -10,61 +10,61 @@ |
||
| 10 | 10 | * @param string $identifier |
| 11 | 11 | * @param object $modelInstance |
| 12 | 12 | */ |
| 13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
| 14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
| 13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
| 14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - protected function getDefaultModelInstance(){ |
|
| 17 | + protected function getDefaultModelInstance() { |
|
| 18 | 18 | return new UserModel(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public static function regular($identifier,$modelInstance=null){ |
|
| 22 | - return new FormAccount($identifier,$modelInstance, |
|
| 23 | - ["message","login","password","passwordConf","email","submit","error"], |
|
| 21 | + public static function regular($identifier, $modelInstance=null) { |
|
| 22 | + return new FormAccount($identifier, $modelInstance, |
|
| 23 | + ["message", "login", "password", "passwordConf", "email", "submit", "error"], |
|
| 24 | 24 | ["message"=>[["icon"=>"sign in"]], |
| 25 | 25 | "input0"=>[["rules"=>"empty"]], |
| 26 | - "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
|
| 27 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 26 | + "input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]], |
|
| 27 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 28 | 28 | "input3"=>[["rules"=>"email"]], |
| 29 | 29 | "submit"=>["green fluid"], |
| 30 | 30 | "message2"=>[["error"=>true]]], |
| 31 | - ["Account","login","password","passwordConf","email","submit","error"], |
|
| 32 | - ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
|
| 33 | - [0,1,3,4,5,6]); |
|
| 31 | + ["Account", "login", "password", "passwordConf", "email", "submit", "error"], |
|
| 32 | + ["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
| 33 | + [0, 1, 3, 4, 5, 6]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function smallInline($identifier,$modelInstance=null){ |
|
| 37 | - $result=new FormAccount($identifier,$modelInstance, |
|
| 38 | - ["login","password","submit"], |
|
| 39 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
| 40 | - ["login","password","submit"], |
|
| 41 | - ["","","Connection"], |
|
| 36 | + public static function smallInline($identifier, $modelInstance=null) { |
|
| 37 | + $result=new FormAccount($identifier, $modelInstance, |
|
| 38 | + ["login", "password", "submit"], |
|
| 39 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
| 40 | + ["login", "password", "submit"], |
|
| 41 | + ["", "", "Connection"], |
|
| 42 | 42 | [2]); |
| 43 | 43 | $result->addDividerBefore(0, "Connection"); |
| 44 | 44 | return $result; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public static function small($identifier,$modelInstance=null){ |
|
| 48 | - $result=new FormAccount($identifier,$modelInstance, |
|
| 49 | - ["login","password","passwordConf","email","submit"], |
|
| 47 | + public static function small($identifier, $modelInstance=null) { |
|
| 48 | + $result=new FormAccount($identifier, $modelInstance, |
|
| 49 | + ["login", "password", "passwordConf", "email", "submit"], |
|
| 50 | 50 | [ |
| 51 | 51 | "input0"=>[["rules"=>"empty"]], |
| 52 | - "input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]], |
|
| 53 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 52 | + "input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]], |
|
| 53 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 54 | 54 | "input3"=>[["rules"=>"email"]], |
| 55 | 55 | "submit"=>["green basic"]], |
| 56 | - ["login","password","passwordConf","email","submit"], |
|
| 57 | - ["Login","Password","Password confirmation","Email address","Creation"], |
|
| 58 | - [1,2]); |
|
| 56 | + ["login", "password", "passwordConf", "email", "submit"], |
|
| 57 | + ["Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
| 58 | + [1, 2]); |
|
| 59 | 59 | $result->addDividerBefore(0, "Creation"); |
| 60 | 60 | return $result; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
| 64 | - $result=self::regular($identifier,$modelInstance); |
|
| 65 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
| 66 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
| 67 | - $result->addWrapper("error", null,"</div>"); |
|
| 63 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
| 64 | + $result=self::regular($identifier, $modelInstance); |
|
| 65 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
| 66 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
| 67 | + $result->addWrapper("error", null, "</div>"); |
|
| 68 | 68 | return $result; |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | trait LabeledIconTrait { |
| 14 | 14 | |
| 15 | 15 | abstract public function addToProperty($name, $value, $separator=" "); |
| 16 | - abstract public function addContent($content,$before=false); |
|
| 16 | + abstract public function addContent($content, $before=false); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Adds an icon before or after |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | * @param boolean $labeled |
| 23 | 23 | * @return \Ajax\semantic\html\elements\HtmlIcon |
| 24 | 24 | */ |
| 25 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 25 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 26 | 26 | $iconO=$icon; |
| 27 | - if(\is_string($icon)){ |
|
| 27 | + if (\is_string($icon)) { |
|
| 28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 29 | 29 | } |
| 30 | - if($labeled!==false){ |
|
| 31 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
| 30 | + if ($labeled!==false) { |
|
| 31 | + $direction=($before===true) ?Direction::LEFT : Direction::RIGHT; |
|
| 32 | 32 | $this->addToProperty("class", $direction." labeled icon"); |
| 33 | 33 | $this->tagName="div"; |
| 34 | 34 | } |
| 35 | - $this->addContent($iconO,$before); |
|
| 35 | + $this->addContent($iconO, $before); |
|
| 36 | 36 | return $iconO; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -16,16 +16,16 @@ |
||
| 16 | 16 | return $this; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function showDimmer(){ |
|
| 19 | + public function showDimmer() { |
|
| 20 | 20 | return $this->setBehavior("hide dimmer"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setInverted(){ |
|
| 23 | + public function setInverted() { |
|
| 24 | 24 | $this->params["inverted"]=true; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function setOnHidden($jsCode) { |
| 28 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
| 28 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
| 29 | 29 | return $this->setParam("onHidden", "%function(){".$jsCode."}%"); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -22,8 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
| 24 | 24 | parent::__construct($identifier, $tagName, ""); |
| 25 | - if (isset($rowCount) && isset($colCount)) |
|
| 26 | - $this->setRowCount($rowCount, $colCount); |
|
| 25 | + if (isset($rowCount) && isset($colCount)) { |
|
| 26 | + $this->setRowCount($rowCount, $colCount); |
|
| 27 | + } |
|
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | /** |
@@ -148,8 +149,9 @@ discard block |
||
| 148 | 149 | $values=\array_fill(0, $count, $values); |
| 149 | 150 | $isArray=false; |
| 150 | 151 | } |
| 151 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 152 | - $values=[ $values ]; |
|
| 152 | + if (JArray::dimension($values) == 1 && $isArray) { |
|
| 153 | + $values=[ $values ]; |
|
| 154 | + } |
|
| 153 | 155 | |
| 154 | 156 | $count=\min(\sizeof($values), $count); |
| 155 | 157 | |
@@ -193,8 +195,9 @@ discard block |
||
| 193 | 195 | $count=$this->count(); |
| 194 | 196 | for($i=0; $i < $count; $i++) { |
| 195 | 197 | $index=$this->content[$i]->getColPosition($colIndex); |
| 196 | - if ($index !== NULL) |
|
| 197 | - $this->getCell($i, $index)->$function(); |
|
| 198 | + if ($index !== NULL) { |
|
| 199 | + $this->getCell($i, $index)->$function(); |
|
| 200 | + } |
|
| 198 | 201 | } |
| 199 | 202 | return $this; |
| 200 | 203 | } |
@@ -225,8 +228,9 @@ discard block |
||
| 225 | 228 | */ |
| 226 | 229 | public function getColCount() { |
| 227 | 230 | $result=0; |
| 228 | - if ($this->count() > 0) |
|
| 229 | - $result=$this->getItem(0)->count(); |
|
| 231 | + if ($this->count() > 0) { |
|
| 232 | + $result=$this->getItem(0)->count(); |
|
| 233 | + } |
|
| 230 | 234 | return $result; |
| 231 | 235 | } |
| 232 | 236 | |
@@ -250,8 +254,9 @@ discard block |
||
| 250 | 254 | |
| 251 | 255 | public function toDelete($rowIndex, $colIndex){ |
| 252 | 256 | $row=$this->getItem($rowIndex); |
| 253 | - if (isset($row) === true) |
|
| 254 | - $row->toDelete($colIndex); |
|
| 257 | + if (isset($row) === true) { |
|
| 258 | + $row->toDelete($colIndex); |
|
| 259 | + } |
|
| 255 | 260 | return $this; |
| 256 | 261 | } |
| 257 | 262 | |
@@ -349,8 +354,9 @@ discard block |
||
| 349 | 354 | foreach ( $rows as $row ) { |
| 350 | 355 | $cell=$row->getItem($colIndex); |
| 351 | 356 | $value=$cell->getContent(); |
| 352 | - if($functionExists) |
|
| 353 | - $value=\call_user_func($function,$value); |
|
| 357 | + if($functionExists) { |
|
| 358 | + $value=\call_user_func($function,$value); |
|
| 359 | + } |
|
| 354 | 360 | if($value!==$identiqual){ |
| 355 | 361 | if($counter>0 && isset($cellToMerge)){ |
| 356 | 362 | $cellToMerge->setRowspan($counter); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | 13 | class HtmlTableContent extends HtmlSemCollection { |
| 14 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
| 14 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
| 15 | 15 | protected $_merged=false; |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function setRowCount($rowCount, $colCount) { |
| 37 | 37 | $count=$this->count(); |
| 38 | - for($i=$count; $i < $rowCount; $i++) { |
|
| 38 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 39 | 39 | $this->addItem($colCount); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $tr=new HtmlTR("", $value); |
| 58 | 58 | $tr->setContainer($this, $count); |
| 59 | 59 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 60 | - if (isset($value) === true) { |
|
| 60 | + if (isset($value)===true) { |
|
| 61 | 61 | $tr->setColCount($value); |
| 62 | 62 | } |
| 63 | 63 | return $tr; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function setCellValue($row, $col, $value="") { |
| 117 | 117 | $cell=$this->getCell($row, $col); |
| 118 | - if (isset($cell) === true) { |
|
| 118 | + if (isset($cell)===true) { |
|
| 119 | 119 | $cell->setValue($value); |
| 120 | 120 | } |
| 121 | 121 | return $this; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param mixed $values |
| 127 | 127 | */ |
| 128 | 128 | public function setValues($values=array()) { |
| 129 | - return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);}); |
|
| 129 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->setValues($_values); }); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param mixed $values |
| 135 | 135 | */ |
| 136 | 136 | public function addValues($values=array()) { |
| 137 | - return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);}); |
|
| 137 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->addValues($_values); }); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -142,21 +142,21 @@ discard block |
||
| 142 | 142 | * @param mixed $values |
| 143 | 143 | * @param callable $callback |
| 144 | 144 | */ |
| 145 | - protected function _addOrSetValues($values,$callback) { |
|
| 145 | + protected function _addOrSetValues($values, $callback) { |
|
| 146 | 146 | $count=$this->count(); |
| 147 | 147 | $isArray=true; |
| 148 | 148 | if (!\is_array($values)) { |
| 149 | 149 | $values=\array_fill(0, $count, $values); |
| 150 | 150 | $isArray=false; |
| 151 | 151 | } |
| 152 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 153 | - $values=[ $values ]; |
|
| 152 | + if (JArray::dimension($values)==1 && $isArray) |
|
| 153 | + $values=[$values]; |
|
| 154 | 154 | |
| 155 | 155 | $count=\min(\sizeof($values), $count); |
| 156 | 156 | |
| 157 | - for($i=0; $i < $count; $i++) { |
|
| 157 | + for ($i=0; $i<$count; $i++) { |
|
| 158 | 158 | $row=$this->content[$i]; |
| 159 | - $callback($row,$values[$i]); |
|
| 159 | + $callback($row, $values[$i]); |
|
| 160 | 160 | } |
| 161 | 161 | return $this; |
| 162 | 162 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $values=\array_fill(0, $count, $values); |
| 168 | 168 | } |
| 169 | 169 | $count=\min(\sizeof($values), $count); |
| 170 | - for($i=0; $i < $count; $i++) { |
|
| 170 | + for ($i=0; $i<$count; $i++) { |
|
| 171 | 171 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
| 172 | 172 | } |
| 173 | 173 | return $this; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | public function addColVariations($colIndex, $variations=array()) { |
| 177 | 177 | $count=$this->count(); |
| 178 | - for($i=0; $i < $count; $i++) { |
|
| 178 | + for ($i=0; $i<$count; $i++) { |
|
| 179 | 179 | $this->getCell($i, $colIndex)->addVariations($variations); |
| 180 | 180 | } |
| 181 | 181 | return $this; |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | private function colAlign($colIndex, $function) { |
| 194 | 194 | $count=$this->count(); |
| 195 | - for($i=0; $i < $count; $i++) { |
|
| 195 | + for ($i=0; $i<$count; $i++) { |
|
| 196 | 196 | $index=$this->content[$i]->getColPosition($colIndex); |
| 197 | - if ($index !== NULL) |
|
| 197 | + if ($index!==NULL) |
|
| 198 | 198 | $this->getCell($i, $index)->$function(); |
| 199 | 199 | } |
| 200 | 200 | return $this; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function getColCount() { |
| 228 | 228 | $result=0; |
| 229 | - if ($this->count() > 0) |
|
| 229 | + if ($this->count()>0) |
|
| 230 | 230 | $result=$this->getItem(0)->count(); |
| 231 | 231 | return $result; |
| 232 | 232 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | public function delete($rowIndex, $colIndex=NULL) { |
| 241 | 241 | if (isset($colIndex)) { |
| 242 | 242 | $row=$this->getItem($rowIndex); |
| 243 | - if (isset($row) === true) { |
|
| 243 | + if (isset($row)===true) { |
|
| 244 | 244 | $row->delete($colIndex); |
| 245 | 245 | } |
| 246 | 246 | } else { |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | return $this; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - public function toDelete($rowIndex, $colIndex){ |
|
| 252 | + public function toDelete($rowIndex, $colIndex) { |
|
| 253 | 253 | $row=$this->getItem($rowIndex); |
| 254 | - if (isset($row) === true) |
|
| 254 | + if (isset($row)===true) |
|
| 255 | 255 | $row->toDelete($colIndex); |
| 256 | 256 | return $this; |
| 257 | 257 | } |
@@ -280,17 +280,17 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | public function conditionalCellFormat($callback, $format) { |
| 282 | 282 | $rows=$this->content; |
| 283 | - foreach ( $rows as $row ) { |
|
| 283 | + foreach ($rows as $row) { |
|
| 284 | 284 | $row->conditionalCellFormat($callback, $format); |
| 285 | 285 | } |
| 286 | 286 | return $this; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - public function conditionalColFormat($colIndex,$callback,$format){ |
|
| 289 | + public function conditionalColFormat($colIndex, $callback, $format) { |
|
| 290 | 290 | $rows=$this->content; |
| 291 | - foreach ( $rows as $row ) { |
|
| 291 | + foreach ($rows as $row) { |
|
| 292 | 292 | $cell=$row->getItem($colIndex); |
| 293 | - $cell->conditionnalCellFormat($callback,$format); |
|
| 293 | + $cell->conditionnalCellFormat($callback, $format); |
|
| 294 | 294 | } |
| 295 | 295 | return $this; |
| 296 | 296 | } |
@@ -302,17 +302,17 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function conditionalRowFormat($callback, $format) { |
| 304 | 304 | $rows=$this->content; |
| 305 | - foreach ( $rows as $row ) { |
|
| 305 | + foreach ($rows as $row) { |
|
| 306 | 306 | $row->conditionalRowFormat($callback, $format); |
| 307 | 307 | } |
| 308 | 308 | return $this; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - public function hideColumn($colIndex){ |
|
| 311 | + public function hideColumn($colIndex) { |
|
| 312 | 312 | $rows=$this->content; |
| 313 | - foreach ( $rows as $row ) { |
|
| 313 | + foreach ($rows as $row) { |
|
| 314 | 314 | $cell=$row->getItem($colIndex); |
| 315 | - $cell->addToProperty("style","display:none;"); |
|
| 315 | + $cell->addToProperty("style", "display:none;"); |
|
| 316 | 316 | } |
| 317 | 317 | return $this; |
| 318 | 318 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | public function applyCells($callback) { |
| 325 | 325 | $rows=$this->content; |
| 326 | - foreach ( $rows as $row ) { |
|
| 326 | + foreach ($rows as $row) { |
|
| 327 | 327 | $row->applyCells($callback); |
| 328 | 328 | } |
| 329 | 329 | return $this; |
@@ -335,25 +335,25 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function applyRows($callback) { |
| 337 | 337 | $rows=$this->content; |
| 338 | - foreach ( $rows as $row ) { |
|
| 338 | + foreach ($rows as $row) { |
|
| 339 | 339 | $row->apply($callback); |
| 340 | 340 | } |
| 341 | 341 | return $this; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - public function mergeIdentiqualValues($colIndex,$function="strip_tags"){ |
|
| 344 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
| 345 | 345 | $rows=$this->content; |
| 346 | 346 | $identiqual=null; |
| 347 | 347 | $counter=0; |
| 348 | 348 | $cellToMerge=null; |
| 349 | 349 | $functionExists=\function_exists($function); |
| 350 | - foreach ( $rows as $row ) { |
|
| 350 | + foreach ($rows as $row) { |
|
| 351 | 351 | $cell=$row->getItem($colIndex); |
| 352 | 352 | $value=$cell->getContent(); |
| 353 | - if($functionExists) |
|
| 354 | - $value=\call_user_func($function,$value); |
|
| 355 | - if($value!==$identiqual){ |
|
| 356 | - if($counter>0 && isset($cellToMerge)){ |
|
| 353 | + if ($functionExists) |
|
| 354 | + $value=\call_user_func($function, $value); |
|
| 355 | + if ($value!==$identiqual) { |
|
| 356 | + if ($counter>0 && isset($cellToMerge)) { |
|
| 357 | 357 | $cellToMerge->setRowspan($counter); |
| 358 | 358 | } |
| 359 | 359 | $counter=0; |
@@ -362,17 +362,17 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | $counter++; |
| 364 | 364 | } |
| 365 | - if($counter>0 && isset($cellToMerge)){ |
|
| 365 | + if ($counter>0 && isset($cellToMerge)) { |
|
| 366 | 366 | $cellToMerge->setRowspan($counter); |
| 367 | 367 | } |
| 368 | 368 | return $this; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - public function _isMerged(){ |
|
| 371 | + public function _isMerged() { |
|
| 372 | 372 | return $this->_merged; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - public function _setMerged($value){ |
|
| 375 | + public function _setMerged($value) { |
|
| 376 | 376 | $this->_merged=$value; |
| 377 | 377 | return $this; |
| 378 | 378 | } |