@@ -35,12 +35,18 @@ |
||
35 | 35 | return $segment; |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param integer $index |
|
40 | + */ |
|
38 | 41 | public function activate($index){ |
39 | 42 | $this->content["menu"]->getItem($index)->setActive(true); |
40 | 43 | $this->content[$index]->setActive(true); |
41 | 44 | return $this; |
42 | 45 | } |
43 | 46 | |
47 | + /** |
|
48 | + * @param string $title |
|
49 | + */ |
|
44 | 50 | public function addPanel($title,$content){ |
45 | 51 | return $this->addItem([$title,$content]); |
46 | 52 | } |
@@ -7,42 +7,42 @@ discard block |
||
7 | 7 | use Ajax\semantic\html\base\constants\Side; |
8 | 8 | use Ajax\JsUtils; |
9 | 9 | |
10 | -class HtmlTab extends HtmlSemCollection{ |
|
10 | +class HtmlTab extends HtmlSemCollection { |
|
11 | 11 | protected $params=array(); |
12 | 12 | |
13 | - public function __construct( $identifier, $tabs=array()){ |
|
14 | - parent::__construct( $identifier, "div", ""); |
|
13 | + public function __construct($identifier, $tabs=array()) { |
|
14 | + parent::__construct($identifier, "div", ""); |
|
15 | 15 | $menu=new HtmlMenu("menu".$this->identifier); |
16 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
16 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
17 | 17 | $this->content["menu"]=$menu; |
18 | 18 | $this->addItems($tabs); |
19 | - if(\sizeof($tabs)>0) |
|
19 | + if (\sizeof($tabs)>0) |
|
20 | 20 | $this->activate(0); |
21 | 21 | } |
22 | 22 | |
23 | - protected function createItem($value){ |
|
23 | + protected function createItem($value) { |
|
24 | 24 | $count=$this->count(); |
25 | 25 | $title=$value; |
26 | 26 | $content=NULL; |
27 | - if(\is_array($value)){ |
|
28 | - $title=@$value[0];$content=@$value[1]; |
|
27 | + if (\is_array($value)) { |
|
28 | + $title=@$value[0]; $content=@$value[1]; |
|
29 | 29 | } |
30 | 30 | $menuItem=$this->content["menu"]->addItem($title); |
31 | 31 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
32 | 32 | $menuItem->removeProperty("href"); |
33 | 33 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
34 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$menuItem->getIdentifier()); |
|
34 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $menuItem->getIdentifier()); |
|
35 | 35 | return $segment; |
36 | 36 | } |
37 | 37 | |
38 | - public function activate($index){ |
|
38 | + public function activate($index) { |
|
39 | 39 | $this->content["menu"]->getItem($index)->setActive(true); |
40 | 40 | $this->content[$index]->setActive(true); |
41 | 41 | return $this; |
42 | 42 | } |
43 | 43 | |
44 | - public function addPanel($title,$content){ |
|
45 | - return $this->addItem([$title,$content]); |
|
44 | + public function addPanel($title, $content) { |
|
45 | + return $this->addItem([$title, $content]); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @param string $action a Phalcon action |
55 | 55 | * @param array $params |
56 | 56 | */ |
57 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
58 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
57 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
58 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @param string $viewName |
67 | 67 | * @param $params The parameters to pass to the view |
68 | 68 | */ |
69 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
70 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
69 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
70 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /* |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @see BaseHtml::run() |
76 | 76 | */ |
77 | 77 | public function run(JsUtils $js) { |
78 | - if(isset($this->_bsComponent)===false) |
|
79 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
78 | + if (isset($this->_bsComponent)===false) |
|
79 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
80 | 80 | $this->addEventsOnRun($js); |
81 | 81 | return $this->_bsComponent; |
82 | 82 | } |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
17 | 17 | $this->content["menu"]=$menu; |
18 | 18 | $this->addItems($tabs); |
19 | - if(\sizeof($tabs)>0) |
|
20 | - $this->activate(0); |
|
19 | + if(\sizeof($tabs)>0) { |
|
20 | + $this->activate(0); |
|
21 | + } |
|
21 | 22 | } |
22 | 23 | |
23 | 24 | protected function createItem($value){ |
@@ -75,8 +76,9 @@ discard block |
||
75 | 76 | * @see BaseHtml::run() |
76 | 77 | */ |
77 | 78 | public function run(JsUtils $js) { |
78 | - if(isset($this->_bsComponent)===false) |
|
79 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
79 | + if(isset($this->_bsComponent)===false) { |
|
80 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
81 | + } |
|
80 | 82 | $this->addEventsOnRun($js); |
81 | 83 | return $this->_bsComponent; |
82 | 84 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
13 | 13 | |
14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
15 | 15 | parent::__construct($identifier, "div", $baseClass); |
16 | 16 | $this->content=array(); |
17 | 17 | $this->initContent($content); |
@@ -19,41 +19,41 @@ discard block |
||
19 | 19 | |
20 | 20 | protected abstract function initContent($content); |
21 | 21 | |
22 | - public function setIcon($icon){ |
|
22 | + public function setIcon($icon) { |
|
23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
24 | 24 | } |
25 | 25 | |
26 | - public function setImage($image){ |
|
26 | + public function setImage($image) { |
|
27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
28 | 28 | $image->asAvatar(); |
29 | 29 | $this->content["image"]=$image; |
30 | 30 | } |
31 | 31 | |
32 | - private function createContent(){ |
|
33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
32 | + private function createContent() { |
|
33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
34 | 34 | return $this->content["content"]; |
35 | 35 | } |
36 | 36 | |
37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
39 | - if(\array_key_exists("content", $this->content)===false){ |
|
37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
39 | + if (\array_key_exists("content", $this->content)===false) { |
|
40 | 40 | $this->createContent(); |
41 | 41 | } |
42 | 42 | $this->content["content"]->addContent($title); |
43 | - if(isset($description)){ |
|
44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
43 | + if (isset($description)) { |
|
44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
45 | 45 | $this->content["content"]->addContent($description); |
46 | 46 | } |
47 | 47 | return $this; |
48 | 48 | } |
49 | 49 | |
50 | - public function getPart($partName="header"){ |
|
51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
50 | + public function getPart($partName="header") { |
|
51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
53 | 53 | } |
54 | 54 | |
55 | - public function setActive($value=true){ |
|
56 | - if($value){ |
|
55 | + public function setActive($value=true) { |
|
56 | + if ($value) { |
|
57 | 57 | $this->setTagName("div"); |
58 | 58 | $this->removeProperty("href"); |
59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | return $this; |
62 | 62 | } |
63 | 63 | |
64 | - public function asLink($href=NULL,$part=NULL){ |
|
64 | + public function asLink($href=NULL, $part=NULL) { |
|
65 | 65 | $this->setTagName("a"); |
66 | - if(isset($href)) |
|
66 | + if (isset($href)) |
|
67 | 67 | $this->setProperty("href", $href); |
68 | 68 | return $this; |
69 | 69 | } |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
76 | 76 | */ |
77 | 77 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
78 | - if(\is_array($this->content)) |
|
79 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
78 | + if (\is_array($this->content)) |
|
79 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
80 | 80 | return parent::compile($js, $view); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | \ No newline at end of file |
@@ -8,52 +8,52 @@ |
||
8 | 8 | class HtmlStepItem extends HtmlAbsractItem { |
9 | 9 | |
10 | 10 | public function __construct($identifier, $content) { |
11 | - parent::__construct($identifier,"step",$content); |
|
11 | + parent::__construct($identifier, "step", $content); |
|
12 | 12 | } |
13 | - protected function initContent($content){ |
|
14 | - if(\is_array($content)){ |
|
15 | - if(JArray::isAssociative($content)===false){ |
|
13 | + protected function initContent($content) { |
|
14 | + if (\is_array($content)) { |
|
15 | + if (JArray::isAssociative($content)===false) { |
|
16 | 16 | $icon=@$content[0]; |
17 | 17 | $title=@$content[1]; |
18 | 18 | $desc=@$content[2]; |
19 | 19 | $status=@$content[3]; |
20 | - }else{ |
|
20 | + } else { |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $title=@$content["title"]; |
23 | 23 | $desc=@$content["description"]; |
24 | 24 | $status=@$content["status"]; |
25 | 25 | } |
26 | - if(isset($icon)===true){ |
|
26 | + if (isset($icon)===true) { |
|
27 | 27 | $this->setIcon($icon); |
28 | 28 | } |
29 | - if(isset($status)===true){ |
|
29 | + if (isset($status)===true) { |
|
30 | 30 | $this->setStatus($status); |
31 | 31 | } |
32 | - if(isset($title)===true){ |
|
33 | - $this->setTitle($title,$desc); |
|
32 | + if (isset($title)===true) { |
|
33 | + $this->setTitle($title, $desc); |
|
34 | 34 | } |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - public function setActive($value=true){ |
|
41 | - if($value) |
|
40 | + public function setActive($value=true) { |
|
41 | + if ($value) |
|
42 | 42 | $this->setStatus(StepStatus::ACTIVE); |
43 | 43 | else |
44 | 44 | $this->setStatus(StepStatus::NONE); |
45 | 45 | return $this; |
46 | 46 | } |
47 | 47 | |
48 | - public function setCompleted(){ |
|
48 | + public function setCompleted() { |
|
49 | 49 | return $this->setStatus(StepStatus::COMPLETED); |
50 | 50 | } |
51 | 51 | |
52 | - public function setStatus($status){ |
|
52 | + public function setStatus($status) { |
|
53 | 53 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
54 | 54 | } |
55 | 55 | |
56 | - public function removeStatus(){ |
|
56 | + public function removeStatus() { |
|
57 | 57 | $this->removePropertyValues("class", StepStatus::getConstants()); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $title=@$content[1]; |
18 | 18 | $desc=@$content[2]; |
19 | 19 | $status=@$content[3]; |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $title=@$content["title"]; |
23 | 23 | $desc=@$content["description"]; |
@@ -32,16 +32,17 @@ discard block |
||
32 | 32 | if(isset($title)===true){ |
33 | 33 | $this->setTitle($title,$desc); |
34 | 34 | } |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActive($value=true){ |
41 | - if($value) |
|
42 | - $this->setStatus(StepStatus::ACTIVE); |
|
43 | - else |
|
44 | - $this->setStatus(StepStatus::NONE); |
|
41 | + if($value) { |
|
42 | + $this->setStatus(StepStatus::ACTIVE); |
|
43 | + } else { |
|
44 | + $this->setStatus(StepStatus::NONE); |
|
45 | + } |
|
45 | 46 | return $this; |
46 | 47 | } |
47 | 48 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 9 | |
10 | 10 | trait BaseTrait { |
11 | - protected $_variations=[ ]; |
|
12 | - protected $_states=[ ]; |
|
11 | + protected $_variations=[]; |
|
12 | + protected $_states=[]; |
|
13 | 13 | protected $_baseClass; |
14 | 14 | |
15 | 15 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->setProperty("class", $this->_baseClass); |
38 | 38 | if (\is_string($variations)) |
39 | 39 | $variations=\explode(" ", $variations); |
40 | - foreach ( $variations as $variation ) { |
|
40 | + foreach ($variations as $variation) { |
|
41 | 41 | $this->addVariation($variation); |
42 | 42 | } |
43 | 43 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function addVariations($variations=array()) { |
52 | 52 | if (\is_string($variations)) |
53 | 53 | $variations=\explode(" ", $variations); |
54 | - foreach ( $variations as $variation ) { |
|
54 | + foreach ($variations as $variation) { |
|
55 | 55 | $this->addVariation($variation); |
56 | 56 | } |
57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addStates($states=array()) { |
61 | 61 | if (\is_string($states)) |
62 | 62 | $states=\explode(" ", $states); |
63 | - foreach ( $states as $state ) { |
|
63 | + foreach ($states as $state) { |
|
64 | 64 | $this->addState($state); |
65 | 65 | } |
66 | 66 | return $this; |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | $this->setProperty("class", $this->_baseClass); |
71 | 71 | if (\is_string($states)) |
72 | 72 | $states=\explode(" ", $states); |
73 | - foreach ( $states as $state ) { |
|
73 | + foreach ($states as $state) { |
|
74 | 74 | $this->addState($state); |
75 | 75 | } |
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addIcon($icon, $before=true) { |
80 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
80 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * show it is currently the active user selection |
120 | 120 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
121 | 121 | */ |
122 | - public function setActive($value=true){ |
|
122 | + public function setActive($value=true) { |
|
123 | 123 | return $this->addToProperty("class", "active"); |
124 | 124 | } |
125 | 125 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | public function setFloated($direction="right") { |
138 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
138 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | public function floatRight() { |
@@ -15,117 +15,117 @@ 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 | 126 | |
127 | - public function setTransition($value){ |
|
128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
127 | + public function setTransition($value) { |
|
128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @param string $viewName |
136 | 136 | * @param $params The parameters to pass to the view |
137 | 137 | */ |
138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $controllerName the controller name |
148 | 148 | * @param string $actionName the action name |
149 | 149 | */ |
150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
159 | 159 | */ |
160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
162 | 162 | return parent::compile($js, $view); |
163 | 163 | } |
164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * @see BaseHtml::run() |
167 | 167 | */ |
168 | 168 | public function run(JsUtils $js) { |
169 | - if(isset($this->_bsComponent)===false) |
|
170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
169 | + if (isset($this->_bsComponent)===false) |
|
170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
171 | 171 | $this->addEventsOnRun($js); |
172 | 172 | return $this->_bsComponent; |
173 | 173 | } |
@@ -6,31 +6,31 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
9 | +class HtmlAccordion extends HtmlSemCollection { |
|
10 | 10 | |
11 | 11 | protected $params=array(); |
12 | 12 | |
13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
18 | + protected function createItem($value) { |
|
19 | 19 | $count=$this->count(); |
20 | 20 | $title=$value; |
21 | 21 | $content=NULL; |
22 | - if(\is_array($value)){ |
|
23 | - $title=@$value[0];$content=@$value[1]; |
|
22 | + if (\is_array($value)) { |
|
23 | + $title=@$value[0]; $content=@$value[1]; |
|
24 | 24 | } |
25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
26 | 26 | } |
27 | 27 | |
28 | - protected function createCondition($value){ |
|
28 | + protected function createCondition($value) { |
|
29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
30 | 30 | } |
31 | 31 | |
32 | - public function addPanel($title,$content){ |
|
33 | - return $this->addItem([$title,$content]); |
|
32 | + public function addPanel($title, $content) { |
|
33 | + return $this->addItem([$title, $content]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $action a Phalcon action |
43 | 43 | * @param array $params |
44 | 44 | */ |
45 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
46 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
45 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
46 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -54,30 +54,30 @@ discard block |
||
54 | 54 | * @param string $viewName |
55 | 55 | * @param $params The parameters to pass to the view |
56 | 56 | */ |
57 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
58 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
57 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
58 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
59 | 59 | } |
60 | 60 | /* |
61 | 61 | * (non-PHPdoc) |
62 | 62 | * @see BaseHtml::run() |
63 | 63 | */ |
64 | 64 | public function run(JsUtils $js) { |
65 | - if(isset($this->_bsComponent)===false) |
|
66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
65 | + if (isset($this->_bsComponent)===false) |
|
66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
67 | 67 | $this->addEventsOnRun($js); |
68 | 68 | return $this->_bsComponent; |
69 | 69 | } |
70 | 70 | |
71 | - public function setStyled(){ |
|
71 | + public function setStyled() { |
|
72 | 72 | return $this->addToProperty("class", "styled"); |
73 | 73 | } |
74 | 74 | |
75 | - public function activate($index){ |
|
75 | + public function activate($index) { |
|
76 | 76 | $this->getItem($index)->setActive(true); |
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | - public function setExclusive($value){ |
|
80 | + public function setExclusive($value) { |
|
81 | 81 | $this->params["exclusive"]=$value; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @return \Ajax\semantic\html\collections\HtmlMenu |
39 | 39 | */ |
40 | 40 | public function setType($type="") { |
41 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
41 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function setActiveItem($index) { |
45 | 45 | $item=$this->getItem($index); |
46 | - if ($item !== null) { |
|
46 | + if ($item!==null) { |
|
47 | 47 | $item->addToProperty("class", "active"); |
48 | 48 | } |
49 | 49 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | private function getItemToInsert($item) { |
53 | 53 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
54 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
54 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
55 | 55 | $itemO->setContent($item); |
56 | 56 | $item=$itemO; |
57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | private function afterInsert($item) { |
62 | 62 | if (!$item instanceof HtmlMenu) |
63 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
63 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
64 | 64 | else { |
65 | 65 | $this->setSecondary(); |
66 | 66 | } |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | |
92 | 92 | public function generateMenuAsItem($menu, $header=null) { |
93 | 93 | $count=$this->count(); |
94 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
94 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
95 | 95 | if (isset($header)) { |
96 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
96 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
97 | 97 | $headerItem->setContent($header); |
98 | 98 | $item->addContent($headerItem); |
99 | 99 | $this->_itemHeader=$headerItem; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
112 | 112 | $value->addContent(new HtmlIcon("", "dropdown")); |
113 | 113 | $value=$this->addItem($value); |
114 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
114 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
115 | 115 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
116 | 116 | $this->wrap("", $popup); |
117 | 117 | return $popup; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function addDropdownAsItem($value, $items=NULL) { |
121 | 121 | $dd=$value; |
122 | 122 | if (\is_string($value)) { |
123 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
123 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
124 | 124 | } |
125 | 125 | return $this->addItem($dd); |
126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
133 | 133 | */ |
134 | 134 | protected function createItem($value) { |
135 | - $itemO=new HtmlLink($this->identifier."item" . \sizeof($this->content), "", $value); |
|
135 | + $itemO=new HtmlLink($this->identifier."item".\sizeof($this->content), "", $value); |
|
136 | 136 | return $itemO->setClass("item"); |
137 | 137 | } |
138 | 138 | |
@@ -145,28 +145,28 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | public function setVertical() { |
148 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
148 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | public function setPosition($value="right") { |
152 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
152 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | public function setPointing($value=Direction::NONE) { |
156 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
156 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | public function asTab($vertical=false) { |
160 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
160 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
161 | 161 | $item->setTagName("a"); |
162 | 162 | }); |
163 | - if ($vertical === true) |
|
163 | + if ($vertical===true) |
|
164 | 164 | $this->setVertical(); |
165 | 165 | return $this->addToProperty("class", "tabular"); |
166 | 166 | } |
167 | 167 | |
168 | 168 | public function asPagination() { |
169 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
169 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
170 | 170 | $item->setTagName("a"); |
171 | 171 | }); |
172 | 172 | return $this->addToProperty("class", "pagination"); |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function setWidth($width) { |
205 | 205 | if (\is_int($width)) { |
206 | - $width=Wide::getConstants()["W" . $width]; |
|
206 | + $width=Wide::getConstants()["W".$width]; |
|
207 | 207 | } |
208 | 208 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
209 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
209 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | public function addImage($identifier, $src="", $alt="") { |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * @return HtmlModal |
80 | 80 | */ |
81 | 81 | public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
82 | - return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
|
82 | + return $this->addHtmlComponent(new HtmlModal($identifier, $header, $content, $actions)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param string|array $params |
120 | 120 | * @return Modal |
121 | 121 | */ |
122 | - public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) { |
|
123 | - $result= $this->addComponent(new Modal($this->js), $attachTo, $params); |
|
122 | + public function modal($attachTo=NULL, $params=NULL, $paramsParts=NULL) { |
|
123 | + $result=$this->addComponent(new Modal($this->js), $attachTo, $params); |
|
124 | 124 | $result->setParamParts($paramsParts); |
125 | 125 | return $result; |
126 | 126 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return Tab |
132 | 132 | */ |
133 | 133 | public function tab($attachTo=NULL, $params=NULL) { |
134 | - $result= $this->addComponent(new Tab($this->js), $attachTo, $params); |
|
134 | + $result=$this->addComponent(new Tab($this->js), $attachTo, $params); |
|
135 | 135 | return $result; |
136 | 136 | } |
137 | 137 | } |
138 | 138 | \ No newline at end of file |