@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | protected $attr; |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public function __construct($identifier,$tagName){ |
|
| 25 | - parent::__construct($identifier,$tagName); |
|
| 24 | + public function __construct($identifier, $tagName) { |
|
| 25 | + parent::__construct($identifier, $tagName); |
|
| 26 | 26 | $this->root=""; |
| 27 | 27 | $this->attr="data-ajax"; |
| 28 | 28 | } |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | * @param string $targetSelector the target of the get |
| 34 | 34 | * @return HtmlNavElement |
| 35 | 35 | */ |
| 36 | - public function autoGetOnClick($targetSelector){ |
|
| 37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 36 | + public function autoGetOnClick($targetSelector) { |
|
| 37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function contentAsString(){ |
|
| 40 | + public function contentAsString() { |
|
| 41 | 41 | return implode("", $this->content); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -23,19 +23,19 @@ |
||
| 23 | 23 | return $this; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function addGlyph($glyphicon,$before=true){ |
|
| 26 | + public function addGlyph($glyphicon, $before=true) { |
|
| 27 | 27 | $glyph=new HtmlGlyphicon(""); |
| 28 | 28 | $glyph->setGlyphicon($glyphicon); |
| 29 | - $this->addContent($glyph,$before); |
|
| 29 | + $this->addContent($glyph, $before); |
|
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
| 33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
| 34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
| 35 | 35 | $after=""; |
| 36 | - if($glyphAfter!==""){ |
|
| 36 | + if ($glyphAfter!=="") { |
|
| 37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
| 38 | 38 | } |
| 39 | - return $this->wrapContent($before,$after); |
|
| 39 | + return $this->wrapContent($before, $after); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | parent::__construct($identifier); |
| 28 | 28 | $this->tagName="ul"; |
| 29 | 29 | $this->_template='<%tagName% id="%identifier%" class="nav navbar-nav %class%">%elements%</%tagName%>'; |
| 30 | - $this->elements=array (); |
|
| 30 | + $this->elements=array(); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function setClass($value) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function addElement($element) { |
| 42 | - if($element instanceof HtmlLink){ |
|
| 42 | + if ($element instanceof HtmlLink) { |
|
| 43 | 43 | $this->addLink($element); |
| 44 | 44 | } else if (is_object($element)) { |
| 45 | 45 | $this->elements []=$element; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function addElements($elements) { |
| 61 | 61 | if (\is_array($elements)) { |
| 62 | - foreach ( $elements as $key => $element ) { |
|
| 62 | + foreach ($elements as $key => $element) { |
|
| 63 | 63 | $iid=$this->getElementsCount()+1; |
| 64 | 64 | if ($element instanceof HtmlDropdownItem) |
| 65 | 65 | $this->elements []=$element; |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | public function addLink($caption, $href="#") { |
| 88 | 88 | $iid=$this->getElementsCount()+1; |
| 89 | 89 | $li=new HtmlBsDoubleElement($this->identifier."-li-".$iid, "li"); |
| 90 | - if($caption instanceof HtmlLink){ |
|
| 90 | + if ($caption instanceof HtmlLink) { |
|
| 91 | 91 | $link=$caption; |
| 92 | - }else{ |
|
| 92 | + } else { |
|
| 93 | 93 | $link=new HtmlLink($this->identifier."-link-".$iid, $href, $caption); |
| 94 | 94 | } |
| 95 | 95 | $li->setContent($link); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | public function run(JsUtils $js) { |
| 125 | - foreach ( $this->elements as $element ) { |
|
| 125 | + foreach ($this->elements as $element) { |
|
| 126 | 126 | $element->run($js); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param int $index |
| 144 | 144 | * @return BaseHtml |
| 145 | 145 | */ |
| 146 | - public function getElement($index){ |
|
| 146 | + public function getElement($index) { |
|
| 147 | 147 | return $this->elements[$index]; |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -62,15 +62,15 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function setIdentifier($identifier) { |
| 64 | 64 | parent::setIdentifier($identifier); |
| 65 | - if($this->content instanceof HtmlLink){ |
|
| 65 | + if ($this->content instanceof HtmlLink) { |
|
| 66 | 66 | $this->content->setIdentifier("link-".$identifier); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | - public function setActive($value=true){ |
|
| 70 | - $this->setProperty("class", ($value)?"active":""); |
|
| 69 | + public function setActive($value=true) { |
|
| 70 | + $this->setProperty("class", ($value) ? "active" : ""); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function disable(){ |
|
| 73 | + public function disable() { |
|
| 74 | 74 | $this->setProperty("class", "disabled"); |
| 75 | 75 | } |
| 76 | 76 | } |