@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | abstract public function setClass($classNames); |
18 | 18 | abstract public function addIcon($icon, $before=true); |
19 | 19 | |
20 | - public function setContent($content){ |
|
21 | - if($content==="-"){ |
|
20 | + public function setContent($content) { |
|
21 | + if ($content==="-") { |
|
22 | 22 | $this->asDivider(); |
23 | - }elseif($content==="-search-"){ |
|
24 | - $values=\explode(",",$content,-1); |
|
25 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
26 | - }elseif(JString::startswith($content, "-")){ |
|
27 | - $content=\ltrim($content,"-"); |
|
23 | + }elseif ($content==="-search-") { |
|
24 | + $values=\explode(",", $content, -1); |
|
25 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
26 | + }elseif (JString::startswith($content, "-")) { |
|
27 | + $content=\ltrim($content, "-"); |
|
28 | 28 | $this->asHeader($content); |
29 | - }else |
|
29 | + } else |
|
30 | 30 | parent::setContent($content); |
31 | 31 | return $this; |
32 | 32 | } |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | * @param string $icon |
37 | 37 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
38 | 38 | */ |
39 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
39 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
40 | 40 | $this->setClass("ui icon search input"); |
41 | 41 | $input=new HtmlInput("search-".$this->identifier); |
42 | - if(isset($placeholder)) |
|
42 | + if (isset($placeholder)) |
|
43 | 43 | $input->setProperty("placeholder", $placeholder); |
44 | 44 | $this->content=$input; |
45 | - if(isset($icon)) |
|
45 | + if (isset($icon)) |
|
46 | 46 | $this->addIcon($icon); |
47 | 47 | return $this; |
48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
52 | 52 | */ |
53 | - public function asDivider(){ |
|
53 | + public function asDivider() { |
|
54 | 54 | $this->content=NULL; |
55 | 55 | $this->tagName="div"; |
56 | 56 | $this->setClass("divider"); |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | * @param string $icon |
63 | 63 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
64 | 64 | */ |
65 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
65 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
66 | 66 | $this->setClass("header"); |
67 | 67 | $this->tagName="div"; |
68 | 68 | $this->content=$caption; |
69 | - if(isset($icon)) |
|
70 | - $this->addIcon($icon,Direction::LEFT); |
|
69 | + if (isset($icon)) |
|
70 | + $this->addIcon($icon, Direction::LEFT); |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function setPosition($direction){ |
|
75 | - $this->addToProperty("class",$direction); |
|
74 | + public function setPosition($direction) { |
|
75 | + $this->addToProperty("class", $direction); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function createItem($value) { |
20 | 20 | $count=$this->count(); |
21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
22 | 22 | return $item; |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addHeader($niveau, $content) { |
26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
27 | 27 | $this->wrap($header); |
28 | 28 | return $header; |
29 | 29 | } |
30 | 30 | |
31 | - public function getItemPart($index,$partName="header"){ |
|
31 | + public function getItemPart($index, $partName="header") { |
|
32 | 32 | return $this->getItem($index)->getPart($partName); |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function asLink() { |
40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
41 | 41 | return $this->contentAs("a"); |
42 | 42 | } |
43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function run(JsUtils $js) { |
63 | - if ($this->_hasCheckedList === true) { |
|
64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
63 | + if ($this->_hasCheckedList===true) { |
|
64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
66 | 66 | $this->executeOnRun($jsCode); |
67 | 67 | } |
68 | 68 | return parent::run($js); |
@@ -86,24 +86,24 @@ discard block |
||
86 | 86 | |
87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
88 | 88 | $count=$this->count(); |
89 | - $identifier=$this->identifier . "-" . $count; |
|
89 | + $identifier=$this->identifier."-".$count; |
|
90 | 90 | if (isset($masterItem)) { |
91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
92 | 92 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
93 | 93 | $masterO->setClass("item"); |
94 | 94 | $this->addItem($masterO); |
95 | 95 | } |
96 | - $fields=array (); |
|
96 | + $fields=array(); |
|
97 | 97 | $i=0; |
98 | - foreach ( $items as $val => $caption ) { |
|
99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
100 | - if (\array_search($val, $values) !== false) { |
|
98 | + foreach ($items as $val => $caption) { |
|
99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
100 | + if (\array_search($val, $values)!==false) { |
|
101 | 101 | $itemO->getField()->setProperty("checked", ""); |
102 | 102 | } |
103 | 103 | $itemO->setClass("item"); |
104 | 104 | $fields[]=$itemO; |
105 | 105 | } |
106 | - if (isset($masterO) === true) { |
|
106 | + if (isset($masterO)===true) { |
|
107 | 107 | $list=new HtmlList("", $fields); |
108 | 108 | $list->setClass("list"); |
109 | 109 | $masterO->addContent($list); |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | use Ajax\semantic\traits\SemanticWidgetsTrait; |
12 | 12 | |
13 | 13 | class Semantic extends BaseGui { |
14 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
15 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait,SemanticWidgetsTrait; |
|
14 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
15 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait, SemanticWidgetsTrait; |
|
16 | 16 | |
17 | 17 | private $language; |
18 | 18 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | - public function setLanguage($language){ |
|
25 | - if($language!==$this->language){ |
|
24 | + public function setLanguage($language) { |
|
25 | + if ($language!==$this->language) { |
|
26 | 26 | $file=\realpath(dirname(__FILE__)."/semantic/components/validation/languages/".$language.".js"); |
27 | - if(\file_exists($file)){ |
|
27 | + if (\file_exists($file)) { |
|
28 | 28 | $script=\file_get_contents($file); |
29 | - $this->js->exec($script,true); |
|
29 | + $this->js->exec($script, true); |
|
30 | 30 | $this->language=$language; |
31 | 31 | } |
32 | 32 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | class JArray { |
6 | 6 | |
7 | 7 | public static function isAssociative($array) { |
8 | - return (array_values($array) !== $array); |
|
8 | + return (array_values($array)!==$array); |
|
9 | 9 | // return (array_keys($array)!==range(0, count($array)-1)); |
10 | 10 | } |
11 | 11 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
17 | + if ($pos<sizeof($values)) |
|
18 | 18 | return $values[$pos]; |
19 | 19 | } |
20 | 20 | |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | $result=NULL; |
23 | 23 | if (array_key_exists($key, $array)) { |
24 | 24 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
25 | + if ($condition($result)===true) |
|
26 | 26 | return $result; |
27 | 27 | } |
28 | 28 | $values=array_values($array); |
29 | - foreach ( $values as $val ) { |
|
30 | - if ($condition($val) === true) |
|
29 | + foreach ($values as $val) { |
|
30 | + if ($condition($val)===true) |
|
31 | 31 | return $val; |
32 | 32 | } |
33 | 33 | return $result; |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $result=""; |
45 | 45 | if (\is_array($glue)) { |
46 | 46 | $size=\sizeof($pieces); |
47 | - if ($size > 0) { |
|
48 | - for($i=0; $i < $size - 1; $i++) { |
|
49 | - $result.=$pieces[$i] . @$glue[$i]; |
|
47 | + if ($size>0) { |
|
48 | + for ($i=0; $i<$size-1; $i++) { |
|
49 | + $result.=$pieces[$i].@$glue[$i]; |
|
50 | 50 | } |
51 | - $result.=$pieces[$size - 1]; |
|
51 | + $result.=$pieces[$size-1]; |
|
52 | 52 | } |
53 | 53 | } else { |
54 | 54 | $result=\implode($glue, $pieces); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public static function dimension($array) { |
60 | 60 | if (\is_array(reset($array))) { |
61 | - $return=self::dimension(reset($array)) + 1; |
|
61 | + $return=self::dimension(reset($array))+1; |
|
62 | 62 | } else { |
63 | 63 | $return=1; |
64 | 64 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public static function sortAssociative($array, $sortedKeys=array()) { |
69 | - $newArray=array (); |
|
70 | - foreach ( $sortedKeys as $key ) { |
|
69 | + $newArray=array(); |
|
70 | + foreach ($sortedKeys as $key) { |
|
71 | 71 | if (\array_key_exists($key, $array)) { |
72 | 72 | $newArray[$key]=$array[$key]; |
73 | 73 | } |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | return $newArray; |
76 | 76 | } |
77 | 77 | |
78 | - public static function modelArray($objects,$identifierFunction=NULL,$modelFunction=NULL){ |
|
78 | + public static function modelArray($objects, $identifierFunction=NULL, $modelFunction=NULL) { |
|
79 | 79 | $result=[]; |
80 | - if(isset($modelFunction)===false){ |
|
80 | + if (isset($modelFunction)===false) { |
|
81 | 81 | $modelFunction="__toString"; |
82 | 82 | } |
83 | - if(isset($identifierFunction)===false){ |
|
84 | - foreach ($objects as $object){ |
|
83 | + if (isset($identifierFunction)===false) { |
|
84 | + foreach ($objects as $object) { |
|
85 | 85 | $result[]=self::callFunction($object, $modelFunction); |
86 | 86 | } |
87 | - }else{ |
|
88 | - foreach ($objects as $object){ |
|
87 | + } else { |
|
88 | + foreach ($objects as $object) { |
|
89 | 89 | $result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction); |
90 | 90 | } |
91 | 91 | } |
92 | 92 | return $result; |
93 | 93 | } |
94 | 94 | |
95 | - private static function callFunction($object,$callback){ |
|
96 | - if(\is_string($callback)) |
|
97 | - return \call_user_func(array($object, $callback),[]); |
|
98 | - else if (\is_callable($callback)){ |
|
95 | + private static function callFunction($object, $callback) { |
|
96 | + if (\is_string($callback)) |
|
97 | + return \call_user_func(array($object, $callback), []); |
|
98 | + else if (\is_callable($callback)) { |
|
99 | 99 | return $callback($object); |
100 | 100 | } |
101 | 101 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | trait JqueryActionsTrait { |
13 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
13 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Get or set the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param boolean $immediatly defers the execution if set to false |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - public function after($element='this', $value='', $immediatly=false){ |
|
41 | + public function after($element='this', $value='', $immediatly=false) { |
|
42 | 42 | $element=Javascript::prep_element($element); |
43 | 43 | $value=Javascript::prep_value($value); |
44 | 44 | $str="$({$element}).after({$value});"; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $animations="\t\t\t"; |
65 | 65 | if (\is_array($params)) { |
66 | - foreach ( $params as $param => $value ) { |
|
66 | + foreach ($params as $param => $value) { |
|
67 | 67 | $animations.=$param.': \''.$value.'\', '; |
68 | 68 | } |
69 | 69 | } |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | * @param boolean $immediatly |
357 | 357 | * @return string |
358 | 358 | */ |
359 | - public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
360 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
359 | + public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
360 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | * @param boolean $immediatly |
384 | 384 | * @return String |
385 | 385 | */ |
386 | - public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
387 | - return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
386 | + public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
387 | + return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @return string |
394 | 394 | */ |
395 | 395 | private function _validate_speed($speed) { |
396 | - if (in_array($speed, array ( |
|
397 | - 'slow','normal','fast' |
|
396 | + if (in_array($speed, array( |
|
397 | + 'slow', 'normal', 'fast' |
|
398 | 398 | ))) { |
399 | 399 | $speed='"'.$speed.'"'; |
400 | 400 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct(JsUtils $js=NULL) { |
19 | 19 | parent::__construct($js); |
20 | - $this->events=array (); |
|
20 | + $this->events=array(); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | protected function compileEvents() { |
24 | - foreach ( $this->events as $event => $jsCode ) { |
|
25 | - if($event=="execute"){ |
|
24 | + foreach ($this->events as $event => $jsCode) { |
|
25 | + if ($event=="execute") { |
|
26 | 26 | $this->jquery_code_for_compile []=$jsCode; |
27 | - }else if($event=="beforeExecute"){ |
|
27 | + } else if ($event=="beforeExecute") { |
|
28 | 28 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
29 | - }else{ |
|
29 | + } else { |
|
30 | 30 | $selector=$this->attachTo; |
31 | - if(isset($this->itemSelector)){ |
|
31 | + if (isset($this->itemSelector)) { |
|
32 | 32 | $selector.=" ".$this->itemSelector; |
33 | 33 | } |
34 | 34 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $result=implode("\n", $this->jquery_code_for_compile); |
41 | 41 | $result=str_ireplace("\"%", "", $result); |
42 | 42 | $result=str_ireplace("%\"", "", $result); |
43 | - $result=str_replace(array ( |
|
43 | + $result=str_replace(array( |
|
44 | 44 | "\\n", |
45 | 45 | "\\r", |
46 | 46 | "\\t" |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function getScript() { |
52 | 52 | $allParams=$this->params; |
53 | - $this->jquery_code_for_compile=array (); |
|
53 | + $this->jquery_code_for_compile=array(); |
|
54 | 54 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
55 | 55 | $this->compileEvents(); |
56 | 56 | return $this->compileJQueryCode(); |
@@ -12,36 +12,36 @@ discard block |
||
12 | 12 | */ |
13 | 13 | abstract class HtmlCollection extends HtmlDoubleElement { |
14 | 14 | |
15 | - public function __construct($identifier,$tagName="div"){ |
|
16 | - parent::__construct($identifier,$tagName); |
|
15 | + public function __construct($identifier, $tagName="div") { |
|
16 | + parent::__construct($identifier, $tagName); |
|
17 | 17 | $this->content=array(); |
18 | 18 | } |
19 | 19 | |
20 | - public function addItems($items){ |
|
21 | - if(JArray::isAssociative($items)){ |
|
22 | - foreach ($items as $k=>$v){ |
|
23 | - $this->addItem([$k,$v]); |
|
20 | + public function addItems($items) { |
|
21 | + if (JArray::isAssociative($items)) { |
|
22 | + foreach ($items as $k=>$v) { |
|
23 | + $this->addItem([$k, $v]); |
|
24 | 24 | } |
25 | - }else{ |
|
26 | - foreach ($items as $item){ |
|
25 | + } else { |
|
26 | + foreach ($items as $item) { |
|
27 | 27 | $this->addItem($item); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function setItems($items){ |
|
33 | + public function setItems($items) { |
|
34 | 34 | $this->content=$items; |
35 | 35 | return $this; |
36 | 36 | } |
37 | 37 | |
38 | - public function getItems(){ |
|
38 | + public function getItems() { |
|
39 | 39 | return $this->content; |
40 | 40 | } |
41 | 41 | |
42 | - protected function getItemToAdd($item){ |
|
42 | + protected function getItemToAdd($item) { |
|
43 | 43 | $itemO=$item; |
44 | - if($this->createCondition($item)===true){ |
|
44 | + if ($this->createCondition($item)===true) { |
|
45 | 45 | $itemO=$this->createItem($item); |
46 | 46 | } |
47 | 47 | return $itemO; |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | * @param HtmlDoubleElement|string|array $item |
53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
54 | 54 | */ |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $itemO=$this->getItemToAdd($item); |
57 | 57 | $this->addContent($itemO); |
58 | 58 | return $itemO; |
59 | 59 | } |
60 | 60 | |
61 | - public function insertItem($item,$position=0){ |
|
61 | + public function insertItem($item, $position=0) { |
|
62 | 62 | $itemO=$this->getItemToAdd($item); |
63 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
63 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
64 | 64 | return $itemO; |
65 | 65 | } |
66 | 66 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function removeItem($index){ |
|
86 | + public function removeItem($index) { |
|
87 | 87 | return array_splice($this->content, $index, 1); |
88 | 88 | } |
89 | 89 | |
90 | - public function count(){ |
|
90 | + public function count() { |
|
91 | 91 | return \sizeof($this->content); |
92 | 92 | } |
93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | return $this->addItem($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function apply($callBack){ |
|
102 | - foreach ($this->content as $item){ |
|
101 | + public function apply($callBack) { |
|
102 | + foreach ($this->content as $item) { |
|
103 | 103 | $callBack($item); |
104 | 104 | } |
105 | 105 | return $this; |
@@ -119,40 +119,40 @@ discard block |
||
119 | 119 | */ |
120 | 120 | abstract protected function createItem($value); |
121 | 121 | |
122 | - protected function createCondition($value){ |
|
122 | + protected function createCondition($value) { |
|
123 | 123 | return \is_object($value)===false; |
124 | 124 | } |
125 | 125 | |
126 | - protected function contentAs($tagName){ |
|
127 | - foreach ($this->content as $item){ |
|
126 | + protected function contentAs($tagName) { |
|
127 | + foreach ($this->content as $item) { |
|
128 | 128 | $item->setTagName($tagName); |
129 | 129 | } |
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | - public function setProperties($properties){ |
|
133 | + public function setProperties($properties) { |
|
134 | 134 | $i=0; |
135 | - foreach ($properties as $k=>$v){ |
|
135 | + foreach ($properties as $k=>$v) { |
|
136 | 136 | $c=$this->content[$i++]; |
137 | - if(isset($c)) |
|
138 | - $c->setProperty($k,$v); |
|
137 | + if (isset($c)) |
|
138 | + $c->setProperty($k, $v); |
|
139 | 139 | else |
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | - public function setPropertyValues($property,$values){ |
|
145 | + public function setPropertyValues($property, $values) { |
|
146 | 146 | $i=0; |
147 | - if(\is_array($values)===false){ |
|
148 | - $values=\array_fill(0, $this->count(),$values); |
|
147 | + if (\is_array($values)===false) { |
|
148 | + $values=\array_fill(0, $this->count(), $values); |
|
149 | 149 | } |
150 | - foreach ($values as $value){ |
|
150 | + foreach ($values as $value) { |
|
151 | 151 | $c=$this->content[$i++]; |
152 | - if(isset($c)){ |
|
153 | - $c->setProperty($property,$value); |
|
152 | + if (isset($c)) { |
|
153 | + $c->setProperty($property, $value); |
|
154 | 154 | } |
155 | - else{ |
|
155 | + else { |
|
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | } |
@@ -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 | } |
34 | 34 | \ No newline at end of file |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | * @property SimpleExtComponent $_bsComponent |
12 | 12 | * @property string identifier |
13 | 13 | */ |
14 | -trait BaseHtmlEventsTrait{ |
|
14 | +trait BaseHtmlEventsTrait { |
|
15 | 15 | |
16 | - protected $_events=array (); |
|
16 | + protected $_events=array(); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $event |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * @return \Ajax\common\html\BaseHtml |
24 | 24 | */ |
25 | 25 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
26 | - if ($stopPropagation === true) { |
|
27 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
26 | + if ($stopPropagation===true) { |
|
27 | + $jsCode="event.stopPropagation();".$jsCode; |
|
28 | 28 | } |
29 | - if ($preventDefault === true) { |
|
30 | - $jsCode="event.preventDefault();" . $jsCode; |
|
29 | + if ($preventDefault===true) { |
|
30 | + $jsCode="event.preventDefault();".$jsCode; |
|
31 | 31 | } |
32 | 32 | return $this->_addEvent($event, $jsCode); |
33 | 33 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if (\is_array($this->_events[$event])) { |
43 | 43 | $this->_events[$event][]=$jsCode; |
44 | 44 | } else { |
45 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
45 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
46 | 46 | } |
47 | 47 | } else { |
48 | 48 | $this->_events[$event]=$jsCode; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | return $this->onClick($jsCode); |
70 | 70 | } |
71 | 71 | |
72 | - public function onCreate($jsCode){ |
|
73 | - if(isset($this->_events["_create"])){ |
|
72 | + public function onCreate($jsCode) { |
|
73 | + if (isset($this->_events["_create"])) { |
|
74 | 74 | $this->_events["_create"][]=$jsCode; |
75 | - }else{ |
|
75 | + } else { |
|
76 | 76 | $this->_events["_create"]=[$jsCode]; |
77 | 77 | } |
78 | 78 | return $this; |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | public function addEventsOnRun(JsUtils $js=NULL) { |
82 | 82 | $this->_eventsOnCreate($js); |
83 | 83 | if (isset($this->_bsComponent)) { |
84 | - foreach ( $this->_events as $event => $jsCode ) { |
|
84 | + foreach ($this->_events as $event => $jsCode) { |
|
85 | 85 | $code=$jsCode; |
86 | 86 | if (\is_array($jsCode)) { |
87 | 87 | $code=""; |
88 | - foreach ( $jsCode as $jsC ) { |
|
88 | + foreach ($jsCode as $jsC) { |
|
89 | 89 | if ($jsC instanceof AjaxCall) { |
90 | - $code.="\n" . $jsC->compile($js); |
|
90 | + $code.="\n".$jsC->compile($js); |
|
91 | 91 | } else { |
92 | - $code.="\n" . $jsC; |
|
92 | + $code.="\n".$jsC; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | } |
98 | 98 | $this->_bsComponent->addEvent($event, $code); |
99 | 99 | } |
100 | - $this->_events=array (); |
|
100 | + $this->_events=array(); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
105 | - if(isset($this->_events["_create"])){ |
|
104 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
105 | + if (isset($this->_events["_create"])) { |
|
106 | 106 | $create=$this->_events["_create"]; |
107 | - if(\is_array($create)){ |
|
107 | + if (\is_array($create)) { |
|
108 | 108 | $create=\implode("", $create); |
109 | 109 | } |
110 | - if(isset($js) && $create!=="") |
|
111 | - $js->exec($create,true); |
|
110 | + if (isset($js) && $create!=="") |
|
111 | + $js->exec($create, true); |
|
112 | 112 | unset($this->_events["_create"]); |
113 | 113 | } |
114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return BaseHtml |
123 | 123 | */ |
124 | 124 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
125 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
125 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
126 | 126 | $params=array_merge($params, $parameters); |
127 | 127 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
128 | 128 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function jsDoJquery($jqueryCall, $param="") { |
158 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
158 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function executeOnRun($jsCode) { |