@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | private $ajaxCall; |
| 18 | 18 | |
| 19 | - public function __construct($type, $url, $params, $jsCallback = null, $method = 'post', $parameters = [], $prompt = NULL, $value = NULL) { |
|
| 19 | + public function __construct($type, $url, $params, $jsCallback=null, $method='post', $parameters=[], $prompt=NULL, $value=NULL) { |
|
| 20 | 20 | parent::__construct($type, $prompt, $value); |
| 21 | - $parameters = \array_merge([ |
|
| 21 | + $parameters=\array_merge([ |
|
| 22 | 22 | 'async' => false, |
| 23 | 23 | 'url' => $url, |
| 24 | 24 | 'params' => $params, |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | 'preventDefault' => false, |
| 30 | 30 | 'responseElement' => null |
| 31 | 31 | ], $parameters); |
| 32 | - $this->ajaxCall = new AjaxCall($method, $parameters); |
|
| 32 | + $this->ajaxCall=new AjaxCall($method, $parameters); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function compile(JsUtils $js) { |
| 36 | - $js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;" . $this->ajaxCall->compile($js) . "return result;}"), true); |
|
| 36 | + $js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;".$this->ajaxCall->compile($js)."return result;}"), true); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | |
| 16 | 16 | protected $jsFunction; |
| 17 | 17 | |
| 18 | - public function __construct($type, $jsFunction, $prompt = NULL, $value = NULL) { |
|
| 18 | + public function __construct($type, $jsFunction, $prompt=NULL, $value=NULL) { |
|
| 19 | 19 | parent::__construct($type, $prompt, $value); |
| 20 | - $this->jsFunction = $jsFunction; |
|
| 20 | + $this->jsFunction=$jsFunction; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function compile(JsUtils $js) { |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @version 1.001 |
| 9 | 9 | * Generates a JSON field validator |
| 10 | 10 | */ |
| 11 | -class FieldValidation implements \JsonSerializable{ |
|
| 11 | +class FieldValidation implements \JsonSerializable { |
|
| 12 | 12 | /** |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | protected $optional; |
| 33 | 33 | |
| 34 | - public function __construct($identifier){ |
|
| 34 | + public function __construct($identifier) { |
|
| 35 | 35 | $this->identifier=$identifier; |
| 36 | 36 | $this->rules=[]; |
| 37 | 37 | } |
@@ -55,31 +55,31 @@ discard block |
||
| 55 | 55 | * @param string $value |
| 56 | 56 | * @return Rule |
| 57 | 57 | */ |
| 58 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 59 | - if($type instanceof Rule) { |
|
| 60 | - $rule = $type; |
|
| 61 | - if($type instanceof CustomRule){ |
|
| 58 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 59 | + if ($type instanceof Rule) { |
|
| 60 | + $rule=$type; |
|
| 61 | + if ($type instanceof CustomRule) { |
|
| 62 | 62 | $this->customRules[]=$type; |
| 63 | 63 | $this->hasCustomRules=true; |
| 64 | 64 | } |
| 65 | - }elseif(\is_array($type)){ |
|
| 65 | + }elseif (\is_array($type)) { |
|
| 66 | 66 | $value=JArray::getValue($type, "value", 2); |
| 67 | 67 | $prompt=JArray::getValue($type, "prompt", 1); |
| 68 | 68 | $type=JArray::getValue($type, "type", 0); |
| 69 | - $rule=new Rule($type,$prompt,$value); |
|
| 70 | - }else { |
|
| 71 | - $rule = new Rule($type, $prompt, $value); |
|
| 69 | + $rule=new Rule($type, $prompt, $value); |
|
| 70 | + } else { |
|
| 71 | + $rule=new Rule($type, $prompt, $value); |
|
| 72 | 72 | } |
| 73 | 73 | $this->rules[]=$rule; |
| 74 | 74 | return $rule; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function jsonSerialize(){ |
|
| 78 | - $result=["identifier"=>$this->identifier,"rules"=>$this->rules]; |
|
| 79 | - if($this->optional){ |
|
| 77 | + public function jsonSerialize() { |
|
| 78 | + $result=["identifier"=>$this->identifier, "rules"=>$this->rules]; |
|
| 79 | + if ($this->optional) { |
|
| 80 | 80 | $result["optional"]=true; |
| 81 | 81 | } |
| 82 | - if(isset($this->depends)){ |
|
| 82 | + if (isset($this->depends)) { |
|
| 83 | 83 | $result["depends"]=$this->depends; |
| 84 | 84 | } |
| 85 | 85 | return $result; |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | return $this; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function compile(JsUtils $js){ |
|
| 99 | - if($this->hasCustomRules) { |
|
| 98 | + public function compile(JsUtils $js) { |
|
| 99 | + if ($this->hasCustomRules) { |
|
| 100 | 100 | foreach ($this->customRules as $rule) { |
| 101 | 101 | $rule->compile($js); |
| 102 | 102 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | use FieldTrait; |
| 17 | 17 | protected $_container; |
| 18 | 18 | protected $_validation; |
| 19 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 20 | - parent::__construct($identifier, "div","field"); |
|
| 19 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 20 | + parent::__construct($identifier, "div", "field"); |
|
| 21 | 21 | $this->content=array(); |
| 22 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 23 | - if(isset($label) && $label!=="") |
|
| 22 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 23 | + if (isset($label) && $label!=="") |
|
| 24 | 24 | $this->setLabel($label); |
| 25 | 25 | $this->setField($field); |
| 26 | 26 | $this->_validation=NULL; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
| 30 | - $labelO=new HtmlLabel("",$label); |
|
| 29 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
| 30 | + $labelO=new HtmlLabel("", $label); |
|
| 31 | 31 | $labelO->setPointing($pointing); |
| 32 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
| 32 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
| 33 | 33 | return $labelO; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function setLabel($label){ |
|
| 36 | + public function setLabel($label) { |
|
| 37 | 37 | $labelO=$label; |
| 38 | - if(\is_string($label)){ |
|
| 39 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 38 | + if (\is_string($label)) { |
|
| 39 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 40 | 40 | $labelO->setContent($label); |
| 41 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 41 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 42 | 42 | } |
| 43 | 43 | $this->content["label"]=$labelO; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setField($field){ |
|
| 46 | + public function setField($field) { |
|
| 47 | 47 | $this->content["field"]=$field; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * Returns the label or null |
| 52 | 52 | * @return mixed |
| 53 | 53 | */ |
| 54 | - public function getLabel(){ |
|
| 55 | - if(\array_key_exists("label", $this->content)) |
|
| 54 | + public function getLabel() { |
|
| 55 | + if (\array_key_exists("label", $this->content)) |
|
| 56 | 56 | return $this->content["label"]; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * Return the field |
| 61 | 61 | * @return mixed |
| 62 | 62 | */ |
| 63 | - public function getField(){ |
|
| 63 | + public function getField() { |
|
| 64 | 64 | return $this->content["field"]; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | * Return the field with data |
| 69 | 69 | * @return mixed |
| 70 | 70 | */ |
| 71 | - public function getDataField(){ |
|
| 71 | + public function getDataField() { |
|
| 72 | 72 | return $this->content["field"]; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * puts the label before or behind |
| 77 | 77 | */ |
| 78 | - public function swapLabel(){ |
|
| 78 | + public function swapLabel() { |
|
| 79 | 79 | $label=$this->getLabel(); |
| 80 | 80 | unset($this->content["label"]); |
| 81 | 81 | $this->content["label"]=$label; |
@@ -86,31 +86,31 @@ discard block |
||
| 86 | 86 | * @param int $width |
| 87 | 87 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 88 | 88 | */ |
| 89 | - public function setWidth($width){ |
|
| 90 | - if(\is_int($width)){ |
|
| 89 | + public function setWidth($width) { |
|
| 90 | + if (\is_int($width)) { |
|
| 91 | 91 | $width=Wide::getConstants()["W".$width]; |
| 92 | 92 | } |
| 93 | 93 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 94 | - if(isset($this->_container)){ |
|
| 94 | + if (isset($this->_container)) { |
|
| 95 | 95 | $this->_container->setEqualWidth(false); |
| 96 | 96 | } |
| 97 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 97 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Field displays an error state |
| 102 | 102 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 103 | 103 | */ |
| 104 | - public function setError(){ |
|
| 104 | + public function setError() { |
|
| 105 | 105 | return $this->addToProperty("class", "error"); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function setInline(){ |
|
| 108 | + public function setInline() { |
|
| 109 | 109 | return $this->addToProperty("class", "inline"); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function jsState($state){ |
|
| 113 | - return $this->jsDoJquery("addClass",$state); |
|
| 112 | + public function jsState($state) { |
|
| 113 | + return $this->jsDoJquery("addClass", $state); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public function setContainer($_container) { |
@@ -118,49 +118,49 @@ discard block |
||
| 118 | 118 | return $this; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function setReadonly(){ |
|
| 121 | + public function setReadonly() { |
|
| 122 | 122 | $this->getDataField()->setProperty("readonly", ""); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 125 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 126 | 126 | $field=$this->getDataField(); |
| 127 | - if(isset($field)){ |
|
| 128 | - if(!isset($this->_validation)){ |
|
| 127 | + if (isset($field)) { |
|
| 128 | + if (!isset($this->_validation)) { |
|
| 129 | 129 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 130 | 130 | } |
| 131 | - if($type==="empty"){ |
|
| 132 | - $this->addToProperty("class","required"); |
|
| 131 | + if ($type==="empty") { |
|
| 132 | + $this->addToProperty("class", "required"); |
|
| 133 | 133 | } |
| 134 | - $this->_validation->addRule($type,$prompt,$value); |
|
| 134 | + $this->_validation->addRule($type, $prompt, $value); |
|
| 135 | 135 | } |
| 136 | 136 | return $this; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function setOptional($optional=true){ |
|
| 139 | + public function setOptional($optional=true) { |
|
| 140 | 140 | $field=$this->getDataField(); |
| 141 | - if(isset($field)){ |
|
| 142 | - if(!isset($this->_validation)){ |
|
| 141 | + if (isset($field)) { |
|
| 142 | + if (!isset($this->_validation)) { |
|
| 143 | 143 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 144 | 144 | } |
| 145 | 145 | $this->_validation->setOptional($optional); |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function addRules(array $rules){ |
|
| 150 | - foreach ($rules as $rule){ |
|
| 149 | + public function addRules(array $rules) { |
|
| 150 | + foreach ($rules as $rule) { |
|
| 151 | 151 | $this->addRule($rule); |
| 152 | 152 | } |
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function setRules(array $rules){ |
|
| 156 | + public function setRules(array $rules) { |
|
| 157 | 157 | $this->_validation=null; |
| 158 | 158 | return $this->addRules($rules); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
| 161 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
| 162 | 162 | $field=$this->getField(); |
| 163 | - return $field->addIcon($icon,$direction); |
|
| 163 | + return $field->addIcon($icon, $direction); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | public function getValidation() { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function run(JsUtils $js) { |
| 175 | - if(isset($this->_validation)){ |
|
| 175 | + if (isset($this->_validation)) { |
|
| 176 | 176 | $this->_validation->compile($js); |
| 177 | 177 | } |
| 178 | 178 | return parent::run($js); |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | class HtmlTableContent extends HtmlSemCollection { |
| 17 | 17 | protected $_focusable=false; |
| 18 | 18 | |
| 19 | - protected $_tdTagNames = [ |
|
| 19 | + protected $_tdTagNames=[ |
|
| 20 | 20 | "thead" => "th", |
| 21 | 21 | "tbody" => "td", |
| 22 | 22 | "tfoot" => "th" |
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | - protected $_merged = false; |
|
| 25 | + protected $_merged=false; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param int $rowCount |
| 32 | 32 | * @param int $colCount |
| 33 | 33 | */ |
| 34 | - public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) { |
|
| 34 | + public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
|
| 35 | 35 | parent::__construct($identifier, $tagName, ""); |
| 36 | 36 | if (isset($rowCount) && isset($colCount)) |
| 37 | 37 | $this->setRowCount($rowCount, $colCount); |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @return HtmlTableContent |
| 45 | 45 | */ |
| 46 | 46 | public function setRowCount($rowCount, $colCount) { |
| 47 | - $count = $this->count(); |
|
| 48 | - for ($i = $count; $i < $rowCount; $i ++) { |
|
| 47 | + $count=$this->count(); |
|
| 48 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 49 | 49 | $this->addItem($colCount); |
| 50 | 50 | } |
| 51 | 51 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function refreshTR() { |
| 59 | - $this->_template = "%wrapContentBefore%%content%%wrapContentAfter%"; |
|
| 59 | + $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | * @return HtmlTR |
| 68 | 68 | */ |
| 69 | 69 | protected function createItem($value) { |
| 70 | - $count = $this->count(); |
|
| 71 | - $tr = new HtmlTR(""); |
|
| 70 | + $count=$this->count(); |
|
| 71 | + $tr=new HtmlTR(""); |
|
| 72 | 72 | $tr->setContainer($this, $count); |
| 73 | - if($this->_focusable) { |
|
| 73 | + if ($this->_focusable) { |
|
| 74 | 74 | $tr->setProperty('tabindex', $count); |
| 75 | 75 | } |
| 76 | 76 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 77 | - if (isset($value) === true) { |
|
| 77 | + if (isset($value)===true) { |
|
| 78 | 78 | $tr->setColCount($value); |
| 79 | 79 | } |
| 80 | 80 | return $tr; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | return $this->addItem($row); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function addMergeRow($colCount, $value = null) { |
|
| 106 | - $row = $this->addRow($colCount); |
|
| 105 | + public function addMergeRow($colCount, $value=null) { |
|
| 106 | + $row=$this->addRow($colCount); |
|
| 107 | 107 | $row->mergeCol(); |
| 108 | 108 | if (isset($value)) { |
| 109 | 109 | $row->setValues([ |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | * @return HtmlTD|HtmlDoubleElement |
| 130 | 130 | */ |
| 131 | 131 | public function getCell($row, $col) { |
| 132 | - $row = $this->getItem($row); |
|
| 132 | + $row=$this->getItem($row); |
|
| 133 | 133 | if (isset($row) && $row instanceof HtmlCollection) { |
| 134 | - $col = $row->getItem($col); |
|
| 134 | + $col=$row->getItem($col); |
|
| 135 | 135 | } else { |
| 136 | - $col = $row; |
|
| 136 | + $col=$row; |
|
| 137 | 137 | } |
| 138 | 138 | return $col; |
| 139 | 139 | } |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | * @param mixed $value |
| 155 | 155 | * @return HtmlTableContent |
| 156 | 156 | */ |
| 157 | - public function setCellValue($row, $col, $value = "") { |
|
| 158 | - $cell = $this->getCell($row, $col); |
|
| 159 | - if (isset($cell) === true) { |
|
| 157 | + public function setCellValue($row, $col, $value="") { |
|
| 158 | + $cell=$this->getCell($row, $col); |
|
| 159 | + if (isset($cell)===true) { |
|
| 160 | 160 | $cell->setValue($value); |
| 161 | 161 | } |
| 162 | 162 | return $this; |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @param mixed $values |
| 169 | 169 | */ |
| 170 | - public function setValues($values = array()) { |
|
| 171 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
| 170 | + public function setValues($values=array()) { |
|
| 171 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
| 172 | 172 | $row->setValues($_values); |
| 173 | 173 | }); |
| 174 | 174 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @param mixed $values |
| 180 | 180 | */ |
| 181 | - public function addValues($values = array()) { |
|
| 182 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
| 181 | + public function addValues($values=array()) { |
|
| 182 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
| 183 | 183 | $row->addValues($_values); |
| 184 | 184 | }); |
| 185 | 185 | } |
@@ -191,42 +191,42 @@ discard block |
||
| 191 | 191 | * @param callable $callback |
| 192 | 192 | */ |
| 193 | 193 | protected function _addOrSetValues($values, $callback) { |
| 194 | - $count = $this->count(); |
|
| 195 | - $isArray = true; |
|
| 196 | - if (! \is_array($values)) { |
|
| 197 | - $values = \array_fill(0, $count, $values); |
|
| 198 | - $isArray = false; |
|
| 194 | + $count=$this->count(); |
|
| 195 | + $isArray=true; |
|
| 196 | + if (!\is_array($values)) { |
|
| 197 | + $values=\array_fill(0, $count, $values); |
|
| 198 | + $isArray=false; |
|
| 199 | 199 | } |
| 200 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 201 | - $values = [ |
|
| 200 | + if (JArray::dimension($values)==1 && $isArray) |
|
| 201 | + $values=[ |
|
| 202 | 202 | $values |
| 203 | 203 | ]; |
| 204 | 204 | |
| 205 | - $count = \min(\sizeof($values), $count); |
|
| 205 | + $count=\min(\sizeof($values), $count); |
|
| 206 | 206 | |
| 207 | - for ($i = 0; $i < $count; $i ++) { |
|
| 208 | - $row = $this->content[$i]; |
|
| 207 | + for ($i=0; $i<$count; $i++) { |
|
| 208 | + $row=$this->content[$i]; |
|
| 209 | 209 | $callback($row, $values[$i]); |
| 210 | 210 | } |
| 211 | 211 | return $this; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - public function setColValues($colIndex, $values = array()) { |
|
| 215 | - $count = $this->count(); |
|
| 216 | - if (! \is_array($values)) { |
|
| 217 | - $values = \array_fill(0, $count, $values); |
|
| 214 | + public function setColValues($colIndex, $values=array()) { |
|
| 215 | + $count=$this->count(); |
|
| 216 | + if (!\is_array($values)) { |
|
| 217 | + $values=\array_fill(0, $count, $values); |
|
| 218 | 218 | } |
| 219 | - $count = \min(\sizeof($values), $count); |
|
| 220 | - for ($i = 0; $i < $count; $i ++) { |
|
| 219 | + $count=\min(\sizeof($values), $count); |
|
| 220 | + for ($i=0; $i<$count; $i++) { |
|
| 221 | 221 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
| 222 | 222 | } |
| 223 | 223 | return $this; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - public function addColVariations($colIndex, $variations = array()) { |
|
| 227 | - $count = $this->count(); |
|
| 228 | - for ($i = 0; $i < $count; $i ++) { |
|
| 229 | - $cell = $this->getCell($i, $colIndex); |
|
| 226 | + public function addColVariations($colIndex, $variations=array()) { |
|
| 227 | + $count=$this->count(); |
|
| 228 | + for ($i=0; $i<$count; $i++) { |
|
| 229 | + $cell=$this->getCell($i, $colIndex); |
|
| 230 | 230 | if ($cell instanceof BaseTrait) |
| 231 | 231 | $cell->addVariations($variations); |
| 232 | 232 | } |
@@ -234,41 +234,41 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | public function addPropertyCol($colIndex, $name, $value) { |
| 237 | - $count = $this->count(); |
|
| 238 | - for ($i = 0; $i < $count; $i ++) { |
|
| 239 | - $cell = $this->getCell($i, $colIndex); |
|
| 237 | + $count=$this->count(); |
|
| 238 | + for ($i=0; $i<$count; $i++) { |
|
| 239 | + $cell=$this->getCell($i, $colIndex); |
|
| 240 | 240 | if (isset($cell)) |
| 241 | 241 | $cell->addToProperty($name, $value); |
| 242 | 242 | } |
| 243 | 243 | return $this; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - public function setRowValues($rowIndex, $values = array()) { |
|
| 247 | - $count = $this->count(); |
|
| 248 | - if (! \is_array($values)) { |
|
| 249 | - $values = \array_fill(0, $count, $values); |
|
| 246 | + public function setRowValues($rowIndex, $values=array()) { |
|
| 247 | + $count=$this->count(); |
|
| 248 | + if (!\is_array($values)) { |
|
| 249 | + $values=\array_fill(0, $count, $values); |
|
| 250 | 250 | } |
| 251 | 251 | $this->getItem($rowIndex)->setValues($values); |
| 252 | 252 | return $this; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | private function colAlign($colIndex, $function) { |
| 256 | - $count = $this->count(); |
|
| 257 | - for ($i = 0; $i < $count; $i ++) { |
|
| 258 | - $index = $this->content[$i]->getColPosition($colIndex); |
|
| 259 | - if ($index !== NULL) |
|
| 256 | + $count=$this->count(); |
|
| 257 | + for ($i=0; $i<$count; $i++) { |
|
| 258 | + $index=$this->content[$i]->getColPosition($colIndex); |
|
| 259 | + if ($index!==NULL) |
|
| 260 | 260 | $this->getCell($i, $index)->$function(); |
| 261 | 261 | } |
| 262 | 262 | return $this; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | private function colAlignFromRight($colIndex, $function) { |
| 266 | - $count = $this->count(); |
|
| 267 | - for ($i = 0; $i < $count; $i ++) { |
|
| 268 | - $maxRow = $this->content[$i]->count(); |
|
| 269 | - $index = $maxRow - $colIndex - 1; |
|
| 270 | - if (($cell = $this->getCell($i, $index)) !== NULL) { |
|
| 271 | - if ($cell->getColspan() == 1) |
|
| 266 | + $count=$this->count(); |
|
| 267 | + for ($i=0; $i<$count; $i++) { |
|
| 268 | + $maxRow=$this->content[$i]->count(); |
|
| 269 | + $index=$maxRow-$colIndex-1; |
|
| 270 | + if (($cell=$this->getCell($i, $index))!==NULL) { |
|
| 271 | + if ($cell->getColspan()==1) |
|
| 272 | 272 | $cell->$function(); |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -314,9 +314,9 @@ discard block |
||
| 314 | 314 | * @return int |
| 315 | 315 | */ |
| 316 | 316 | public function getColCount() { |
| 317 | - $result = 0; |
|
| 318 | - if ($this->count() > 0) |
|
| 319 | - $result = $this->getItem(0)->count(); |
|
| 317 | + $result=0; |
|
| 318 | + if ($this->count()>0) |
|
| 319 | + $result=$this->getItem(0)->count(); |
|
| 320 | 320 | return $result; |
| 321 | 321 | } |
| 322 | 322 | |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | * @param int $colIndex |
| 328 | 328 | * @return HtmlTableContent |
| 329 | 329 | */ |
| 330 | - public function delete($rowIndex, $colIndex = NULL) { |
|
| 330 | + public function delete($rowIndex, $colIndex=NULL) { |
|
| 331 | 331 | if (isset($colIndex)) { |
| 332 | - $row = $this->getItem($rowIndex); |
|
| 333 | - if (isset($row) === true) { |
|
| 332 | + $row=$this->getItem($rowIndex); |
|
| 333 | + if (isset($row)===true) { |
|
| 334 | 334 | $row->delete($colIndex); |
| 335 | 335 | } |
| 336 | 336 | } else { |
@@ -340,24 +340,24 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | public function toDelete($rowIndex, $colIndex) { |
| 343 | - $row = $this->getItem($rowIndex); |
|
| 344 | - if (isset($row) === true) |
|
| 343 | + $row=$this->getItem($rowIndex); |
|
| 344 | + if (isset($row)===true) |
|
| 345 | 345 | $row->toDelete($colIndex); |
| 346 | 346 | return $this; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | public function toRowspanned($rowIndex, $colIndex) { |
| 350 | - $row = $this->getItem($rowIndex); |
|
| 351 | - if (isset($row) === true) |
|
| 350 | + $row=$this->getItem($rowIndex); |
|
| 351 | + if (isset($row)===true) |
|
| 352 | 352 | $row->toRowspanned($colIndex); |
| 353 | 353 | return $this; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - public function mergeCol($rowIndex = 0, $colIndex = 0) { |
|
| 356 | + public function mergeCol($rowIndex=0, $colIndex=0) { |
|
| 357 | 357 | return $this->getItem($rowIndex)->mergeCol($colIndex); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - public function mergeRow($rowIndex = 0, $colIndex = 0) { |
|
| 360 | + public function mergeRow($rowIndex=0, $colIndex=0) { |
|
| 361 | 361 | return $this->getItem($rowIndex)->mergeRow($colIndex); |
| 362 | 362 | } |
| 363 | 363 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @return HtmlTableContent |
| 378 | 378 | */ |
| 379 | 379 | public function conditionalCellFormat($callback, $format) { |
| 380 | - $rows = $this->content; |
|
| 380 | + $rows=$this->content; |
|
| 381 | 381 | foreach ($rows as $row) { |
| 382 | 382 | $row->conditionalCellFormat($callback, $format); |
| 383 | 383 | } |
@@ -385,9 +385,9 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | public function conditionalColFormat($colIndex, $callback, $format) { |
| 388 | - $rows = $this->content; |
|
| 388 | + $rows=$this->content; |
|
| 389 | 389 | foreach ($rows as $row) { |
| 390 | - $cell = $row->getItem($colIndex); |
|
| 390 | + $cell=$row->getItem($colIndex); |
|
| 391 | 391 | $cell->conditionnalCellFormat($callback, $format); |
| 392 | 392 | } |
| 393 | 393 | return $this; |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | * @return HtmlTableContent |
| 401 | 401 | */ |
| 402 | 402 | public function conditionalRowFormat($callback, $format) { |
| 403 | - $rows = $this->content; |
|
| 403 | + $rows=$this->content; |
|
| 404 | 404 | foreach ($rows as $row) { |
| 405 | 405 | $row->conditionalRowFormat($callback, $format); |
| 406 | 406 | } |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | public function hideColumn($colIndex) { |
| 411 | - $rows = $this->content; |
|
| 411 | + $rows=$this->content; |
|
| 412 | 412 | foreach ($rows as $row) { |
| 413 | - $cell = $row->getItem($colIndex); |
|
| 413 | + $cell=$row->getItem($colIndex); |
|
| 414 | 414 | $cell->addToProperty("style", "display:none;"); |
| 415 | 415 | } |
| 416 | 416 | return $this; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | * @return HtmlTableContent |
| 423 | 423 | */ |
| 424 | 424 | public function applyCells($callback) { |
| 425 | - $rows = $this->content; |
|
| 425 | + $rows=$this->content; |
|
| 426 | 426 | foreach ($rows as $row) { |
| 427 | 427 | $row->applyCells($callback); |
| 428 | 428 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * @return HtmlTableContent |
| 436 | 436 | */ |
| 437 | 437 | public function applyRows($callback) { |
| 438 | - $rows = $this->content; |
|
| 438 | + $rows=$this->content; |
|
| 439 | 439 | foreach ($rows as $row) { |
| 440 | 440 | $row->apply($callback); |
| 441 | 441 | } |
@@ -450,28 +450,28 @@ discard block |
||
| 450 | 450 | * @see https://fomantic-ui.com/collections/table.html#definition needs rowspanned class |
| 451 | 451 | * @since fomantic-ui 2.4.8 |
| 452 | 452 | */ |
| 453 | - public function mergeIdentiqualValues($colIndex, $function = "strip_tags") { |
|
| 454 | - $rows = $this->content; |
|
| 455 | - $identiqual = null; |
|
| 456 | - $counter = 0; |
|
| 457 | - $cellToMerge = null; |
|
| 458 | - $functionExists = \function_exists($function); |
|
| 453 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
| 454 | + $rows=$this->content; |
|
| 455 | + $identiqual=null; |
|
| 456 | + $counter=0; |
|
| 457 | + $cellToMerge=null; |
|
| 458 | + $functionExists=\function_exists($function); |
|
| 459 | 459 | foreach ($rows as $row) { |
| 460 | - $cell = $row->getItem($colIndex); |
|
| 461 | - $value = $cell->getContent(); |
|
| 460 | + $cell=$row->getItem($colIndex); |
|
| 461 | + $value=$cell->getContent(); |
|
| 462 | 462 | if ($functionExists) |
| 463 | - $value = \call_user_func($function, $value); |
|
| 464 | - if ($value !== $identiqual) { |
|
| 465 | - if ($counter > 0 && isset($cellToMerge)) { |
|
| 463 | + $value=\call_user_func($function, $value); |
|
| 464 | + if ($value!==$identiqual) { |
|
| 465 | + if ($counter>0 && isset($cellToMerge)) { |
|
| 466 | 466 | $cellToMerge->setRowspanned($counter); |
| 467 | 467 | } |
| 468 | - $counter = 0; |
|
| 469 | - $cellToMerge = $cell; |
|
| 470 | - $identiqual = $value; |
|
| 468 | + $counter=0; |
|
| 469 | + $cellToMerge=$cell; |
|
| 470 | + $identiqual=$value; |
|
| 471 | 471 | } |
| 472 | - $counter ++; |
|
| 472 | + $counter++; |
|
| 473 | 473 | } |
| 474 | - if ($counter > 0 && isset($cellToMerge)) { |
|
| 474 | + if ($counter>0 && isset($cellToMerge)) { |
|
| 475 | 475 | $cellToMerge->setRowspanned($counter); |
| 476 | 476 | } |
| 477 | 477 | return $this; |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | public function _setMerged($value) { |
| 485 | - $this->_merged = $value; |
|
| 485 | + $this->_merged=$value; |
|
| 486 | 486 | return $this; |
| 487 | 487 | } |
| 488 | 488 | |
@@ -490,6 +490,6 @@ discard block |
||
| 490 | 490 | * @param bool $focusable |
| 491 | 491 | */ |
| 492 | 492 | public function setFocusable(bool $focusable): void { |
| 493 | - $this->_focusable = $focusable; |
|
| 493 | + $this->_focusable=$focusable; |
|
| 494 | 494 | } |
| 495 | 495 | } |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | trait TableTrait { |
| 12 | 12 | |
| 13 | - abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false); |
|
| 13 | + abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
|
| 14 | 14 | |
| 15 | - abstract public function getOn($event, $url, $responseElement = "", $parameters = array()); |
|
| 15 | + abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
|
| 16 | 16 | |
| 17 | 17 | protected function addToPropertyTable($property, $value) { |
| 18 | 18 | return $this->_self->addToProperty($property, $value); |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | return $this->addToPropertyTable("class", "celled"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function setBasic($very = false) { |
|
| 26 | - $table = $this->_self; |
|
| 25 | + public function setBasic($very=false) { |
|
| 26 | + $table=$this->_self; |
|
| 27 | 27 | if ($very) |
| 28 | 28 | $table->addToPropertyCtrl("class", "very", array( |
| 29 | 29 | "very" |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | )); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function setCompact($very = false) { |
|
| 37 | - $table = $this->_self; |
|
| 36 | + public function setCompact($very=false) { |
|
| 37 | + $table=$this->_self; |
|
| 38 | 38 | if ($very) |
| 39 | 39 | $table->addToPropertyCtrl("class", "very", array( |
| 40 | 40 | "very" |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | return $this->addToPropertyTable("class", "structured"); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function setSortable($colIndex = NULL) { |
|
| 60 | - $table = $this->_self; |
|
| 59 | + public function setSortable($colIndex=NULL) { |
|
| 60 | + $table=$this->_self; |
|
| 61 | 61 | if (isset($colIndex) && $table->hasPart("thead")) { |
| 62 | 62 | $table->getHeader()->sort($colIndex); |
| 63 | 63 | } |
@@ -80,29 +80,29 @@ discard block |
||
| 80 | 80 | return $this->addToPropertyTable("class", "striped"); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) { |
|
| 83 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 84 | 84 | return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) { |
|
| 88 | - return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 87 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 88 | + return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function getOnRow($event, $url, $responseElement = "", $parameters = array()) { |
|
| 92 | - $jsCondition = '!$(this).closest("tr").is(":focus")'; |
|
| 91 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
| 92 | + $jsCondition='!$(this).closest("tr").is(":focus")'; |
|
| 93 | 93 | if (isset($parameters['jsCondition'])) { |
| 94 | - $jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')'; |
|
| 94 | + $jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')'; |
|
| 95 | 95 | } |
| 96 | - $parameters = \array_merge($parameters, [ |
|
| 96 | + $parameters=\array_merge($parameters, [ |
|
| 97 | 97 | "stopPropagation" => false, |
| 98 | 98 | "preventDefault" => false, |
| 99 | 99 | "jsCondition" => $jsCondition |
| 100 | 100 | ]); |
| 101 | - $selector = "tbody tr"; |
|
| 101 | + $selector="tbody tr"; |
|
| 102 | 102 | if (isset($parameters["selector"])) { |
| 103 | - $selector = $parameters["selector"]; |
|
| 103 | + $selector=$parameters["selector"]; |
|
| 104 | 104 | } |
| 105 | - return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters); |
|
| 105 | + return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function onPageChange($jsCode) { |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | return $this->_self->getBsComponent()->getScript(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function addEventsOnRun(JsUtils $js = NULL) { |
|
| 123 | - $script = parent::addEventsOnRun($js); |
|
| 124 | - $innerScript = $this->_self->getInnerScript(); |
|
| 125 | - if (! isset($innerScript)) { |
|
| 122 | + public function addEventsOnRun(JsUtils $js=NULL) { |
|
| 123 | + $script=parent::addEventsOnRun($js); |
|
| 124 | + $innerScript=$this->_self->getInnerScript(); |
|
| 125 | + if (!isset($innerScript)) { |
|
| 126 | 126 | $this->_self->setInnerScript($script); |
| 127 | 127 | } |
| 128 | 128 | return $script; |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public function __construct($identifier, $rowCount, $colCount) { |
| 42 | 42 | parent::__construct($identifier, "table", "ui table"); |
| 43 | - $this->content=array (); |
|
| 43 | + $this->content=array(); |
|
| 44 | 44 | $this->setRowCount($rowCount, $colCount); |
| 45 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 46 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
| 45 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 46 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
| 47 | 47 | $this->_afterCompileEvents=[]; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | * @return HtmlTableContent |
| 54 | 54 | */ |
| 55 | 55 | public function getPart($key) { |
| 56 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 56 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 57 | 57 | $this->content[$key]=new HtmlTableContent("", $key); |
| 58 | - if ($key !== "tbody") { |
|
| 58 | + if ($key!=="tbody") { |
|
| 59 | 59 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | return $this->content[$key]; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - protected function _getFirstPart(){ |
|
| 66 | - if(isset($this->content["thead"])){ |
|
| 65 | + protected function _getFirstPart() { |
|
| 66 | + if (isset($this->content["thead"])) { |
|
| 67 | 67 | return $this->content["thead"]; |
| 68 | 68 | } |
| 69 | 69 | return $this->content["tbody"]; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @return boolean |
| 109 | 109 | */ |
| 110 | 110 | public function hasPart($key) { |
| 111 | - return \array_key_exists($key, $this->content) === true; |
|
| 111 | + return \array_key_exists($key, $this->content)===true; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | return $this->colAlign($colIndex, "colLeftFromRight"); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - public function setColAlignment($colIndex,$alignment){ |
|
| 272 | - switch ($alignment){ |
|
| 271 | + public function setColAlignment($colIndex, $alignment) { |
|
| 272 | + switch ($alignment) { |
|
| 273 | 273 | case TextAlignment::LEFT: |
| 274 | 274 | $function="colLeft"; |
| 275 | 275 | break; |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | return $this; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - public function setColAlignmentFromRight($colIndex,$alignment){ |
|
| 293 | - switch ($alignment){ |
|
| 292 | + public function setColAlignmentFromRight($colIndex, $alignment) { |
|
| 293 | + switch ($alignment) { |
|
| 294 | 294 | case TextAlignment::LEFT: |
| 295 | 295 | $function="colLeftFromRight"; |
| 296 | 296 | break; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | private function colAlign($colIndex, $function) { |
| 314 | 314 | if (\is_array($colIndex)) { |
| 315 | - foreach ( $colIndex as $cIndex ) { |
|
| 315 | + foreach ($colIndex as $cIndex) { |
|
| 316 | 316 | $this->colAlign($cIndex, $function); |
| 317 | 317 | } |
| 318 | 318 | } else { |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * @see HtmlSemDoubleElement::compile() |
| 374 | 374 | */ |
| 375 | 375 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 376 | - if(\sizeof($this->_compileParts)<3){ |
|
| 376 | + if (\sizeof($this->_compileParts)<3) { |
|
| 377 | 377 | $this->_template="%content%"; |
| 378 | 378 | $this->refresh($js); |
| 379 | 379 | } |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
| 385 | - parent::compile_once($js,$view); |
|
| 385 | + parent::compile_once($js, $view); |
|
| 386 | 386 | if ($this->propertyContains("class", "sortable")) { |
| 387 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
| 387 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | public function fromDatabaseObject($object, $function) { |
| 398 | 398 | $result=$function($object); |
| 399 | 399 | if (\is_array($result)) { |
| 400 | - $result= $this->addRow($function($object)); |
|
| 400 | + $result=$this->addRow($function($object)); |
|
| 401 | 401 | } else { |
| 402 | - $result= $this->getBody()->_addRow($result); |
|
| 402 | + $result=$this->getBody()->_addRow($result); |
|
| 403 | 403 | } |
| 404 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
| 405 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 406 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 404 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
| 405 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 406 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
| 407 | 407 | } |
| 408 | 408 | return $result; |
| 409 | 409 | } |
@@ -418,26 +418,26 @@ discard block |
||
| 418 | 418 | return $this; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - public function refreshTR(){ |
|
| 421 | + public function refreshTR() { |
|
| 422 | 422 | $this->setCompileParts(); |
| 423 | 423 | $this->getPart("tbody")->refreshTR(); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - public function refresh($js){ |
|
| 426 | + public function refresh($js) { |
|
| 427 | 427 | $this->_footer=$this->getFooter(); |
| 428 | - if(isset($js)){ |
|
| 429 | - $js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");',true); |
|
| 428 | + if (isset($js)) { |
|
| 429 | + $js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");', true); |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - public function run(JsUtils $js){ |
|
| 434 | - if(!$this->_runned){ |
|
| 435 | - if(isset($this->_activeRowSelector)){ |
|
| 433 | + public function run(JsUtils $js) { |
|
| 434 | + if (!$this->_runned) { |
|
| 435 | + if (isset($this->_activeRowSelector)) { |
|
| 436 | 436 | $this->_activeRowSelector->run(); |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | - $result= parent::run($js); |
|
| 440 | - if(isset($this->_footer)) |
|
| 439 | + $result=parent::run($js); |
|
| 440 | + if (isset($this->_footer)) |
|
| 441 | 441 | $this->_footer->run($js); |
| 442 | 442 | $this->_runned=true; |
| 443 | 443 | return $result; |
@@ -461,51 +461,51 @@ discard block |
||
| 461 | 461 | * @param boolean $multiple |
| 462 | 462 | * @return HtmlTable |
| 463 | 463 | */ |
| 464 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
| 465 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
| 464 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
| 465 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
| 466 | 466 | return $this; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - public function hasActiveRowSelector(){ |
|
| 469 | + public function hasActiveRowSelector() { |
|
| 470 | 470 | return isset($this->_activeRowSelector); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - public function hideColumn($colIndex){ |
|
| 474 | - if(isset($this->content["thead"])){ |
|
| 473 | + public function hideColumn($colIndex) { |
|
| 474 | + if (isset($this->content["thead"])) { |
|
| 475 | 475 | $this->content["thead"]->hideColumn($colIndex); |
| 476 | 476 | } |
| 477 | 477 | $this->content["tbody"]->hideColumn($colIndex); |
| 478 | - if(isset($this->content["tfoot"])){ |
|
| 478 | + if (isset($this->content["tfoot"])) { |
|
| 479 | 479 | $this->content["tfoot"]->hideColumn($colIndex); |
| 480 | 480 | } |
| 481 | 481 | return $this; |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - public function setColWidth($colIndex,$width){ |
|
| 484 | + public function setColWidth($colIndex, $width) { |
|
| 485 | 485 | $part=$this->_getFirstPart(); |
| 486 | - if($part!==null && $part->count()>0) |
|
| 486 | + if ($part!==null && $part->count()>0) |
|
| 487 | 487 | $part->getCell(0, $colIndex)->setWidth($width); |
| 488 | 488 | return $this; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - public function setColWidths($widths){ |
|
| 491 | + public function setColWidths($widths) { |
|
| 492 | 492 | $part=$this->_getFirstPart(); |
| 493 | - if($part!==null && $part->count()>0){ |
|
| 493 | + if ($part!==null && $part->count()>0) { |
|
| 494 | 494 | $count=$part->getColCount(); |
| 495 | - if(!\is_array($widths)){ |
|
| 495 | + if (!\is_array($widths)) { |
|
| 496 | 496 | $widths=\array_fill(0, $count, $widths); |
| 497 | 497 | } |
| 498 | - $max=\min(\sizeof($widths),$count); |
|
| 499 | - for($i=0;$i<$max;$i++){ |
|
| 498 | + $max=\min(\sizeof($widths), $count); |
|
| 499 | + for ($i=0; $i<$max; $i++) { |
|
| 500 | 500 | $part->getCell(0, $i)->setWidth($widths[$i]); |
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | return $this; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - public function mergeIdentiqualValues($colIndex,$function="strip_tags"){ |
|
| 506 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
| 507 | 507 | $body=$this->getBody(); |
| 508 | - $body->mergeIdentiqualValues($colIndex,$function); |
|
| 508 | + $body->mergeIdentiqualValues($colIndex, $function); |
|
| 509 | 509 | return $this; |
| 510 | 510 | } |
| 511 | 511 | /** |
@@ -519,16 +519,16 @@ discard block |
||
| 519 | 519 | * @param mixed $_innerScript |
| 520 | 520 | */ |
| 521 | 521 | public function setInnerScript($_innerScript) { |
| 522 | - $this->_innerScript = $_innerScript; |
|
| 522 | + $this->_innerScript=$_innerScript; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - public function onActiveRowChange($jsCode){ |
|
| 526 | - $this->on("activeRowChange",$jsCode); |
|
| 525 | + public function onActiveRowChange($jsCode) { |
|
| 526 | + $this->on("activeRowChange", $jsCode); |
|
| 527 | 527 | return $this; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - public function addMergeRow($colCount,$value=null){ |
|
| 531 | - return $this->getBody()->addMergeRow($colCount,$value); |
|
| 530 | + public function addMergeRow($colCount, $value=null) { |
|
| 531 | + return $this->getBody()->addMergeRow($colCount, $value); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | /** |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class HtmlRail extends HtmlSemDoubleElement { |
| 12 | 12 | |
| 13 | - public function __construct($identifier, $content = NULL) { |
|
| 13 | + public function __construct($identifier, $content=NULL) { |
|
| 14 | 14 | parent::__construct($identifier, 'div', 'ui rail', $content); |
| 15 | 15 | } |
| 16 | 16 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $onClick |
| 46 | 46 | * @return HtmlButton |
| 47 | 47 | */ |
| 48 | - public function htmlButton($identifier, $value = null, $cssStyle = null, $onClick = null) { |
|
| 48 | + public function htmlButton($identifier, $value=null, $cssStyle=null, $onClick=null) { |
|
| 49 | 49 | return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param boolean $asIcons |
| 60 | 60 | * @return HtmlButtonGroups |
| 61 | 61 | */ |
| 62 | - public function htmlButtonGroups($identifier, $elements = array(), $asIcons = false) { |
|
| 62 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
| 63 | 63 | return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param string $content |
| 73 | 73 | * @return HtmlContainer |
| 74 | 74 | */ |
| 75 | - public function htmlContainer($identifier, $content = "") { |
|
| 75 | + public function htmlContainer($identifier, $content="") { |
|
| 76 | 76 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param string $content |
| 86 | 86 | * @return HtmlDivider |
| 87 | 87 | */ |
| 88 | - public function htmlDivider($identifier, $content = "", $tagName = "div") { |
|
| 88 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
| 89 | 89 | return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param string $type |
| 101 | 101 | * @return HtmlHeader |
| 102 | 102 | */ |
| 103 | - public function htmlHeader($identifier, $niveau = 1, $content = NULL, $type = "page") { |
|
| 103 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
| 104 | 104 | return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param string $size |
| 129 | 129 | * @return HtmlImage |
| 130 | 130 | */ |
| 131 | - public function htmlImage($identifier, $src = "", $alt = "", $size = NULL) { |
|
| 131 | + public function htmlImage($identifier, $src="", $alt="", $size=NULL) { |
|
| 132 | 132 | return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size)); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param string $size |
| 143 | 143 | * @return HtmlIconGroups |
| 144 | 144 | */ |
| 145 | - public function htmlIconGroups($identifier, $icons = array(), $size = "") { |
|
| 145 | + public function htmlIconGroups($identifier, $icons=array(), $size="") { |
|
| 146 | 146 | return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size)); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string $placeholder |
| 158 | 158 | * @return HtmlInput |
| 159 | 159 | */ |
| 160 | - public function htmlInput($identifier, $type = "text", $value = "", $placeholder = "") { |
|
| 160 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
| 161 | 161 | return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $tagName |
| 172 | 172 | * @return HtmlLabel |
| 173 | 173 | */ |
| 174 | - public function htmlLabel($identifier, $content = "", $icon = NULL, $tagName = "div") { |
|
| 174 | + public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") { |
|
| 175 | 175 | return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName)); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param array $attributes |
| 183 | 183 | * @return HtmlLabelGroups |
| 184 | 184 | */ |
| 185 | - public function htmlLabelGroups($identifier, $labels = array(), $attributes = array()) { |
|
| 185 | + public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) { |
|
| 186 | 186 | return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes)); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param array $items |
| 194 | 194 | * @return HtmlList |
| 195 | 195 | */ |
| 196 | - public function htmlList($identifier, $items = array()) { |
|
| 196 | + public function htmlList($identifier, $items=array()) { |
|
| 197 | 197 | return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param string $content |
| 205 | 205 | * @return HtmlSegment |
| 206 | 206 | */ |
| 207 | - public function htmlSegment($identifier, $content = "") { |
|
| 207 | + public function htmlSegment($identifier, $content="") { |
|
| 208 | 208 | return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * the segments |
| 217 | 217 | * @return HtmlSegmentGroups |
| 218 | 218 | */ |
| 219 | - public function htmlSegmentGroups($identifier, $items = array()) { |
|
| 219 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
| 220 | 220 | return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param Direction|string $attributeType |
| 231 | 231 | * @return HtmlReveal |
| 232 | 232 | */ |
| 233 | - public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type = RevealType::FADE, $attributeType = NULL) { |
|
| 233 | + public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) { |
|
| 234 | 234 | return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType)); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @param array $steps |
| 242 | 242 | * @return HtmlStep |
| 243 | 243 | */ |
| 244 | - public function htmlStep($identifier, $steps = array()) { |
|
| 244 | + public function htmlStep($identifier, $steps=array()) { |
|
| 245 | 245 | return $this->addHtmlComponent(new HtmlStep($identifier, $steps)); |
| 246 | 246 | } |
| 247 | 247 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @param mixed $content |
| 276 | 276 | * @return HtmlRail |
| 277 | 277 | */ |
| 278 | - public function htmlRail($identifier, $content = null) { |
|
| 278 | + public function htmlRail($identifier, $content=null) { |
|
| 279 | 279 | return $this->addHtmlComponent(new HtmlRail($identifier, $content)); |
| 280 | 280 | } |
| 281 | 281 | } |