@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class Sidebar extends SimpleSemExtComponent { |
16 | 16 | |
17 | - public function __construct(JsUtils $js = NULL) { |
|
17 | + public function __construct(JsUtils $js=NULL) { |
|
18 | 18 | parent::__construct($js); |
19 | - $this->uiName = 'sidebar'; |
|
19 | + $this->uiName='sidebar'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function show() { |
@@ -46,32 +46,32 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | public function setContext($value) { |
49 | - $this->params['context'] = $value; |
|
49 | + $this->params['context']=$value; |
|
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function setExclusive($value = true) { |
|
54 | - $this->params['exclusive'] = true; |
|
53 | + public function setExclusive($value=true) { |
|
54 | + $this->params['exclusive']=true; |
|
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function setClosable($value = true) { |
|
59 | - $this->params['closable'] = $value; |
|
58 | + public function setClosable($value=true) { |
|
59 | + $this->params['closable']=$value; |
|
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setDimPage($value = true) { |
|
64 | - $this->params['dimPage'] = $value; |
|
63 | + public function setDimPage($value=true) { |
|
64 | + $this->params['dimPage']=$value; |
|
65 | 65 | return $this; |
66 | 66 | } |
67 | 67 | |
68 | - public function setScrollLock($value = false) { |
|
69 | - $this->params['scrollLock'] = $value; |
|
68 | + public function setScrollLock($value=false) { |
|
69 | + $this->params['scrollLock']=$value; |
|
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | - public function setReturnScroll($value = false) { |
|
74 | - $this->params['returnScroll'] = $value; |
|
73 | + public function setReturnScroll($value=false) { |
|
74 | + $this->params['returnScroll']=$value; |
|
75 | 75 | return $this; |
76 | 76 | } |
77 | 77 |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected $js; |
31 | 31 | |
32 | - public function __construct($autoCompile = true) { |
|
33 | - $this->autoCompile = $autoCompile; |
|
34 | - $this->components = array(); |
|
35 | - $this->htmlComponents = array(); |
|
32 | + public function __construct($autoCompile=true) { |
|
33 | + $this->autoCompile=$autoCompile; |
|
34 | + $this->components=array(); |
|
35 | + $this->htmlComponents=array(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function isAutoCompile() { |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | public function setAutoCompile($autoCompile) { |
43 | - $this->autoCompile = $autoCompile; |
|
43 | + $this->autoCompile=$autoCompile; |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 | |
47 | - public function compile($internal = false) { |
|
48 | - if ($internal === false && $this->autoCompile === true) |
|
47 | + public function compile($internal=false) { |
|
48 | + if ($internal===false && $this->autoCompile===true) |
|
49 | 49 | throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
50 | 50 | foreach ($this->components as $component) { |
51 | 51 | $component->compile(); |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setJs(JsUtils $js) { |
56 | - $this->js = $js; |
|
56 | + $this->js=$js; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function addComponent(SimpleComponent $component, $attachTo, $params) { |
60 | 60 | if ($this->autoCompile) { |
61 | - if ($attachTo != null) { |
|
62 | - if (! isset($this->components[$attachTo])) { |
|
63 | - $this->components[$attachTo] = $component; |
|
61 | + if ($attachTo!=null) { |
|
62 | + if (!isset($this->components[$attachTo])) { |
|
63 | + $this->components[$attachTo]=$component; |
|
64 | 64 | } else { |
65 | - $this->components[] = $component; |
|
65 | + $this->components[]=$component; |
|
66 | 66 | } |
67 | 67 | $component->attach($attachTo); |
68 | 68 | } else { |
69 | - $this->components[] = $component; |
|
69 | + $this->components[]=$component; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | if (isset($params)) |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | public function addHtmlComponent(BaseHtml $htmlComponent) { |
79 | - $this->htmlComponents[$htmlComponent->getIdentifier()] = $htmlComponent; |
|
79 | + $this->htmlComponents[$htmlComponent->getIdentifier()]=$htmlComponent; |
|
80 | 80 | return $htmlComponent; |
81 | 81 | } |
82 | 82 | |
83 | - public function compileHtml(JsUtils $js = NULL, &$view = NULL) { |
|
83 | + public function compileHtml(JsUtils $js=NULL, &$view=NULL) { |
|
84 | 84 | foreach ($this->htmlComponents as $htmlComponent) { |
85 | 85 | $htmlComponent->compile($js, $view); |
86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return array_filter($this->htmlComponents, $callback); |
91 | 91 | } |
92 | 92 | |
93 | - public function getHtmlComponent($identifier){ |
|
94 | - return $this->htmlComponents[$identifier]??''; |
|
93 | + public function getHtmlComponent($identifier) { |
|
94 | + return $this->htmlComponents[$identifier] ?? ''; |
|
95 | 95 | } |
96 | 96 | } |
@@ -16,15 +16,15 @@ discard block |
||
16 | 16 | * @version 1.001 |
17 | 17 | */ |
18 | 18 | class HtmlMessage extends HtmlSemDoubleElement { |
19 | - use AttachedTrait,HasTimeoutTrait; |
|
19 | + use AttachedTrait, HasTimeoutTrait; |
|
20 | 20 | |
21 | 21 | protected $icon; |
22 | 22 | |
23 | 23 | protected $close; |
24 | 24 | |
25 | - public function __construct($identifier, $content = "") { |
|
25 | + public function __construct($identifier, $content="") { |
|
26 | 26 | parent::__construct($identifier, "div"); |
27 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%close%%icon%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
27 | + $this->_template='<%tagName% id="%identifier%" %properties%>%close%%icon%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
28 | 28 | $this->setClass("ui message"); |
29 | 29 | $this->setContent($content); |
30 | 30 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @return \Ajax\semantic\html\collections\HtmlMessage |
37 | 37 | */ |
38 | 38 | public function addHeader($header) { |
39 | - $headerO = $header; |
|
39 | + $headerO=$header; |
|
40 | 40 | if (\is_string($header)) { |
41 | - $headerO = new HtmlSemDoubleElement("header-" . $this->identifier, "div"); |
|
41 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
42 | 42 | $headerO->setClass("header"); |
43 | 43 | $headerO->setContent($header); |
44 | 44 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | $this->addToProperty("class", "icon"); |
54 | 54 | $this->wrapContent("<div class='content'>", "</div>"); |
55 | 55 | if (\is_string($icon)) { |
56 | - $this->icon = new HtmlIcon("icon-" . $this->identifier, $icon); |
|
56 | + $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
57 | 57 | } else { |
58 | - $this->icon = $icon; |
|
58 | + $this->icon=$icon; |
|
59 | 59 | } |
60 | 60 | return $this; |
61 | 61 | } |
@@ -72,23 +72,23 @@ discard block |
||
72 | 72 | * default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false) |
73 | 73 | * @return $this |
74 | 74 | */ |
75 | - public function getOnClose($url, $responseElement = "", $parameters = array()) { |
|
75 | + public function getOnClose($url, $responseElement="", $parameters=array()) { |
|
76 | 76 | if (isset($this->close)) { |
77 | 77 | $this->close->getOnClick($url, $responseElement, $parameters); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - public function addLoader($loaderIcon = "notched circle") { |
|
81 | + public function addLoader($loaderIcon="notched circle") { |
|
82 | 82 | $this->setIcon($loaderIcon); |
83 | 83 | $this->icon->addToIcon("loading"); |
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | - public function setDismissable($dismiss = true) { |
|
88 | - if ($dismiss === true) |
|
89 | - $this->close = new HtmlIcon("close-" . $this->identifier, "close"); |
|
87 | + public function setDismissable($dismiss=true) { |
|
88 | + if ($dismiss===true) |
|
89 | + $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
90 | 90 | else |
91 | - $this->close = NULL; |
|
91 | + $this->close=NULL; |
|
92 | 92 | return $this; |
93 | 93 | } |
94 | 94 | |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
99 | 99 | */ |
100 | 100 | public function run(JsUtils $js) { |
101 | - if (! isset($this->_bsComponent)) { |
|
101 | + if (!isset($this->_bsComponent)) { |
|
102 | 102 | if (isset($this->close)) { |
103 | - $js->execOn("click", "#" . $this->identifier . " .close", "$(this).closest('.message').transition({$this->_closeTransition}).trigger('close-message');"); |
|
103 | + $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition}).trigger('close-message');"); |
|
104 | 104 | } |
105 | 105 | if (isset($this->_timeout)) { |
106 | 106 | $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}).trigger('close-message'); }, {$this->_timeout});", true); |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | return parent::run($js); |
110 | 110 | } |
111 | 111 | |
112 | - public function setState($visible = true) { |
|
113 | - $visible = ($visible === true) ? "visible" : "hidden"; |
|
112 | + public function setState($visible=true) { |
|
113 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
114 | 114 | return $this->addToPropertyCtrl("class", $visible, array( |
115 | 115 | "visible", |
116 | 116 | "hidden" |
117 | 117 | )); |
118 | 118 | } |
119 | 119 | |
120 | - public function setVariation($value = "floating") { |
|
120 | + public function setVariation($value="floating") { |
|
121 | 121 | return $this->addToPropertyCtrl("class", $value, array( |
122 | 122 | "floating", |
123 | 123 | "compact" |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | public function setMessage($message) { |
140 | 140 | if (\is_array($this->content)) { |
141 | - $this->content[\sizeof($this->content) - 1] = $message; |
|
141 | + $this->content[\sizeof($this->content)-1]=$message; |
|
142 | 142 | } else |
143 | 143 | $this->setContent($message); |
144 | 144 | } |
@@ -10,50 +10,50 @@ discard block |
||
10 | 10 | private $parameters; |
11 | 11 | |
12 | 12 | public function __construct($method, $parameters) { |
13 | - $this->method = $method; |
|
14 | - $this->parameters = $parameters; |
|
13 | + $this->method=$method; |
|
14 | + $this->parameters=$parameters; |
|
15 | 15 | } |
16 | 16 | |
17 | - public function compile(JsUtils $js = null) { |
|
18 | - if ($js === null) |
|
17 | + public function compile(JsUtils $js=null) { |
|
18 | + if ($js===null) |
|
19 | 19 | return; |
20 | - $params = "{}"; |
|
21 | - $stopPropagation = true; |
|
22 | - $preventDefault = true; |
|
23 | - $method = "get"; |
|
24 | - $this->parameters["immediatly"] = false; |
|
20 | + $params="{}"; |
|
21 | + $stopPropagation=true; |
|
22 | + $preventDefault=true; |
|
23 | + $method="get"; |
|
24 | + $this->parameters["immediatly"]=false; |
|
25 | 25 | extract($this->parameters); |
26 | - $result = $this->_eventPreparing($preventDefault, $stopPropagation); |
|
26 | + $result=$this->_eventPreparing($preventDefault, $stopPropagation); |
|
27 | 27 | switch ($this->method) { |
28 | 28 | case "get": |
29 | - $result .= $js->getDeferred($url, $responseElement, $this->parameters); |
|
29 | + $result.=$js->getDeferred($url, $responseElement, $this->parameters); |
|
30 | 30 | break; |
31 | 31 | case "post": |
32 | - $result .= $js->postDeferred($url, $params, $responseElement, $this->parameters); |
|
32 | + $result.=$js->postDeferred($url, $params, $responseElement, $this->parameters); |
|
33 | 33 | break; |
34 | 34 | case "postForm": |
35 | - $result .= $js->postFormDeferred($url, $form, $responseElement, $this->parameters); |
|
35 | + $result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters); |
|
36 | 36 | break; |
37 | 37 | case "json": |
38 | - $result .= $js->jsonDeferred($url, $method, $this->parameters); |
|
38 | + $result.=$js->jsonDeferred($url, $method, $this->parameters); |
|
39 | 39 | break; |
40 | 40 | case "jsonArray": |
41 | - $result .= $js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters); |
|
41 | + $result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters); |
|
42 | 42 | break; |
43 | 43 | default: |
44 | - $result .= $js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters); |
|
44 | + $result.=$js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters); |
|
45 | 45 | break; |
46 | 46 | } |
47 | 47 | return $result; |
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function _eventPreparing($preventDefault, $stopPropagation) { |
51 | - $result = ""; |
|
52 | - if ($preventDefault === true) { |
|
53 | - $result .= Javascript::$preventDefault; |
|
51 | + $result=""; |
|
52 | + if ($preventDefault===true) { |
|
53 | + $result.=Javascript::$preventDefault; |
|
54 | 54 | } |
55 | - if ($stopPropagation === true) { |
|
56 | - $result .= Javascript::$stopPropagation; |
|
55 | + if ($stopPropagation===true) { |
|
56 | + $result.=Javascript::$stopPropagation; |
|
57 | 57 | } |
58 | 58 | return $result; |
59 | 59 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | public function setMethod($method) { |
66 | - $this->method = $method; |
|
66 | + $this->method=$method; |
|
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public function setParameters($parameters) { |
75 | - $this->parameters = $parameters; |
|
75 | + $this->parameters=$parameters; |
|
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | } |
@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | use Ajax\service\JArray; |
14 | 14 | |
15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
16 | - use FieldTrait,LabeledIconTrait { |
|
16 | + use FieldTrait, LabeledIconTrait { |
|
17 | 17 | addIcon as addIconP; |
18 | 18 | } |
19 | 19 | |
20 | - protected $mClass = "menu"; |
|
20 | + protected $mClass="menu"; |
|
21 | 21 | |
22 | - protected $mTagName = "div"; |
|
22 | + protected $mTagName="div"; |
|
23 | 23 | |
24 | - protected $items = array(); |
|
24 | + protected $items=array(); |
|
25 | 25 | |
26 | - protected $_params = array( |
|
26 | + protected $_params=array( |
|
27 | 27 | "action" => "nothing", |
28 | 28 | "on" => "hover", |
29 | 29 | "showOnFocus" => true |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | |
38 | 38 | protected $_multiple; |
39 | 39 | |
40 | - public function __construct($identifier, $value = "", $items = array(), $associative = true) { |
|
40 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
41 | 41 | parent::__construct($identifier, "div"); |
42 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdown.php'; |
|
42 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
|
43 | 43 | $this->setProperty("class", "ui dropdown"); |
44 | - $this->_multiple = false; |
|
45 | - $content = []; |
|
46 | - $text = ''; |
|
44 | + $this->_multiple=false; |
|
45 | + $content=[]; |
|
46 | + $text=''; |
|
47 | 47 | if ($value instanceof HtmlSemDoubleElement) { |
48 | - $text = $value; |
|
49 | - } elseif ($value !== null) { |
|
50 | - $text = new HtmlSemDoubleElement("text-" . $this->identifier, "div"); |
|
48 | + $text=$value; |
|
49 | + } elseif ($value!==null) { |
|
50 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
51 | 51 | $text->setClass("text"); |
52 | 52 | $this->setValue($value); |
53 | 53 | } |
54 | - if ($text != null) { |
|
55 | - $content = [ |
|
54 | + if ($text!=null) { |
|
55 | + $content=[ |
|
56 | 56 | "text" => $text |
57 | 57 | ]; |
58 | 58 | } |
59 | - $content["arrow"] = new HtmlIcon($identifier . "-icon", "dropdown"); |
|
60 | - $this->content = $content; |
|
61 | - $this->tagName = "div"; |
|
62 | - $this->_associative = $associative; |
|
59 | + $content["arrow"]=new HtmlIcon($identifier."-icon", "dropdown"); |
|
60 | + $this->content=$content; |
|
61 | + $this->tagName="div"; |
|
62 | + $this->_associative=$associative; |
|
63 | 63 | $this->addItems($items); |
64 | 64 | } |
65 | 65 | |
@@ -71,16 +71,16 @@ discard block |
||
71 | 71 | return $this->input; |
72 | 72 | } |
73 | 73 | |
74 | - public function addItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
75 | - $itemO = $this->beforeAddItem($item, $value, $image, $description); |
|
76 | - $this->items[] = $itemO; |
|
74 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
75 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
76 | + $this->items[]=$itemO; |
|
77 | 77 | return $itemO; |
78 | 78 | } |
79 | 79 | |
80 | - public function addIcon($icon, $before = true, $labeled = false) { |
|
80 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
81 | 81 | $this->removeArrow(); |
82 | 82 | $this->addIconP($icon, $before, $labeled); |
83 | - $elm = $this->getElementById("text-" . $this->identifier, $this->content); |
|
83 | + $elm=$this->getElementById("text-".$this->identifier, $this->content); |
|
84 | 84 | if (isset($elm)) { |
85 | 85 | $elm->setWrapAfter(""); |
86 | 86 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | public function addIcons($icons) { |
91 | - $count = $this->count(); |
|
92 | - for ($i = 0; $i < \sizeof($icons) && $i < $count; $i ++) { |
|
91 | + $count=$this->count(); |
|
92 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
93 | 93 | $this->getItem($i)->addIcon($icons[$i]); |
94 | 94 | } |
95 | 95 | } |
@@ -101,32 +101,32 @@ discard block |
||
101 | 101 | * @param int $position |
102 | 102 | * @return HtmlDropdownItem |
103 | 103 | */ |
104 | - public function insertItem($item, $position = 0) { |
|
105 | - $itemO = $this->beforeAddItem($item); |
|
106 | - $start = array_slice($this->items, 0, $position); |
|
107 | - $end = array_slice($this->items, $position); |
|
108 | - $start[] = $item; |
|
109 | - $this->items = array_merge($start, $end); |
|
104 | + public function insertItem($item, $position=0) { |
|
105 | + $itemO=$this->beforeAddItem($item); |
|
106 | + $start=array_slice($this->items, 0, $position); |
|
107 | + $end=array_slice($this->items, $position); |
|
108 | + $start[]=$item; |
|
109 | + $this->items=array_merge($start, $end); |
|
110 | 110 | return $itemO; |
111 | 111 | } |
112 | 112 | |
113 | 113 | protected function removeArrow() { |
114 | - if (\sizeof($this->content) > 1) { |
|
114 | + if (\sizeof($this->content)>1) { |
|
115 | 115 | unset($this->content["arrow"]); |
116 | - $this->content = \array_values($this->content); |
|
116 | + $this->content=\array_values($this->content); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - protected function beforeAddItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
121 | - $itemO = $item; |
|
120 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
121 | + $itemO=$item; |
|
122 | 122 | if (\is_array($item)) { |
123 | - $description = JArray::getValue($item, "description", 3); |
|
124 | - $value = JArray::getValue($item, "value", 1); |
|
125 | - $image = JArray::getValue($item, "image", 2); |
|
126 | - $item = JArray::getValue($item, "item", 0); |
|
123 | + $description=JArray::getValue($item, "description", 3); |
|
124 | + $value=JArray::getValue($item, "value", 1); |
|
125 | + $image=JArray::getValue($item, "image", 2); |
|
126 | + $item=JArray::getValue($item, "item", 0); |
|
127 | 127 | } |
128 | - if (! $item instanceof HtmlDropdownItem) { |
|
129 | - $itemO = new HtmlDropdownItem("dd-item-" . $this->identifier . "-" . \sizeof($this->items), $item, $value, $image, $description); |
|
128 | + if (!$item instanceof HtmlDropdownItem) { |
|
129 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
130 | 130 | } elseif ($itemO instanceof HtmlDropdownItem) { |
131 | 131 | $this->addToProperty("class", "vertical"); |
132 | 132 | } |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | public function addInput($name) { |
145 | - if (! isset($name)) |
|
146 | - $name = "input-" . $this->identifier; |
|
145 | + if (!isset($name)) |
|
146 | + $name="input-".$this->identifier; |
|
147 | 147 | $this->setAction("activate"); |
148 | - $this->input = new HtmlInput($name, "hidden"); |
|
149 | - $this->input->setIdentifier("input-" . $this->identifier); |
|
148 | + $this->input=new HtmlInput($name, "hidden"); |
|
149 | + $this->input->setIdentifier("input-".$this->identifier); |
|
150 | 150 | return $this->input; |
151 | 151 | } |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string $icon |
158 | 158 | * @return HtmlDropdownItem |
159 | 159 | */ |
160 | - public function addSearchInputItem($placeHolder = NULL, $icon = NULL) { |
|
160 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
161 | 161 | return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
162 | 162 | } |
163 | 163 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string $icon |
178 | 178 | * @return HtmlDropdownItem |
179 | 179 | */ |
180 | - public function addHeaderItem($caption = NULL, $icon = NULL) { |
|
180 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
181 | 181 | return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
182 | 182 | } |
183 | 183 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | * @return $this |
223 | 223 | */ |
224 | 224 | public function setPropertyValues($property, $values) { |
225 | - $i = 0; |
|
226 | - if (\is_array($values) === false) { |
|
227 | - $values = \array_fill(0, $this->count(), $values); |
|
225 | + $i=0; |
|
226 | + if (\is_array($values)===false) { |
|
227 | + $values=\array_fill(0, $this->count(), $values); |
|
228 | 228 | } |
229 | 229 | foreach ($values as $value) { |
230 | - $c = $this->items[$i ++]; |
|
230 | + $c=$this->items[$i++]; |
|
231 | 231 | if (isset($c)) { |
232 | 232 | $c->setProperty($property, $value); |
233 | 233 | } else { |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | * @param boolean $dropdown |
262 | 262 | */ |
263 | 263 | public function asDropdown($dropdown) { |
264 | - if ($dropdown === false) { |
|
265 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdownMenu.php'; |
|
266 | - $dropdown = "menu"; |
|
264 | + if ($dropdown===false) { |
|
265 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
|
266 | + $dropdown="menu"; |
|
267 | 267 | } else { |
268 | - $dropdown = "dropdown"; |
|
269 | - $this->mClass = "menu"; |
|
268 | + $dropdown="dropdown"; |
|
269 | + $this->mClass="menu"; |
|
270 | 270 | } |
271 | 271 | return $this->addToPropertyCtrl("class", $dropdown, array( |
272 | 272 | "menu", |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | )); |
293 | 293 | } |
294 | 294 | |
295 | - public function asButton($floating = false) { |
|
295 | + public function asButton($floating=false) { |
|
296 | 296 | $this->removeArrow(); |
297 | 297 | if ($floating) |
298 | 298 | $this->addToProperty("class", "floating"); |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | return $this->addToProperty("class", "button"); |
301 | 301 | } |
302 | 302 | |
303 | - public function asSelect($name = NULL, $multiple = false, $selection = true) { |
|
304 | - $this->_multiple = $multiple; |
|
303 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
304 | + $this->_multiple=$multiple; |
|
305 | 305 | if (isset($name)) |
306 | 306 | $this->addInput($name); |
307 | 307 | if ($multiple) { |
308 | 308 | $this->addToProperty("class", "multiple"); |
309 | 309 | } |
310 | 310 | if ($selection) { |
311 | - if ($this->propertyContains("class", "button") === false) |
|
311 | + if ($this->propertyContains("class", "button")===false) |
|
312 | 312 | $this->addToPropertyCtrl("class", "selection", array( |
313 | 313 | "selection" |
314 | 314 | )); |
@@ -316,31 +316,31 @@ discard block |
||
316 | 316 | return $this; |
317 | 317 | } |
318 | 318 | |
319 | - public function asSearch($name = NULL, $multiple = false, $selection = true) { |
|
319 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
320 | 320 | $this->asSelect($name, $multiple, $selection); |
321 | 321 | return $this->addToProperty("class", "search"); |
322 | 322 | } |
323 | 323 | |
324 | - public function setSelect($name = NULL, $multiple = false) { |
|
325 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
326 | - if (! isset($name)) |
|
327 | - $name = "select-" . $this->identifier; |
|
328 | - $this->input = null; |
|
324 | + public function setSelect($name=NULL, $multiple=false) { |
|
325 | + $this->_template='<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
326 | + if (!isset($name)) |
|
327 | + $name="select-".$this->identifier; |
|
328 | + $this->input=null; |
|
329 | 329 | if ($multiple) { |
330 | 330 | $this->setProperty("multiple", true); |
331 | 331 | $this->addToProperty("class", "multiple"); |
332 | 332 | } |
333 | 333 | $this->setAction("activate"); |
334 | - $this->tagName = "select"; |
|
334 | + $this->tagName="select"; |
|
335 | 335 | $this->setProperty("name", $name); |
336 | - $this->content = null; |
|
336 | + $this->content=null; |
|
337 | 337 | foreach ($this->items as $item) { |
338 | 338 | $item->asOption(); |
339 | 339 | } |
340 | 340 | return $this; |
341 | 341 | } |
342 | 342 | |
343 | - public function asSubmenu($pointing = NULL) { |
|
343 | + public function asSubmenu($pointing=NULL) { |
|
344 | 344 | $this->setClass("ui dropdown link item"); |
345 | 345 | if (isset($pointing)) { |
346 | 346 | $this->setPointing($pointing); |
@@ -348,29 +348,29 @@ discard block |
||
348 | 348 | return $this; |
349 | 349 | } |
350 | 350 | |
351 | - public function setPointing($value = Direction::NONE) { |
|
352 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
351 | + public function setPointing($value=Direction::NONE) { |
|
352 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | public function setValue($value) { |
356 | - $this->value = $value; |
|
356 | + $this->value=$value; |
|
357 | 357 | return $this; |
358 | 358 | } |
359 | 359 | |
360 | 360 | public function setDefaultText($text) { |
361 | - $this->content["text"] = new HtmlSemDoubleElement("", "div", "default text", $text); |
|
361 | + $this->content["text"]=new HtmlSemDoubleElement("", "div", "default text", $text); |
|
362 | 362 | return $this; |
363 | 363 | } |
364 | 364 | |
365 | 365 | private function applyValue() { |
366 | - $value = $this->value; |
|
366 | + $value=$this->value; |
|
367 | 367 | if (isset($this->input) && isset($value)) { |
368 | 368 | $this->input->setProperty("value", $value); |
369 | 369 | } else { |
370 | 370 | $this->setProperty("value", $value); |
371 | 371 | } |
372 | - $textElement = $this->getElementById("text-" . $this->identifier, $this->content); |
|
373 | - if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple) |
|
372 | + $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
|
373 | + if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple) |
|
374 | 374 | $textElement->setContent($value); |
375 | 375 | return $this; |
376 | 376 | } |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @see BaseHtml::run() |
381 | 381 | */ |
382 | 382 | public function run(JsUtils $js) { |
383 | - if ($this->propertyContains("class", "simple") === false) { |
|
384 | - if (isset($this->_bsComponent) === false) { |
|
385 | - $this->_bsComponent = $js->semantic()->dropdown("#" . $this->identifier, $this->_params); |
|
383 | + if ($this->propertyContains("class", "simple")===false) { |
|
384 | + if (isset($this->_bsComponent)===false) { |
|
385 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
386 | 386 | $this->_bsComponent->setItemSelector(".item"); |
387 | 387 | } |
388 | 388 | $this->addEventsOnRun($js); |
@@ -397,31 +397,31 @@ discard block |
||
397 | 397 | } |
398 | 398 | |
399 | 399 | public function setAction($action) { |
400 | - $this->_params["action"] = $action; |
|
400 | + $this->_params["action"]=$action; |
|
401 | 401 | return $this; |
402 | 402 | } |
403 | 403 | |
404 | 404 | public function setOn($on) { |
405 | - $this->_params["on"] = $on; |
|
405 | + $this->_params["on"]=$on; |
|
406 | 406 | return $this; |
407 | 407 | } |
408 | 408 | |
409 | 409 | public function setShowOnFocus($value) { |
410 | - $this->_params["showOnFocus"] = $value; |
|
410 | + $this->_params["showOnFocus"]=$value; |
|
411 | 411 | return $this; |
412 | 412 | } |
413 | 413 | |
414 | 414 | public function setAllowAdditions($value) { |
415 | - $this->_params["allowAdditions"] = $value; |
|
415 | + $this->_params["allowAdditions"]=$value; |
|
416 | 416 | return $this; |
417 | 417 | } |
418 | 418 | |
419 | 419 | public function setFullTextSearch($value) { |
420 | - $this->_params["fullTextSearch"] = $value; |
|
420 | + $this->_params["fullTextSearch"]=$value; |
|
421 | 421 | return $this; |
422 | 422 | } |
423 | 423 | |
424 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
424 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
425 | 425 | $this->applyValue(); |
426 | 426 | return parent::compile($js, $view); |
427 | 427 | } |
@@ -430,19 +430,19 @@ discard block |
||
430 | 430 | return $this->input; |
431 | 431 | } |
432 | 432 | |
433 | - public function setIcon($icon = "dropdown") { |
|
434 | - $this->content["arrow"] = new HtmlIcon($this->identifier . "-icon", $icon); |
|
433 | + public function setIcon($icon="dropdown") { |
|
434 | + $this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon); |
|
435 | 435 | return $this; |
436 | 436 | } |
437 | 437 | |
438 | - public function jsAddItem($caption, $value = null) { |
|
439 | - $value = $value ?? $caption; |
|
440 | - $js = "var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}"; |
|
438 | + public function jsAddItem($caption, $value=null) { |
|
439 | + $value=$value ?? $caption; |
|
440 | + $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}"; |
|
441 | 441 | return $js; |
442 | 442 | } |
443 | 443 | |
444 | 444 | public function setClearable($value) { |
445 | - $this->_params["clearable"] = $value; |
|
445 | + $this->_params["clearable"]=$value; |
|
446 | 446 | return $this; |
447 | 447 | } |
448 | 448 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * Parameters addedValue, addedText, $addedChoice |
452 | 452 | */ |
453 | 453 | public function setOnAdd($jsCode) { |
454 | - $this->_params["onAdd"] = $jsCode; |
|
454 | + $this->_params["onAdd"]=$jsCode; |
|
455 | 455 | return $this; |
456 | 456 | } |
457 | 457 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * Parameters removedValue, removedText, $removedChoice |
461 | 461 | */ |
462 | 462 | public function setOnRemove($jsCode) { |
463 | - $this->_params["onRemove"] = $jsCode; |
|
463 | + $this->_params["onRemove"]=$jsCode; |
|
464 | 464 | return $this; |
465 | 465 | } |
466 | 466 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @property array $jquery_code_for_compile |
11 | 11 | */ |
12 | 12 | trait JsUtilsEventsTrait { |
13 | - protected $jquery_events = [ |
|
13 | + protected $jquery_events=[ |
|
14 | 14 | 'bind', |
15 | 15 | 'blur', |
16 | 16 | 'change', |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'unload' |
52 | 52 | ]; |
53 | 53 | |
54 | - abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn=false); |
|
54 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Outputs a javascript library blur event |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * code to execute |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - public function blur($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
66 | - return $this->_add_event ( $element, $js, 'blur', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
65 | + public function blur($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
66 | + return $this->_add_event($element, $js, 'blur', $preventDefault, $stopPropagation, true, $listenerOn); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function change($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
82 | - return $this->_add_event ( $element, $js, 'change', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
81 | + public function change($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
82 | + return $this->_add_event($element, $js, 'change', $preventDefault, $stopPropagation, true, $listenerOn); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -96,18 +96,18 @@ discard block |
||
96 | 96 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
100 | - if (! is_array ( $js )) { |
|
101 | - $js = array ( |
|
99 | + public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
100 | + if (!is_array($js)) { |
|
101 | + $js=array( |
|
102 | 102 | $js |
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($ret_false) { |
107 | - $js [] = "return false;"; |
|
107 | + $js []="return false;"; |
|
108 | 108 | } |
109 | 109 | |
110 | - return $this->_add_event ( $element, $js, 'click', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
110 | + return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation, true, $listenerOn); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
123 | 123 | * @return string |
124 | 124 | */ |
125 | - public function contextmenu($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
126 | - return $this->_add_event ( $element, $js, 'contextmenu', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
125 | + public function contextmenu($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
126 | + return $this->_add_event($element, $js, 'contextmenu', $preventDefault, $stopPropagation, true, $listenerOn); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function dblclick($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
142 | - return $this->_add_event ( $element, $js, 'dblclick', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
141 | + public function dblclick($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
142 | + return $this->_add_event($element, $js, 'dblclick', $preventDefault, $stopPropagation, true, $listenerOn); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * code to execute |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function error($element = 'this', $js = '') { |
|
155 | - return $this->_add_event ( $element, $js, 'error' ); |
|
154 | + public function error($element='this', $js='') { |
|
155 | + return $this->_add_event($element, $js, 'error'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function focus($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
171 | - return $this->_add_event ( $element, $js, 'focus', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
170 | + public function focus($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
171 | + return $this->_add_event($element, $js, 'focus', $preventDefault, $stopPropagation, true, $listenerOn); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * code for mouse out |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public function hover($element = 'this', $over = '', $out = '') { |
|
185 | - $event = "\n\t$(" . Javascript::prep_element ( $element ) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; |
|
186 | - $this->jquery_code_for_compile [] = $event; |
|
184 | + public function hover($element='this', $over='', $out='') { |
|
185 | + $event="\n\t$(".Javascript::prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; |
|
186 | + $this->jquery_code_for_compile []=$event; |
|
187 | 187 | return $event; |
188 | 188 | } |
189 | 189 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public function keydown($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
203 | - return $this->_add_event ( $element, $js, 'keydown', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
202 | + public function keydown($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
203 | + return $this->_add_event($element, $js, 'keydown', $preventDefault, $stopPropagation, true, $listenerOn); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function keypress($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
219 | - return $this->_add_event ( $element, $js, 'keypress', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
218 | + public function keypress($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
219 | + return $this->_add_event($element, $js, 'keypress', $preventDefault, $stopPropagation, true, $listenerOn); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
232 | 232 | * @return string |
233 | 233 | */ |
234 | - public function keyup($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
235 | - return $this->_add_event ( $element, $js, 'keyup', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
234 | + public function keyup($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
235 | + return $this->_add_event($element, $js, 'keyup', $preventDefault, $stopPropagation, true, $listenerOn); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
248 | 248 | * @return string |
249 | 249 | */ |
250 | - public function load($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
251 | - return $this->_add_event ( $element, $js, 'load', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
250 | + public function load($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
251 | + return $this->_add_event($element, $js, 'load', $preventDefault, $stopPropagation, true, $listenerOn); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
264 | 264 | * @return string |
265 | 265 | */ |
266 | - public function mousedown($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
267 | - return $this->_add_event ( $element, $js, 'mousedown', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
266 | + public function mousedown($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
267 | + return $this->_add_event($element, $js, 'mousedown', $preventDefault, $stopPropagation, true, $listenerOn); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - public function mouseout($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
283 | - return $this->_add_event ( $element, $js, 'mouseout', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
282 | + public function mouseout($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
283 | + return $this->_add_event($element, $js, 'mouseout', $preventDefault, $stopPropagation, true, $listenerOn); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
296 | 296 | * @return string |
297 | 297 | */ |
298 | - public function mouseleave($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
299 | - return $this->_add_event ( $element, $js, 'mouseleave', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
298 | + public function mouseleave($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
299 | + return $this->_add_event($element, $js, 'mouseleave', $preventDefault, $stopPropagation, true, $listenerOn); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
312 | 312 | * @return string |
313 | 313 | */ |
314 | - public function mouseenter($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
315 | - return $this->_add_event ( $element, $js, 'mouseenter', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
314 | + public function mouseenter($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
315 | + return $this->_add_event($element, $js, 'mouseenter', $preventDefault, $stopPropagation, true, $listenerOn); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
328 | 328 | * @return string |
329 | 329 | */ |
330 | - public function mouseover($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
331 | - return $this->_add_event ( $element, $js, 'mouseover', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
330 | + public function mouseover($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
331 | + return $this->_add_event($element, $js, 'mouseover', $preventDefault, $stopPropagation, true, $listenerOn); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - public function mouseup($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
347 | - return $this->_add_event ( $element, $js, 'mouseup', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
346 | + public function mouseup($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
347 | + return $this->_add_event($element, $js, 'mouseup', $preventDefault, $stopPropagation, true, $listenerOn); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
360 | 360 | * @return string |
361 | 361 | */ |
362 | - public function unload($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
363 | - return $this->_add_event ( $element, $js, 'unload', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
362 | + public function unload($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
363 | + return $this->_add_event($element, $js, 'unload', $preventDefault, $stopPropagation, true, $listenerOn); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // -------------------------------------------------------------------- |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
377 | 377 | * @return string |
378 | 378 | */ |
379 | - public function resize($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
380 | - return $this->_add_event ( $element, $js, 'resize', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
379 | + public function resize($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
380 | + return $this->_add_event($element, $js, 'resize', $preventDefault, $stopPropagation, true, $listenerOn); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // -------------------------------------------------------------------- |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public function scroll($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
397 | - return $this->_add_event ( $element, $js, 'scroll', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
396 | + public function scroll($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
397 | + return $this->_add_event($element, $js, 'scroll', $preventDefault, $stopPropagation, true, $listenerOn); |
|
398 | 398 | } |
399 | 399 | } |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class HtmlTab extends HtmlSemCollection { |
20 | 20 | |
21 | - protected $params = []; |
|
21 | + protected $params=[]; |
|
22 | 22 | |
23 | - protected $_activated = false; |
|
23 | + protected $_activated=false; |
|
24 | 24 | |
25 | - public function __construct($identifier, $tabs = array()) { |
|
25 | + public function __construct($identifier, $tabs=array()) { |
|
26 | 26 | parent::__construct($identifier, "div", ""); |
27 | - $menu = new HtmlMenu("menu" . $this->identifier); |
|
27 | + $menu=new HtmlMenu("menu".$this->identifier); |
|
28 | 28 | $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
29 | - $this->content["menu"] = $menu; |
|
29 | + $this->content["menu"]=$menu; |
|
30 | 30 | $this->addItems($tabs); |
31 | 31 | } |
32 | 32 | |
33 | - public function getMenu(){ |
|
33 | + public function getMenu() { |
|
34 | 34 | return $this->content['menu']; |
35 | 35 | } |
36 | 36 | |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | * @return HtmlSegment |
42 | 42 | */ |
43 | 43 | protected function createItem($value) { |
44 | - $count = $this->count(); |
|
45 | - $title = $value; |
|
46 | - $content = NULL; |
|
44 | + $count=$this->count(); |
|
45 | + $title=$value; |
|
46 | + $content=NULL; |
|
47 | 47 | if (\is_array($value)) { |
48 | - $title = @$value[0]; |
|
49 | - $content = @$value[1]; |
|
48 | + $title=@$value[0]; |
|
49 | + $content=@$value[1]; |
|
50 | 50 | } |
51 | - $menuItem = $this->content["menu"]->addItem($title); |
|
51 | + $menuItem=$this->content["menu"]->addItem($title); |
|
52 | 52 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
53 | 53 | $menuItem->removeProperty("href"); |
54 | - $result = $this->createSegment($count, $content, $menuItem->getIdentifier()); |
|
55 | - $result->menuTab = $menuItem; |
|
54 | + $result=$this->createSegment($count, $content, $menuItem->getIdentifier()); |
|
55 | + $result->menuTab=$menuItem; |
|
56 | 56 | return $result; |
57 | 57 | } |
58 | 58 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return \Ajax\semantic\html\elements\HtmlSegment |
65 | 65 | */ |
66 | 66 | private function createSegment($count, $content, $datatab) { |
67 | - $segment = new HtmlSegment("item-" . $this->identifier . "-" . $count, $content); |
|
67 | + $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
|
68 | 68 | $segment->setAttachment(NULL, Side::BOTTOM) |
69 | 69 | ->addToProperty("class", "tab") |
70 | 70 | ->addToProperty("data-tab", $datatab); |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @return \Ajax\semantic\html\modules\HtmlTab |
82 | 82 | */ |
83 | 83 | public function setTabContent($index, $content) { |
84 | - $menu = $this->content["menu"]; |
|
85 | - if ($index < $menu->count()) { |
|
86 | - if (isset($this->content[$index]) === false) { |
|
87 | - $this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index) |
|
84 | + $menu=$this->content["menu"]; |
|
85 | + if ($index<$menu->count()) { |
|
86 | + if (isset($this->content[$index])===false) { |
|
87 | + $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index) |
|
88 | 88 | ->getIdentifier()); |
89 | 89 | } else |
90 | 90 | $this->content[$index]->setContent($content); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @return \Ajax\semantic\html\modules\HtmlTab |
100 | 100 | */ |
101 | 101 | public function setTabsContent($contents) { |
102 | - $size = \sizeof($contents); |
|
103 | - for ($i = 0; $i < $size; $i ++) { |
|
102 | + $size=\sizeof($contents); |
|
103 | + for ($i=0; $i<$size; $i++) { |
|
104 | 104 | $this->setTabContent($i, $contents[$i]); |
105 | 105 | } |
106 | 106 | return $this; |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | * @return \Ajax\semantic\html\modules\HtmlTab |
114 | 114 | */ |
115 | 115 | public function activate($index) { |
116 | - $item = $this->content["menu"]->getItem($index); |
|
117 | - if ($item != null) { |
|
116 | + $item=$this->content["menu"]->getItem($index); |
|
117 | + if ($item!=null) { |
|
118 | 118 | $item->setActive(true); |
119 | 119 | $this->content[$index]->setActive(true); |
120 | - $this->_activated = true; |
|
120 | + $this->_activated=true; |
|
121 | 121 | } |
122 | 122 | return $this; |
123 | 123 | } |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * @param array $params |
152 | 152 | * @return \Ajax\semantic\html\elements\HtmlSegment |
153 | 153 | */ |
154 | - public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params = array()) { |
|
154 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
155 | 155 | if (\array_key_exists($index, $this->content)) { |
156 | - $this->content[$index] = $js->forward($initialController, $controller, $action, $params); |
|
156 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
157 | 157 | return $this->content[$index]; |
158 | 158 | } |
159 | 159 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | * The parameters to pass to the view |
175 | 175 | * @return \Ajax\semantic\html\elements\HtmlSegment |
176 | 176 | */ |
177 | - public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params = array()) { |
|
177 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
178 | 178 | if (\array_key_exists($index, $this->content)) { |
179 | - $this->content[$index] = $js->renderContent($initialController, $viewName, $params); |
|
179 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
180 | 180 | return $this->content[$index]; |
181 | 181 | } |
182 | 182 | return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | * @param array $params |
197 | 197 | * @return \Ajax\semantic\html\elements\HtmlSegment |
198 | 198 | */ |
199 | - public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params = array()) { |
|
199 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
200 | 200 | \ob_start(); |
201 | 201 | $js->forward($initialController, $controller, $action, $params); |
202 | - $content = \ob_get_clean(); |
|
202 | + $content=\ob_get_clean(); |
|
203 | 203 | return $this->addTab($title, $content); |
204 | 204 | } |
205 | 205 | |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | * The parameters to pass to the view |
216 | 216 | * @return \Ajax\semantic\html\elements\HtmlSegment |
217 | 217 | */ |
218 | - public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params = array()) { |
|
218 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
219 | 219 | return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
220 | 220 | } |
221 | 221 | |
222 | - public function setPointing($value = Direction::NONE) { |
|
222 | + public function setPointing($value=Direction::NONE) { |
|
223 | 223 | return $this->content["menu"]->setPointing($value); |
224 | 224 | } |
225 | 225 | |
@@ -254,25 +254,25 @@ discard block |
||
254 | 254 | * @return \Ajax\semantic\html\modules\HtmlTab |
255 | 255 | */ |
256 | 256 | public function setMenu($menu) { |
257 | - $contentSize = \sizeof($this->content); |
|
258 | - for ($i = 0; $i < $contentSize; $i ++) { |
|
259 | - if ($menu->getItem($i) !== NULL) { |
|
257 | + $contentSize=\sizeof($this->content); |
|
258 | + for ($i=0; $i<$contentSize; $i++) { |
|
259 | + if ($menu->getItem($i)!==NULL) { |
|
260 | 260 | if (isset($this->content[$i])) { |
261 | 261 | $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
265 | - $menuSize = $menu->count(); |
|
266 | - for ($i = 0; $i < $menuSize; $i ++) { |
|
265 | + $menuSize=$menu->count(); |
|
266 | + for ($i=0; $i<$menuSize; $i++) { |
|
267 | 267 | $menu->getItem($i)->removeProperty("href"); |
268 | - if (isset($this->content[$i]) === false) { |
|
269 | - $this->content[$i] = $this->createSegment($i, "New content", $menu->getItem($i) |
|
268 | + if (isset($this->content[$i])===false) { |
|
269 | + $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i) |
|
270 | 270 | ->getIdentifier()); |
271 | 271 | } |
272 | 272 | $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
273 | 273 | } |
274 | 274 | |
275 | - $this->content["menu"] = $menu; |
|
275 | + $this->content["menu"]=$menu; |
|
276 | 276 | return $this; |
277 | 277 | } |
278 | 278 | |
@@ -281,19 +281,19 @@ discard block |
||
281 | 281 | * @see BaseHtml::run() |
282 | 282 | */ |
283 | 283 | public function run(JsUtils $js) { |
284 | - if (isset($this->_bsComponent) === false) |
|
285 | - $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
284 | + if (isset($this->_bsComponent)===false) |
|
285 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
286 | 286 | $this->addEventsOnRun($js); |
287 | 287 | return $this->_bsComponent; |
288 | 288 | } |
289 | 289 | |
290 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
291 | - if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) |
|
290 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
291 | + if (!$this->_activated && $this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
292 | 292 | $this->activate(0); |
293 | 293 | return parent::compile($js, $view); |
294 | 294 | } |
295 | 295 | |
296 | - public function setInverted($recursive=true){ |
|
296 | + public function setInverted($recursive=true) { |
|
297 | 297 | parent::setInverted($recursive); |
298 | 298 | $this->content['menu']->addClass('inverted'); |
299 | 299 | } |
@@ -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) { |