@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class StepStatus extends BaseEnum { |
8 | - const ACTIVE="active",COMPLETED="completed",DISABLED="disabled",NONE=""; |
|
8 | + const ACTIVE="active", COMPLETED="completed", DISABLED="disabled", NONE=""; |
|
9 | 9 | } |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | abstract public function setClass($classNames); |
20 | 20 | abstract public function addIcon($icon, $before=true); |
21 | 21 | |
22 | - public function setContent($content){ |
|
23 | - if($content==="-"){ |
|
22 | + public function setContent($content) { |
|
23 | + if ($content==="-") { |
|
24 | 24 | $this->asDivider(); |
25 | - }elseif($content==="-search-"){ |
|
26 | - $values=\explode(",",$content,-1); |
|
27 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
28 | - }elseif(JString::startswith($content, "-")){ |
|
29 | - $content=\ltrim($content,"-"); |
|
25 | + }elseif ($content==="-search-") { |
|
26 | + $values=\explode(",", $content, -1); |
|
27 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
28 | + }elseif (JString::startswith($content, "-")) { |
|
29 | + $content=\ltrim($content, "-"); |
|
30 | 30 | $this->asHeader($content); |
31 | - }else |
|
31 | + } else |
|
32 | 32 | parent::setContent($content); |
33 | 33 | return $this; |
34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | * @param string $icon |
39 | 39 | * @return HtmlDropdownItem|HtmlMenuItem |
40 | 40 | */ |
41 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
41 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
42 | 42 | $this->setClass("ui icon search input"); |
43 | 43 | $input=new HtmlInput("search-".$this->identifier); |
44 | - if(isset($placeholder)) |
|
44 | + if (isset($placeholder)) |
|
45 | 45 | $input->setProperty("placeholder", $placeholder); |
46 | 46 | $this->content=$input; |
47 | - if(isset($icon)) |
|
47 | + if (isset($icon)) |
|
48 | 48 | $this->addIcon($icon); |
49 | 49 | return $this; |
50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return HtmlDropdownItem|HtmlMenuItem |
54 | 54 | */ |
55 | - public function asDivider(){ |
|
55 | + public function asDivider() { |
|
56 | 56 | $this->content=NULL; |
57 | 57 | $this->tagName="div"; |
58 | 58 | $this->setClass("divider"); |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | * @param string $icon |
65 | 65 | * @return HtmlDropdownItem|HtmlMenuItem |
66 | 66 | */ |
67 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
67 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
68 | 68 | $this->setClass("header"); |
69 | 69 | $this->tagName="div"; |
70 | 70 | $this->content=$caption; |
71 | - if(isset($icon)) |
|
72 | - $this->addIcon($icon,Direction::LEFT); |
|
71 | + if (isset($icon)) |
|
72 | + $this->addIcon($icon, Direction::LEFT); |
|
73 | 73 | return $this; |
74 | 74 | } |
75 | 75 | |
76 | - public function setPosition($direction){ |
|
77 | - $this->addToProperty("class",$direction); |
|
76 | + public function setPosition($direction) { |
|
77 | + $this->addToProperty("class", $direction); |
|
78 | 78 | } |
79 | 79 | } |
@@ -12,23 +12,23 @@ |
||
12 | 12 | * @param string $value |
13 | 13 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
14 | 14 | */ |
15 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
16 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
15 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
16 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
17 | 17 | } |
18 | 18 | |
19 | - public function textCenterAligned(){ |
|
19 | + public function textCenterAligned() { |
|
20 | 20 | return $this->setTextAlignment(TextAlignment::CENTER); |
21 | 21 | } |
22 | 22 | |
23 | - public function textJustified(){ |
|
23 | + public function textJustified() { |
|
24 | 24 | return $this->setTextAlignment(TextAlignment::JUSTIFIED); |
25 | 25 | } |
26 | 26 | |
27 | - public function textRightAligned(){ |
|
27 | + public function textRightAligned() { |
|
28 | 28 | return $this->setTextAlignment(TextAlignment::RIGHT); |
29 | 29 | } |
30 | 30 | |
31 | - public function textLeftAligned(){ |
|
31 | + public function textLeftAligned() { |
|
32 | 32 | return $this->setTextAlignment(); |
33 | 33 | } |
34 | 34 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class HtmlCard extends HtmlViewItem { |
8 | 8 | |
9 | - public function __construct($identifier,$content=NULL) { |
|
9 | + public function __construct($identifier, $content=NULL) { |
|
10 | 10 | parent::__construct($identifier, "ui card", $content); |
11 | 11 | } |
12 | 12 | } |
@@ -14,64 +14,64 @@ |
||
14 | 14 | protected $params; |
15 | 15 | protected $semElement; |
16 | 16 | |
17 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
17 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
18 | 18 | $this->semElement=$semElement; |
19 | 19 | $this->title=$title; |
20 | 20 | $this->content=$content; |
21 | - $this->setAttributes($variation,$params); |
|
21 | + $this->setAttributes($variation, $params); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function setHtml($html) { |
25 | - $this->html= $html; |
|
25 | + $this->html=$html; |
|
26 | 26 | return $this; |
27 | 27 | } |
28 | 28 | |
29 | - public function setAttributes($variation=NULL,$params=array()){ |
|
29 | + public function setAttributes($variation=NULL, $params=array()) { |
|
30 | 30 | $this->variation=$variation; |
31 | 31 | $this->params=$params; |
32 | 32 | } |
33 | 33 | |
34 | - public function onShow($jsCode){ |
|
34 | + public function onShow($jsCode) { |
|
35 | 35 | $this->params["onShow"]=$jsCode; |
36 | 36 | } |
37 | 37 | |
38 | - public function compile(JsUtils $js=NULL){ |
|
39 | - if(JString::isNotNull($this->title)){ |
|
38 | + public function compile(JsUtils $js=NULL) { |
|
39 | + if (JString::isNotNull($this->title)) { |
|
40 | 40 | $this->semElement->addToProperty("data-title", $this->title); |
41 | 41 | } |
42 | - if(JString::isNotNull($this->content)){ |
|
42 | + if (JString::isNotNull($this->content)) { |
|
43 | 43 | $this->semElement->addToProperty("data-content", $this->content); |
44 | 44 | } |
45 | 45 | $this->_compileHtml($js); |
46 | - if(JString::isNotNull($this->variation)){ |
|
46 | + if (JString::isNotNull($this->variation)) { |
|
47 | 47 | $this->semElement->addToProperty("data-variation", $this->variation); |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - private function _compileHtml(JsUtils $js=NULL){ |
|
52 | - if(JString::isNotNull($this->html)){ |
|
51 | + private function _compileHtml(JsUtils $js=NULL) { |
|
52 | + if (JString::isNotNull($this->html)) { |
|
53 | 53 | $html=$this->html; |
54 | - if(\is_array($html)){ |
|
54 | + if (\is_array($html)) { |
|
55 | 55 | \array_walk($html, function(&$item) use($js){ |
56 | - if($item instanceof HtmlSemDoubleElement){ |
|
56 | + if ($item instanceof HtmlSemDoubleElement) { |
|
57 | 57 | $comp=$item->compile($js); |
58 | - if(isset($js)){ |
|
58 | + if (isset($js)) { |
|
59 | 59 | $bs=$item->run($js); |
60 | - if(isset($bs)) |
|
60 | + if (isset($bs)) |
|
61 | 61 | $this->params['onShow']=$bs->getScript(); |
62 | 62 | } |
63 | 63 | $item=$comp; |
64 | 64 | } |
65 | 65 | }); |
66 | - $html=\implode("",$html); |
|
66 | + $html=\implode("", $html); |
|
67 | 67 | } |
68 | 68 | $html=\str_replace("\"", "'", $html); |
69 | 69 | $this->semElement->addToProperty("data-html", $html); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - public function run(JsUtils $js){ |
|
74 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
73 | + public function run(JsUtils $js) { |
|
74 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function setWidth($width) { |
32 | 32 | if (\is_int($width)) { |
33 | - $width=Wide::getConstants()["W" . $width]; |
|
33 | + $width=Wide::getConstants()["W".$width]; |
|
34 | 34 | } |
35 | 35 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
36 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
36 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function setValue($value) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $divider->setVertical(); |
52 | 52 | else |
53 | 53 | $divider->setHorizontal(); |
54 | - $this->wrap($divider,""); |
|
54 | + $this->wrap($divider, ""); |
|
55 | 55 | return $divider; |
56 | 56 | } |
57 | 57 | } |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
19 | +class HtmlGridRow extends HtmlSemCollection { |
|
20 | 20 | use TextAlignmentTrait; |
21 | 21 | |
22 | 22 | private $_colSize; |
23 | 23 | private $_implicite=false; |
24 | 24 | |
25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
26 | - parent::__construct( $identifier,"div","row"); |
|
25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
26 | + parent::__construct($identifier, "div", "row"); |
|
27 | 27 | $this->_implicite=$implicite; |
28 | 28 | $width=null; |
29 | - if(isset($numCols)){ |
|
30 | - $numCols=min(16,$numCols); |
|
31 | - $numCols=max(1,$numCols); |
|
32 | - if($colSizing) |
|
29 | + if (isset($numCols)) { |
|
30 | + $numCols=min(16, $numCols); |
|
31 | + $numCols=max(1, $numCols); |
|
32 | + if ($colSizing) |
|
33 | 33 | $width=(int)(16/$numCols); |
34 | 34 | else |
35 | 35 | $this->_colSize=16/$numCols; |
36 | - for ($i=0;$i<$numCols;$i++){ |
|
36 | + for ($i=0; $i<$numCols; $i++) { |
|
37 | 37 | $this->addItem($width); |
38 | 38 | } |
39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @param int $width |
45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
46 | 46 | */ |
47 | - public function setWidth($width){ |
|
48 | - if(\is_int($width)){ |
|
47 | + public function setWidth($width) { |
|
48 | + if (\is_int($width)) { |
|
49 | 49 | $width=Wide::getConstants()["W".$width]; |
50 | 50 | } |
51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param int $index |
58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
59 | 59 | */ |
60 | - public function getCol($index){ |
|
60 | + public function getCol($index) { |
|
61 | 61 | return $this->getItem($index); |
62 | 62 | } |
63 | 63 | |
64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
65 | 65 | $this->setWidth($colsCount); |
66 | - if($toCreate===true){ |
|
66 | + if ($toCreate===true) { |
|
67 | 67 | $count=$this->count(); |
68 | - for($i=$count;$i<$colsCount;$i++){ |
|
68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
69 | 69 | $this->addItem(null); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function addCols($colCount){ |
|
76 | - for($i=0;$i<$colCount;$i++){ |
|
75 | + public function addCols($colCount) { |
|
76 | + for ($i=0; $i<$colCount; $i++) { |
|
77 | 77 | $this->addItem(null); |
78 | 78 | } |
79 | 79 | return $this; |
80 | 80 | } |
81 | 81 | |
82 | - public function addCol($width=NULL){ |
|
82 | + public function addCol($width=NULL) { |
|
83 | 83 | return $this->addItem($width); |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * stretch the row contents to take up the entire column height |
88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
89 | 89 | */ |
90 | - public function setStretched(){ |
|
90 | + public function setStretched() { |
|
91 | 91 | return $this->addToProperty("class", "stretched"); |
92 | 92 | } |
93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | * @param string $color |
96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
97 | 97 | */ |
98 | - public function setColor($color){ |
|
99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
98 | + public function setColor($color) { |
|
99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
100 | 100 | } |
101 | 101 | |
102 | - public function setValues($values,$force=false){ |
|
102 | + public function setValues($values, $force=false) { |
|
103 | 103 | $count=$this->count(); |
104 | 104 | $valuesSize=\sizeof($values); |
105 | - if($force===true){ |
|
106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
105 | + if ($force===true) { |
|
106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
108 | 108 | } |
109 | 109 | } |
110 | - $count=\min(array($this->count(),$valuesSize)); |
|
111 | - for($i=0;$i<$count;$i++){ |
|
110 | + $count=\min(array($this->count(), $valuesSize)); |
|
111 | + for ($i=0; $i<$count; $i++) { |
|
112 | 112 | $this->content[$i]->setValue($values[$i]); |
113 | 113 | } |
114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | * {@inheritDoc} |
119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
120 | 120 | */ |
121 | - protected function createItem($value){ |
|
122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
121 | + protected function createItem($value) { |
|
122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
123 | 123 | return $col; |
124 | 124 | } |
125 | 125 | |
126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
127 | - if($this->_implicite===true){ |
|
126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
127 | + if ($this->_implicite===true) { |
|
128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
129 | 129 | } |
130 | - return parent::compile($js,$view); |
|
130 | + return parent::compile($js, $view); |
|
131 | 131 | } |
132 | 132 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $event |
22 | 22 | * @param boolean $multiple |
23 | 23 | */ |
24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
25 | 25 | $this->table=$table; |
26 | 26 | $this->class=$class; |
27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function compile(){ |
|
58 | + public function compile() { |
|
59 | 59 | $multiple=""; |
60 | - if(!$this->multiple){ |
|
60 | + if (!$this->multiple) { |
|
61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
62 | 62 | } |
63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlLabeledIconMenu extends HtmlMenu{ |
|
15 | +class HtmlLabeledIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "labeled icon"); |
25 | 25 | } |
26 | 26 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | protected function createItem($value) { |
32 | 32 | $text=""; |
33 | 33 | $v=$value; |
34 | - if(\is_array($value)){ |
|
34 | + if (\is_array($value)) { |
|
35 | 35 | $v=@$value[0]; |
36 | 36 | $text=@$value[1]; |
37 | 37 | } |
38 | 38 | $count=\sizeof($this->content); |
39 | 39 | $value=new HtmlIcon("icon-".$count, $v); |
40 | - $value->wrap("",$text); |
|
41 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
40 | + $value->wrap("", $text); |
|
41 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
42 | 42 | return $itemO->setClass("item"); |
43 | 43 | } |
44 | 44 | } |