@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * @author jc |
| 15 | 15 | * @version 1.001 |
| 16 | 16 | */ |
| 17 | -class HtmlTab extends HtmlSemCollection{ |
|
| 17 | +class HtmlTab extends HtmlSemCollection { |
|
| 18 | 18 | |
| 19 | 19 | protected $params=array("debug"=>true); |
| 20 | 20 | |
| 21 | - public function __construct( $identifier, $tabs=array()){ |
|
| 22 | - parent::__construct( $identifier, "div", ""); |
|
| 21 | + public function __construct($identifier, $tabs=array()) { |
|
| 22 | + parent::__construct($identifier, "div", ""); |
|
| 23 | 23 | $menu=new HtmlMenu("menu".$this->identifier); |
| 24 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
| 24 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
| 25 | 25 | $this->content["menu"]=$menu; |
| 26 | 26 | $this->addItems($tabs); |
| 27 | 27 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 32 | 32 | * @return HtmlSegment |
| 33 | 33 | */ |
| 34 | - protected function createItem($value){ |
|
| 34 | + protected function createItem($value) { |
|
| 35 | 35 | $count=$this->count(); |
| 36 | 36 | $title=$value; |
| 37 | 37 | $content=NULL; |
| 38 | - if(\is_array($value)){ |
|
| 39 | - $title=@$value[0];$content=@$value[1]; |
|
| 38 | + if (\is_array($value)) { |
|
| 39 | + $title=@$value[0]; $content=@$value[1]; |
|
| 40 | 40 | } |
| 41 | 41 | $menuItem=$this->content["menu"]->addItem($title); |
| 42 | 42 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * @param string $datatab |
| 51 | 51 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 52 | 52 | */ |
| 53 | - private function createSegment($count,$content,$datatab){ |
|
| 53 | + private function createSegment($count, $content, $datatab) { |
|
| 54 | 54 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
| 55 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab); |
|
| 55 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab); |
|
| 56 | 56 | return $segment; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | * @param String $content new content |
| 63 | 63 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 64 | 64 | */ |
| 65 | - public function setTabContent($index,$content){ |
|
| 65 | + public function setTabContent($index, $content) { |
|
| 66 | 66 | $menu=$this->content["menu"]; |
| 67 | - if($index<$menu->count()){ |
|
| 68 | - if(isset($this->content[$index])===false){ |
|
| 67 | + if ($index<$menu->count()) { |
|
| 68 | + if (isset($this->content[$index])===false) { |
|
| 69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
| 70 | - }else |
|
| 70 | + } else |
|
| 71 | 71 | $this->content[$index]->setContent($content); |
| 72 | 72 | } |
| 73 | 73 | return $this; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param array $contents |
| 79 | 79 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 80 | 80 | */ |
| 81 | - public function setTabsContent($contents){ |
|
| 82 | - for($i=0;$i<\sizeof($contents);$i++){ |
|
| 81 | + public function setTabsContent($contents) { |
|
| 82 | + for ($i=0; $i<\sizeof($contents); $i++) { |
|
| 83 | 83 | $this->setTabContent($i, $contents[$i]); |
| 84 | 84 | } |
| 85 | 85 | return $this; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param int $index |
| 91 | 91 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 92 | 92 | */ |
| 93 | - public function activate($index){ |
|
| 93 | + public function activate($index) { |
|
| 94 | 94 | $this->content["menu"]->getItem($index)->setActive(true); |
| 95 | 95 | $this->content[$index]->setActive(true); |
| 96 | 96 | return $this; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | * @param string $content |
| 103 | 103 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 104 | 104 | */ |
| 105 | - public function addTab($title,$content){ |
|
| 106 | - return $this->addItem([$title,$content]); |
|
| 105 | + public function addTab($title, $content) { |
|
| 106 | + return $this->addItem([$title, $content]); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | * @param array $params |
| 118 | 118 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 119 | 119 | */ |
| 120 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 121 | - if(\array_key_exists($index, $this->content)){ |
|
| 122 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
| 120 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 121 | + if (\array_key_exists($index, $this->content)) { |
|
| 122 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
| 123 | 123 | return $this->content[$index]; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
| 126 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | * @param $params The parameters to pass to the view |
| 137 | 137 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 138 | 138 | */ |
| 139 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 140 | - if(\array_key_exists($index, $this->content)){ |
|
| 141 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
| 139 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 140 | + if (\array_key_exists($index, $this->content)) { |
|
| 141 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
| 142 | 142 | return $this->content[$index]; |
| 143 | 143 | } |
| 144 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
| 144 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @param array $params |
| 156 | 156 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 157 | 157 | */ |
| 158 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 159 | - return $this->addTab($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 158 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 159 | + return $this->addTab($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * @param $params The parameters to pass to the view |
| 169 | 169 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 170 | 170 | */ |
| 171 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 172 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 171 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 172 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | public function setPointing($value=Direction::NONE) { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param int $index |
| 186 | 186 | * @return Ajax\semantic\html\content\HtmlMenuItem |
| 187 | 187 | */ |
| 188 | - public function getMenuTab($index){ |
|
| 188 | + public function getMenuTab($index) { |
|
| 189 | 189 | return $this->content["menu"]->getItem($index); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param int $index |
| 195 | 195 | * @return HtmlSegment |
| 196 | 196 | */ |
| 197 | - public function getTab($index){ |
|
| 197 | + public function getTab($index) { |
|
| 198 | 198 | return $this->content[$index]; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -203,20 +203,20 @@ discard block |
||
| 203 | 203 | * @param HtmlMenu $menu |
| 204 | 204 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 205 | 205 | */ |
| 206 | - public function setMenu($menu){ |
|
| 207 | - for($i=0;$i<\sizeof($this->content);$i++){ |
|
| 208 | - if($menu->getItem($i)!==NULL){ |
|
| 209 | - if(isset($this->content[$i])){ |
|
| 210 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
| 206 | + public function setMenu($menu) { |
|
| 207 | + for ($i=0; $i<\sizeof($this->content); $i++) { |
|
| 208 | + if ($menu->getItem($i)!==NULL) { |
|
| 209 | + if (isset($this->content[$i])) { |
|
| 210 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - for($i=0;$i<$menu->count();$i++){ |
|
| 214 | + for ($i=0; $i<$menu->count(); $i++) { |
|
| 215 | 215 | $menu->getItem($i)->removeProperty("href"); |
| 216 | - if(isset($this->content[$i])===false){ |
|
| 216 | + if (isset($this->content[$i])===false) { |
|
| 217 | 217 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
| 218 | 218 | } |
| 219 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
| 219 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $this->content["menu"]=$menu; |
@@ -228,15 +228,15 @@ discard block |
||
| 228 | 228 | * @see BaseHtml::run() |
| 229 | 229 | */ |
| 230 | 230 | public function run(JsUtils $js) { |
| 231 | - if(isset($this->_bsComponent)===false) |
|
| 232 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
| 231 | + if (isset($this->_bsComponent)===false) |
|
| 232 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
| 233 | 233 | $this->addEventsOnRun($js); |
| 234 | 234 | return $this->_bsComponent; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 238 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
| 238 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
| 239 | 239 | $this->activate(0); |
| 240 | - return parent::compile($js,$view); |
|
| 240 | + return parent::compile($js, $view); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | \ No newline at end of file |
@@ -8,52 +8,52 @@ |
||
| 8 | 8 | class HtmlStepItem extends HtmlAbsractItem { |
| 9 | 9 | |
| 10 | 10 | public function __construct($identifier, $content) { |
| 11 | - parent::__construct($identifier,"step",$content); |
|
| 11 | + parent::__construct($identifier, "step", $content); |
|
| 12 | 12 | } |
| 13 | - protected function initContent($content){ |
|
| 14 | - if(\is_array($content)){ |
|
| 15 | - if(JArray::isAssociative($content)===false){ |
|
| 13 | + protected function initContent($content) { |
|
| 14 | + if (\is_array($content)) { |
|
| 15 | + if (JArray::isAssociative($content)===false) { |
|
| 16 | 16 | $icon=@$content[0]; |
| 17 | 17 | $title=@$content[1]; |
| 18 | 18 | $desc=@$content[2]; |
| 19 | 19 | $status=@$content[3]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $title=@$content["title"]; |
| 23 | 23 | $desc=@$content["description"]; |
| 24 | 24 | $status=@$content["status"]; |
| 25 | 25 | } |
| 26 | - if(isset($icon)){ |
|
| 26 | + if (isset($icon)) { |
|
| 27 | 27 | $this->setIcon($icon); |
| 28 | 28 | } |
| 29 | - if(isset($status)){ |
|
| 29 | + if (isset($status)) { |
|
| 30 | 30 | $this->setStatus($status); |
| 31 | 31 | } |
| 32 | - if(isset($title)){ |
|
| 33 | - $this->setTitle($title,$desc); |
|
| 32 | + if (isset($title)) { |
|
| 33 | + $this->setTitle($title, $desc); |
|
| 34 | 34 | } |
| 35 | - }else{ |
|
| 35 | + } else { |
|
| 36 | 36 | $this->setContent($content); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function setActive($value=true){ |
|
| 41 | - if($value) |
|
| 40 | + public function setActive($value=true) { |
|
| 41 | + if ($value) |
|
| 42 | 42 | $this->setStatus(StepStatus::ACTIVE); |
| 43 | 43 | else |
| 44 | 44 | $this->setStatus(StepStatus::NONE); |
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function setCompleted(){ |
|
| 48 | + public function setCompleted() { |
|
| 49 | 49 | return $this->setStatus(StepStatus::COMPLETED); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function setStatus($status){ |
|
| 52 | + public function setStatus($status) { |
|
| 53 | 53 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function removeStatus(){ |
|
| 56 | + public function removeStatus() { |
|
| 57 | 57 | $this->removePropertyValues("class", StepStatus::getConstants()); |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
| 9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
| 10 | 10 | use MenuItemTrait; |
| 11 | 11 | public function __construct($identifier, $content) { |
| 12 | - parent::__construct($identifier,"div","item",$content); |
|
| 12 | + parent::__construct($identifier, "div", "item", $content); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function initContent($content){ |
|
| 16 | - if(\is_array($content)){ |
|
| 17 | - if(JArray::isAssociative($content)===false){ |
|
| 15 | + protected function initContent($content) { |
|
| 16 | + if (\is_array($content)) { |
|
| 17 | + if (JArray::isAssociative($content)===false) { |
|
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | 20 | $desc=@$content[2]; |
| 21 | - }else{ |
|
| 21 | + } else { |
|
| 22 | 22 | $icon=@$content["icon"]; |
| 23 | 23 | $title=@$content["title"]; |
| 24 | 24 | $desc=@$content["description"]; |
| 25 | 25 | } |
| 26 | - if(isset($icon)){ |
|
| 26 | + if (isset($icon)) { |
|
| 27 | 27 | $this->addIcon($icon); |
| 28 | 28 | } |
| 29 | - if(isset($title)){ |
|
| 30 | - $this->setTitle($title,$desc); |
|
| 29 | + if (isset($title)) { |
|
| 30 | + $this->setTitle($title, $desc); |
|
| 31 | 31 | } |
| 32 | - }else{ |
|
| 32 | + } else { |
|
| 33 | 33 | $this->setContent($content); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -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,26 +116,26 @@ 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; |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 40 | 40 | */ |
| 41 | 41 | public function setType($type="") { |
| 42 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 42 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function setActiveItem($index) { |
| 46 | 46 | $item=$this->getItem($index); |
| 47 | - if ($item !== null) { |
|
| 47 | + if ($item!==null) { |
|
| 48 | 48 | $item->addToProperty("class", "active"); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | private function getItemToInsert($item) { |
| 54 | - if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton ) { |
|
| 55 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
| 54 | + if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton) { |
|
| 55 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
| 56 | 56 | $item=$itemO; |
| 57 | 57 | } |
| 58 | 58 | return $item; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | private function afterInsert($item) { |
| 62 | 62 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 63 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 64 | 64 | else { |
| 65 | 65 | $this->setSecondary(); |
| 66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function addItem($item) { |
| 77 | 77 | $number=$item; |
| 78 | 78 | $item=parent::addItem($this->getItemToInsert($item)); |
| 79 | - if(\is_int($number)) |
|
| 79 | + if (\is_int($number)) |
|
| 80 | 80 | $item->setProperty("data-page", $number); |
| 81 | 81 | return $this->afterInsert($item); |
| 82 | 82 | } |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function generateMenuAsItem($menu, $header=null) { |
| 96 | 96 | $count=$this->count(); |
| 97 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 97 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 98 | 98 | if (isset($header)) { |
| 99 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 99 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 100 | 100 | $headerItem->setContent($header); |
| 101 | 101 | $item->addContent($headerItem); |
| 102 | 102 | $this->_itemHeader=$headerItem; |
| 103 | 103 | } |
| 104 | - if(\is_array($menu)){ |
|
| 105 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 104 | + if (\is_array($menu)) { |
|
| 105 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 106 | 106 | } |
| 107 | 107 | $menu->setClass("menu"); |
| 108 | 108 | $item->addContent($menu); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 118 | 118 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 119 | 119 | $value=$this->addItem($value); |
| 120 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 120 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 121 | 121 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 122 | 122 | $this->wrap("", $popup); |
| 123 | 123 | return $popup; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | public function addDropdownAsItem($value, $items=NULL) { |
| 127 | 127 | $dd=$value; |
| 128 | 128 | if (\is_string($value)) { |
| 129 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 129 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 130 | 130 | } |
| 131 | 131 | $this->addItem($dd); |
| 132 | 132 | return $dd; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 140 | 140 | */ |
| 141 | 141 | protected function createItem($value) { |
| 142 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
| 142 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
| 143 | 143 | $itemO->setTagName("a"); |
| 144 | 144 | $itemO->setContent($value); |
| 145 | 145 | return $itemO; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function setSecondary($value=true) { |
| 153 | - if($value) |
|
| 153 | + if ($value) |
|
| 154 | 154 | $this->addToProperty("class", "secondary"); |
| 155 | 155 | else |
| 156 | 156 | $this->removePropertyValue("class", "secondary"); |
@@ -158,28 +158,28 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | public function setVertical() { |
| 161 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 161 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function setPosition($value="right") { |
| 165 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 165 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | public function setPointing($value=Direction::NONE) { |
| 169 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 169 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public function asTab($vertical=false) { |
| 173 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 173 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 174 | 174 | $item->setTagName("a"); |
| 175 | 175 | }); |
| 176 | - if ($vertical === true) |
|
| 176 | + if ($vertical===true) |
|
| 177 | 177 | $this->setVertical(); |
| 178 | 178 | return $this->addToProperty("class", "tabular"); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | public function asPagination() { |
| 182 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 182 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 183 | 183 | $item->setTagName("a"); |
| 184 | 184 | }); |
| 185 | 185 | return $this->addToProperty("class", "pagination"); |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function setWidth($width) { |
| 218 | 218 | if (\is_int($width)) { |
| 219 | - $width=Wide::getConstants()["W" . $width]; |
|
| 219 | + $width=Wide::getConstants()["W".$width]; |
|
| 220 | 220 | } |
| 221 | 221 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 222 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 222 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | public function addImage($identifier, $src="", $alt="") { |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | return $this->_itemHeader; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - public function run(JsUtils $js){ |
|
| 238 | - $result= parent::run($js); |
|
| 237 | + public function run(JsUtils $js) { |
|
| 238 | + $result=parent::run($js); |
|
| 239 | 239 | return $result->setItemSelector(".item"); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | \ No newline at end of file |
@@ -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->_validationParams=[]; |
| 40 | 40 | $this->addItems($elements); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function getForm(){ |
|
| 43 | + protected function getForm() { |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -61,14 +61,14 @@ 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) { |
| 69 | 69 | if (isset($fields)) { |
| 70 | 70 | if (!$fields instanceof HtmlFormFields) { |
| 71 | - if (\is_array($fields) === false) { |
|
| 71 | + if (\is_array($fields)===false) { |
|
| 72 | 72 | $fields=\func_get_args(); |
| 73 | 73 | $end=\end($fields); |
| 74 | 74 | if (\is_string($end)) { |
@@ -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; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | return $this->addItem($message); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - private function addCompoValidation($js,$compo,$field){ |
|
| 146 | + private function addCompoValidation($js, $compo, $field) { |
|
| 147 | 147 | $validation=$field->getValidation(); |
| 148 | - if(isset($validation)){ |
|
| 149 | - if(isset($compo)===false){ |
|
| 148 | + if (isset($validation)) { |
|
| 149 | + if (isset($compo)===false) { |
|
| 150 | 150 | $compo=$js->semantic()->form("#".$this->identifier); |
| 151 | 151 | } |
| 152 | 152 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
@@ -155,38 +155,38 @@ discard block |
||
| 155 | 155 | return $compo; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 159 | - if(\sizeof($this->_validationParams)>0) |
|
| 158 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 159 | + if (\sizeof($this->_validationParams)>0) |
|
| 160 | 160 | $this->setProperty("novalidate", ""); |
| 161 | - return parent::compile($js,$view); |
|
| 161 | + return parent::compile($js, $view); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function run(JsUtils $js) { |
| 165 | 165 | $compo=NULL; |
| 166 | - foreach ($this->_fields as $field){ |
|
| 167 | - if($field instanceof HtmlFormField) |
|
| 166 | + foreach ($this->_fields as $field) { |
|
| 167 | + if ($field instanceof HtmlFormField) |
|
| 168 | 168 | $compo=$this->addCompoValidation($js, $compo, $field); |
| 169 | 169 | } |
| 170 | - foreach ($this->content as $field){ |
|
| 171 | - if($field instanceof HtmlFormFields){ |
|
| 170 | + foreach ($this->content as $field) { |
|
| 171 | + if ($field instanceof HtmlFormFields) { |
|
| 172 | 172 | $items=$field->getItems(); |
| 173 | - foreach ($items as $_field){ |
|
| 174 | - if($_field instanceof HtmlFormField) |
|
| 173 | + foreach ($items as $_field) { |
|
| 174 | + if ($_field instanceof HtmlFormField) |
|
| 175 | 175 | $compo=$this->addCompoValidation($js, $compo, $_field); |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - if(isset($compo)===false){ |
|
| 179 | + if (isset($compo)===false) { |
|
| 180 | 180 | return parent::run($js); |
| 181 | 181 | } |
| 182 | - $this->_runValidationParams($compo,$js); |
|
| 182 | + $this->_runValidationParams($compo, $js); |
|
| 183 | 183 | return $this->_bsComponent; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - private function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
| 187 | - if(isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall){ |
|
| 186 | + private function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
| 187 | + if (isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall) { |
|
| 188 | 188 | $compilation=$this->_validationParams["_ajaxSubmit"]->compile($js); |
| 189 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
| 189 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
| 190 | 190 | $this->onSuccess($compilation); |
| 191 | 191 | unset($this->_validationParams["_ajaxSubmit"]); |
| 192 | 192 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $this->addEventsOnRun($js); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public function addValidationParam($paramName,$paramValue){ |
|
| 198 | + public function addValidationParam($paramName, $paramValue) { |
|
| 199 | 199 | $this->_validationParams[$paramName]=$paramValue; |
| 200 | 200 | return $this; |
| 201 | 201 | } |
@@ -10,16 +10,16 @@ discard block |
||
| 10 | 10 | * @property SimpleExtComponent $_bsComponent |
| 11 | 11 | * @property string identifier |
| 12 | 12 | */ |
| 13 | -trait BaseHtmlEventsTrait{ |
|
| 13 | +trait BaseHtmlEventsTrait { |
|
| 14 | 14 | |
| 15 | - protected $_events=array (); |
|
| 15 | + protected $_events=array(); |
|
| 16 | 16 | |
| 17 | 17 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 18 | - if ($stopPropagation === true) { |
|
| 19 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 18 | + if ($stopPropagation===true) { |
|
| 19 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 20 | 20 | } |
| 21 | - if ($preventDefault === true) { |
|
| 22 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 21 | + if ($preventDefault===true) { |
|
| 22 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 23 | 23 | } |
| 24 | 24 | return $this->_addEvent($event, $jsCode); |
| 25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if (is_array($this->_events[$event])) { |
| 30 | 30 | $this->_events[$event][]=$jsCode; |
| 31 | 31 | } else { |
| 32 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 32 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 33 | 33 | } |
| 34 | 34 | } else { |
| 35 | 35 | $this->_events[$event]=$jsCode; |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | return $this->onClick($jsCode); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function onCreate($jsCode){ |
|
| 53 | - if(isset($this->_events["_create"])){ |
|
| 52 | + public function onCreate($jsCode) { |
|
| 53 | + if (isset($this->_events["_create"])) { |
|
| 54 | 54 | $this->_events["_create"][]=$jsCode; |
| 55 | - }else{ |
|
| 55 | + } else { |
|
| 56 | 56 | $this->_events["_create"]=[$jsCode]; |
| 57 | 57 | } |
| 58 | 58 | return $this; |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | public function addEventsOnRun(JsUtils $js=NULL) { |
| 62 | 62 | $this->_eventsOnCreate($js); |
| 63 | 63 | if (isset($this->_bsComponent)) { |
| 64 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 64 | + foreach ($this->_events as $event => $jsCode) { |
|
| 65 | 65 | $code=$jsCode; |
| 66 | 66 | if (is_array($jsCode)) { |
| 67 | 67 | $code=""; |
| 68 | - foreach ( $jsCode as $jsC ) { |
|
| 68 | + foreach ($jsCode as $jsC) { |
|
| 69 | 69 | if ($jsC instanceof AjaxCall) { |
| 70 | - $code.="\n" . $jsC->compile($js); |
|
| 70 | + $code.="\n".$jsC->compile($js); |
|
| 71 | 71 | } else { |
| 72 | - $code.="\n" . $jsC; |
|
| 72 | + $code.="\n".$jsC; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -77,24 +77,24 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | $this->_bsComponent->addEvent($event, $code); |
| 79 | 79 | } |
| 80 | - $this->_events=array (); |
|
| 80 | + $this->_events=array(); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
| 85 | - if(isset($this->_events["_create"])){ |
|
| 84 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
| 85 | + if (isset($this->_events["_create"])) { |
|
| 86 | 86 | $create=$this->_events["_create"]; |
| 87 | - if(\is_array($create)){ |
|
| 87 | + if (\is_array($create)) { |
|
| 88 | 88 | $create=\implode("", $create); |
| 89 | 89 | } |
| 90 | - if(isset($js) && $create!=="") |
|
| 91 | - $js->exec($create,true); |
|
| 90 | + if (isset($js) && $create!=="") |
|
| 91 | + $js->exec($create, true); |
|
| 92 | 92 | unset($this->_events["_create"]); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 97 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 97 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 98 | 98 | $params=array_merge($params, $parameters); |
| 99 | 99 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 100 | 100 | return $this; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function jsDoJquery($jqueryCall, $param="") { |
| 130 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
| 130 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function executeOnRun($jsCode) { |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | use BaseHtmlEventsTrait; |
| 18 | 18 | protected $_template; |
| 19 | 19 | protected $tagName; |
| 20 | - protected $properties=array (); |
|
| 21 | - protected $_wrapBefore=array (); |
|
| 22 | - protected $_wrapAfter=array (); |
|
| 20 | + protected $properties=array(); |
|
| 21 | + protected $_wrapBefore=array(); |
|
| 22 | + protected $_wrapAfter=array(); |
|
| 23 | 23 | protected $_bsComponent; |
| 24 | 24 | |
| 25 | 25 | public function getBsComponent() { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function getTemplate(JsUtils $js=NULL) { |
| 35 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 35 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getProperties() { |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | if (\is_array($value)) { |
| 59 | - foreach ( $value as $v ) { |
|
| 59 | + foreach ($value as $v) { |
|
| 60 | 60 | $this->addToProperty($name, $v, $separator); |
| 61 | 61 | } |
| 62 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 62 | + } else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 63 | 63 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 64 | + if (isset($v) && $v!=="") |
|
| 65 | + $v=$v.$separator.$value; |
|
| 66 | 66 | else |
| 67 | 67 | $v=$value; |
| 68 | 68 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | 80 | $result=$this->getTemplate($js); |
| 81 | - foreach ( $this as $key => $value ) { |
|
| 82 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
| 81 | + foreach ($this as $key => $value) { |
|
| 82 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
| 83 | 83 | if (is_array($value)) { |
| 84 | 84 | $v=PropertyWrapper::wrap($value, $js); |
| 85 | 85 | } else { |
| 86 | 86 | $v=$value; |
| 87 | 87 | } |
| 88 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 88 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | if (isset($js)===true) { |
| 92 | 92 | $this->run($js); |
| 93 | - if (isset($view) === true) { |
|
| 93 | + if (isset($view)===true) { |
|
| 94 | 94 | $js->addViewElement($this->identifier, $result, $view); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function ctrl($name, $value, $typeCtrl) { |
| 101 | 101 | if (is_array($typeCtrl)) { |
| 102 | - if (array_search($value, $typeCtrl) === false) { |
|
| 103 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 102 | + if (array_search($value, $typeCtrl)===false) { |
|
| 103 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | 106 | if (!$typeCtrl($value)) { |
| 107 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 107 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 123 | 123 | return $this->setProperty($name, $value); |
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 129 | 129 | return $name=$value; |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 135 | 135 | if (is_array($typeCtrl)) { |
| 136 | 136 | $this->removeOldValues($name, $typeCtrl); |
| 137 | - $name.=$separator . $value; |
|
| 137 | + $name.=$separator.$value; |
|
| 138 | 138 | } |
| 139 | 139 | return $this; |
| 140 | 140 | } |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 159 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 160 | 160 | if (is_array($typeCtrl)) { |
| 161 | 161 | $this->removeOldValues($name, $typeCtrl); |
| 162 | 162 | } |
| 163 | - $name.=$separator . $value; |
|
| 163 | + $name.=$separator.$value; |
|
| 164 | 164 | } |
| 165 | 165 | return $this; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 169 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 170 | 170 | return $this; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 187 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 187 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 188 | 188 | return $this->addToProperty($name, $value); |
| 189 | 189 | } |
| 190 | 190 | return $this; |
@@ -212,26 +212,26 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function fromArray($array) { |
| 215 | - foreach ( $this as $key => $value ) { |
|
| 216 | - if(array_key_exists($key, $array)===true) |
|
| 217 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 215 | + foreach ($this as $key => $value) { |
|
| 216 | + if (array_key_exists($key, $array)===true) |
|
| 217 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
| 218 | 218 | } |
| 219 | - foreach ( $array as $key => $value ) { |
|
| 220 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
| 221 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
| 219 | + foreach ($array as $key => $value) { |
|
| 220 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
| 221 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | return $array; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - private function _callSetter($setter,$key,$value,&$array){ |
|
| 227 | + private function _callSetter($setter, $key, $value, &$array) { |
|
| 228 | 228 | $result=false; |
| 229 | 229 | if (method_exists($this, $setter) && !JString::startswith($key, "_")) { |
| 230 | 230 | try { |
| 231 | 231 | $this->$setter($value); |
| 232 | 232 | unset($array[$key]); |
| 233 | 233 | $result=true; |
| 234 | - } catch ( \Exception $e ) { |
|
| 234 | + }catch (\Exception $e) { |
|
| 235 | 235 | $result=false; |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | public function fromDatabaseObjects($objects, $function) { |
| 242 | 242 | if (isset($objects)) { |
| 243 | - foreach ( $objects as $object ) { |
|
| 243 | + foreach ($objects as $object) { |
|
| 244 | 244 | $this->fromDatabaseObject($object, $function); |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -264,33 +264,33 @@ discard block |
||
| 264 | 264 | if (is_array($elements)) { |
| 265 | 265 | $flag=false; |
| 266 | 266 | $index=0; |
| 267 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 267 | + while (!$flag && $index<sizeof($elements)) { |
|
| 268 | 268 | if ($elements[$index] instanceof BaseHtml) |
| 269 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 269 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 270 | 270 | $index++; |
| 271 | 271 | } |
| 272 | - if ($flag === true) |
|
| 273 | - return $elements[$index - 1]; |
|
| 272 | + if ($flag===true) |
|
| 273 | + return $elements[$index-1]; |
|
| 274 | 274 | } elseif ($elements instanceof BaseHtml) { |
| 275 | - if ($elements->getIdentifier() === $identifier) |
|
| 275 | + if ($elements->getIdentifier()===$identifier) |
|
| 276 | 276 | return $elements; |
| 277 | 277 | } |
| 278 | 278 | return null; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
| 281 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
| 282 | 282 | if (is_array($elements)) { |
| 283 | 283 | $flag=false; |
| 284 | 284 | $index=0; |
| 285 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 285 | + while (!$flag && $index<sizeof($elements)) { |
|
| 286 | 286 | if ($elements[$index] instanceof BaseHtml) |
| 287 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 287 | + $flag=($elements[$index]->propertyContains($propertyName, $value)===true); |
|
| 288 | 288 | $index++; |
| 289 | 289 | } |
| 290 | - if ($flag === true) |
|
| 291 | - return $elements[$index - 1]; |
|
| 290 | + if ($flag===true) |
|
| 291 | + return $elements[$index-1]; |
|
| 292 | 292 | } elseif ($elements instanceof BaseHtml) { |
| 293 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 293 | + if ($elements->propertyContains($propertyName, $value)===true) |
|
| 294 | 294 | return $elements; |
| 295 | 295 | } |
| 296 | 296 | return null; |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | trait HtmlLinkTrait { |
| 6 | 6 | |
| 7 | - abstract public function setProperty($name,$value); |
|
| 7 | + abstract public function setProperty($name, $value); |
|
| 8 | 8 | abstract public function getProperty($name); |
| 9 | 9 | |
| 10 | 10 | public function setHref($value) { |