@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | $this->params["fields"]=[]; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function addField($identifier){ |
|
| 23 | + public function addField($identifier) { |
|
| 24 | 24 | $this->params["fields"][$identifier]=new FieldValidation($identifier); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setInline($value){ |
|
| 27 | + public function setInline($value) { |
|
| 28 | 28 | return $this->setParam("inline", true); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function setOn($value){ |
|
| 31 | + public function setOn($value) { |
|
| 32 | 32 | return $this->setParam("on", $value); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -40,33 +40,33 @@ discard block |
||
| 40 | 40 | * @param mixed $value |
| 41 | 41 | * @param string|NULL $prompt |
| 42 | 42 | */ |
| 43 | - public function addFieldRule($identifier,$type,$prompt=NULL,$value=NULL){ |
|
| 44 | - if(isset($this->params["fields"][$identifier])===false){ |
|
| 43 | + public function addFieldRule($identifier, $type, $prompt=NULL, $value=NULL) { |
|
| 44 | + if (isset($this->params["fields"][$identifier])===false) { |
|
| 45 | 45 | $this->addField($identifier); |
| 46 | 46 | } |
| 47 | - $this->params["fields"][$identifier]->addRule($type,$prompt,$value); |
|
| 47 | + $this->params["fields"][$identifier]->addRule($type, $prompt, $value); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @param FieldValidation $fieldValidation |
| 52 | 52 | */ |
| 53 | - public function addFieldValidation($fieldValidation){ |
|
| 53 | + public function addFieldValidation($fieldValidation) { |
|
| 54 | 54 | $this->params["fields"][$fieldValidation->getIdentifier()]=$fieldValidation; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function setJs(JsUtils $js){ |
|
| 57 | + public function setJs(JsUtils $js) { |
|
| 58 | 58 | $this->js=$js; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function getScript() { |
| 62 | 62 | $allParams=$this->params; |
| 63 | - $this->jquery_code_for_compile=array (); |
|
| 63 | + $this->jquery_code_for_compile=array(); |
|
| 64 | 64 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
| 65 | 65 | $this->compileEvents(); |
| 66 | 66 | return $this->compileJQueryCode(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function onValid($jsCode){ |
|
| 69 | + public function onValid($jsCode) { |
|
| 70 | 70 | $this->addComponentEvent("onValid", $jsCode); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
| 18 | 18 | * @return \Ajax\semantic\components\Dropdown |
| 19 | 19 | */ |
| 20 | - public function setAction($action){ |
|
| 21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
| 20 | + public function setAction($action) { |
|
| 21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event) |
| 27 | 27 | * @return \Ajax\semantic\components\Dropdown |
| 28 | 28 | */ |
| 29 | - public function setOn($event){ |
|
| 29 | + public function setOn($event) { |
|
| 30 | 30 | return $this->setParam("on", $event); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setFullTextSearch($value){ |
|
| 33 | + public function setFullTextSearch($value) { |
|
| 34 | 34 | return $this->setParam("fullTextSearch", $value); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function fromArray($array) { |
| 70 | - foreach ( $array as $key => $value ) { |
|
| 70 | + foreach ($array as $key => $value) { |
|
| 71 | 71 | $this->{$key}=$value; |
| 72 | 72 | } |
| 73 | 73 | return $this; |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function JsonSerialize() { |
| 81 | 81 | $vars=get_object_vars($this); |
| 82 | - $result=array (); |
|
| 83 | - foreach ( $vars as $k => $v ) { |
|
| 82 | + $result=array(); |
|
| 83 | + foreach ($vars as $k => $v) { |
|
| 84 | 84 | if (isset($v)) |
| 85 | 85 | $result[$k]=$v; |
| 86 | 86 | } |
@@ -89,6 +89,6 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function search($query, $field="title") { |
| 91 | 91 | $value=$this->$field; |
| 92 | - return \stripos($value, $query) !== false; |
|
| 92 | + return \stripos($value, $query)!==false; |
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @version 1.001 |
| 6 | 6 | * Generates a JSON Rule for the validation of a field |
| 7 | 7 | */ |
| 8 | -class Rule implements \JsonSerializable{ |
|
| 8 | +class Rule implements \JsonSerializable { |
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | private $value; |
| 22 | 22 | |
| 23 | - public function __construct($type,$prompt=NULL,$value=NULL){ |
|
| 23 | + public function __construct($type, $prompt=NULL, $value=NULL) { |
|
| 24 | 24 | $this->type=$type; |
| 25 | 25 | $this->prompt=$prompt; |
| 26 | 26 | $this->value=$value; |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function jsonSerialize() { |
| 57 | - $result= ["type"=>$this->type]; |
|
| 58 | - if(isset($this->prompt)) |
|
| 57 | + $result=["type"=>$this->type]; |
|
| 58 | + if (isset($this->prompt)) |
|
| 59 | 59 | $result["prompt"]=$this->prompt; |
| 60 | - if(isset($this->value)) |
|
| 60 | + if (isset($this->value)) |
|
| 61 | 61 | $result["value"]=$this->value; |
| 62 | 62 | return $result; |
| 63 | 63 | } |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @param string $prompt |
| 69 | 69 | * @return \Ajax\semantic\components\validation\Rule |
| 70 | 70 | */ |
| 71 | - public static function match($name,$prompt=NULL){ |
|
| 72 | - return new Rule("match[".$name."]",$prompt); |
|
| 71 | + public static function match($name, $prompt=NULL) { |
|
| 72 | + return new Rule("match[".$name."]", $prompt); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param string $prompt |
| 79 | 79 | * @return \Ajax\semantic\components\validation\Rule |
| 80 | 80 | */ |
| 81 | - public static function different($name,$prompt=NULL){ |
|
| 82 | - return new Rule("different[".$name."]",$prompt); |
|
| 81 | + public static function different($name, $prompt=NULL) { |
|
| 82 | + return new Rule("different[".$name."]", $prompt); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -89,78 +89,78 @@ discard block |
||
| 89 | 89 | * @param string $prompt |
| 90 | 90 | * @return \Ajax\semantic\components\validation\Rule |
| 91 | 91 | */ |
| 92 | - public static function integer($min=NULL,$max=NULL,$prompt=NULL){ |
|
| 93 | - if(\is_int($min) && \is_int($max)) |
|
| 94 | - return new Rule("integer[{$min}..{$max}]",$prompt); |
|
| 95 | - return new Rule("integer",$prompt); |
|
| 92 | + public static function integer($min=NULL, $max=NULL, $prompt=NULL) { |
|
| 93 | + if (\is_int($min) && \is_int($max)) |
|
| 94 | + return new Rule("integer[{$min}..{$max}]", $prompt); |
|
| 95 | + return new Rule("integer", $prompt); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public static function decimal($prompt=NULL){ |
|
| 99 | - return new Rule("decimal",$prompt); |
|
| 98 | + public static function decimal($prompt=NULL) { |
|
| 99 | + return new Rule("decimal", $prompt); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public static function number($prompt=NULL){ |
|
| 103 | - return new Rule("number",$prompt); |
|
| 102 | + public static function number($prompt=NULL) { |
|
| 103 | + return new Rule("number", $prompt); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public static function is($value,$prompt=NULL){ |
|
| 107 | - return new Rule("is[".$value."]",$prompt); |
|
| 106 | + public static function is($value, $prompt=NULL) { |
|
| 107 | + return new Rule("is[".$value."]", $prompt); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public static function isExactly($value,$prompt=NULL){ |
|
| 111 | - return new Rule("isExactly[".$value."]",$prompt); |
|
| 110 | + public static function isExactly($value, $prompt=NULL) { |
|
| 111 | + return new Rule("isExactly[".$value."]", $prompt); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public static function not($value,$prompt=NULL){ |
|
| 115 | - return new Rule("not[".$value."]",$prompt); |
|
| 114 | + public static function not($value, $prompt=NULL) { |
|
| 115 | + return new Rule("not[".$value."]", $prompt); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public static function notExactly($value,$prompt=NULL){ |
|
| 119 | - return new Rule("notExactly[".$value."]",$prompt); |
|
| 118 | + public static function notExactly($value, $prompt=NULL) { |
|
| 119 | + return new Rule("notExactly[".$value."]", $prompt); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public static function contains($value,$prompt=NULL){ |
|
| 123 | - return new Rule("contains[".$value."]",$prompt); |
|
| 122 | + public static function contains($value, $prompt=NULL) { |
|
| 123 | + return new Rule("contains[".$value."]", $prompt); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public static function containsExactly($value,$prompt=NULL){ |
|
| 127 | - return new Rule("containsExactly[".$value."]",$prompt); |
|
| 126 | + public static function containsExactly($value, $prompt=NULL) { |
|
| 127 | + return new Rule("containsExactly[".$value."]", $prompt); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public static function doesntContain($value,$prompt=NULL){ |
|
| 131 | - return new Rule("doesntContain[".$value."]",$prompt); |
|
| 130 | + public static function doesntContain($value, $prompt=NULL) { |
|
| 131 | + return new Rule("doesntContain[".$value."]", $prompt); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public static function doesntContainExactly($value,$prompt=NULL){ |
|
| 135 | - return new Rule("doesntContainExactly[".$value."]",$prompt); |
|
| 134 | + public static function doesntContainExactly($value, $prompt=NULL) { |
|
| 135 | + return new Rule("doesntContainExactly[".$value."]", $prompt); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public static function minCount($value,$prompt=NULL){ |
|
| 139 | - return new Rule("minCount[".$value."]",$prompt); |
|
| 138 | + public static function minCount($value, $prompt=NULL) { |
|
| 139 | + return new Rule("minCount[".$value."]", $prompt); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - public static function maxCount($value,$prompt=NULL){ |
|
| 143 | - return new Rule("maxCount[".$value."]",$prompt); |
|
| 142 | + public static function maxCount($value, $prompt=NULL) { |
|
| 143 | + return new Rule("maxCount[".$value."]", $prompt); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - public static function exactCount($value,$prompt=NULL){ |
|
| 147 | - return new Rule("exactCount[".$value."]",$prompt); |
|
| 146 | + public static function exactCount($value, $prompt=NULL) { |
|
| 147 | + return new Rule("exactCount[".$value."]", $prompt); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - public static function email($prompt=NULL){ |
|
| 151 | - return new Rule("email",$prompt); |
|
| 150 | + public static function email($prompt=NULL) { |
|
| 151 | + return new Rule("email", $prompt); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public static function url($prompt=NULL){ |
|
| 155 | - return new Rule("url",$prompt); |
|
| 154 | + public static function url($prompt=NULL) { |
|
| 155 | + return new Rule("url", $prompt); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - public static function regExp($value,$prompt=NULL){ |
|
| 159 | - return new Rule("regExp",$prompt,$value); |
|
| 158 | + public static function regExp($value, $prompt=NULL) { |
|
| 159 | + return new Rule("regExp", $prompt, $value); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public static function custom($name,$jsFunction){ |
|
| 163 | - return "$.fn.form.settings.rules.".$name." =".$jsFunction ; |
|
| 162 | + public static function custom($name, $jsFunction) { |
|
| 163 | + return "$.fn.form.settings.rules.".$name." =".$jsFunction; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | } |
@@ -14,44 +14,44 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | abstract class HtmlCollection extends HtmlDoubleElement { |
| 16 | 16 | |
| 17 | - public function __construct($identifier,$tagName="div"){ |
|
| 18 | - parent::__construct($identifier,$tagName); |
|
| 17 | + public function __construct($identifier, $tagName="div") { |
|
| 18 | + parent::__construct($identifier, $tagName); |
|
| 19 | 19 | $this->content=array(); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function addItems($items){ |
|
| 23 | - if(JArray::isAssociative($items)){ |
|
| 24 | - foreach ($items as $k=>$v){ |
|
| 25 | - $this->addItem([$k,$v]); |
|
| 22 | + public function addItems($items) { |
|
| 23 | + if (JArray::isAssociative($items)) { |
|
| 24 | + foreach ($items as $k=>$v) { |
|
| 25 | + $this->addItem([$k, $v]); |
|
| 26 | 26 | } |
| 27 | - }else{ |
|
| 28 | - foreach ($items as $item){ |
|
| 27 | + } else { |
|
| 28 | + foreach ($items as $item) { |
|
| 29 | 29 | $this->addItem($item); |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setItems($items){ |
|
| 35 | + public function setItems($items) { |
|
| 36 | 36 | $this->content=$items; |
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function getItems(){ |
|
| 40 | + public function getItems() { |
|
| 41 | 41 | return $this->content; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - protected function getItemToAdd($item){ |
|
| 44 | + protected function getItemToAdd($item) { |
|
| 45 | 45 | $itemO=$item; |
| 46 | - if($this->createCondition($item)===true){ |
|
| 46 | + if ($this->createCondition($item)===true) { |
|
| 47 | 47 | $itemO=$this->createItem($item); |
| 48 | 48 | } |
| 49 | 49 | return $itemO; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected function setItemIdentifier($item,$classname,$index){ |
|
| 53 | - if($item instanceof BaseWidget){ |
|
| 54 | - if($item->getIdentifier()===""){ |
|
| 52 | + protected function setItemIdentifier($item, $classname, $index) { |
|
| 53 | + if ($item instanceof BaseWidget) { |
|
| 54 | + if ($item->getIdentifier()==="") { |
|
| 55 | 55 | $item->setIdentifier($classname."-".$this->identifier."-".$index); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | * @param HtmlDoubleElement|string|array $item |
| 63 | 63 | * @return \Ajax\common\html\HtmlDoubleElement |
| 64 | 64 | */ |
| 65 | - public function addItem($item){ |
|
| 65 | + public function addItem($item) { |
|
| 66 | 66 | $itemO=$this->getItemToAdd($item); |
| 67 | 67 | $this->addContent($itemO); |
| 68 | 68 | return $itemO; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function insertItem($item,$position=0){ |
|
| 71 | + public function insertItem($item, $position=0) { |
|
| 72 | 72 | $itemO=$this->getItemToAdd($item); |
| 73 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
| 73 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
| 74 | 74 | return $itemO; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | return $this; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function removeItem($index){ |
|
| 96 | + public function removeItem($index) { |
|
| 97 | 97 | return array_splice($this->content, $index, 1); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function count(){ |
|
| 100 | + public function count() { |
|
| 101 | 101 | return \sizeof($this->content); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | return $this->addItem($function($object)); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function apply($callBack){ |
|
| 112 | - foreach ($this->content as $item){ |
|
| 111 | + public function apply($callBack) { |
|
| 112 | + foreach ($this->content as $item) { |
|
| 113 | 113 | $callBack($item); |
| 114 | 114 | } |
| 115 | 115 | return $this; |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | abstract protected function createItem($value); |
| 131 | 131 | |
| 132 | - protected function createCondition($value){ |
|
| 132 | + protected function createCondition($value) { |
|
| 133 | 133 | return \is_object($value)===false; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - protected function contentAs($tagName){ |
|
| 137 | - foreach ($this->content as $item){ |
|
| 136 | + protected function contentAs($tagName) { |
|
| 137 | + foreach ($this->content as $item) { |
|
| 138 | 138 | $item->setTagName($tagName); |
| 139 | 139 | } |
| 140 | 140 | return $this; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function setProperties($properties){ |
|
| 143 | + public function setProperties($properties) { |
|
| 144 | 144 | $i=0; |
| 145 | - foreach ($properties as $k=>$v){ |
|
| 145 | + foreach ($properties as $k=>$v) { |
|
| 146 | 146 | $c=$this->content[$i++]; |
| 147 | - if(isset($c)) |
|
| 148 | - $c->setProperty($k,$v); |
|
| 147 | + if (isset($c)) |
|
| 148 | + $c->setProperty($k, $v); |
|
| 149 | 149 | else |
| 150 | 150 | return $this; |
| 151 | 151 | } |
@@ -158,17 +158,17 @@ discard block |
||
| 158 | 158 | * @param array $values |
| 159 | 159 | * @return HtmlCollection |
| 160 | 160 | */ |
| 161 | - public function setPropertyValues($property,$values){ |
|
| 161 | + public function setPropertyValues($property, $values) { |
|
| 162 | 162 | $i=0; |
| 163 | - if(\is_array($values)===false){ |
|
| 164 | - $values=\array_fill(0, $this->count(),$values); |
|
| 163 | + if (\is_array($values)===false) { |
|
| 164 | + $values=\array_fill(0, $this->count(), $values); |
|
| 165 | 165 | } |
| 166 | - foreach ($values as $value){ |
|
| 166 | + foreach ($values as $value) { |
|
| 167 | 167 | $c=$this->content[$i++]; |
| 168 | - if(isset($c)){ |
|
| 169 | - $c->setProperty($property,$value); |
|
| 168 | + if (isset($c)) { |
|
| 169 | + $c->setProperty($property, $value); |
|
| 170 | 170 | } |
| 171 | - else{ |
|
| 171 | + else { |
|
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 179 | 179 | $index=0; |
| 180 | 180 | $classname=\strtolower(JReflection::shortClassName($this)); |
| 181 | - foreach ($this->content as $item){ |
|
| 182 | - $this->setItemIdentifier($item,$classname,$index++); |
|
| 181 | + foreach ($this->content as $item) { |
|
| 182 | + $this->setItemIdentifier($item, $classname, $index++); |
|
| 183 | 183 | } |
| 184 | - return parent::compile($js,$view); |
|
| 184 | + return parent::compile($js, $view); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function getItemById($identifier){ |
|
| 187 | + public function getItemById($identifier) { |
|
| 188 | 188 | return $this->getElementById($identifier, $this->content); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -7,27 +7,27 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlTextarea extends HtmlDoubleElement { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
| 10 | + public function __construct($identifier, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
| 11 | 11 | parent::__construct($identifier, "textarea"); |
| 12 | 12 | $this->setProperty("name", $identifier); |
| 13 | 13 | $this->setValue($value); |
| 14 | 14 | $this->setPlaceholder($placeholder); |
| 15 | - if(isset($rows)) |
|
| 15 | + if (isset($rows)) |
|
| 16 | 16 | $this->setRows($rows); |
| 17 | 17 | } |
| 18 | 18 | public function setValue($value) { |
| 19 | - if(isset($value)) |
|
| 19 | + if (isset($value)) |
|
| 20 | 20 | $this->setContent($value); |
| 21 | 21 | return $this; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function setPlaceholder($value){ |
|
| 25 | - if(JString::isNotNull($value)) |
|
| 24 | + public function setPlaceholder($value) { |
|
| 25 | + if (JString::isNotNull($value)) |
|
| 26 | 26 | $this->setProperty("placeholder", $value); |
| 27 | 27 | return $this; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setRows($count){ |
|
| 30 | + public function setRows($count) { |
|
| 31 | 31 | $this->setProperty("rows", $count); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class HtmlInput extends HtmlSingleElement { |
| 10 | 10 | protected $_placeholder; |
| 11 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 11 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 12 | 12 | parent::__construct($identifier, "input"); |
| 13 | 13 | $this->setProperty("name", $identifier); |
| 14 | 14 | $this->setValue($value); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function setValue($value) { |
| 20 | - if(isset($value)) |
|
| 20 | + if (isset($value)) |
|
| 21 | 21 | $this->setProperty("value", $value); |
| 22 | 22 | return $this; |
| 23 | 23 | } |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | return $this->setProperty("type", $value); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function setPlaceholder($value){ |
|
| 30 | - if(JString::isNotNull($value)) |
|
| 29 | + public function setPlaceholder($value) { |
|
| 30 | + if (JString::isNotNull($value)) |
|
| 31 | 31 | $this->_placeholder=$value; |
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 35 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 36 | 36 | $value=$this->_placeholder; |
| 37 | - if(JString::isNull($value)){ |
|
| 38 | - if(JString::isNotNull($this->getProperty("name"))) |
|
| 37 | + if (JString::isNull($value)) { |
|
| 38 | + if (JString::isNotNull($this->getProperty("name"))) |
|
| 39 | 39 | $value=\ucfirst($this->getProperty("name")); |
| 40 | 40 | } |
| 41 | 41 | $this->setProperty("placeholder", $value); |
| 42 | - return parent::compile($js,$view); |
|
| 42 | + return parent::compile($js, $view); |
|
| 43 | 43 | } |
| 44 | 44 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use Ajax\semantic\html\modules\HtmlModal; |
| 21 | 21 | |
| 22 | 22 | abstract class Widget extends HtmlDoubleElement { |
| 23 | - use FieldAsTrait,FormTrait; |
|
| 23 | + use FieldAsTrait, FormTrait; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @var string classname |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | protected $_generated; |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
| 56 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 57 | 57 | parent::__construct($identifier); |
| 58 | 58 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 59 | 59 | $this->setModel($model); |
| 60 | - if(isset($modelInstance)){ |
|
| 60 | + if (isset($modelInstance)) { |
|
| 61 | 61 | $this->show($modelInstance); |
| 62 | 62 | } |
| 63 | 63 | $this->_generated=false; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected function _init($instanceViewer,$contentKey,$content,$edition){ |
|
| 66 | + protected function _init($instanceViewer, $contentKey, $content, $edition) { |
|
| 67 | 67 | $this->_instanceViewer=$instanceViewer; |
| 68 | 68 | $this->content=[$contentKey=>$content]; |
| 69 | 69 | $this->_self=$content; |
@@ -75,31 +75,31 @@ discard block |
||
| 75 | 75 | * @param int|string $fieldName |
| 76 | 76 | * @return int|string |
| 77 | 77 | */ |
| 78 | - protected function _getIndex($fieldName){ |
|
| 78 | + protected function _getIndex($fieldName) { |
|
| 79 | 79 | $index=$fieldName; |
| 80 | - if(\is_string($fieldName)){ |
|
| 80 | + if (\is_string($fieldName)) { |
|
| 81 | 81 | $fields=$this->_instanceViewer->getVisibleProperties(); |
| 82 | 82 | $index=\array_search($fieldName, $fields); |
| 83 | 83 | } |
| 84 | 84 | return $index; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
| 87 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
| 88 | 88 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - protected function _getFieldName($index){ |
|
| 91 | + protected function _getFieldName($index) { |
|
| 92 | 92 | return $this->_instanceViewer->getFieldName($index); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - protected function _getFieldCaption($index){ |
|
| 95 | + protected function _getFieldCaption($index) { |
|
| 96 | 96 | return $this->_instanceViewer->getCaption($index); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - abstract protected function _setToolbarPosition($table,$captions=NULL); |
|
| 99 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
| 100 | 100 | |
| 101 | - public function show($modelInstance){ |
|
| 102 | - if(\is_array($modelInstance)){ |
|
| 101 | + public function show($modelInstance) { |
|
| 102 | + if (\is_array($modelInstance)) { |
|
| 103 | 103 | $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
| 104 | 104 | } |
| 105 | 105 | $this->_modelInstance=$modelInstance; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | abstract public function getHtmlComponent(); |
| 127 | 127 | |
| 128 | - public function setAttached($value=true){ |
|
| 128 | + public function setAttached($value=true) { |
|
| 129 | 129 | return $this->getHtmlComponent()->setAttached($value); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -136,66 +136,66 @@ discard block |
||
| 136 | 136 | * @param callable $callback function called after the field compilation |
| 137 | 137 | * @return Widget |
| 138 | 138 | */ |
| 139 | - public function afterCompile($index,$callback){ |
|
| 139 | + public function afterCompile($index, $callback) { |
|
| 140 | 140 | $index=$this->_getIndex($index); |
| 141 | 141 | $this->_instanceViewer->afterCompile($index, $callback); |
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function setColor($color){ |
|
| 145 | + public function setColor($color) { |
|
| 146 | 146 | return $this->getHtmlComponent()->setColor($color); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
| 150 | - public function setCaptions($captions){ |
|
| 150 | + public function setCaptions($captions) { |
|
| 151 | 151 | $this->_instanceViewer->setCaptions($captions); |
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - public function setCaption($index,$caption){ |
|
| 155 | + public function setCaption($index, $caption) { |
|
| 156 | 156 | $this->_instanceViewer->setCaption($this->_getIndex($index), $caption); |
| 157 | 157 | return $this; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function setFields($fields){ |
|
| 160 | + public function setFields($fields) { |
|
| 161 | 161 | $this->_instanceViewer->setVisibleProperties($fields); |
| 162 | 162 | return $this; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - public function addField($field){ |
|
| 165 | + public function addField($field) { |
|
| 166 | 166 | $this->_instanceViewer->addField($field); |
| 167 | 167 | return $this; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function addMessage($attributes=NULL,$fieldName="message"){ |
|
| 170 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
| 171 | 171 | $this->_instanceViewer->addField($fieldName); |
| 172 | 172 | $count=$this->_instanceViewer->visiblePropertiesCount(); |
| 173 | - return $this->fieldAsMessage($count-1,$attributes); |
|
| 173 | + return $this->fieldAsMessage($count-1, $attributes); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function addErrorMessage(){ |
|
| 177 | - return $this->addMessage(["error"=>true],"message"); |
|
| 176 | + public function addErrorMessage() { |
|
| 177 | + return $this->addMessage(["error"=>true], "message"); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function insertField($index,$field){ |
|
| 180 | + public function insertField($index, $field) { |
|
| 181 | 181 | $index=$this->_getIndex($index); |
| 182 | 182 | $this->_instanceViewer->insertField($index, $field); |
| 183 | 183 | return $this; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function insertInField($index,$field){ |
|
| 186 | + public function insertInField($index, $field) { |
|
| 187 | 187 | $index=$this->_getIndex($index); |
| 188 | 188 | $this->_instanceViewer->insertInField($index, $field); |
| 189 | 189 | return $this; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - public function setValueFunction($index,$callback){ |
|
| 192 | + public function setValueFunction($index, $callback) { |
|
| 193 | 193 | $index=$this->_getIndex($index); |
| 194 | 194 | $this->_instanceViewer->setValueFunction($index, $callback); |
| 195 | 195 | return $this; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public function setIdentifierFunction($callback){ |
|
| 198 | + public function setIdentifierFunction($callback) { |
|
| 199 | 199 | $this->_instanceViewer->setIdentifierFunction($callback); |
| 200 | 200 | return $this; |
| 201 | 201 | } |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | /** |
| 204 | 204 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
| 205 | 205 | */ |
| 206 | - public function getToolbar(){ |
|
| 207 | - if(isset($this->_toolbar)===false){ |
|
| 206 | + public function getToolbar() { |
|
| 207 | + if (isset($this->_toolbar)===false) { |
|
| 208 | 208 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
| 209 | 209 | } |
| 210 | 210 | return $this->_toolbar; |
@@ -216,15 +216,15 @@ discard block |
||
| 216 | 216 | * @param callable $callback function to call on $element |
| 217 | 217 | * @return \Ajax\common\html\HtmlDoubleElement |
| 218 | 218 | */ |
| 219 | - public function addInToolbar($element,$callback=NULL){ |
|
| 219 | + public function addInToolbar($element, $callback=NULL) { |
|
| 220 | 220 | $tb=$this->getToolbar(); |
| 221 | - if($element instanceof BaseWidget){ |
|
| 222 | - if($element->getIdentifier()===""){ |
|
| 221 | + if ($element instanceof BaseWidget) { |
|
| 222 | + if ($element->getIdentifier()==="") { |
|
| 223 | 223 | $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | - if(isset($callback)){ |
|
| 227 | - if(\is_callable($callback)){ |
|
| 226 | + if (isset($callback)) { |
|
| 227 | + if (\is_callable($callback)) { |
|
| 228 | 228 | $callback($element); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | * @param callable $callback function($element) |
| 238 | 238 | * @return \Ajax\common\html\HtmlDoubleElement |
| 239 | 239 | */ |
| 240 | - public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
|
| 241 | - $result=$this->addInToolbar($caption,$callback); |
|
| 242 | - if(isset($icon)) |
|
| 240 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
| 241 | + $result=$this->addInToolbar($caption, $callback); |
|
| 242 | + if (isset($icon)) |
|
| 243 | 243 | $result->addIcon($icon); |
| 244 | 244 | return $result; |
| 245 | 245 | } |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | * @param callable $callback function($element) |
| 250 | 250 | * @return \Ajax\common\Widget |
| 251 | 251 | */ |
| 252 | - public function addItemsInToolbar(array $items,$callback=NULL){ |
|
| 253 | - if(JArray::isAssociative($items)){ |
|
| 254 | - foreach ($items as $icon=>$item){ |
|
| 255 | - $this->addItemInToolbar($item,$icon,$callback); |
|
| 252 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
| 253 | + if (JArray::isAssociative($items)) { |
|
| 254 | + foreach ($items as $icon=>$item) { |
|
| 255 | + $this->addItemInToolbar($item, $icon, $callback); |
|
| 256 | 256 | } |
| 257 | - }else{ |
|
| 258 | - foreach ($items as $item){ |
|
| 259 | - $this->addItemInToolbar($item,null,$callback); |
|
| 257 | + } else { |
|
| 258 | + foreach ($items as $item) { |
|
| 259 | + $this->addItemInToolbar($item, null, $callback); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | return $this; |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | * @param callable $callback function($element) |
| 269 | 269 | * @return \Ajax\common\html\HtmlDoubleElement |
| 270 | 270 | */ |
| 271 | - public function addDropdownInToolbar($value,$items,$callback=NULL){ |
|
| 271 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
| 272 | 272 | $dd=$value; |
| 273 | 273 | if (\is_string($value)) { |
| 274 | - $dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items); |
|
| 274 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
| 275 | 275 | } |
| 276 | - return $this->addInToolbar($dd,$callback); |
|
| 276 | + return $this->addInToolbar($dd, $callback); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | * @param callable $callback function($element) |
| 283 | 283 | * @return \Ajax\common\html\HtmlDoubleElement |
| 284 | 284 | */ |
| 285 | - public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){ |
|
| 286 | - $bt=new HtmlButton("bt-".$caption,$caption,$cssStyle); |
|
| 287 | - return $this->addInToolbar($bt,$callback); |
|
| 285 | + public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) { |
|
| 286 | + $bt=new HtmlButton("bt-".$caption, $caption, $cssStyle); |
|
| 287 | + return $this->addInToolbar($bt, $callback); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | * @param callable $callback function($element) |
| 294 | 294 | * @return \Ajax\common\html\HtmlDoubleElement |
| 295 | 295 | */ |
| 296 | - public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){ |
|
| 297 | - $bts=new HtmlButtonGroups("",$captions,$asIcon); |
|
| 298 | - return $this->addInToolbar($bts,$callback); |
|
| 296 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
| 297 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
| 298 | + return $this->addInToolbar($bts, $callback); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | * @param boolean $labeled |
| 306 | 306 | * @return \Ajax\common\html\HtmlDoubleElement |
| 307 | 307 | */ |
| 308 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
| 309 | - $bt=new HtmlButton("",$caption); |
|
| 310 | - $bt->addIcon($icon,$before,$labeled); |
|
| 308 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
| 309 | + $bt=new HtmlButton("", $caption); |
|
| 310 | + $bt->addIcon($icon, $before, $labeled); |
|
| 311 | 311 | return $this->addInToolbar($bt); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
| 315 | - $button=new HtmlButton($identifier,$value,$cssStyle); |
|
| 316 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters); |
|
| 314 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
| 315 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
| 316 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters); |
|
| 317 | 317 | return $this->addInToolbar($button); |
| 318 | 318 | } |
| 319 | 319 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model |
| 344 | 344 | * @return \Ajax\common\Widget |
| 345 | 345 | */ |
| 346 | - public function setDefaultValueFunction($defaultValueFunction){ |
|
| 346 | + public function setDefaultValueFunction($defaultValueFunction) { |
|
| 347 | 347 | $this->_instanceViewer->setDefaultValueFunction($defaultValueFunction); |
| 348 | 348 | return $this; |
| 349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param string|boolean $disable |
| 353 | 353 | * @return string |
| 354 | 354 | */ |
| 355 | - public function jsDisabled($disable=true){ |
|
| 355 | + public function jsDisabled($disable=true) { |
|
| 356 | 356 | return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
| 357 | 357 | } |
| 358 | 358 | |
@@ -361,12 +361,12 @@ discard block |
||
| 361 | 361 | * @param callable $callback function($element) |
| 362 | 362 | * @return \Ajax\common\html\HtmlDoubleElement |
| 363 | 363 | */ |
| 364 | - public function addEditButtonInToolbar($caption,$callback=NULL){ |
|
| 365 | - $bt=new HtmlButton($this->identifier."-editBtn",$caption); |
|
| 364 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
| 365 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
| 366 | 366 | $bt->setToggle(); |
| 367 | 367 | $bt->setActive($this->_edition); |
| 368 | 368 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
| 369 | - return $this->addInToolbar($bt,$callback); |
|
| 369 | + return $this->addInToolbar($bt, $callback); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | public function setToolbar(HtmlMenu $_toolbar) { |
@@ -380,35 +380,35 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | public function getForm() { |
| 383 | - if(!isset($this->_form)){ |
|
| 383 | + if (!isset($this->_form)) { |
|
| 384 | 384 | $this->_form=new HtmlForm("frm-".$this->identifier); |
| 385 | 385 | $this->setEdition(true); |
| 386 | 386 | } |
| 387 | 387 | return $this->_form; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - public function run(JsUtils $js){ |
|
| 390 | + public function run(JsUtils $js) { |
|
| 391 | 391 | $result=parent::run($js); |
| 392 | - if(isset($this->_form)){ |
|
| 392 | + if (isset($this->_form)) { |
|
| 393 | 393 | $result=$this->runForm($js); |
| 394 | 394 | } |
| 395 | 395 | return $result; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - protected function runForm(JsUtils $js){ |
|
| 398 | + protected function runForm(JsUtils $js) { |
|
| 399 | 399 | $fields=$this->getContentInstances(HtmlFormField::class); |
| 400 | - foreach ($fields as $field){ |
|
| 400 | + foreach ($fields as $field) { |
|
| 401 | 401 | $this->_form->addField($field); |
| 402 | 402 | } |
| 403 | 403 | return $this->_form->run($js); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - protected function _compileForm(){ |
|
| 407 | - if(isset($this->_form)){ |
|
| 406 | + protected function _compileForm() { |
|
| 407 | + if (isset($this->_form)) { |
|
| 408 | 408 | $noValidate=""; |
| 409 | - if(\sizeof($this->_form->getValidationParams())>0) |
|
| 409 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
| 410 | 410 | $noValidate="novalidate"; |
| 411 | - $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>"); |
|
| 411 | + $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | |
@@ -417,32 +417,32 @@ discard block |
||
| 417 | 417 | return $this; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - public function moveFieldTo($from,$to){ |
|
| 420 | + public function moveFieldTo($from, $to) { |
|
| 421 | 421 | return $this->_instanceViewer->moveFieldTo($from, $to); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - public function swapFields($index1,$index2){ |
|
| 424 | + public function swapFields($index1, $index2) { |
|
| 425 | 425 | $index1=$this->_getIndex($index1); |
| 426 | 426 | $index2=$this->_getIndex($index2); |
| 427 | 427 | return $this->_instanceViewer->swapFields($index1, $index2); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - public function removeField($index){ |
|
| 430 | + public function removeField($index) { |
|
| 431 | 431 | $index=$this->_getIndex($index); |
| 432 | 432 | $this->_instanceViewer->removeField($index); |
| 433 | 433 | return $this; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - public function asModal($header=null){ |
|
| 437 | - $modal=new HtmlModal("modal-".$this->identifier,$header); |
|
| 436 | + public function asModal($header=null) { |
|
| 437 | + $modal=new HtmlModal("modal-".$this->identifier, $header); |
|
| 438 | 438 | $modal->setContent($this); |
| 439 | - if(isset($this->_form)){ |
|
| 439 | + if (isset($this->_form)) { |
|
| 440 | 440 | $this->_form->onSuccess($modal->jsHide()); |
| 441 | 441 | } |
| 442 | 442 | return $modal; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | public function addToProperty($name, $value, $separator=" ") { |
| 446 | - return $this->getHtmlComponent()->addToProperty($name,$value,$separator); |
|
| 446 | + return $this->getHtmlComponent()->addToProperty($name, $value, $separator); |
|
| 447 | 447 | } |
| 448 | 448 | } |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | * @version 1.001 |
| 11 | 11 | */ |
| 12 | 12 | abstract class BaseComponent { |
| 13 | - public $jquery_code_for_compile=array (); |
|
| 14 | - protected $params=array (); |
|
| 13 | + public $jquery_code_for_compile=array(); |
|
| 14 | + protected $params=array(); |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function setParams($params) { |
| 71 | - foreach ( $params as $k => $v ) { |
|
| 71 | + foreach ($params as $k => $v) { |
|
| 72 | 72 | $method="set".ucfirst($k); |
| 73 | 73 | if (method_exists($this, $method)) |
| 74 | 74 | $this->$method($v); |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | return $this; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function addParams($params){ |
|
| 85 | - foreach ($params as $k=>$v){ |
|
| 84 | + public function addParams($params) { |
|
| 85 | + foreach ($params as $k=>$v) { |
|
| 86 | 86 | $this->setParam($k, $v); |
| 87 | 87 | } |
| 88 | 88 | return $this; |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | abstract public function getScript(); |
| 92 | 92 | |
| 93 | - public function setDebug($value){ |
|
| 93 | + public function setDebug($value) { |
|
| 94 | 94 | return $this->setParam("debug", $value); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function setVerbose($value){ |
|
| 97 | + public function setVerbose($value) { |
|
| 98 | 98 | return $this->setParam("verbose", $value); |
| 99 | 99 | } |
| 100 | 100 | } |