@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | return $this->content; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function addContent($content,$before=false) { |
|
| 30 | + public function addContent($content, $before=false) { |
|
| 31 | 31 | if (!\is_array($this->content)) { |
| 32 | - if(isset($this->content)) |
|
| 33 | - $this->content=array ($this->content); |
|
| 32 | + if (isset($this->content)) |
|
| 33 | + $this->content=array($this->content); |
|
| 34 | 34 | else |
| 35 | 35 | $this->content=array(); |
| 36 | 36 | } |
| 37 | - if($before) |
|
| 38 | - array_unshift($this->content,$content); |
|
| 37 | + if ($before) |
|
| 38 | + array_unshift($this->content, $content); |
|
| 39 | 39 | else |
| 40 | 40 | $this->content []=$content; |
| 41 | 41 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
| 51 | 51 | $this->content->run($js); |
| 52 | 52 | } else if (\is_array($this->content)) { |
| 53 | - foreach ( $this->content as $itemContent ) { |
|
| 53 | + foreach ($this->content as $itemContent) { |
|
| 54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
| 55 | 55 | $itemContent->run($js); |
| 56 | 56 | } |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function getContentInstances($class){ |
|
| 71 | - return $this->_getContentInstances($class,$this->content); |
|
| 70 | + public function getContentInstances($class) { |
|
| 71 | + return $this->_getContentInstances($class, $this->content); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - protected function _getContentInstances($class,$content){ |
|
| 74 | + protected function _getContentInstances($class, $content) { |
|
| 75 | 75 | $instances=[]; |
| 76 | - if($content instanceof $class){ |
|
| 76 | + if ($content instanceof $class) { |
|
| 77 | 77 | $instances[]=$content; |
| 78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
| 79 | - $instances=\array_merge($instances,$content->getContentInstances($class)); |
|
| 80 | - }elseif (\is_array($content)){ |
|
| 81 | - foreach ($content as $element){ |
|
| 82 | - $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
|
| 78 | + }elseif ($content instanceof HtmlDoubleElement) { |
|
| 79 | + $instances=\array_merge($instances, $content->getContentInstances($class)); |
|
| 80 | + }elseif (\is_array($content)) { |
|
| 81 | + foreach ($content as $element) { |
|
| 82 | + $instances=\array_merge($instances, $this->_getContentInstances($class, $element)); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | return $instances; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class HtmlInput extends HtmlSingleElement { |
| 10 | 10 | protected $_placeholder; |
| 11 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 11 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 12 | 12 | parent::__construct($identifier, "input"); |
| 13 | 13 | $this->setProperty("name", $identifier); |
| 14 | 14 | $this->setValue($value); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function setValue($value) { |
| 20 | - if(isset($value)) |
|
| 20 | + if (isset($value)) |
|
| 21 | 21 | $this->setProperty("value", $value); |
| 22 | 22 | return $this; |
| 23 | 23 | } |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | return $this->setProperty("type", $value); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function setPlaceholder($value){ |
|
| 30 | - if(JString::isNotNull($value)) |
|
| 29 | + public function setPlaceholder($value) { |
|
| 30 | + if (JString::isNotNull($value)) |
|
| 31 | 31 | $this->_placeholder=$value; |
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 35 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 36 | 36 | $value=$this->_placeholder; |
| 37 | - if(JString::isNull($value)){ |
|
| 38 | - if(JString::isNotNull($this->getProperty("name"))) |
|
| 37 | + if (JString::isNull($value)) { |
|
| 38 | + if (JString::isNotNull($this->getProperty("name"))) |
|
| 39 | 39 | $value=\ucfirst($this->getProperty("name")); |
| 40 | 40 | } |
| 41 | 41 | $this->setProperty("placeholder", $value); |
| 42 | - return parent::compile($js,$view); |
|
| 42 | + return parent::compile($js, $view); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -14,34 +14,34 @@ discard block |
||
| 14 | 14 | use FieldTrait; |
| 15 | 15 | protected $_container; |
| 16 | 16 | protected $_validation; |
| 17 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 18 | - parent::__construct($identifier, "div","field"); |
|
| 17 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 18 | + parent::__construct($identifier, "div", "field"); |
|
| 19 | 19 | $this->content=array(); |
| 20 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 21 | - if(isset($label)) |
|
| 20 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 21 | + if (isset($label)) |
|
| 22 | 22 | $this->setLabel($label); |
| 23 | 23 | $this->setField($field); |
| 24 | 24 | $this->_validation=NULL; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
| 28 | - $labelO=new HtmlLabel("",$label); |
|
| 27 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
| 28 | + $labelO=new HtmlLabel("", $label); |
|
| 29 | 29 | $labelO->setPointing($pointing); |
| 30 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
| 30 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
| 31 | 31 | return $labelO; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setLabel($label){ |
|
| 34 | + public function setLabel($label) { |
|
| 35 | 35 | $labelO=$label; |
| 36 | - if(\is_string($label)){ |
|
| 37 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 36 | + if (\is_string($label)) { |
|
| 37 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 38 | 38 | $labelO->setContent($label); |
| 39 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 39 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 40 | 40 | } |
| 41 | 41 | $this->content["label"]=$labelO; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setField($field){ |
|
| 44 | + public function setField($field) { |
|
| 45 | 45 | $this->content["field"]=$field; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * Returns the label or null |
| 50 | 50 | * @return mixed |
| 51 | 51 | */ |
| 52 | - public function getLabel(){ |
|
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 52 | + public function getLabel() { |
|
| 53 | + if (\array_key_exists("label", $this->content)) |
|
| 54 | 54 | return $this->content["label"]; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * Return the field |
| 59 | 59 | * @return mixed |
| 60 | 60 | */ |
| 61 | - public function getField(){ |
|
| 61 | + public function getField() { |
|
| 62 | 62 | return $this->content["field"]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | * Return the field with data |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - public function getDataField(){ |
|
| 69 | + public function getDataField() { |
|
| 70 | 70 | return $this->content["field"]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * puts the label before or behind |
| 75 | 75 | */ |
| 76 | - public function swapLabel(){ |
|
| 76 | + public function swapLabel() { |
|
| 77 | 77 | $label=$this->getLabel(); |
| 78 | 78 | unset($this->content["label"]); |
| 79 | 79 | $this->content["label"]=$label; |
@@ -84,31 +84,31 @@ discard block |
||
| 84 | 84 | * @param int $width |
| 85 | 85 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 86 | 86 | */ |
| 87 | - public function setWidth($width){ |
|
| 88 | - if(\is_int($width)){ |
|
| 87 | + public function setWidth($width) { |
|
| 88 | + if (\is_int($width)) { |
|
| 89 | 89 | $width=Wide::getConstants()["W".$width]; |
| 90 | 90 | } |
| 91 | 91 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 92 | - if(isset($this->_container)){ |
|
| 92 | + if (isset($this->_container)) { |
|
| 93 | 93 | $this->_container->setEqualWidth(false); |
| 94 | 94 | } |
| 95 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 95 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Field displays an error state |
| 100 | 100 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 101 | 101 | */ |
| 102 | - public function setError(){ |
|
| 102 | + public function setError() { |
|
| 103 | 103 | return $this->addToProperty("class", "error"); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function setInline(){ |
|
| 106 | + public function setInline() { |
|
| 107 | 107 | return $this->addToProperty("class", "inline"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function jsState($state){ |
|
| 111 | - return $this->jsDoJquery("addClass",$state); |
|
| 110 | + public function jsState($state) { |
|
| 111 | + return $this->jsDoJquery("addClass", $state); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function setContainer($_container) { |
@@ -116,39 +116,39 @@ discard block |
||
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setReadonly(){ |
|
| 119 | + public function setReadonly() { |
|
| 120 | 120 | $this->getField()->setProperty("readonly", ""); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 123 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 124 | 124 | $field=$this->getDataField(); |
| 125 | - if(isset($field)){ |
|
| 126 | - if(!isset($this->_validation)){ |
|
| 125 | + if (isset($field)) { |
|
| 126 | + if (!isset($this->_validation)) { |
|
| 127 | 127 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 128 | 128 | } |
| 129 | - if($type==="empty"){ |
|
| 130 | - $this->addToProperty("class","required"); |
|
| 129 | + if ($type==="empty") { |
|
| 130 | + $this->addToProperty("class", "required"); |
|
| 131 | 131 | } |
| 132 | - $this->_validation->addRule($type,$prompt,$value); |
|
| 132 | + $this->_validation->addRule($type, $prompt, $value); |
|
| 133 | 133 | } |
| 134 | 134 | return $this; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function addRules(array $rules){ |
|
| 138 | - foreach ($rules as $rule){ |
|
| 137 | + public function addRules(array $rules) { |
|
| 138 | + foreach ($rules as $rule) { |
|
| 139 | 139 | $this->addRule($rule); |
| 140 | 140 | } |
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function setRules(array $rules){ |
|
| 144 | + public function setRules(array $rules) { |
|
| 145 | 145 | $this->_validation=null; |
| 146 | 146 | return $this->addRules($rules); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
| 149 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
| 150 | 150 | $field=$this->getField(); |
| 151 | - return $field->addIcon($icon,$direction); |
|
| 151 | + return $field->addIcon($icon, $direction); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function getValidation() { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class HtmlForm extends HtmlSemCollection { |
| 22 | 22 | |
| 23 | - use FieldsTrait,FormTrait; |
|
| 23 | + use FieldsTrait, FormTrait; |
|
| 24 | 24 | /** |
| 25 | 25 | * @var array |
| 26 | 26 | */ |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function __construct($identifier, $elements=array()) { |
| 35 | 35 | parent::__construct($identifier, "form", "ui form"); |
| 36 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
| 36 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
| 37 | 37 | $this->setProperty("name", $this->identifier); |
| 38 | - $this->_fields=array (); |
|
| 38 | + $this->_fields=array(); |
|
| 39 | 39 | $this->addItems($elements); |
| 40 | 40 | $this->_validationParams=[]; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function getForm(){ |
|
| 43 | + protected function getForm() { |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * @param string $caption |
| 62 | 62 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 63 | 63 | */ |
| 64 | - public function addDivider($caption=NULL){ |
|
| 65 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
| 64 | + public function addDivider($caption=NULL) { |
|
| 65 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function addFields($fields=NULL, $label=NULL) { |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | $label=NULL; |
| 79 | 79 | } |
| 80 | 80 | $this->_fields=\array_merge($this->_fields, $fields); |
| 81 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
| 81 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 82 | 82 | } |
| 83 | 83 | if (isset($label)) |
| 84 | 84 | $fields=new HtmlFormField("", $fields, $label); |
| 85 | 85 | } else { |
| 86 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
| 86 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
| 87 | 87 | } |
| 88 | 88 | $this->addItem($fields); |
| 89 | 89 | return $fields; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function addItem($item) { |
| 93 | 93 | $item=parent::addItem($item); |
| 94 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
| 94 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 95 | 95 | $this->_fields[]=$item; |
| 96 | 96 | } |
| 97 | 97 | return $item; |
@@ -145,38 +145,38 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
| 148 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 149 | - if(\sizeof($this->_validationParams)>0) |
|
| 148 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 149 | + if (\sizeof($this->_validationParams)>0) |
|
| 150 | 150 | $this->setProperty("novalidate", ""); |
| 151 | - return parent::compile($js,$view); |
|
| 151 | + return parent::compile($js, $view); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function run(JsUtils $js) { |
| 155 | - if(isset($js)){ |
|
| 155 | + if (isset($js)) { |
|
| 156 | 156 | $compo=$js->semantic()->form("#".$this->identifier); |
| 157 | - }else{ |
|
| 157 | + } else { |
|
| 158 | 158 | $compo=new Form(); |
| 159 | 159 | $compo->attach("#".$this->identifier); |
| 160 | 160 | } |
| 161 | - foreach ($this->_fields as $field){ |
|
| 162 | - if($field instanceof HtmlFormField){ |
|
| 161 | + foreach ($this->_fields as $field) { |
|
| 162 | + if ($field instanceof HtmlFormField) { |
|
| 163 | 163 | $compo=$this->addCompoValidation($compo, $field); |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | - foreach ($this->content as $field){ |
|
| 167 | - if($field instanceof HtmlFormFields){ |
|
| 166 | + foreach ($this->content as $field) { |
|
| 167 | + if ($field instanceof HtmlFormFields) { |
|
| 168 | 168 | $items=$field->getItems(); |
| 169 | - foreach ($items as $_field){ |
|
| 170 | - if($_field instanceof HtmlFormField) |
|
| 169 | + foreach ($items as $_field) { |
|
| 170 | + if ($_field instanceof HtmlFormField) |
|
| 171 | 171 | $compo=$this->addCompoValidation($compo, $_field); |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | - $this->_runValidationParams($compo,$js); |
|
| 175 | + $this->_runValidationParams($compo, $js); |
|
| 176 | 176 | return $this->_bsComponent; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function addValidationParam($paramName,$paramValue){ |
|
| 179 | + public function addValidationParam($paramName, $paramValue) { |
|
| 180 | 180 | $this->_validationParams[$paramName]=$paramValue; |
| 181 | 181 | return $this; |
| 182 | 182 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | return $this->_validationParams; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - public function removeValidationParam($param){ |
|
| 193 | + public function removeValidationParam($param) { |
|
| 194 | 194 | unset($this->_validationParams[$param]); |
| 195 | 195 | return $this; |
| 196 | 196 | } |
@@ -19,45 +19,45 @@ discard block |
||
| 19 | 19 | class DataElement extends Widget { |
| 20 | 20 | |
| 21 | 21 | public function __construct($identifier, $modelInstance=NULL) { |
| 22 | - parent::__construct($identifier, null,$modelInstance); |
|
| 23 | - $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false); |
|
| 22 | + parent::__construct($identifier, null, $modelInstance); |
|
| 23 | + $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false); |
|
| 24 | 24 | $this->content["table"]->setDefinition(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 28 | - if(!$this->_generated){ |
|
| 27 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 28 | + if (!$this->_generated) { |
|
| 29 | 29 | $this->_instanceViewer->setInstance($this->_modelInstance); |
| 30 | 30 | |
| 31 | 31 | $table=$this->content["table"]; |
| 32 | 32 | $this->_generateContent($table); |
| 33 | 33 | |
| 34 | - if(isset($this->_toolbar)){ |
|
| 34 | + if (isset($this->_toolbar)) { |
|
| 35 | 35 | $this->_setToolbarPosition($table); |
| 36 | 36 | } |
| 37 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
| 37 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
| 38 | 38 | $this->_compileForm(); |
| 39 | 39 | $this->_generated=true; |
| 40 | 40 | } |
| 41 | - return parent::compile($js,$view); |
|
| 41 | + return parent::compile($js, $view); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @param HtmlTable $table |
| 46 | 46 | */ |
| 47 | - protected function _generateContent($table){ |
|
| 47 | + protected function _generateContent($table) { |
|
| 48 | 48 | $captions=$this->_instanceViewer->getCaptions(); |
| 49 | - $values= $this->_instanceViewer->getValues(); |
|
| 49 | + $values=$this->_instanceViewer->getValues(); |
|
| 50 | 50 | $count=$this->_instanceViewer->count(); |
| 51 | - for($i=0;$i<$count;$i++){ |
|
| 52 | - $table->addRow([$captions[$i],$values[$i]]); |
|
| 51 | + for ($i=0; $i<$count; $i++) { |
|
| 52 | + $table->addRow([$captions[$i], $values[$i]]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - protected function _getFieldName($index){ |
|
| 56 | + protected function _getFieldName($index) { |
|
| 57 | 57 | return $this->_instanceViewer->getFieldName($index); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - protected function _getFieldCaption($index){ |
|
| 60 | + protected function _getFieldCaption($index) { |
|
| 61 | 61 | return null; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function asForm(){ |
|
| 92 | + public function asForm() { |
|
| 93 | 93 | return $this->getForm(); |
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | \ No newline at end of file |
@@ -16,6 +16,6 @@ |
||
| 16 | 16 | if (isset($toElement)) { |
| 17 | 17 | $toElement->setAttached(true); |
| 18 | 18 | } |
| 19 | - return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached")); |
|
| 19 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | * @property string $identifier |
| 13 | 13 | */ |
| 14 | 14 | trait BaseTrait { |
| 15 | - protected $_variations=[ ]; |
|
| 16 | - protected $_states=[ ]; |
|
| 15 | + protected $_variations=[]; |
|
| 16 | + protected $_states=[]; |
|
| 17 | 17 | protected $_baseClass; |
| 18 | 18 | |
| 19 | 19 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | abstract public function setProperty($name, $value); |
| 28 | 28 | |
| 29 | - abstract public function addContent($content,$before=false); |
|
| 29 | + abstract public function addContent($content, $before=false); |
|
| 30 | 30 | |
| 31 | 31 | abstract public function onCreate($jsCode); |
| 32 | 32 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->setProperty("class", $this->_baseClass); |
| 48 | 48 | if (\is_string($variations)) |
| 49 | 49 | $variations=\explode(" ", $variations); |
| 50 | - foreach ( $variations as $variation ) { |
|
| 50 | + foreach ($variations as $variation) { |
|
| 51 | 51 | $this->addVariation($variation); |
| 52 | 52 | } |
| 53 | 53 | return $this; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function addVariations($variations=array()) { |
| 62 | 62 | if (\is_string($variations)) |
| 63 | 63 | $variations=\explode(" ", $variations); |
| 64 | - foreach ( $variations as $variation ) { |
|
| 64 | + foreach ($variations as $variation) { |
|
| 65 | 65 | $this->addVariation($variation); |
| 66 | 66 | } |
| 67 | 67 | return $this; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function addStates($states=array()) { |
| 71 | 71 | if (\is_string($states)) |
| 72 | 72 | $states=\explode(" ", $states); |
| 73 | - foreach ( $states as $state ) { |
|
| 73 | + foreach ($states as $state) { |
|
| 74 | 74 | $this->addState($state); |
| 75 | 75 | } |
| 76 | 76 | return $this; |
@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | $this->setProperty("class", $this->_baseClass); |
| 81 | 81 | if (\is_string($states)) |
| 82 | 82 | $states=\explode(" ", $states); |
| 83 | - foreach ( $states as $state ) { |
|
| 83 | + foreach ($states as $state) { |
|
| 84 | 84 | $this->addState($state); |
| 85 | 85 | } |
| 86 | 86 | return $this; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function addIcon($icon, $before=true) { |
| 90 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
| 90 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function addSticky($context="body"){ |
|
| 93 | + public function addSticky($context="body") { |
|
| 94 | 94 | $this->onCreate("$('#".$this->identifier."').sticky({ context: '".$context."'});"); |
| 95 | 95 | return $this; |
| 96 | 96 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
| 112 | 112 | */ |
| 113 | 113 | public function setDisabled($disable=true) { |
| 114 | - if($disable) |
|
| 114 | + if ($disable) |
|
| 115 | 115 | $this->addToProperty("class", "disabled"); |
| 116 | 116 | return $this; |
| 117 | 117 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 139 | 139 | */ |
| 140 | - public function asHeader(){ |
|
| 140 | + public function asHeader() { |
|
| 141 | 141 | return $this->addToProperty("class", "header"); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | * show it is currently the active user selection |
| 146 | 146 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 147 | 147 | */ |
| 148 | - public function setActive($value=true){ |
|
| 149 | - if($value) |
|
| 148 | + public function setActive($value=true) { |
|
| 149 | + if ($value) |
|
| 150 | 150 | $this->addToProperty("class", "active"); |
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function setAttached($value=true){ |
|
| 155 | - if($value) |
|
| 156 | - $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 154 | + public function setAttached($value=true) { |
|
| 155 | + if ($value) |
|
| 156 | + $this->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 157 | 157 | return $this; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | public function setFloated($direction="right") { |
| 172 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
| 172 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | public function floatRight() { |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\semantic\html\collections\table\traits; |
| 3 | 3 | |
| 4 | -trait TableTrait{ |
|
| 4 | +trait TableTrait { |
|
| 5 | 5 | /** |
| 6 | 6 | * @return HtmlTable |
| 7 | 7 | */ |
| 8 | 8 | abstract protected function getTable(); |
| 9 | 9 | |
| 10 | - protected function addToPropertyTable($property,$value){ |
|
| 10 | + protected function addToPropertyTable($property, $value) { |
|
| 11 | 11 | return $this->getTable()->addToProperty($property, $value); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | public function setBasic($very=false) { |
| 19 | 19 | $table=$this->getTable(); |
| 20 | 20 | if ($very) |
| 21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 22 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 21 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 22 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function setCompact($very=false) { |
| 26 | 26 | $table=$this->getTable(); |
| 27 | 27 | if ($very) |
| 28 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 29 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
| 28 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 29 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function setCollapsing() { |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | * @property SimpleExtComponent $_bsComponent |
| 12 | 12 | * @property string identifier |
| 13 | 13 | */ |
| 14 | -trait BaseHtmlEventsTrait{ |
|
| 14 | +trait BaseHtmlEventsTrait { |
|
| 15 | 15 | |
| 16 | - protected $_events=array (); |
|
| 16 | + protected $_events=array(); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $event |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * @return \Ajax\common\html\BaseHtml |
| 24 | 24 | */ |
| 25 | 25 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 26 | - if ($stopPropagation === true) { |
|
| 27 | - $jsCode=Javascript::$stopPropagation . $jsCode; |
|
| 26 | + if ($stopPropagation===true) { |
|
| 27 | + $jsCode=Javascript::$stopPropagation.$jsCode; |
|
| 28 | 28 | } |
| 29 | - if ($preventDefault === true) { |
|
| 30 | - $jsCode=Javascript::$preventDefault . $jsCode; |
|
| 29 | + if ($preventDefault===true) { |
|
| 30 | + $jsCode=Javascript::$preventDefault.$jsCode; |
|
| 31 | 31 | } |
| 32 | 32 | return $this->_addEvent($event, $jsCode); |
| 33 | 33 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (\is_array($this->_events[$event])) { |
| 43 | 43 | $this->_events[$event][]=$jsCode; |
| 44 | 44 | } else { |
| 45 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 45 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 46 | 46 | } |
| 47 | 47 | } else { |
| 48 | 48 | $this->_events[$event]=$jsCode; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | return $this->onClick($jsCode); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function onCreate($jsCode){ |
|
| 73 | - if(isset($this->_events["_create"])){ |
|
| 72 | + public function onCreate($jsCode) { |
|
| 73 | + if (isset($this->_events["_create"])) { |
|
| 74 | 74 | $this->_events["_create"][]=$jsCode; |
| 75 | - }else{ |
|
| 75 | + } else { |
|
| 76 | 76 | $this->_events["_create"]=[$jsCode]; |
| 77 | 77 | } |
| 78 | 78 | return $this; |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | public function addEventsOnRun(JsUtils $js=NULL) { |
| 82 | 82 | $this->_eventsOnCreate($js); |
| 83 | 83 | if (isset($this->_bsComponent)) { |
| 84 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 84 | + foreach ($this->_events as $event => $jsCode) { |
|
| 85 | 85 | $code=$jsCode; |
| 86 | 86 | if (\is_array($jsCode)) { |
| 87 | 87 | $code=""; |
| 88 | - foreach ( $jsCode as $jsC ) { |
|
| 88 | + foreach ($jsCode as $jsC) { |
|
| 89 | 89 | if ($jsC instanceof AjaxCall) { |
| 90 | - $code.="\n" . $jsC->compile($js); |
|
| 90 | + $code.="\n".$jsC->compile($js); |
|
| 91 | 91 | } else { |
| 92 | - $code.="\n" . $jsC; |
|
| 92 | + $code.="\n".$jsC; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | $this->_bsComponent->addEvent($event, $code); |
| 99 | 99 | } |
| 100 | - $this->_events=array (); |
|
| 100 | + $this->_events=array(); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
| 105 | - if(isset($this->_events["_create"])){ |
|
| 104 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
| 105 | + if (isset($this->_events["_create"])) { |
|
| 106 | 106 | $create=$this->_events["_create"]; |
| 107 | - if(\is_array($create)){ |
|
| 107 | + if (\is_array($create)) { |
|
| 108 | 108 | $create=\implode("", $create); |
| 109 | 109 | } |
| 110 | - if(isset($js) && $create!=="") |
|
| 111 | - $js->exec($create,true); |
|
| 110 | + if (isset($js) && $create!=="") |
|
| 111 | + $js->exec($create, true); |
|
| 112 | 112 | unset($this->_events["_create"]); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @return BaseHtml |
| 123 | 123 | */ |
| 124 | 124 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 125 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 125 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 126 | 126 | $params=array_merge($params, $parameters); |
| 127 | 127 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 128 | 128 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function jsDoJquery($jqueryCall, $param="") { |
| 158 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
| 158 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function executeOnRun($jsCode) { |