@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base\constants; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Social extends BaseEnum { |
5 | - const FACEBOOK="facebook", TWITTER="twitter",GOOGLEPLUS="google plus",VK="vk",LINKEDIN="linkedin",INSTAGRAM="instagram",YOUTUBE="youtube"; |
|
5 | + const FACEBOOK="facebook", TWITTER="twitter", GOOGLEPLUS="google plus", VK="vk", LINKEDIN="linkedin", INSTAGRAM="instagram", YOUTUBE="youtube"; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
10 | 10 | * @author jc |
11 | 11 | * @version 1.001 |
12 | 12 | */ |
13 | -abstract class HtmlSemCollection extends HtmlCollection{ |
|
13 | +abstract class HtmlSemCollection extends HtmlCollection { |
|
14 | 14 | use BaseTrait; |
15 | - public function __construct( $identifier, $tagName="div",$baseClass=""){ |
|
16 | - parent::__construct( $identifier, $tagName); |
|
15 | + public function __construct($identifier, $tagName="div", $baseClass="") { |
|
16 | + parent::__construct($identifier, $tagName); |
|
17 | 17 | $this->_baseClass=$baseClass; |
18 | 18 | $this->setClass($baseClass); |
19 | 19 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
13 | 13 | private $_params; |
14 | 14 | private $_container; |
15 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
15 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
16 | 16 | parent::__construct($identifier, "div"); |
17 | 17 | $this->_container=$container; |
18 | 18 | $this->setClass("ui popup"); |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | $this->_params=array("on"=>"hover"); |
21 | 21 | } |
22 | 22 | |
23 | - public function addList($items=array(),$header=NULL){ |
|
24 | - if(!$this->content instanceof HtmlGrid){ |
|
25 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
23 | + public function addList($items=array(), $header=NULL) { |
|
24 | + if (!$this->content instanceof HtmlGrid) { |
|
25 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
26 | 26 | } |
27 | 27 | $grid=$this->content; |
28 | 28 | |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | $colCount++; |
31 | 31 | $grid->setColsCount($colCount); |
32 | 32 | |
33 | - $list=new HtmlList("",$items); |
|
33 | + $list=new HtmlList("", $items); |
|
34 | 34 | $list->asLink(); |
35 | - if(isset($header)){ |
|
36 | - $list->addHeader(4,$header); |
|
35 | + if (isset($header)) { |
|
36 | + $list->addHeader(4, $header); |
|
37 | 37 | } |
38 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
38 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
39 | 39 | $grid->setDivided()->setRelaxed(true); |
40 | 40 | return $list; |
41 | 41 | } |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * A popup can have no maximum width and continue to flow to fit its content |
45 | 45 | */ |
46 | - public function setFlowing(){ |
|
46 | + public function setFlowing() { |
|
47 | 47 | return $this->addToProperty("class", "flowing"); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * A popup can provide more basic formatting |
52 | 52 | */ |
53 | - public function setBasic(){ |
|
53 | + public function setBasic() { |
|
54 | 54 | return $this->addToProperty("class", "basic"); |
55 | 55 | } |
56 | 56 | |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | * {@inheritDoc} |
59 | 59 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
60 | 60 | */ |
61 | - public function run(JsUtils $js){ |
|
61 | + public function run(JsUtils $js) { |
|
62 | 62 | $this->_params["popup"]="#".$this->identifier; |
63 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
63 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
64 | 64 | } |
65 | 65 | |
66 | - public function setOn($event="click"){ |
|
66 | + public function setOn($event="click") { |
|
67 | 67 | $this->_params["on"]=$event; |
68 | 68 | return $this; |
69 | 69 | } |
70 | 70 | |
71 | - public function setInline($value=true){ |
|
71 | + public function setInline($value=true) { |
|
72 | 72 | $this->_params["inline"]=$value; |
73 | 73 | return $this; |
74 | 74 | } |
75 | 75 | |
76 | - public function setPosition($position){ |
|
76 | + public function setPosition($position) { |
|
77 | 77 | $this->_params["position"]=$position; |
78 | 78 | return $this; |
79 | 79 | } |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | use Ajax\semantic\html\base\constants\State; |
10 | 10 | |
11 | 11 | class HtmlProgress extends HtmlSemDoubleElement { |
12 | - private $_params=array (); |
|
12 | + private $_params=array(); |
|
13 | 13 | |
14 | 14 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
15 | 15 | parent::__construct($identifier, "div", "ui progress"); |
16 | - if (isset($value) === true) |
|
16 | + if (isset($value)===true) |
|
17 | 17 | $this->setProperty("data-percent", $value); |
18 | 18 | $this->createBar(); |
19 | - if (isset($label) === true) |
|
19 | + if (isset($label)===true) |
|
20 | 20 | $this->setLabel($label); |
21 | - $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
|
21 | + $this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED]; |
|
22 | 22 | $this->addToProperty("class", $attributes); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function setLabel($label) { |
26 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
26 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 | |
30 | 30 | private function createBar() { |
31 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
31 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
32 | 32 | $this->content["bar"]=$bar; |
33 | 33 | return $this; |
34 | 34 | } |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
69 | 69 | */ |
70 | 70 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
71 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
71 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
72 | 72 | return parent::compile($js, $view); |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function jsSetValue($value) { |
76 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
76 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function jsIncValue() { |
80 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
80 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function jsDecValue() { |
84 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
84 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return HtmlProgress |
96 | 96 | */ |
97 | 97 | public function setTextValues($active=false, $error=false, $success=false, $warning=false, $percent="{percent}%", $ratio="{value} of {total}") { |
98 | - if (\is_array($active) == true) { |
|
98 | + if (\is_array($active)==true) { |
|
99 | 99 | $array=$active; |
100 | 100 | $active=JArray::getDefaultValue($array, "active", false); |
101 | 101 | $success=JArray::getDefaultValue($array, "success", $success); |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
104 | 104 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
105 | 105 | } |
106 | - $this->_params["text"]="%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; |
|
106 | + $this->_params["text"]="%{active : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio : ".\var_export($ratio, true)."}%"; |
|
107 | 107 | return $this; |
108 | 108 | } |
109 | 109 | |
110 | 110 | public function onChange($jsCode) { |
111 | - return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%"; |
|
111 | + return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%"; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /* |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @see BaseHtml::run() |
117 | 117 | */ |
118 | 118 | public function run(JsUtils $js) { |
119 | - if (isset($this->_bsComponent) === false) |
|
120 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
119 | + if (isset($this->_bsComponent)===false) |
|
120 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
121 | 121 | $this->addEventsOnRun($js); |
122 | 122 | return $this->_bsComponent; |
123 | 123 | } |
@@ -15,120 +15,120 @@ discard block |
||
15 | 15 | protected $_paramParts=array(); |
16 | 16 | |
17 | 17 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
18 | - parent::__construct($identifier, "div","ui modal"); |
|
19 | - if(isset($header)){ |
|
18 | + parent::__construct($identifier, "div", "ui modal"); |
|
19 | + if (isset($header)) { |
|
20 | 20 | $this->setHeader($header); |
21 | 21 | } |
22 | - if(isset($content)){ |
|
22 | + if (isset($content)) { |
|
23 | 23 | $this->setContent($content); |
24 | 24 | } |
25 | - if(isset($actions)){ |
|
25 | + if (isset($actions)) { |
|
26 | 26 | $this->setActions($actions); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setHeader($value) { |
31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContent($value) { |
36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActions($actions) { |
41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
42 | - if(\is_array($actions)){ |
|
43 | - foreach ($actions as $action){ |
|
41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
42 | + if (\is_array($actions)) { |
|
43 | + foreach ($actions as $action) { |
|
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | 46 | } |
47 | - else{ |
|
47 | + else { |
|
48 | 48 | $this->addAction($actions); |
49 | 49 | } |
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function addAction($action){ |
|
54 | - if(!$action instanceof BaseHtml){ |
|
53 | + public function addAction($action) { |
|
54 | + if (!$action instanceof BaseHtml) { |
|
55 | 55 | $class=""; |
56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
57 | 57 | $class="approve"; |
58 | 58 | } |
59 | - if(\array_search($action, ["Cancel","No"])!==false){ |
|
59 | + if (\array_search($action, ["Cancel", "No"])!==false) { |
|
60 | 60 | $class="cancel"; |
61 | 61 | } |
62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
63 | - if($class!=="") |
|
62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
63 | + if ($class!=="") |
|
64 | 64 | $action->addToProperty("class", $class); |
65 | 65 | } |
66 | 66 | return $this->addElementInPart($action, "actions"); |
67 | 67 | } |
68 | 68 | |
69 | - public function addContent($content,$before=false){ |
|
70 | - $this->content["content"]->addContent($content,$before); |
|
69 | + public function addContent($content, $before=false) { |
|
70 | + $this->content["content"]->addContent($content, $before); |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function addImageContent($image,$description=NULL){ |
|
74 | + public function addImageContent($image, $description=NULL) { |
|
75 | 75 | $content=$this->content["content"]; |
76 | - if(isset($description)){ |
|
77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
78 | - $content->addContent($description,true); |
|
76 | + if (isset($description)) { |
|
77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
78 | + $content->addContent($description, true); |
|
79 | 79 | } |
80 | - if($image!==""){ |
|
81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
82 | - $content->addContent($img,true); |
|
83 | - $content->addToProperty("class","image"); |
|
80 | + if ($image!=="") { |
|
81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
82 | + $content->addContent($img, true); |
|
83 | + $content->addToProperty("class", "image"); |
|
84 | 84 | } |
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - public function addIconContent($icon,$description=NULL){ |
|
88 | + public function addIconContent($icon, $description=NULL) { |
|
89 | 89 | $content=$this->content["content"]; |
90 | - if(isset($description)){ |
|
91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
92 | - $content->addContent($description,true); |
|
90 | + if (isset($description)) { |
|
91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
92 | + $content->addContent($description, true); |
|
93 | 93 | } |
94 | - if($icon!==""){ |
|
95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
96 | - $content->addContent($img,true); |
|
97 | - $content->addToProperty("class","image"); |
|
94 | + if ($icon!=="") { |
|
95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
96 | + $content->addContent($img, true); |
|
97 | + $content->addToProperty("class", "image"); |
|
98 | 98 | } |
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - private function addContentInPart($content,$uiClass,$part) { |
|
103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
102 | + private function addContentInPart($content, $uiClass, $part) { |
|
103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
104 | 104 | } |
105 | 105 | |
106 | - private function addElementInPart($element,$part) { |
|
106 | + private function addElementInPart($element, $part) { |
|
107 | 107 | $this->content[$part]->addContent($element); |
108 | 108 | return $element; |
109 | 109 | } |
110 | 110 | |
111 | - public function showDimmer($value){ |
|
112 | - $value=$value?"show":"hide"; |
|
111 | + public function showDimmer($value) { |
|
112 | + $value=$value ? "show" : "hide"; |
|
113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function setInverted(){ |
|
117 | + public function setInverted() { |
|
118 | 118 | $this->_params["inverted"]=true; |
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | - public function setBasic(){ |
|
122 | + public function setBasic() { |
|
123 | 123 | return $this->addToProperty("class", "basic"); |
124 | 124 | } |
125 | 125 | |
126 | - public function setActive(){ |
|
126 | + public function setActive() { |
|
127 | 127 | return $this->addToProperty("class", "active"); |
128 | 128 | } |
129 | 129 | |
130 | - public function setTransition($value){ |
|
131 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
130 | + public function setTransition($value) { |
|
131 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $viewName |
139 | 139 | * @param $params The parameters to pass to the view |
140 | 140 | */ |
141 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
142 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
141 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
142 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @param string $controllerName the controller name |
151 | 151 | * @param string $actionName the action name |
152 | 152 | */ |
153 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
154 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
153 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
154 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
162 | 162 | */ |
163 | 163 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
164 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
164 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
165 | 165 | return parent::compile($js, $view); |
166 | 166 | } |
167 | 167 | /* |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @see BaseHtml::run() |
170 | 170 | */ |
171 | 171 | public function run(JsUtils $js) { |
172 | - if(isset($this->_bsComponent)===false) |
|
173 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
172 | + if (isset($this->_bsComponent)===false) |
|
173 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
174 | 174 | $this->addEventsOnRun($js); |
175 | 175 | return $this->_bsComponent; |
176 | 176 | } |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | } |
18 | 18 | protected $mClass="menu"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
20 | + protected $items=array(); |
|
21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
22 | 22 | protected $input; |
23 | 23 | |
24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
25 | 25 | parent::__construct($identifier, "div"); |
26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
27 | 27 | $this->setProperty("class", "ui dropdown"); |
28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
29 | 29 | $content->setClass("text"); |
30 | 30 | $content->setContent($value); |
31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
32 | 32 | $this->content=array($content); |
33 | 33 | $this->tagName="div"; |
34 | 34 | $this->addItems($items); |
35 | 35 | } |
36 | 36 | |
37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
39 | 39 | $this->items[]=$itemO; |
40 | 40 | return $itemO; |
41 | 41 | } |
42 | 42 | |
43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
44 | - $this->addIconP($icon,$before,$labeled); |
|
43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
44 | + $this->addIconP($icon, $before, $labeled); |
|
45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
46 | 46 | } |
47 | 47 | /** |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | * @param number $position |
51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
52 | 52 | */ |
53 | - public function insertItem($item,$position=0){ |
|
53 | + public function insertItem($item, $position=0) { |
|
54 | 54 | $itemO=$this->beforeAddItem($item); |
55 | - $start = array_slice($this->items, 0, $position); |
|
56 | - $end = array_slice($this->items, $position); |
|
57 | - $start[] = $item; |
|
55 | + $start=array_slice($this->items, 0, $position); |
|
56 | + $end=array_slice($this->items, $position); |
|
57 | + $start[]=$item; |
|
58 | 58 | $this->items=array_merge($start, $end); |
59 | 59 | return $itemO; |
60 | 60 | } |
61 | 61 | |
62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
63 | 63 | $itemO=$item; |
64 | - if(\is_array($item)){ |
|
64 | + if (\is_array($item)) { |
|
65 | 65 | $value=JArray::getValue($item, "value", 1); |
66 | 66 | $image=JArray::getValue($item, "image", 2); |
67 | 67 | $item=JArray::getValue($item, "item", 0); |
68 | 68 | } |
69 | - if(!$item instanceof HtmlDropdownItem){ |
|
70 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
69 | + if (!$item instanceof HtmlDropdownItem) { |
|
70 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
71 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
72 | 72 | $this->addToProperty("class", "vertical"); |
73 | 73 | } |
74 | 74 | return $itemO; |
@@ -81,76 +81,76 @@ discard block |
||
81 | 81 | $this->addItem($function($object)); |
82 | 82 | } |
83 | 83 | |
84 | - public function addInput($name){ |
|
85 | - if(!isset($name)) |
|
84 | + public function addInput($name) { |
|
85 | + if (!isset($name)) |
|
86 | 86 | $name="input-".$this->identifier; |
87 | 87 | $this->setAction("activate"); |
88 | - $this->input=new HtmlInput($name,"hidden"); |
|
88 | + $this->input=new HtmlInput($name, "hidden"); |
|
89 | 89 | } |
90 | 90 | |
91 | - public function addItems($items){ |
|
92 | - if(JArray::isAssociative($items)){ |
|
93 | - foreach ($items as $k=>$v){ |
|
91 | + public function addItems($items) { |
|
92 | + if (JArray::isAssociative($items)) { |
|
93 | + foreach ($items as $k=>$v) { |
|
94 | 94 | $this->addItem($v)->setData($k); |
95 | 95 | } |
96 | - }else{ |
|
97 | - foreach ($items as $item){ |
|
96 | + } else { |
|
97 | + foreach ($items as $item) { |
|
98 | 98 | $this->addItem($item); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - public function count(){ |
|
103 | + public function count() { |
|
104 | 104 | return \sizeof($this->items); |
105 | 105 | } |
106 | 106 | /** |
107 | 107 | * @param boolean $dropdown |
108 | 108 | */ |
109 | - public function asDropdown($dropdown){ |
|
110 | - if($dropdown===false){ |
|
109 | + public function asDropdown($dropdown) { |
|
110 | + if ($dropdown===false) { |
|
111 | 111 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
112 | 112 | $dropdown="menu"; |
113 | - }else{ |
|
113 | + } else { |
|
114 | 114 | $dropdown="dropdown"; |
115 | 115 | $this->mClass="menu"; |
116 | 116 | } |
117 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
117 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
118 | 118 | } |
119 | 119 | |
120 | - public function setVertical(){ |
|
121 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
120 | + public function setVertical() { |
|
121 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
122 | 122 | } |
123 | 123 | |
124 | - public function setSimple(){ |
|
125 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
124 | + public function setSimple() { |
|
125 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
126 | 126 | } |
127 | 127 | |
128 | - public function asButton($floating=false){ |
|
129 | - if($floating) |
|
128 | + public function asButton($floating=false) { |
|
129 | + if ($floating) |
|
130 | 130 | $this->addToProperty("class", "floating"); |
131 | 131 | return $this->addToProperty("class", "button"); |
132 | 132 | } |
133 | 133 | |
134 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
135 | - if(isset($name)) |
|
134 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
135 | + if (isset($name)) |
|
136 | 136 | $this->addInput($name); |
137 | - if($multiple) |
|
137 | + if ($multiple) |
|
138 | 138 | $this->addToProperty("class", "multiple"); |
139 | 139 | if ($selection) |
140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
140 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
141 | 141 | return $this; |
142 | 142 | } |
143 | 143 | |
144 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
145 | - $this->asSelect($name,$multiple,$selection); |
|
144 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
145 | + $this->asSelect($name, $multiple, $selection); |
|
146 | 146 | return $this->addToProperty("class", "search"); |
147 | 147 | } |
148 | 148 | |
149 | - public function setSelect($name=NULL,$multiple=false){ |
|
150 | - if(!isset($name)) |
|
149 | + public function setSelect($name=NULL, $multiple=false) { |
|
150 | + if (!isset($name)) |
|
151 | 151 | $name="select-".$this->identifier; |
152 | 152 | $this->input=null; |
153 | - if($multiple){ |
|
153 | + if ($multiple) { |
|
154 | 154 | $this->setProperty("multiple", true); |
155 | 155 | $this->addToProperty("class", "multiple"); |
156 | 156 | } |
@@ -158,32 +158,32 @@ discard block |
||
158 | 158 | $this->tagName="select"; |
159 | 159 | $this->setProperty("name", $name); |
160 | 160 | $this->content=null; |
161 | - foreach ($this->items as $item){ |
|
161 | + foreach ($this->items as $item) { |
|
162 | 162 | $item->asOption(); |
163 | 163 | } |
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | - public function asSubmenu($pointing=NULL){ |
|
167 | + public function asSubmenu($pointing=NULL) { |
|
168 | 168 | $this->setClass("ui dropdown link item"); |
169 | - if(isset($pointing)){ |
|
169 | + if (isset($pointing)) { |
|
170 | 170 | $this->setPointing($pointing); |
171 | 171 | } |
172 | 172 | return $this; |
173 | 173 | } |
174 | 174 | |
175 | - public function setPointing($value=Direction::NONE){ |
|
176 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
175 | + public function setPointing($value=Direction::NONE) { |
|
176 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
177 | 177 | } |
178 | 178 | |
179 | - public function setValue($value){ |
|
180 | - if(isset($this->input)){ |
|
179 | + public function setValue($value) { |
|
180 | + if (isset($this->input)) { |
|
181 | 181 | $this->input->setProperty("value", $value); |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | $this->setProperty("value", $value); |
184 | 184 | } |
185 | 185 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
186 | - if(isset($textElement)) |
|
186 | + if (isset($textElement)) |
|
187 | 187 | $textElement->setContent($value); |
188 | 188 | return $this; |
189 | 189 | } |
@@ -193,23 +193,23 @@ discard block |
||
193 | 193 | * @see BaseHtml::run() |
194 | 194 | */ |
195 | 195 | public function run(JsUtils $js) { |
196 | - if($this->propertyContains("class", "simple")===false){ |
|
197 | - if(isset($this->_bsComponent)===false) |
|
198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
196 | + if ($this->propertyContains("class", "simple")===false) { |
|
197 | + if (isset($this->_bsComponent)===false) |
|
198 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
199 | 199 | $this->addEventsOnRun($js); |
200 | 200 | return $this->_bsComponent; |
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - public function setCompact(){ |
|
204 | + public function setCompact() { |
|
205 | 205 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
206 | 206 | } |
207 | 207 | |
208 | - public function setAction($action){ |
|
208 | + public function setAction($action) { |
|
209 | 209 | $this->_params["action"]=$action; |
210 | 210 | } |
211 | 211 | |
212 | - public function setFullTextSearch($value){ |
|
212 | + public function setFullTextSearch($value) { |
|
213 | 213 | $this->_params["fullTextSearch"]=$value; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @param int $max |
14 | 14 | * @param string $icon star or heart |
15 | 15 | */ |
16 | - public function __construct($identifier, $value,$max=5,$icon="") { |
|
16 | + public function __construct($identifier, $value, $max=5, $icon="") { |
|
17 | 17 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
18 | 18 | $this->setValue($value); |
19 | 19 | $this->setMax($max); |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
25 | 25 | */ |
26 | - public function setValue($value){ |
|
26 | + public function setValue($value) { |
|
27 | 27 | $this->setProperty("data-rating", $value); |
28 | 28 | } |
29 | 29 | |
30 | - public function setMax($max){ |
|
30 | + public function setMax($max) { |
|
31 | 31 | $this->setProperty("data-max-rating", $max); |
32 | 32 | } |
33 | 33 | |
@@ -35,20 +35,20 @@ discard block |
||
35 | 35 | * {@inheritDoc} |
36 | 36 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
37 | 37 | */ |
38 | - public function run(JsUtils $js){ |
|
38 | + public function run(JsUtils $js) { |
|
39 | 39 | parent::run($js); |
40 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
40 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function asStar(){ |
|
43 | + public function asStar() { |
|
44 | 44 | return $this->setIcon(); |
45 | 45 | } |
46 | 46 | |
47 | - public function asHeart(){ |
|
47 | + public function asHeart() { |
|
48 | 48 | return $this->setIcon("heart"); |
49 | 49 | } |
50 | 50 | |
51 | - public function setIcon($icon="star"){ |
|
52 | - return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]); |
|
51 | + public function setIcon($icon="star") { |
|
52 | + return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
7 | 7 | |
8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
9 | - protected $_params=array (); |
|
9 | + protected $_params=array(); |
|
10 | 10 | |
11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
74 | 74 | */ |
75 | 75 | public function attachEvent($selector, $action=NULL) { |
76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
78 | 78 | } else { |
79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function attachEvents($events=array()) { |
91 | 91 | if (\is_array($events)) { |
92 | - foreach ( $events as $action => $selector ) { |
|
92 | + foreach ($events as $action => $selector) { |
|
93 | 93 | $this->attachEvent($selector, $action); |
94 | 94 | } |
95 | 95 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class HtmlDimmer extends HtmlSemDoubleElement { |
11 | 11 | private $_container; |
12 | - private $_params=array (); |
|
12 | + private $_params=array(); |
|
13 | 13 | private $_inverted; |
14 | 14 | |
15 | 15 | public function __construct($identifier, $content=NULL) { |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setContent($content) { |
22 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
22 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
27 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
27 | + $header=new HtmlHeader("header-".$this->identifier); |
|
28 | 28 | $header->asIcon($icon, $title, $subHeader); |
29 | - if ($this->_inverted === false) |
|
29 | + if ($this->_inverted===false) |
|
30 | 30 | $header->setInverted(); |
31 | 31 | return $this->setContent($header); |
32 | 32 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | public function run(JsUtils $js) { |
45 | 45 | if ($this->_container instanceof HtmlSingleElement) |
46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
46 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
47 | 47 | return parent::run($js); |
48 | 48 | } |
49 | 49 | |
50 | 50 | public function jsShow() { |
51 | - if (isset($this->_container) === true) |
|
52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
51 | + if (isset($this->_container)===true) |
|
52 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setBlurring() { |