@@ -11,51 +11,51 @@ |
||
| 11 | 11 | |
| 12 | 12 | public abstract function addToProperty($name, $value, $separator=" "); |
| 13 | 13 | public abstract function addLabel($caption, $style="label-default", $leftSeparator=" "); |
| 14 | - public abstract function addContent($content,$before=false); |
|
| 14 | + public abstract function addContent($content, $before=false); |
|
| 15 | 15 | public function setFocus() { |
| 16 | 16 | $this->addToProperty("class", State::FOCUS); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function addLoading() { |
| 20 | - if ($this->_hasIcon === false) { |
|
| 20 | + if ($this->_hasIcon===false) { |
|
| 21 | 21 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 22 | 22 | } |
| 23 | 23 | return $this->addToProperty("class", State::LOADING); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
| 27 | - $labelO=$this->addLabel($label,$direction===Direction::LEFT,$icon); |
|
| 28 | - $this->addToProperty("class", $direction . " labeled"); |
|
| 27 | + $labelO=$this->addLabel($label, $direction===Direction::LEFT, $icon); |
|
| 28 | + $this->addToProperty("class", $direction." labeled"); |
|
| 29 | 29 | return $labelO; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
| 33 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
| 33 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 37 | 37 | $actionO=$action; |
| 38 | - if (\is_object($action) === false) { |
|
| 39 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
| 38 | + if (\is_object($action)===false) { |
|
| 39 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 40 | 40 | if (isset($icon)) |
| 41 | 41 | $actionO->addIcon($icon, true, $labeled); |
| 42 | 42 | } |
| 43 | - $this->addToProperty("class", $direction . " action"); |
|
| 44 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
| 43 | + $this->addToProperty("class", $direction." action"); |
|
| 44 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 45 | 45 | return $actionO; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
| 49 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
| 50 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
| 51 | - return $this->labeled($labelO,$direction); |
|
| 48 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
| 49 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
| 50 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
| 51 | + return $this->labeled($labelO, $direction); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function setTransparent() { |
| 55 | 55 | return $this->addToProperty("class", "transparent"); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setReadonly(){ |
|
| 58 | + public function setReadonly() { |
|
| 59 | 59 | $this->getField()->setProperty("readonly", ""); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -12,34 +12,34 @@ discard block |
||
| 12 | 12 | class HtmlFormField extends HtmlSemDoubleElement { |
| 13 | 13 | protected $_container; |
| 14 | 14 | protected $_validation; |
| 15 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 16 | - parent::__construct($identifier, "div","field"); |
|
| 15 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 16 | + parent::__construct($identifier, "div", "field"); |
|
| 17 | 17 | $this->content=array(); |
| 18 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 19 | - if(isset($label)) |
|
| 18 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 19 | + if (isset($label)) |
|
| 20 | 20 | $this->setLabel($label); |
| 21 | 21 | $this->setField($field); |
| 22 | 22 | $this->_validation=NULL; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
| 26 | - $labelO=new HtmlLabel("",$label); |
|
| 25 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
| 26 | + $labelO=new HtmlLabel("", $label); |
|
| 27 | 27 | $labelO->setPointing($pointing); |
| 28 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
| 28 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
| 29 | 29 | return $labelO; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function setLabel($label){ |
|
| 32 | + public function setLabel($label) { |
|
| 33 | 33 | $labelO=$label; |
| 34 | - if(\is_string($label)){ |
|
| 35 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 34 | + if (\is_string($label)) { |
|
| 35 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 36 | 36 | $labelO->setContent($label); |
| 37 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 37 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 38 | 38 | } |
| 39 | 39 | $this->content["label"]=$labelO; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setField($field){ |
|
| 42 | + public function setField($field) { |
|
| 43 | 43 | $this->content["field"]=$field; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | * Returns the label or null |
| 48 | 48 | * @return mixed |
| 49 | 49 | */ |
| 50 | - public function getLabel(){ |
|
| 51 | - if(\array_key_exists("label", $this->content)) |
|
| 50 | + public function getLabel() { |
|
| 51 | + if (\array_key_exists("label", $this->content)) |
|
| 52 | 52 | return $this->content["label"]; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * Return the field |
| 57 | 57 | * @return mixed |
| 58 | 58 | */ |
| 59 | - public function getField(){ |
|
| 59 | + public function getField() { |
|
| 60 | 60 | return $this->content["field"]; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | * Return the field with data |
| 65 | 65 | * @return mixed |
| 66 | 66 | */ |
| 67 | - public function getDataField(){ |
|
| 67 | + public function getDataField() { |
|
| 68 | 68 | return $this->content["field"]; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * puts the label before or behind |
| 73 | 73 | */ |
| 74 | - public function swapLabel(){ |
|
| 74 | + public function swapLabel() { |
|
| 75 | 75 | $label=$this->getLabel(); |
| 76 | 76 | unset($this->content["label"]); |
| 77 | 77 | $this->content["label"]=$label; |
@@ -82,31 +82,31 @@ discard block |
||
| 82 | 82 | * @param int $width |
| 83 | 83 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 84 | 84 | */ |
| 85 | - public function setWidth($width){ |
|
| 86 | - if(\is_int($width)){ |
|
| 85 | + public function setWidth($width) { |
|
| 86 | + if (\is_int($width)) { |
|
| 87 | 87 | $width=Wide::getConstants()["W".$width]; |
| 88 | 88 | } |
| 89 | 89 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 90 | - if(isset($this->_container)){ |
|
| 90 | + if (isset($this->_container)) { |
|
| 91 | 91 | $this->_container->setEqualWidth(false); |
| 92 | 92 | } |
| 93 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 93 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Field displays an error state |
| 98 | 98 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 99 | 99 | */ |
| 100 | - public function setError(){ |
|
| 100 | + public function setError() { |
|
| 101 | 101 | return $this->addToProperty("class", "error"); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function setInline(){ |
|
| 104 | + public function setInline() { |
|
| 105 | 105 | return $this->addToProperty("class", "inline"); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function jsState($state){ |
|
| 109 | - return $this->jsDoJquery("addClass",$state); |
|
| 108 | + public function jsState($state) { |
|
| 109 | + return $this->jsDoJquery("addClass", $state); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function setContainer($_container) { |
@@ -114,23 +114,23 @@ discard block |
||
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setReadonly(){ |
|
| 117 | + public function setReadonly() { |
|
| 118 | 118 | $this->getField()->setProperty("readonly", ""); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 121 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 122 | 122 | $field=$this->getDataField(); |
| 123 | - if(isset($field)){ |
|
| 124 | - if(!isset($this->_validation)){ |
|
| 123 | + if (isset($field)) { |
|
| 124 | + if (!isset($this->_validation)) { |
|
| 125 | 125 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 126 | 126 | } |
| 127 | - $this->_validation->addRule($type,$prompt,$value); |
|
| 127 | + $this->_validation->addRule($type, $prompt, $value); |
|
| 128 | 128 | } |
| 129 | 129 | return $this; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function addRules(array $rules){ |
|
| 133 | - foreach ($rules as $rule){ |
|
| 132 | + public function addRules(array $rules) { |
|
| 133 | + foreach ($rules as $rule) { |
|
| 134 | 134 | $this->addRule($rule); |
| 135 | 135 | } |
| 136 | 136 | return $this; |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | class HtmlFormTextarea extends HtmlFormField { |
| 10 | 10 | use TextFieldsTrait; |
| 11 | 11 | |
| 12 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
| 13 | - if(!isset($placeholder)) |
|
| 12 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
| 13 | + if (!isset($placeholder)) |
|
| 14 | 14 | $placeholder=$label; |
| 15 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
| 15 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Defines the textarea row count |
| 20 | 20 | * @param int $count |
| 21 | 21 | */ |
| 22 | - public function setRows($count){ |
|
| 22 | + public function setRows($count) { |
|
| 23 | 23 | $this->getField()->setRows($count); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | use Ajax\semantic\html\elements\HtmlInput; |
| 8 | 8 | |
| 9 | 9 | class HtmlFormInput extends HtmlFormField { |
| 10 | - use TextFieldsTrait,FieldTrait; |
|
| 10 | + use TextFieldsTrait, FieldTrait; |
|
| 11 | 11 | |
| 12 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 13 | - if(!isset($placeholder) && $type==="text") |
|
| 12 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 13 | + if (!isset($placeholder) && $type==="text") |
|
| 14 | 14 | $placeholder=$label; |
| 15 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
| 15 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function getDataField(){ |
|
| 19 | - $field= $this->getField(); |
|
| 20 | - if($field instanceof HtmlInput) |
|
| 18 | + public function getDataField() { |
|
| 19 | + $field=$this->getField(); |
|
| 20 | + if ($field instanceof HtmlInput) |
|
| 21 | 21 | $field=$field->getField(); |
| 22 | 22 | return $field; |
| 23 | 23 | } |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function asSegment() { |
| 39 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function asContainer() { |
| 43 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 43 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | * @param int $wide |
| 49 | 49 | */ |
| 50 | 50 | public function setWide($wide) { |
| 51 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
| 52 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 51 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
| 52 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 53 | 53 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 54 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 54 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 55 | 55 | } |
| 56 | 56 | return $this; |
| 57 | 57 | } |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | * @return mixed |
| 72 | 72 | */ |
| 73 | 73 | public function addRow($colsCount=NULL) { |
| 74 | - $rowCount=$this->rowCount() + 1; |
|
| 74 | + $rowCount=$this->rowCount()+1; |
|
| 75 | 75 | $this->setRowsCount($rowCount, $colsCount, true); |
| 76 | - return $this->content[$rowCount - 1]; |
|
| 76 | + return $this->content[$rowCount-1]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 83 | 83 | */ |
| 84 | 84 | public function addCol($width=NULL) { |
| 85 | - $colCount=$this->colCount() + 1; |
|
| 85 | + $colCount=$this->colCount()+1; |
|
| 86 | 86 | $this->setColsCount($colCount, true, $width); |
| 87 | 87 | if ($this->hasOnlyCols($this->count())) |
| 88 | - return $this->content[$colCount - 1]; |
|
| 88 | + return $this->content[$colCount-1]; |
|
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 96 | 96 | */ |
| 97 | 97 | public function addCols($sizes=array()) { |
| 98 | - foreach ( $sizes as $size ) { |
|
| 98 | + foreach ($sizes as $size) { |
|
| 99 | 99 | $this->addCol($size); |
| 100 | 100 | } |
| 101 | 101 | return $this; |
@@ -109,19 +109,19 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 111 | 111 | $count=$this->count(); |
| 112 | - if ($rowsCount < 2 && $force === false) { |
|
| 113 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 114 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 112 | + if ($rowsCount<2 && $force===false) { |
|
| 113 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 114 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | if ($this->hasOnlyCols($count)) { |
| 118 | 118 | $tmpContent=$this->content; |
| 119 | 119 | $item=$this->addItem($colsCount); |
| 120 | 120 | $item->setContent($tmpContent); |
| 121 | - $this->content=array (); |
|
| 121 | + $this->content=array(); |
|
| 122 | 122 | $count=1; |
| 123 | 123 | } |
| 124 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 124 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 125 | 125 | $this->addItem($colsCount); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | protected function hasOnlyCols($count) { |
| 132 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 132 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | if (isset($width)==false) { |
| 144 | 144 | $this->setWide($numCols); |
| 145 | 145 | } |
| 146 | - if ($toCreate == true) { |
|
| 146 | + if ($toCreate==true) { |
|
| 147 | 147 | $count=$this->count(); |
| 148 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 149 | - for($i=$count; $i < $numCols; $i++) { |
|
| 150 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 148 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 149 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 150 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 151 | 151 | } |
| 152 | 152 | } else { |
| 153 | - for($i=0; $i < $count; $i++) { |
|
| 153 | + for ($i=0; $i<$count; $i++) { |
|
| 154 | 154 | $this->getItem($i)->setColsCount($numCols); |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $count=$this->count(); |
| 187 | 187 | if ($this->hasOnlyCols($count)) |
| 188 | 188 | return $count; |
| 189 | - if ($count > 0) |
|
| 189 | + if ($count>0) |
|
| 190 | 190 | return $this->getItem(0)->count(); |
| 191 | 191 | return 0; |
| 192 | 192 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 199 | 199 | */ |
| 200 | 200 | public function getCell($row, $col) { |
| 201 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 201 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 202 | 202 | return $this->getItem($col); |
| 203 | 203 | $row=$this->getItem($row); |
| 204 | 204 | if (isset($row)) { |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 214 | 214 | */ |
| 215 | 215 | public function setDivided($vertically=false) { |
| 216 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 217 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 216 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 217 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -223,15 +223,15 @@ discard block |
||
| 223 | 223 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 224 | 224 | */ |
| 225 | 225 | public function setCelled($internally=false) { |
| 226 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 227 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 226 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 227 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * A grid can have its columns centered |
| 232 | 232 | */ |
| 233 | 233 | public function setCentered() { |
| 234 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 234 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function setPadded($value=NULL) { |
| 251 | 251 | if (isset($value)) |
| 252 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 252 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 253 | 253 | return $this->addToProperty("class", "padded"); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 260 | 260 | */ |
| 261 | 261 | public function setRelaxed($very=false) { |
| 262 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 263 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 262 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 263 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 267 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 267 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 275 | 275 | */ |
| 276 | 276 | protected function createItem($value) { |
| 277 | - if ($this->_createCols === false) |
|
| 277 | + if ($this->_createCols===false) |
|
| 278 | 278 | $value=null; |
| 279 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 279 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 280 | 280 | return $item; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -286,15 +286,15 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | public function setValues($values, $force=true) { |
| 288 | 288 | $count=$this->count(); |
| 289 | - if ($this->_createCols === false || $force === true) { |
|
| 290 | - for($i=$count; $i < \sizeof($values); $i++) { |
|
| 289 | + if ($this->_createCols===false || $force===true) { |
|
| 290 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 291 | 291 | $colSize=\sizeof($values[$i]); |
| 292 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 292 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | - $count=\min(array ($this->count(),\sizeof($values) )); |
|
| 296 | - for($i=0; $i < $count; $i++) { |
|
| 297 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 295 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 296 | + for ($i=0; $i<$count; $i++) { |
|
| 297 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | return $this->getHtmlCk()->attachEvents($events); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function getField(){ |
|
| 36 | + public function getField() { |
|
| 37 | 37 | return $this->content["field"]->getField(); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function getHtmlCk(){ |
|
| 40 | + public function getHtmlCk() { |
|
| 41 | 41 | return $this->content["field"]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function getDataField(){ |
|
| 45 | - $field= $this->getField(); |
|
| 46 | - if($field instanceof AbstractCheckbox) |
|
| 44 | + public function getDataField() { |
|
| 45 | + $field=$this->getField(); |
|
| 46 | + if ($field instanceof AbstractCheckbox) |
|
| 47 | 47 | $field=$field->getField(); |
| 48 | 48 | return $field; |
| 49 | 49 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | * @param boolean $value |
| 54 | 54 | * @return \Ajax\semantic\html\collections\form\traits\CheckboxTrait |
| 55 | 55 | */ |
| 56 | - public function setChecked($value=true){ |
|
| 57 | - if($value===true){ |
|
| 56 | + public function setChecked($value=true) { |
|
| 57 | + if ($value===true) { |
|
| 58 | 58 | $this->getDataField()->setProperty("checked", "checked"); |
| 59 | - }else{ |
|
| 59 | + } else { |
|
| 60 | 60 | $this->getDataField()->removeProperty("checked"); |
| 61 | 61 | } |
| 62 | 62 | return $this; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | 107 | $this->tagName="div"; |
| 108 | 108 | $this->addToProperty("class", "labeled"); |
| 109 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 109 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
| 111 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
| 112 | 112 | $label->setBasic(); |
| 113 | 113 | $this->addContent($label, $before); |
| 114 | 114 | return $label; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function fromArray($array) { |
| 122 | 122 | $array=parent::fromArray($array); |
| 123 | - foreach ( $array as $key => $value ) { |
|
| 123 | + foreach ($array as $key => $value) { |
|
| 124 | 124 | $this->setProperty($key, $value); |
| 125 | 125 | } |
| 126 | 126 | return $array; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public static function social($identifier, $social, $value=NULL) { |
| 178 | - if ($value === NULL) |
|
| 178 | + if ($value===NULL) |
|
| 179 | 179 | $value=\ucfirst($social); |
| 180 | 180 | $return=new HtmlButton($identifier, $value); |
| 181 | 181 | $return->addIcon($social); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public function asLink($href=NULL) { |
| 198 | - $lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content); |
|
| 198 | + $lnk=new HtmlLink("lnk-".$this->identifier, $href, $this->content); |
|
| 199 | 199 | $this->content=$lnk; |
| 200 | 200 | return $this; |
| 201 | 201 | } |
@@ -11,46 +11,46 @@ discard block |
||
| 11 | 11 | use Ajax\semantic\html\collections\form\HtmlFormField; |
| 12 | 12 | |
| 13 | 13 | trait FieldsTrait { |
| 14 | - public abstract function addFields($fields=NULL,$label=NULL); |
|
| 14 | + public abstract function addFields($fields=NULL, $label=NULL); |
|
| 15 | 15 | public abstract function addItem($item); |
| 16 | 16 | |
| 17 | - protected function createItem($value){ |
|
| 18 | - if(\is_array($value)){ |
|
| 19 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
| 17 | + protected function createItem($value) { |
|
| 18 | + if (\is_array($value)) { |
|
| 19 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
| 20 | 20 | return $itemO; |
| 21 | - }elseif(\is_object($value)){ |
|
| 21 | + }elseif (\is_object($value)) { |
|
| 22 | 22 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
| 23 | 23 | return $itemO; |
| 24 | - }else |
|
| 24 | + } else |
|
| 25 | 25 | return new HtmlFormInput($value); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function createCondition($value){ |
|
| 28 | + protected function createCondition($value) { |
|
| 29 | 29 | return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function addInputs($inputs,$fieldslabel=null){ |
|
| 32 | + public function addInputs($inputs, $fieldslabel=null) { |
|
| 33 | 33 | $fields=array(); |
| 34 | - foreach ($inputs as $input){ |
|
| 34 | + foreach ($inputs as $input) { |
|
| 35 | 35 | \extract($input); |
| 36 | - $f=new HtmlFormInput("",""); |
|
| 36 | + $f=new HtmlFormInput("", ""); |
|
| 37 | 37 | $f->fromArray($input); |
| 38 | 38 | $fields[]=$f; |
| 39 | 39 | } |
| 40 | - return $this->addFields($fields,$fieldslabel); |
|
| 40 | + return $this->addFields($fields, $fieldslabel); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){ |
|
| 43 | + public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) { |
|
| 44 | 44 | $field=$this->getItem($index); |
| 45 | - if(isset($field)){ |
|
| 46 | - $field->addRule($type,$prompt,$value); |
|
| 45 | + if (isset($field)) { |
|
| 46 | + $field->addRule($type, $prompt, $value); |
|
| 47 | 47 | } |
| 48 | 48 | return $this; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function addFieldRules($index,$rules){ |
|
| 51 | + public function addFieldRules($index, $rules) { |
|
| 52 | 52 | $field=$this->getItem($index); |
| 53 | - if(isset($field)){ |
|
| 53 | + if (isset($field)) { |
|
| 54 | 54 | $field->addRules($rules); |
| 55 | 55 | } |
| 56 | 56 | return $this; |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | * @param boolean $multiple |
| 65 | 65 | * @return \Ajax\common\html\HtmlDoubleElement |
| 66 | 66 | */ |
| 67 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
| 68 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
| 67 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
| 68 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -76,23 +76,23 @@ discard block |
||
| 76 | 76 | * @param string $placeholder |
| 77 | 77 | * @return HtmlFormInput |
| 78 | 78 | */ |
| 79 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
| 80 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
| 79 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 80 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function addPassword($identifier, $label=NULL){ |
|
| 84 | - return $this->addItem(new HtmlFormInput($identifier,$label,"password","","")); |
|
| 83 | + public function addPassword($identifier, $label=NULL) { |
|
| 84 | + return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", "")); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
| 88 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
| 87 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
| 88 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
| 92 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
| 91 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
| 92 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
| 96 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
| 95 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
| 96 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | \ No newline at end of file |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function __construct($identifier, $elements=array()) { |
| 34 | 34 | parent::__construct($identifier, "form", "ui form"); |
| 35 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
| 35 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
| 36 | 36 | $this->setProperty("name", $this->identifier); |
| 37 | - $this->_fields=array (); |
|
| 37 | + $this->_fields=array(); |
|
| 38 | 38 | $this->_validationParams=[]; |
| 39 | 39 | $this->addItems($elements); |
| 40 | 40 | } |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | * @param string $caption |
| 57 | 57 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 58 | 58 | */ |
| 59 | - public function addDivider($caption=NULL){ |
|
| 60 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
| 59 | + public function addDivider($caption=NULL) { |
|
| 60 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function addFields($fields=NULL, $label=NULL) { |
| 64 | 64 | if (isset($fields)) { |
| 65 | 65 | if (!$fields instanceof HtmlFormFields) { |
| 66 | - if (\is_array($fields) === false) { |
|
| 66 | + if (\is_array($fields)===false) { |
|
| 67 | 67 | $fields=\func_get_args(); |
| 68 | 68 | $end=\end($fields); |
| 69 | 69 | if (\is_string($end)) { |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | $label=NULL; |
| 74 | 74 | } |
| 75 | 75 | $this->_fields=\array_merge($this->_fields, $fields); |
| 76 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
| 76 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 77 | 77 | } |
| 78 | 78 | if (isset($label)) |
| 79 | 79 | $fields=new HtmlFormField("", $fields, $label); |
| 80 | 80 | } else { |
| 81 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
| 81 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
| 82 | 82 | } |
| 83 | 83 | $this->addItem($fields); |
| 84 | 84 | return $fields; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addItem($item) { |
| 88 | 88 | $item=parent::addItem($item); |
| 89 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
| 89 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 90 | 90 | $this->_fields[]=$item; |
| 91 | 91 | } |
| 92 | 92 | return $item; |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | return $this->addItem($message); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - private function addCompoValidation($js,$compo,$field){ |
|
| 141 | + private function addCompoValidation($js, $compo, $field) { |
|
| 142 | 142 | $validation=$field->getValidation(); |
| 143 | - if(isset($validation)){ |
|
| 144 | - if(isset($compo)===false){ |
|
| 143 | + if (isset($validation)) { |
|
| 144 | + if (isset($compo)===false) { |
|
| 145 | 145 | $compo=$js->semantic()->form("#".$this->identifier); |
| 146 | 146 | } |
| 147 | 147 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
@@ -152,26 +152,26 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | public function run(JsUtils $js) { |
| 154 | 154 | $compo=NULL; |
| 155 | - foreach ($this->_fields as $field){ |
|
| 156 | - if($field instanceof HtmlFormField) |
|
| 155 | + foreach ($this->_fields as $field) { |
|
| 156 | + if ($field instanceof HtmlFormField) |
|
| 157 | 157 | $compo=$this->addCompoValidation($js, $compo, $field); |
| 158 | 158 | } |
| 159 | - foreach ($this->content as $field){ |
|
| 160 | - if($field instanceof HtmlFormFields){ |
|
| 159 | + foreach ($this->content as $field) { |
|
| 160 | + if ($field instanceof HtmlFormFields) { |
|
| 161 | 161 | $items=$field->getItems(); |
| 162 | - foreach ($items as $_field){ |
|
| 163 | - if($_field instanceof HtmlFormField) |
|
| 162 | + foreach ($items as $_field) { |
|
| 163 | + if ($_field instanceof HtmlFormField) |
|
| 164 | 164 | $compo=$this->addCompoValidation($js, $compo, $_field); |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | - if(isset($compo)===false){ |
|
| 168 | + if (isset($compo)===false) { |
|
| 169 | 169 | return parent::run($js); |
| 170 | 170 | } |
| 171 | - if(isset($this->_validationParams["_ajaxSubmit"])){ |
|
| 172 | - if($this->_validationParams["_ajaxSubmit"] instanceof AjaxCall){ |
|
| 171 | + if (isset($this->_validationParams["_ajaxSubmit"])) { |
|
| 172 | + if ($this->_validationParams["_ajaxSubmit"] instanceof AjaxCall) { |
|
| 173 | 173 | $compilation=$this->_validationParams["_ajaxSubmit"]->compile($js); |
| 174 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
| 174 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
| 175 | 175 | $this->onSuccess($compilation); |
| 176 | 176 | unset($this->_validationParams["_ajaxSubmit"]); |
| 177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | return $this->addToProperty("class", "loading"); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - public function addErrorMessage(){ |
|
| 189 | + public function addErrorMessage() { |
|
| 190 | 190 | return $this->addContent((new HtmlMessage(""))->setError()); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -199,22 +199,22 @@ discard block |
||
| 199 | 199 | return $this; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function submitOn($event,$identifier,$url,$responseElement){ |
|
| 202 | + public function submitOn($event, $identifier, $url, $responseElement) { |
|
| 203 | 203 | $elem=$this->getElementById($identifier, $this->content); |
| 204 | - if(isset($elem)){ |
|
| 204 | + if (isset($elem)) { |
|
| 205 | 205 | $elem->addEvent($event, "$('#".$this->identifier."').form('validate form');"); |
| 206 | - $this->_validationParams["_ajaxSubmit"]=new AjaxCall("postForm", ["form"=>$this->identifier,"responseElement"=>$responseElement,"url"=>$url]); |
|
| 206 | + $this->_validationParams["_ajaxSubmit"]=new AjaxCall("postForm", ["form"=>$this->identifier, "responseElement"=>$responseElement, "url"=>$url]); |
|
| 207 | 207 | } |
| 208 | 208 | return $this; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - public function submitOnClick($identifier,$url,$responseElement){ |
|
| 211 | + public function submitOnClick($identifier, $url, $responseElement) { |
|
| 212 | 212 | return $this->submitOn("click", $identifier, $url, $responseElement); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - public function addSubmit($identifier,$value,$CssStyle=NULL,$url=NULL,$responseElement=NULL){ |
|
| 216 | - $bt=$this->addButton($identifier, $value,$CssStyle); |
|
| 217 | - if(isset($url) && isset($responseElement)) |
|
| 215 | + public function addSubmit($identifier, $value, $CssStyle=NULL, $url=NULL, $responseElement=NULL) { |
|
| 216 | + $bt=$this->addButton($identifier, $value, $CssStyle); |
|
| 217 | + if (isset($url) && isset($responseElement)) |
|
| 218 | 218 | $this->submitOnClick($identifier, $url, $responseElement); |
| 219 | 219 | return $bt; |
| 220 | 220 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @param string $jsCode |
| 225 | 225 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 226 | 226 | */ |
| 227 | - public function onValid($jsCode){ |
|
| 227 | + public function onValid($jsCode) { |
|
| 228 | 228 | $this->_validationParams["onValid"]="%function(){".$jsCode."}%"; |
| 229 | 229 | return $this; |
| 230 | 230 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @param string $jsCode can use event and fields parameters |
| 235 | 235 | * @return HtmlForm |
| 236 | 236 | */ |
| 237 | - public function onSuccess($jsCode){ |
|
| 237 | + public function onSuccess($jsCode) { |
|
| 238 | 238 | $this->_validationParams["onSuccess"]="%function(evt,fields){".$jsCode."}%"; |
| 239 | 239 | return $this; |
| 240 | 240 | } |