@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | protected $variation; |
12 | 12 | protected $params; |
13 | 13 | protected $semElement; |
14 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
14 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
15 | 15 | $this->semElement=$semElement; |
16 | 16 | $this->title=$title; |
17 | 17 | $this->content=$content; |
18 | - $this->setAttributes($variation,$params); |
|
18 | + $this->setAttributes($variation, $params); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setHtml($html) { |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | - public function setAttributes($variation=NULL,$params=array()){ |
|
26 | + public function setAttributes($variation=NULL, $params=array()) { |
|
27 | 27 | $this->variation=$variation; |
28 | 28 | $this->params=$params; |
29 | 29 | } |
30 | 30 | |
31 | - public function onShow($jsCode){ |
|
31 | + public function onShow($jsCode) { |
|
32 | 32 | $this->params["onShow"]=$jsCode; |
33 | 33 | } |
34 | 34 | |
35 | - public function compile(){ |
|
36 | - if(JString::isNotNull($this->title)){ |
|
35 | + public function compile() { |
|
36 | + if (JString::isNotNull($this->title)) { |
|
37 | 37 | $this->semElement->addToProperty("data-title", $this->title); |
38 | 38 | } |
39 | - if(JString::isNotNull($this->content)){ |
|
39 | + if (JString::isNotNull($this->content)) { |
|
40 | 40 | $this->semElement->addToProperty("data-content", $this->content); |
41 | 41 | } |
42 | - if(JString::isNotNull($this->html)){ |
|
42 | + if (JString::isNotNull($this->html)) { |
|
43 | 43 | $this->semElement->addToProperty("data-html", $this->html); |
44 | 44 | } |
45 | - if(JString::isNotNull($this->variation)){ |
|
45 | + if (JString::isNotNull($this->variation)) { |
|
46 | 46 | $this->semElement->addToProperty("data-variation", $this->variation); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - public function run(JsUtils $js){ |
|
51 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
50 | + public function run(JsUtils $js) { |
|
51 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -10,30 +10,30 @@ discard block |
||
10 | 10 | |
11 | 11 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
12 | 12 | |
13 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
|
13 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL) { |
|
14 | 14 | parent::__construct($identifier, "div"); |
15 | 15 | $this->setClass("item"); |
16 | 16 | $this->setContent($content); |
17 | - if($value!==NULL) |
|
17 | + if ($value!==NULL) |
|
18 | 18 | $this->setData($value); |
19 | - if($image!==NULL) |
|
19 | + if ($image!==NULL) |
|
20 | 20 | $this->asMiniAvatar($image); |
21 | 21 | } |
22 | 22 | |
23 | - public function setDescription($description){ |
|
24 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
23 | + public function setDescription($description) { |
|
24 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
25 | 25 | $descO->setClass("description"); |
26 | 26 | $descO->setContent($description); |
27 | - return $this->addContent($descO,true); |
|
27 | + return $this->addContent($descO, true); |
|
28 | 28 | } |
29 | 29 | |
30 | - public function setData($value){ |
|
30 | + public function setData($value) { |
|
31 | 31 | $this->setProperty("data-value", $value); |
32 | 32 | } |
33 | 33 | |
34 | - public function asOption(){ |
|
34 | + public function asOption() { |
|
35 | 35 | $this->tagName="option"; |
36 | - if($this->getProperty("data-value")!==null) |
|
36 | + if ($this->getProperty("data-value")!==null) |
|
37 | 37 | $this->setProperty("value", $this->getProperty("data-value")); |
38 | 38 | } |
39 | 39 | |
@@ -41,58 +41,58 @@ discard block |
||
41 | 41 | * @param string $image the image src |
42 | 42 | * @return \Ajax\common\html\html5\HtmlImg |
43 | 43 | */ |
44 | - public function asMiniAvatar($image){ |
|
44 | + public function asMiniAvatar($image) { |
|
45 | 45 | $this->tagName="div"; |
46 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
46 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
47 | 47 | $img->setClass("ui mini avatar image"); |
48 | - $this->addContent($img,true); |
|
48 | + $this->addContent($img, true); |
|
49 | 49 | return $img; |
50 | 50 | } |
51 | 51 | |
52 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
52 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
53 | 53 | $this->setClass("ui icon search input"); |
54 | 54 | $input=new HtmlInput("search-".$this->identifier); |
55 | - if(isset($placeholder)) |
|
55 | + if (isset($placeholder)) |
|
56 | 56 | $input->setProperty("placeholder", $placeholder); |
57 | 57 | $this->content=$input; |
58 | - if(isset($icon)) |
|
58 | + if (isset($icon)) |
|
59 | 59 | $this->addIcon($icon); |
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setContent($content){ |
|
64 | - if($content==="-"){ |
|
63 | + public function setContent($content) { |
|
64 | + if ($content==="-") { |
|
65 | 65 | $this->asDivider(); |
66 | - }elseif($content==="-search-"){ |
|
67 | - $values=\explode(",",$content,-1); |
|
68 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
66 | + }elseif ($content==="-search-") { |
|
67 | + $values=\explode(",", $content, -1); |
|
68 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
69 | 69 | }else |
70 | 70 | parent::setContent($content); |
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function asDivider(){ |
|
74 | + public function asDivider() { |
|
75 | 75 | $this->content=NULL; |
76 | 76 | $this->setClass("divider"); |
77 | 77 | } |
78 | 78 | |
79 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
79 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
80 | 80 | $this->setClass("header"); |
81 | 81 | $this->content=$caption; |
82 | - if(isset($icon)) |
|
83 | - $this->addIcon($icon,true); |
|
82 | + if (isset($icon)) |
|
83 | + $this->addIcon($icon, true); |
|
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
88 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
87 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
88 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
89 | 89 | } |
90 | 90 | |
91 | - public static function divider($placeholder=NULL,$icon=NULL){ |
|
91 | + public static function divider($placeholder=NULL, $icon=NULL) { |
|
92 | 92 | return (new HtmlDropdownItem(""))->asDivider(); |
93 | 93 | } |
94 | 94 | |
95 | - public static function header($caption=NULL,$icon=NULL){ |
|
96 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
95 | + public static function header($caption=NULL, $icon=NULL) { |
|
96 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | \ No newline at end of file |
@@ -14,10 +14,12 @@ discard block |
||
14 | 14 | parent::__construct($identifier, "div"); |
15 | 15 | $this->setClass("item"); |
16 | 16 | $this->setContent($content); |
17 | - if($value!==NULL) |
|
18 | - $this->setData($value); |
|
19 | - if($image!==NULL) |
|
20 | - $this->asMiniAvatar($image); |
|
17 | + if($value!==NULL) { |
|
18 | + $this->setData($value); |
|
19 | + } |
|
20 | + if($image!==NULL) { |
|
21 | + $this->asMiniAvatar($image); |
|
22 | + } |
|
21 | 23 | } |
22 | 24 | |
23 | 25 | public function setDescription($description){ |
@@ -33,8 +35,9 @@ discard block |
||
33 | 35 | |
34 | 36 | public function asOption(){ |
35 | 37 | $this->tagName="option"; |
36 | - if($this->getProperty("data-value")!==null) |
|
37 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
38 | + if($this->getProperty("data-value")!==null) { |
|
39 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
40 | + } |
|
38 | 41 | } |
39 | 42 | |
40 | 43 | /** |
@@ -52,22 +55,25 @@ discard block |
||
52 | 55 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
53 | 56 | $this->setClass("ui icon search input"); |
54 | 57 | $input=new HtmlInput("search-".$this->identifier); |
55 | - if(isset($placeholder)) |
|
56 | - $input->setProperty("placeholder", $placeholder); |
|
58 | + if(isset($placeholder)) { |
|
59 | + $input->setProperty("placeholder", $placeholder); |
|
60 | + } |
|
57 | 61 | $this->content=$input; |
58 | - if(isset($icon)) |
|
59 | - $this->addIcon($icon); |
|
62 | + if(isset($icon)) { |
|
63 | + $this->addIcon($icon); |
|
64 | + } |
|
60 | 65 | return $this; |
61 | 66 | } |
62 | 67 | |
63 | 68 | public function setContent($content){ |
64 | 69 | if($content==="-"){ |
65 | 70 | $this->asDivider(); |
66 | - }elseif($content==="-search-"){ |
|
71 | + } elseif($content==="-search-"){ |
|
67 | 72 | $values=\explode(",",$content,-1); |
68 | 73 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
69 | - }else |
|
70 | - parent::setContent($content); |
|
74 | + } else { |
|
75 | + parent::setContent($content); |
|
76 | + } |
|
71 | 77 | return $this; |
72 | 78 | } |
73 | 79 | |
@@ -79,8 +85,9 @@ discard block |
||
79 | 85 | public function asHeader($caption=NULL,$icon=NULL){ |
80 | 86 | $this->setClass("header"); |
81 | 87 | $this->content=$caption; |
82 | - if(isset($icon)) |
|
83 | - $this->addIcon($icon,true); |
|
88 | + if(isset($icon)) { |
|
89 | + $this->addIcon($icon,true); |
|
90 | + } |
|
84 | 91 | return $this; |
85 | 92 | } |
86 | 93 |
@@ -11,6 +11,10 @@ discard block |
||
11 | 11 | |
12 | 12 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
13 | 13 | use IconTrait; |
14 | + |
|
15 | + /** |
|
16 | + * @param string $identifier |
|
17 | + */ |
|
14 | 18 | public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
15 | 19 | parent::__construct($identifier, "a"); |
16 | 20 | $this->setClass("item"); |
@@ -61,6 +65,9 @@ discard block |
||
61 | 65 | return $this; |
62 | 66 | } |
63 | 67 | |
68 | + /** |
|
69 | + * @param string $content |
|
70 | + */ |
|
64 | 71 | public function setContent($content){ |
65 | 72 | if($content==="-"){ |
66 | 73 | $this->asDivider(); |
@@ -2,21 +2,21 @@ |
||
2 | 2 | namespace Ajax\service; |
3 | 3 | class JString { |
4 | 4 | |
5 | - public static function contains($hay,$needle){ |
|
6 | - return strpos($hay, $needle) !== false; |
|
5 | + public static function contains($hay, $needle) { |
|
6 | + return strpos($hay, $needle)!==false; |
|
7 | 7 | } |
8 | 8 | public static function startswith($hay, $needle) { |
9 | - return substr($hay, 0, strlen($needle)) === $needle; |
|
9 | + return substr($hay, 0, strlen($needle))===$needle; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public static function endswith($hay, $needle) { |
13 | - return substr($hay, -strlen($needle)) === $needle; |
|
13 | + return substr($hay, -strlen($needle))===$needle; |
|
14 | 14 | } |
15 | 15 | |
16 | - public static function isNull($s){ |
|
16 | + public static function isNull($s) { |
|
17 | 17 | return (!isset($s) || NULL===$s || ""===$s); |
18 | 18 | } |
19 | - public static function isNotNull($s){ |
|
19 | + public static function isNotNull($s) { |
|
20 | 20 | return (isset($s) && NULL!==$s && ""!==$s); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -24,38 +24,38 @@ discard block |
||
24 | 24 | $this->setContent($content); |
25 | 25 | } |
26 | 26 | |
27 | - public function addHeader($header){ |
|
27 | + public function addHeader($header) { |
|
28 | 28 | $headerO=$header; |
29 | - if(\is_string($header)){ |
|
30 | - $headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div"); |
|
29 | + if (\is_string($header)) { |
|
30 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
31 | 31 | $headerO->setClass("header"); |
32 | 32 | $headerO->setContent($header); |
33 | 33 | } |
34 | - return $this->addContent($headerO,true); |
|
34 | + return $this->addContent($headerO, true); |
|
35 | 35 | } |
36 | 36 | |
37 | - public function addList($elements,$ordered=false){ |
|
38 | - $list=new HtmlList("list-".$this->identifier,$elements); |
|
37 | + public function addList($elements, $ordered=false) { |
|
38 | + $list=new HtmlList("list-".$this->identifier, $elements); |
|
39 | 39 | $list->setOrdered($ordered); |
40 | 40 | $list->setClass("ui list"); |
41 | 41 | $this->addContent($list); |
42 | 42 | } |
43 | 43 | |
44 | - public function setIcon($icon){ |
|
44 | + public function setIcon($icon) { |
|
45 | 45 | $this->addToProperty("class", "icon"); |
46 | - $this->wrapContent("<div class='content'>","</div>"); |
|
46 | + $this->wrapContent("<div class='content'>", "</div>"); |
|
47 | 47 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
48 | 48 | return $this; |
49 | 49 | } |
50 | 50 | |
51 | - public function addLoader($loaderIcon="notched circle"){ |
|
51 | + public function addLoader($loaderIcon="notched circle") { |
|
52 | 52 | $this->setIcon($loaderIcon); |
53 | 53 | $this->icon->addToIcon("loading"); |
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
57 | - public function setDismissable($dismiss=true){ |
|
58 | - if($dismiss===true) |
|
57 | + public function setDismissable($dismiss=true) { |
|
58 | + if ($dismiss===true) |
|
59 | 59 | $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
60 | 60 | else |
61 | 61 | $this->close=NULL; |
@@ -66,28 +66,28 @@ discard block |
||
66 | 66 | * {@inheritDoc} |
67 | 67 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
68 | 68 | */ |
69 | - public function run(JsUtils $js){ |
|
69 | + public function run(JsUtils $js) { |
|
70 | 70 | parent::run($js); |
71 | - if(isset($this->close)){ |
|
71 | + if (isset($this->close)) { |
|
72 | 72 | $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition('fade')"); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - public function setState($visible=true){ |
|
77 | - $visible=($visible===true)?"visible":"hidden"; |
|
78 | - return $this->addToPropertyCtrl("class", $visible, array("visible","hidden")); |
|
76 | + public function setState($visible=true) { |
|
77 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
78 | + return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden")); |
|
79 | 79 | } |
80 | 80 | |
81 | - public function setVariation($value="floating"){ |
|
82 | - return $this->addToPropertyCtrl("class", $value, array("floating","compact")); |
|
81 | + public function setVariation($value="floating") { |
|
82 | + return $this->addToPropertyCtrl("class", $value, array("floating", "compact")); |
|
83 | 83 | } |
84 | 84 | |
85 | - public function setStyle($style){ |
|
85 | + public function setStyle($style) { |
|
86 | 86 | return $this->addToPropertyCtrl("class", $style, Style::getConstants()); |
87 | 87 | } |
88 | 88 | |
89 | - public function setAttached(HtmlDoubleElement $toElement=NULL){ |
|
90 | - if(isset($toElement)){ |
|
89 | + public function setAttached(HtmlDoubleElement $toElement=NULL) { |
|
90 | + if (isset($toElement)) { |
|
91 | 91 | $toElement->addToProperty("class", "attached"); |
92 | 92 | } |
93 | 93 | return $this->addToProperty("class", "attached"); |
@@ -55,10 +55,11 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public function setDismissable($dismiss=true){ |
58 | - if($dismiss===true) |
|
59 | - $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
60 | - else |
|
61 | - $this->close=NULL; |
|
58 | + if($dismiss===true) { |
|
59 | + $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
60 | + } else { |
|
61 | + $this->close=NULL; |
|
62 | + } |
|
62 | 63 | return $this; |
63 | 64 | } |
64 | 65 |
@@ -13,8 +13,8 @@ |
||
13 | 13 | parent::__construct($identifier, "ul"); |
14 | 14 | $this->addItems($items); |
15 | 15 | } |
16 | - public function setOrdered($ordered=true){ |
|
17 | - $this->tagName=($ordered===true)?"ol":"ul"; |
|
16 | + public function setOrdered($ordered=true) { |
|
17 | + $this->tagName=($ordered===true) ? "ol" : "ul"; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
31 | 31 | } |
32 | 32 | |
33 | - public function setExclusive($value){ |
|
33 | + public function setExclusive($value) { |
|
34 | 34 | return $this->setParam("exclusive", $value); |
35 | 35 | } |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $popup the css selector of the popup |
40 | 40 | * @return \Ajax\semantic\components\Popup |
41 | 41 | */ |
42 | - public function setPopup($popup){ |
|
42 | + public function setPopup($popup) { |
|
43 | 43 | return $this->setParam("popup", $popup); |
44 | 44 | } |
45 | 45 | //TODO other events implementation |
@@ -9,8 +9,9 @@ |
||
9 | 9 | public function __construct($identifier,$width){ |
10 | 10 | parent::__construct($identifier,"div"); |
11 | 11 | $this->setClass("column"); |
12 | - if(isset($width)) |
|
13 | - $this->setWidth($width); |
|
12 | + if(isset($width)) { |
|
13 | + $this->setWidth($width); |
|
14 | + } |
|
14 | 15 | } |
15 | 16 | |
16 | 17 | public function setWidth($width){ |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlGridCol extends HtmlSemDoubleElement{ |
|
15 | +class HtmlGridCol extends HtmlSemDoubleElement { |
|
16 | 16 | use TextAlignmentTrait; |
17 | - public function __construct($identifier,$width){ |
|
18 | - parent::__construct($identifier,"div"); |
|
17 | + public function __construct($identifier, $width) { |
|
18 | + parent::__construct($identifier, "div"); |
|
19 | 19 | $this->setClass("column"); |
20 | - if(isset($width)) |
|
20 | + if (isset($width)) |
|
21 | 21 | $this->setWidth($width); |
22 | 22 | } |
23 | 23 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | * @param int $width |
27 | 27 | * @return \Ajax\semantic\html\content\HtmlGridCol |
28 | 28 | */ |
29 | - public function setWidth($width){ |
|
30 | - if(\is_int($width)){ |
|
29 | + public function setWidth($width) { |
|
30 | + if (\is_int($width)) { |
|
31 | 31 | $width=Wide::getConstants()["W".$width]; |
32 | 32 | } |
33 | 33 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
34 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
34 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | * @param string $value left or right |
40 | 40 | * @return \Ajax\semantic\html\content\HtmlGridCol |
41 | 41 | */ |
42 | - public function setFloated($value="left"){ |
|
42 | + public function setFloated($value="left") { |
|
43 | 43 | return $this->addToProperty("class", $value." floated"); |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | - public function setValue($value){ |
|
47 | + public function setValue($value) { |
|
48 | 48 | $this->content=$value; |
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -14,10 +14,11 @@ |
||
14 | 14 | if(isset($numCols)){ |
15 | 15 | $numCols=min(16,$numCols); |
16 | 16 | $numCols=max(1,$numCols); |
17 | - if($colSizing) |
|
18 | - $width=(int)(16/$numCols); |
|
19 | - else |
|
20 | - $this->_colSize=16/$numCols; |
|
17 | + if($colSizing) { |
|
18 | + $width=(int)(16/$numCols); |
|
19 | + } else { |
|
20 | + $this->_colSize=16/$numCols; |
|
21 | + } |
|
21 | 22 | for ($i=0;$i<$numCols;$i++){ |
22 | 23 | $this->addItem($width); |
23 | 24 | } |
@@ -16,6 +16,10 @@ discard block |
||
16 | 16 | class HtmlGridRow extends HtmlCollection{ |
17 | 17 | |
18 | 18 | private $_colSize; |
19 | + |
|
20 | + /** |
|
21 | + * @param string $identifier |
|
22 | + */ |
|
19 | 23 | public function __construct( $identifier,$numCols=NULL,$colSizing=false){ |
20 | 24 | parent::__construct( $identifier,"div"); |
21 | 25 | $this->setClass("row"); |
@@ -49,7 +53,7 @@ discard block |
||
49 | 53 | /** |
50 | 54 | * return the col at $index |
51 | 55 | * @param int $index |
52 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
56 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
53 | 57 | */ |
54 | 58 | public function getCol($index){ |
55 | 59 | return $this->getItem($index); |
@@ -16,23 +16,23 @@ 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 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
25 | - parent::__construct( $identifier,"div","row"); |
|
24 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
25 | + parent::__construct($identifier, "div", "row"); |
|
26 | 26 | $this->_implicite=$implicite; |
27 | 27 | $width=null; |
28 | - if(isset($numCols)){ |
|
29 | - $numCols=min(16,$numCols); |
|
30 | - $numCols=max(1,$numCols); |
|
31 | - if($colSizing) |
|
32 | - $width=(int)(16/$numCols); |
|
28 | + if (isset($numCols)) { |
|
29 | + $numCols=min(16, $numCols); |
|
30 | + $numCols=max(1, $numCols); |
|
31 | + if ($colSizing) |
|
32 | + $width=(int) (16 / $numCols); |
|
33 | 33 | else |
34 | - $this->_colSize=16/$numCols; |
|
35 | - for ($i=0;$i<$numCols;$i++){ |
|
34 | + $this->_colSize=16 / $numCols; |
|
35 | + for ($i=0; $i<$numCols; $i++) { |
|
36 | 36 | $this->addItem($width); |
37 | 37 | } |
38 | 38 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | * @param int $width |
44 | 44 | * @return \Ajax\semantic\html\content\HtmlGridRow |
45 | 45 | */ |
46 | - public function setWidth($width){ |
|
47 | - if(\is_int($width)){ |
|
46 | + public function setWidth($width) { |
|
47 | + if (\is_int($width)) { |
|
48 | 48 | $width=Wide::getConstants()["W".$width]; |
49 | 49 | } |
50 | 50 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
51 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
51 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param int $index |
57 | 57 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
58 | 58 | */ |
59 | - public function getCol($index){ |
|
59 | + public function getCol($index) { |
|
60 | 60 | return $this->getItem($index); |
61 | 61 | } |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * stretch the row contents to take up the entire column height |
65 | 65 | * @return \Ajax\semantic\html\content\HtmlGridRow |
66 | 66 | */ |
67 | - public function setStretched(){ |
|
67 | + public function setStretched() { |
|
68 | 68 | return $this->addToProperty("class", "stretched"); |
69 | 69 | } |
70 | 70 | |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | * @param string $color |
73 | 73 | * @return \Ajax\semantic\html\content\HtmlGridRow |
74 | 74 | */ |
75 | - public function setColor($color){ |
|
76 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
75 | + public function setColor($color) { |
|
76 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
77 | 77 | } |
78 | 78 | |
79 | - public function setValues($values,$force=false){ |
|
79 | + public function setValues($values, $force=false) { |
|
80 | 80 | $count=$this->count(); |
81 | - if($force===true){ |
|
82 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
83 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
81 | + if ($force===true) { |
|
82 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
83 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
84 | 84 | } |
85 | 85 | } |
86 | - $count=\min(array($this->count(),\sizeof($values))); |
|
87 | - for($i=0;$i<$count;$i++){ |
|
86 | + $count=\min(array($this->count(), \sizeof($values))); |
|
87 | + for ($i=0; $i<$count; $i++) { |
|
88 | 88 | $this->content[$i]->setValue($values[$i]); |
89 | 89 | } |
90 | 90 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | * {@inheritDoc} |
94 | 94 | * @see \Ajax\common\html\HtmlCollection::createItem() |
95 | 95 | */ |
96 | - protected function createItem($value){ |
|
97 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
96 | + protected function createItem($value) { |
|
97 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
98 | 98 | return $col; |
99 | 99 | } |
100 | 100 | |
101 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
102 | - if($this->_implicite===true){ |
|
101 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
102 | + if ($this->_implicite===true) { |
|
103 | 103 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
104 | 104 | } |
105 | - return parent::compile($js,$view); |
|
105 | + return parent::compile($js, $view); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | \ No newline at end of file |
@@ -101,8 +101,9 @@ discard block |
||
101 | 101 | * @return \Ajax\semantic\html\collections\HtmlGrid |
102 | 102 | */ |
103 | 103 | public function setPadded($value=NULL){ |
104 | - if(isset($value)) |
|
105 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
104 | + if(isset($value)) { |
|
105 | + $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
106 | + } |
|
106 | 107 | return $this->addToProperty("class", "padded"); |
107 | 108 | } |
108 | 109 | |
@@ -124,8 +125,9 @@ discard block |
||
124 | 125 | * @see \Ajax\common\html\HtmlCollection::createItem() |
125 | 126 | */ |
126 | 127 | protected function createItem($value){ |
127 | - if($this->_createCols===false) |
|
128 | - $value=null; |
|
128 | + if($this->_createCols===false) { |
|
129 | + $value=null; |
|
130 | + } |
|
129 | 131 | $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing); |
130 | 132 | return $item; |
131 | 133 | } |
@@ -19,6 +19,11 @@ discard block |
||
19 | 19 | private $_createCols; |
20 | 20 | private $_colSizing=true; |
21 | 21 | private $_implicitRows=false; |
22 | + |
|
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + * @param integer $numCols |
|
26 | + */ |
|
22 | 27 | public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
23 | 28 | parent::__construct( $identifier, "div"); |
24 | 29 | $this->_implicitRows=$implicitRows; |
@@ -51,7 +56,7 @@ discard block |
||
51 | 56 | /** |
52 | 57 | * return the row at $index |
53 | 58 | * @param int $index |
54 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
59 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
55 | 60 | */ |
56 | 61 | public function getRow($index){ |
57 | 62 | return $this->getItem($index); |
@@ -15,23 +15,23 @@ discard block |
||
15 | 15 | * @author jc |
16 | 16 | * @version 1.001 |
17 | 17 | */ |
18 | -class HtmlGrid extends HtmlSemCollection{ |
|
18 | +class HtmlGrid extends HtmlSemCollection { |
|
19 | 19 | use TextAlignmentTrait; |
20 | 20 | private $_createCols; |
21 | 21 | private $_colSizing=true; |
22 | 22 | private $_implicitRows=false; |
23 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
24 | - parent::__construct( $identifier, "div","ui grid"); |
|
23 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
24 | + parent::__construct($identifier, "div", "ui grid"); |
|
25 | 25 | $this->_implicitRows=$implicitRows; |
26 | 26 | $this->_createCols=$createCols; |
27 | - if(isset($numCols)){ |
|
27 | + if (isset($numCols)) { |
|
28 | 28 | //if($this->_createCols){ |
29 | 29 | $this->_colSizing=false; |
30 | 30 | //} |
31 | 31 | $cols=Wide::getConstants()["W".$numCols]; |
32 | - $this->addToProperty("class",$cols." column"); |
|
32 | + $this->addToProperty("class", $cols." column"); |
|
33 | 33 | } |
34 | - $this->setNumRows($numRows,$numCols); |
|
34 | + $this->setNumRows($numRows, $numCols); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * @param int $numCols |
41 | 41 | * @return \Ajax\semantic\html\collections\HtmlGrid |
42 | 42 | */ |
43 | - public function setNumRows($numRows,$numCols=NULL){ |
|
43 | + public function setNumRows($numRows, $numCols=NULL) { |
|
44 | 44 | $count=$this->count(); |
45 | - for($i=$count;$i<$numRows;$i++){ |
|
45 | + for ($i=$count; $i<$numRows; $i++) { |
|
46 | 46 | $this->addItem($numCols); |
47 | 47 | } |
48 | 48 | return $this; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $index |
54 | 54 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
55 | 55 | */ |
56 | - public function getRow($index){ |
|
56 | + public function getRow($index) { |
|
57 | 57 | return $this->getItem($index); |
58 | 58 | } |
59 | 59 | |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * @param int $col |
63 | 63 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
64 | 64 | */ |
65 | - public function getCell($row,$col){ |
|
65 | + public function getCell($row, $col) { |
|
66 | 66 | $row=$this->getItem($row); |
67 | - if(isset($row)){ |
|
67 | + if (isset($row)) { |
|
68 | 68 | $col=$row->getItem($col); |
69 | 69 | } |
70 | 70 | return $col; |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @param boolean $vertically |
76 | 76 | * @return \Ajax\semantic\html\collections\HtmlGrid |
77 | 77 | */ |
78 | - public function setDivided($vertically=false){ |
|
79 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
78 | + public function setDivided($vertically=false) { |
|
79 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
80 | 80 | return $this->addToProperty("class", $value); |
81 | 81 | } |
82 | 82 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @param boolean $internal true for internal cells |
86 | 86 | * @return \Ajax\semantic\html\collections\HtmlGrid |
87 | 87 | */ |
88 | - public function setCelled($internal=false){ |
|
89 | - $value=($internal===true)?"internal celled":"celled"; |
|
88 | + public function setCelled($internal=false) { |
|
89 | + $value=($internal===true) ? "internal celled" : "celled"; |
|
90 | 90 | return $this->addToProperty("class", $value); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * automatically resize all elements to split the available width evenly |
95 | 95 | * @return \Ajax\semantic\html\collections\HtmlGrid |
96 | 96 | */ |
97 | - public function setEqualWidth(){ |
|
97 | + public function setEqualWidth() { |
|
98 | 98 | return $this->addToProperty("class", "equal width"); |
99 | 99 | } |
100 | 100 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * @param string $value |
104 | 104 | * @return \Ajax\semantic\html\collections\HtmlGrid |
105 | 105 | */ |
106 | - public function setPadded($value=NULL){ |
|
107 | - if(isset($value)) |
|
108 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
106 | + public function setPadded($value=NULL) { |
|
107 | + if (isset($value)) |
|
108 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
109 | 109 | return $this->addToProperty("class", "padded"); |
110 | 110 | } |
111 | 111 | |
@@ -113,37 +113,37 @@ discard block |
||
113 | 113 | * @param boolean $very |
114 | 114 | * @return \Ajax\semantic\html\collections\HtmlGrid |
115 | 115 | */ |
116 | - public function setRelaxed($very=false){ |
|
117 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
116 | + public function setRelaxed($very=false) { |
|
117 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
118 | 118 | return $this->addToProperty("class", $value); |
119 | 119 | } |
120 | 120 | |
121 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
122 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
121 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
122 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * {@inheritDoc} |
127 | 127 | * @see \Ajax\common\html\HtmlCollection::createItem() |
128 | 128 | */ |
129 | - protected function createItem($value){ |
|
130 | - if($this->_createCols===false) |
|
129 | + protected function createItem($value) { |
|
130 | + if ($this->_createCols===false) |
|
131 | 131 | $value=null; |
132 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
132 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
133 | 133 | return $item; |
134 | 134 | } |
135 | 135 | |
136 | - public function setValues($values){ |
|
136 | + public function setValues($values) { |
|
137 | 137 | $count=$this->count(); |
138 | - if($this->_createCols===false){ |
|
139 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
138 | + if ($this->_createCols===false) { |
|
139 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
140 | 140 | $colSize=\sizeof($values[$i]); |
141 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
141 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
142 | 142 | } |
143 | 143 | } |
144 | - $count=\min(array($this->count(),\sizeof($values))); |
|
145 | - for($i=0;$i<$count;$i++){ |
|
146 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
144 | + $count=\min(array($this->count(), \sizeof($values))); |
|
145 | + for ($i=0; $i<$count; $i++) { |
|
146 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 |