@@ -54,6 +54,9 @@ |
||
54 | 54 | return $this->setParam("keyboard", $value); |
55 | 55 | } |
56 | 56 | |
57 | + /** |
|
58 | + * @param boolean $value |
|
59 | + */ |
|
57 | 60 | public function setDraggable($value) { |
58 | 61 | if ($value) { |
59 | 62 | $this->jsCodes ["draggable"]=new Draggable(); |
@@ -19,6 +19,10 @@ discard block |
||
19 | 19 | protected $attr; |
20 | 20 | |
21 | 21 | |
22 | + /** |
|
23 | + * @param string $identifier |
|
24 | + * @param string $tagName |
|
25 | + */ |
|
22 | 26 | public function __construct($identifier,$tagName){ |
23 | 27 | parent::__construct($identifier,$tagName); |
24 | 28 | $this->root=""; |
@@ -29,7 +33,6 @@ discard block |
||
29 | 33 | * Associate an ajax get to the elements, displayed in $targetSelector |
30 | 34 | * $attr member is used to build each element url |
31 | 35 | * @param string $targetSelector the target of the get |
32 | - * @param string $attr the html attribute used to build the elements url |
|
33 | 36 | * @return HtmlNavElement |
34 | 37 | */ |
35 | 38 | public function autoGetOnClick($targetSelector){ |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | protected $attr; |
20 | 20 | |
21 | 21 | |
22 | - public function __construct($identifier,$tagName){ |
|
23 | - parent::__construct($identifier,$tagName); |
|
22 | + public function __construct($identifier, $tagName) { |
|
23 | + parent::__construct($identifier, $tagName); |
|
24 | 24 | $this->root=""; |
25 | 25 | $this->attr="data-ajax"; |
26 | 26 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | * @param string $attr the html attribute used to build the elements url |
33 | 33 | * @return HtmlNavElement |
34 | 34 | */ |
35 | - public function autoGetOnClick($targetSelector){ |
|
36 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
35 | + public function autoGetOnClick($targetSelector) { |
|
36 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
37 | 37 | } |
38 | 38 | |
39 | - public function contentAsString(){ |
|
39 | + public function contentAsString() { |
|
40 | 40 | return implode("", $this->content); |
41 | 41 | } |
42 | 42 | |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * Generate the jquery script to set the elements to the HtmlNavElement |
45 | 45 | * @param JsUtils $jsUtils |
46 | 46 | */ |
47 | - public function jsSetContent(JsUtils $jsUtils){ |
|
48 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
47 | + public function jsSetContent(JsUtils $jsUtils) { |
|
48 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function getRoot() { |
52 | 52 | return $this->root; |
53 | 53 | } |
54 | 54 | public function setRoot($root) { |
55 | - $this->root = $root; |
|
55 | + $this->root=$root; |
|
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | public function getAttr() { |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | * @return HtmlNavElement |
66 | 66 | */ |
67 | 67 | public function setAttr($attr) { |
68 | - $this->attr = $attr; |
|
68 | + $this->attr=$attr; |
|
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
72 | 72 | public function __call($method, $args) { |
73 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
73 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
74 | 74 | return call_user_func_array( |
75 | 75 | $this->$method, |
76 | 76 | $args |
@@ -78,6 +78,6 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - public abstract function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0); |
|
81 | + public abstract function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -14,6 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
16 | 16 | private $cols; |
17 | + |
|
18 | + /** |
|
19 | + * @param string $identifier |
|
20 | + * @param integer $numCols |
|
21 | + */ |
|
17 | 22 | public function __construct($identifier,$numCols=NULL){ |
18 | 23 | parent::__construct($identifier,"div"); |
19 | 24 | $this->setProperty("class", "row"); |
@@ -86,6 +91,11 @@ discard block |
||
86 | 91 | $this->delete($size,$start+1, $width); |
87 | 92 | } |
88 | 93 | } |
94 | + |
|
95 | + /** |
|
96 | + * @param integer $start |
|
97 | + * @param integer $width |
|
98 | + */ |
|
89 | 99 | public function delete($size=CssSize::SIZE_MD,$start,$width){ |
90 | 100 | while($start<sizeof($this->cols)+1 && $width>0){ |
91 | 101 | $col=$this->getColAt($start,false); |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Ajax\bootstrap\html\base\CssSize; |
5 | 5 | use Ajax\JsUtils; |
6 | - |
|
7 | 6 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
8 | 7 | |
9 | 8 | /** |
@@ -14,89 +14,89 @@ |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
16 | 16 | private $cols; |
17 | - public function __construct($identifier,$numCols=NULL){ |
|
18 | - parent::__construct($identifier,"div"); |
|
17 | + public function __construct($identifier, $numCols=NULL) { |
|
18 | + parent::__construct($identifier, "div"); |
|
19 | 19 | $this->setProperty("class", "row"); |
20 | 20 | $this->cols=array(); |
21 | - if(isset($numCols)){ |
|
22 | - $numCols=min(12,$numCols); |
|
23 | - $numCols=max(1,$numCols); |
|
21 | + if (isset($numCols)) { |
|
22 | + $numCols=min(12, $numCols); |
|
23 | + $numCols=max(1, $numCols); |
|
24 | 24 | $width=12/$numCols; |
25 | - for ($i=0;$i<$numCols;$i++){ |
|
26 | - $this->addCol(CssSize::SIZE_MD,$width); |
|
25 | + for ($i=0; $i<$numCols; $i++) { |
|
26 | + $this->addCol(CssSize::SIZE_MD, $width); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - public function addCol($size=CssSize::SIZE_MD,$width=1){ |
|
32 | - $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1),$size,$width); |
|
31 | + public function addCol($size=CssSize::SIZE_MD, $width=1) { |
|
32 | + $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1), $size, $width); |
|
33 | 33 | $this->cols[]=$col; |
34 | 34 | return $col; |
35 | 35 | } |
36 | 36 | |
37 | - public function addColAt($size=CssSize::SIZE_MD,$width=1,$offset=1){ |
|
38 | - $col=$this->addCol($size,$width); |
|
39 | - return $col->setOffset($size, max($offset,sizeof($this->cols)+1)); |
|
37 | + public function addColAt($size=CssSize::SIZE_MD, $width=1, $offset=1) { |
|
38 | + $col=$this->addCol($size, $width); |
|
39 | + return $col->setOffset($size, max($offset, sizeof($this->cols)+1)); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function getCol($index,$force=true){ |
|
42 | + public function getCol($index, $force=true) { |
|
43 | 43 | $result=null; |
44 | - if($index<sizeof($this->cols)+1){ |
|
44 | + if ($index<sizeof($this->cols)+1) { |
|
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
47 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
46 | + } else if ($force) { |
|
47 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
48 | 48 | } |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public function getColAt($offset,$force=true){ |
|
52 | + public function getColAt($offset, $force=true) { |
|
53 | 53 | $result=null; |
54 | - foreach ($this->cols as $col){ |
|
54 | + foreach ($this->cols as $col) { |
|
55 | 55 | $offsets=$col->getOffsets(); |
56 | - if($result=array_search($offset, $offsets)){ |
|
56 | + if ($result=array_search($offset, $offsets)) { |
|
57 | 57 | break; |
58 | 58 | } |
59 | 59 | } |
60 | - if(!$result || isset($result)==false){ |
|
61 | - $result=$this->getCol($offset,$force); |
|
60 | + if (!$result || isset($result)==false) { |
|
61 | + $result=$this->getCol($offset, $force); |
|
62 | 62 | } |
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | |
66 | 66 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
67 | 67 | |
68 | - foreach ($this->cols as $col){ |
|
68 | + foreach ($this->cols as $col) { |
|
69 | 69 | $this->addContent($col); |
70 | 70 | } |
71 | - return parent::compile($js,$view); |
|
71 | + return parent::compile($js, $view); |
|
72 | 72 | } |
73 | 73 | public function getCols() { |
74 | 74 | return $this->cols; |
75 | 75 | } |
76 | 76 | |
77 | - public function setContentForAll($content){ |
|
78 | - foreach ($this->cols as $col){ |
|
77 | + public function setContentForAll($content) { |
|
78 | + foreach ($this->cols as $col) { |
|
79 | 79 | $col->setContent($content); |
80 | 80 | } |
81 | 81 | } |
82 | - public function merge($size=CssSize::SIZE_MD,$start,$width){ |
|
83 | - $col=$this->getColAt($start,false); |
|
84 | - if(isset($col)){ |
|
85 | - $col->setWidth($size,$width+1); |
|
86 | - $this->delete($size,$start+1, $width); |
|
82 | + public function merge($size=CssSize::SIZE_MD, $start, $width) { |
|
83 | + $col=$this->getColAt($start, false); |
|
84 | + if (isset($col)) { |
|
85 | + $col->setWidth($size, $width+1); |
|
86 | + $this->delete($size, $start+1, $width); |
|
87 | 87 | } |
88 | 88 | } |
89 | - public function delete($size=CssSize::SIZE_MD,$start,$width){ |
|
90 | - while($start<sizeof($this->cols)+1 && $width>0){ |
|
91 | - $col=$this->getColAt($start,false); |
|
92 | - if(isset($col)){ |
|
89 | + public function delete($size=CssSize::SIZE_MD, $start, $width) { |
|
90 | + while ($start<sizeof($this->cols)+1 && $width>0) { |
|
91 | + $col=$this->getColAt($start, false); |
|
92 | + if (isset($col)) { |
|
93 | 93 | $widthCol=$col->getWidth($size); |
94 | - if($widthCol<=$width){ |
|
94 | + if ($widthCol<=$width) { |
|
95 | 95 | unset($this->cols[$start-1]); |
96 | - $this->cols = array_values($this->cols); |
|
96 | + $this->cols=array_values($this->cols); |
|
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + } else { |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $result=null; |
44 | 44 | if($index<sizeof($this->cols)+1){ |
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force){ |
|
47 | 47 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
48 | 48 | } |
49 | 49 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->cols = array_values($this->cols); |
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + } else{ |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -14,6 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class HtmlAccordion extends HtmlBsDoubleElement { |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $identifier |
|
19 | + */ |
|
17 | 20 | public function __construct($identifier, $tagName="div") { |
18 | 21 | parent::__construct($identifier, $tagName); |
19 | 22 | $this->setClass("panel-group"); |
@@ -22,6 +25,9 @@ discard block |
||
22 | 25 | $this->content=array (); |
23 | 26 | } |
24 | 27 | |
28 | + /** |
|
29 | + * @param string $title |
|
30 | + */ |
|
25 | 31 | public function addPanel($title, $content) { |
26 | 32 | $nb=sizeof($this->content)+1; |
27 | 33 | $panel=new HtmlPanel("panel-".$this->identifier."-".$nb); |
@@ -50,14 +50,14 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * render the content of $controller::$action and set the response to a new panel |
|
54 | - * @param JsUtils $js |
|
55 | - * @param string $title The panel title |
|
56 | - * @param Controller $initialController |
|
57 | - * @param string $controller a Phalcon controller |
|
58 | - * @param string $action a Phalcon action |
|
59 | - * @param array $params |
|
60 | - */ |
|
53 | + * render the content of $controller::$action and set the response to a new panel |
|
54 | + * @param JsUtils $js |
|
55 | + * @param string $title The panel title |
|
56 | + * @param Controller $initialController |
|
57 | + * @param string $controller a Phalcon controller |
|
58 | + * @param string $action a Phalcon action |
|
59 | + * @param array $params |
|
60 | + */ |
|
61 | 61 | public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
62 | 62 | return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
63 | 63 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->setClass("panel-group"); |
20 | 20 | $this->setRole("tablist"); |
21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
22 | - $this->content=array (); |
|
22 | + $this->content=array(); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addPanel($title, $content) { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param string $viewName |
46 | 46 | * @param $params The parameters to pass to the view |
47 | 47 | */ |
48 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
49 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
48 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
49 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * @param string $action a Phalcon action |
59 | 59 | * @param array $params |
60 | 60 | */ |
61 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
62 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
61 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
62 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function run(JsUtils $js) { |
66 | - foreach ( $this->content as $content ) { |
|
66 | + foreach ($this->content as $content) { |
|
67 | 67 | $content->run($js); |
68 | 68 | } |
69 | 69 | } |
@@ -69,7 +69,8 @@ |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | public function getPanel($index) { |
72 | - if ($index<sizeof($this->content)) |
|
73 | - return $this->content [$index]; |
|
72 | + if ($index<sizeof($this->content)) { |
|
73 | + return $this->content [$index]; |
|
74 | + } |
|
74 | 75 | } |
75 | 76 | } |
76 | 77 | \ No newline at end of file |
@@ -49,6 +49,9 @@ |
||
49 | 49 | $element->setStyle($value); |
50 | 50 | } |
51 | 51 | |
52 | + /** |
|
53 | + * @param HtmlDropdown $bt |
|
54 | + */ |
|
52 | 55 | private function dropdownAsButton($bt) { |
53 | 56 | $this->addExistingDropDown($bt); |
54 | 57 | $bt->setTagName("button"); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return HtmlButtongroups default : "" |
36 | 36 | */ |
37 | 37 | public function setSize($size) { |
38 | - foreach ( $this->elements as $element ) { |
|
38 | + foreach ($this->elements as $element) { |
|
39 | 39 | $element->setSize($size); |
40 | 40 | } |
41 | 41 | if (is_int($size)) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function setStyle($value) { |
48 | - foreach ( $this->elements as $element ) |
|
48 | + foreach ($this->elements as $element) |
|
49 | 49 | $element->setStyle($value); |
50 | 50 | } |
51 | 51 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function addElement($element) { |
66 | 66 | $result=$element; |
67 | 67 | $iid=sizeof($this->elements)+1; |
68 | - if (($element instanceof HtmlDropdown)||($element instanceof HtmlSplitbutton)) { |
|
68 | + if (($element instanceof HtmlDropdown) || ($element instanceof HtmlSplitbutton)) { |
|
69 | 69 | $this->addExistingDropDown($element); |
70 | 70 | $this->elements[]=$element; |
71 | 71 | } elseif ($element instanceof HtmlButton) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | public function addElements($elements) { |
97 | - foreach ( $elements as $element ) { |
|
97 | + foreach ($elements as $element) { |
|
98 | 98 | $this->addElement($element); |
99 | 99 | } |
100 | 100 | return $this; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } else |
115 | 115 | $value="btn-group-".$value; |
116 | 116 | if (strstr($value, "justified")) { |
117 | - foreach ( $this->elements as $element ) { |
|
117 | + foreach ($this->elements as $element) { |
|
118 | 118 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
119 | 119 | } |
120 | 120 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
146 | 146 | */ |
147 | 147 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
148 | - foreach ( $this->elements as $element ) { |
|
148 | + foreach ($this->elements as $element) { |
|
149 | 149 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
150 | 150 | } |
151 | 151 | return $this; |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function setStyle($value) { |
48 | - foreach ( $this->elements as $element ) |
|
49 | - $element->setStyle($value); |
|
48 | + foreach ( $this->elements as $element ) { |
|
49 | + $element->setStyle($value); |
|
50 | + } |
|
50 | 51 | } |
51 | 52 | |
52 | 53 | private function dropdownAsButton($bt) { |
@@ -71,16 +72,18 @@ discard block |
||
71 | 72 | } elseif ($element instanceof HtmlButton) { |
72 | 73 | $this->elements[]=$element; |
73 | 74 | } elseif (is_array($element)) { |
74 | - if (array_key_exists("glyph", $element)) |
|
75 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
76 | - elseif (array_key_exists("btnCaption", $element)) { |
|
77 | - if (array_key_exists("split", $element)) |
|
78 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
79 | - else |
|
80 | - $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
75 | + if (array_key_exists("glyph", $element)) { |
|
76 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
77 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
78 | + if (array_key_exists("split", $element)) { |
|
79 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
80 | + } else { |
|
81 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
82 | + } |
|
81 | 83 | $this->dropdownAsButton($bt); |
82 | - } else |
|
83 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
84 | + } else { |
|
85 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
86 | + } |
|
84 | 87 | $bt->fromArray($element); |
85 | 88 | $this->elements[]=$bt; |
86 | 89 | $result=$bt; |
@@ -111,8 +114,9 @@ discard block |
||
111 | 114 | public function setAlignment($value) { |
112 | 115 | if (is_int($value)) { |
113 | 116 | $value=CssRef::alignment("btn-group")[$value]; |
114 | - } else |
|
115 | - $value="btn-group-".$value; |
|
117 | + } else { |
|
118 | + $value="btn-group-".$value; |
|
119 | + } |
|
116 | 120 | if (strstr($value, "justified")) { |
117 | 121 | foreach ( $this->elements as $element ) { |
118 | 122 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -127,9 +131,9 @@ discard block |
||
127 | 131 | * @return HtmlButton |
128 | 132 | */ |
129 | 133 | public function getElement($index) { |
130 | - if (is_int($index)) |
|
131 | - return $this->elements[$index]; |
|
132 | - else { |
|
134 | + if (is_int($index)) { |
|
135 | + return $this->elements[$index]; |
|
136 | + } else { |
|
133 | 137 | $elm=$this->getElementById($index, $this->elements); |
134 | 138 | return $elm; |
135 | 139 | } |
@@ -12,6 +12,11 @@ discard block |
||
12 | 12 | |
13 | 13 | class HtmlButtontoolbar extends HtmlButtongroups { |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $identifier |
|
17 | + * @param string $cssStyle |
|
18 | + * @param string $size |
|
19 | + */ |
|
15 | 20 | public function __construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div") { |
16 | 21 | parent::__construct($identifier, $elements, $cssStyle, $size, $tagName); |
17 | 22 | $this->setClass("btn-toolbar"); |
@@ -57,7 +62,7 @@ discard block |
||
57 | 62 | |
58 | 63 | /** |
59 | 64 | * return the Buttongroups at position $index |
60 | - * @return \Ajax\bootstrap\html\HtmlButtongroups |
|
65 | + * @return HtmlButton |
|
61 | 66 | */ |
62 | 67 | public function getGroup($index) { |
63 | 68 | return parent::getElement($index); |
@@ -79,15 +79,15 @@ |
||
79 | 79 | $element=null; |
80 | 80 | $i=0; |
81 | 81 | if (is_int($index)) { |
82 | - $elements=array (); |
|
83 | - foreach ( $this->elements as $group ) { |
|
82 | + $elements=array(); |
|
83 | + foreach ($this->elements as $group) { |
|
84 | 84 | $elements=array_merge($elements, $group->getElements()); |
85 | 85 | } |
86 | 86 | if ($index<sizeof($elements)) { |
87 | 87 | $element=$elements [$index]; |
88 | 88 | } |
89 | 89 | } else { |
90 | - while ( $element==null&&$i<sizeof($this->elements) ) { |
|
90 | + while ($element==null && $i<sizeof($this->elements)) { |
|
91 | 91 | $element=$this->elements [$i]->getElement($index); |
92 | 92 | $i++; |
93 | 93 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | private function getLastButtonGroup() { |
48 | 48 | $nb=sizeof($this->elements); |
49 | - if ($nb>0) |
|
50 | - $bg=$this->elements [$nb-1]; |
|
51 | - else { |
|
49 | + if ($nb>0) { |
|
50 | + $bg=$this->elements [$nb-1]; |
|
51 | + } else { |
|
52 | 52 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
53 | 53 | $this->elements []=$bg; |
54 | 54 | } |
@@ -66,8 +66,9 @@ discard block |
||
66 | 66 | public function getLastGroup() { |
67 | 67 | $bg=null; |
68 | 68 | $nb=sizeof($this->elements); |
69 | - if ($nb>0) |
|
70 | - $bg=$this->elements [$nb-1]; |
|
69 | + if ($nb>0) { |
|
70 | + $bg=$this->elements [$nb-1]; |
|
71 | + } |
|
71 | 72 | return $bg; |
72 | 73 | } |
73 | 74 |
@@ -23,6 +23,9 @@ discard block |
||
23 | 23 | protected $_base=""; |
24 | 24 | protected $_glyphs=array (); |
25 | 25 | |
26 | + /** |
|
27 | + * @param string $identifier |
|
28 | + */ |
|
26 | 29 | public function __construct($identifier, $images=NULL) { |
27 | 30 | parent::__construct($identifier); |
28 | 31 | $this->_template=include 'templates/tplCarousel.php'; |
@@ -61,7 +64,7 @@ discard block |
||
61 | 64 | * |
62 | 65 | * @param string $caption |
63 | 66 | * @param string $sens |
64 | - * @return HtmlCarouselControl|string |
|
67 | + * @return HtmlCarouselControl |
|
65 | 68 | */ |
66 | 69 | private function createControl($caption="next", $sens="left") { |
67 | 70 | $control=new HtmlCarouselControl($sens."-ctrl-".$this->identifier); |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Ajax\bootstrap\html\base\CssRef; |
8 | 8 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
9 | 9 | use Ajax\bootstrap\html\content\HtmlCarouselItem; |
10 | - |
|
11 | 10 | use Ajax\common\html\BaseHtml; |
12 | 11 | /** |
13 | 12 | * Composant Twitter Bootstrap Carousel |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | * @version 1.001 |
17 | 17 | */ |
18 | 18 | class HtmlCarousel extends BaseHtml { |
19 | - protected $indicators=array (); |
|
20 | - protected $slides=array (); |
|
19 | + protected $indicators=array(); |
|
20 | + protected $slides=array(); |
|
21 | 21 | protected $leftControl=""; |
22 | 22 | protected $rightControl=""; |
23 | 23 | protected $_base=""; |
24 | - protected $_glyphs=array (); |
|
24 | + protected $_glyphs=array(); |
|
25 | 25 | |
26 | 26 | public function __construct($identifier, $images=NULL) { |
27 | 27 | parent::__construct($identifier); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setBase($_base) { |
41 | - foreach ($this->slides as $slide){ |
|
41 | + foreach ($this->slides as $slide) { |
|
42 | 42 | $imgSrc=$slide->getImageSrc(); |
43 | 43 | $slide->setImageSrc(str_replace($this->_base.$imgSrc, $_base.$imgSrc, $imgSrc)); |
44 | 44 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
96 | - if(is_array($imageSrc)){ |
|
97 | - $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
|
98 | - }else{ |
|
96 | + if (is_array($imageSrc)) { |
|
97 | + $this->addImage($imageSrc[0], @$imageSrc[1], @$imageSrc[2], @$imageSrc[3]); |
|
98 | + } else { |
|
99 | 99 | $image=new HtmlCarouselItem("item-".$this->identifier); |
100 | 100 | $image->setImageSrc($this->_base.$imageSrc); |
101 | 101 | $image->setImageAlt($imageAlt); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function fromArray($array) { |
120 | 120 | if (is_array($array) && sizeof($array)>0) { |
121 | - foreach ( $array as $value ) { |
|
121 | + foreach ($array as $value) { |
|
122 | 122 | if (is_array($value)) { |
123 | 123 | $this->addImage($value ["src"], @$value ["alt"], @$value ["caption"], @$value ["description"]); |
124 | 124 | } else { |
@@ -75,27 +75,30 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | private function getGlyph($sens="left") { |
78 | - if (array_key_exists($sens, $this->_glyphs)) |
|
79 | - return $this->_glyphs [$sens]; |
|
78 | + if (array_key_exists($sens, $this->_glyphs)) { |
|
79 | + return $this->_glyphs [$sens]; |
|
80 | + } |
|
80 | 81 | return "glyphicon-chevron-".$sens; |
81 | 82 | } |
82 | 83 | |
83 | 84 | public function setRightGlyph($glyphicon) { |
84 | 85 | $glyphs=CssRef::glyphIcons(); |
85 | - if (array_search($glyphicon, $glyphs)!==false) |
|
86 | - $this->_glyphs ["right"]=$glyphicon; |
|
86 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
87 | + $this->_glyphs ["right"]=$glyphicon; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | public function setLeftGlyph($glyphicon) { |
90 | 92 | $glyphs=CssRef::glyphIcons(); |
91 | - if (array_search($glyphicon, $glyphs)!==false) |
|
92 | - $this->_glyphs ["left"]=$glyphicon; |
|
93 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
94 | + $this->_glyphs ["left"]=$glyphicon; |
|
95 | + } |
|
93 | 96 | } |
94 | 97 | |
95 | 98 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
96 | 99 | if(is_array($imageSrc)){ |
97 | 100 | $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
98 | - }else{ |
|
101 | + } else{ |
|
99 | 102 | $image=new HtmlCarouselItem("item-".$this->identifier); |
100 | 103 | $image->setImageSrc($this->_base.$imageSrc); |
101 | 104 | $image->setImageAlt($imageAlt); |
@@ -22,6 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * |
24 | 24 | * @param string $identifier the id |
25 | + * @param string $cssStyle |
|
25 | 26 | */ |
26 | 27 | public function __construct($identifier, $value="", $items=array(), $cssStyle=null, $onClick=null) { |
27 | 28 | parent::__construct($identifier, "", $cssStyle, $onClick); |
@@ -45,7 +46,7 @@ discard block |
||
45 | 46 | /** |
46 | 47 | * define the button style |
47 | 48 | * avaible values : "btn-default","btn-primary","btn-success","btn-info","btn-warning","btn-danger" |
48 | - * @param string|int $cssStyle |
|
49 | + * @param string $cssStyle |
|
49 | 50 | * @return \Ajax\bootstrap\html\HtmlDropdown default : "btn-default" |
50 | 51 | */ |
51 | 52 | public function setStyle($cssStyle) { |
@@ -149,10 +150,16 @@ discard block |
||
149 | 150 | return $this->items [$index]; |
150 | 151 | } |
151 | 152 | |
153 | + /** |
|
154 | + * @param string $value |
|
155 | + */ |
|
152 | 156 | public function setBtnClass($value) { |
153 | 157 | $this->class=$value; |
154 | 158 | } |
155 | 159 | |
160 | + /** |
|
161 | + * @param string $value |
|
162 | + */ |
|
156 | 163 | public function setMClass($value) { |
157 | 164 | $this->mClass=$value; |
158 | 165 | } |
@@ -183,6 +190,7 @@ discard block |
||
183 | 190 | /** |
184 | 191 | * Sets the tagName's dropdown |
185 | 192 | * @see \Ajax\bootstrap\html\BaseHtml::setTagName() |
193 | + * @param string $tagName |
|
186 | 194 | */ |
187 | 195 | public function setTagName($tagName) { |
188 | 196 | if ($tagName=="button") |
@@ -194,6 +202,9 @@ discard block |
||
194 | 202 | return $this->compile(); |
195 | 203 | } |
196 | 204 | |
205 | + /** |
|
206 | + * @param string $btnCaption |
|
207 | + */ |
|
197 | 208 | public function setBtnCaption($btnCaption) { |
198 | 209 | $this->btnCaption=$btnCaption; |
199 | 210 | return $this; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $class="dropdown-toggle"; |
18 | 18 | protected $mClass="dropdown"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
20 | + protected $items=array(); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @return HtmlDropdownItem |
88 | 88 | */ |
89 | 89 | public function addItem($caption, $href="#") { |
90 | - if($caption instanceof HtmlDropdownItem){ |
|
90 | + if ($caption instanceof HtmlDropdownItem) { |
|
91 | 91 | $item=$caption; |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $iid=$this->getItemsCount()+1; |
94 | 94 | $item=new HtmlDropdownItem($this->identifier."-dropdown-item-".$iid); |
95 | 95 | $item->setCaption($caption)->setHref($href); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | public function addItems($items) { |
110 | 110 | $iid=$this->getItemsCount()+1; |
111 | 111 | if (is_array($items)) { |
112 | - foreach ( $items as $item ) { |
|
112 | + foreach ($items as $item) { |
|
113 | 113 | if (is_string($item)) { |
114 | 114 | $this->addItem($item); |
115 | 115 | } else if (is_array($item)) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | public function setItems($items) { |
139 | - $this->items=array (); |
|
139 | + $this->items=array(); |
|
140 | 140 | $this->addItems($items); |
141 | 141 | } |
142 | 142 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function run(JsUtils $js) { |
173 | 173 | if ($this->getProperty("role")==="nav") { |
174 | - foreach ( $this->items as $dropdownItem ) { |
|
174 | + foreach ($this->items as $dropdownItem) { |
|
175 | 175 | $dropdownItem->runNav($js); |
176 | 176 | } |
177 | 177 | } |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | /* (non-PHPdoc) |
264 | 264 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
265 | 265 | */ |
266 | - public function on($event, $jsCode, $stopPropagation = false, $preventDefault = false) { |
|
267 | - foreach ($this->items as $item){ |
|
268 | - $item->on($event, $jsCode,$stopPropagation,$preventDefault); |
|
266 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
267 | + foreach ($this->items as $item) { |
|
268 | + $item->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function addItem($caption, $href="#") { |
90 | 90 | if($caption instanceof HtmlDropdownItem){ |
91 | 91 | $item=$caption; |
92 | - }else{ |
|
92 | + } else{ |
|
93 | 93 | $iid=$this->getItemsCount()+1; |
94 | 94 | $item=new HtmlDropdownItem($this->identifier."-dropdown-item-".$iid); |
95 | 95 | $item->setCaption($caption)->setHref($href); |
@@ -129,10 +129,11 @@ discard block |
||
129 | 129 | * @see BaseHtml::fromArray() |
130 | 130 | */ |
131 | 131 | public function fromArray($array) { |
132 | - if (array_keys($array)!==range(0, count($array)-1)) |
|
133 | - return parent::fromArray($array); |
|
134 | - else |
|
135 | - return $this->addItems($array); |
|
132 | + if (array_keys($array)!==range(0, count($array)-1)) { |
|
133 | + return parent::fromArray($array); |
|
134 | + } else { |
|
135 | + return $this->addItems($array); |
|
136 | + } |
|
136 | 137 | } |
137 | 138 | |
138 | 139 | public function setItems($items) { |
@@ -185,8 +186,9 @@ discard block |
||
185 | 186 | * @see \Ajax\bootstrap\html\BaseHtml::setTagName() |
186 | 187 | */ |
187 | 188 | public function setTagName($tagName) { |
188 | - if ($tagName=="button") |
|
189 | - $this->class="btn dropdown-toggle"; |
|
189 | + if ($tagName=="button") { |
|
190 | + $this->class="btn dropdown-toggle"; |
|
191 | + } |
|
190 | 192 | return parent::setTagName($tagName); |
191 | 193 | } |
192 | 194 | |
@@ -204,8 +206,9 @@ discard block |
||
204 | 206 | } |
205 | 207 | |
206 | 208 | public function setAlignment($alignment) { |
207 | - if (is_int($alignment)) |
|
208 | - $alignment="dropdown-menu-".CssRef::alignment()[$alignment]; |
|
209 | + if (is_int($alignment)) { |
|
210 | + $alignment="dropdown-menu-".CssRef::alignment()[$alignment]; |
|
211 | + } |
|
209 | 212 | return $this->addToMemberCtrl($this->class, $alignment, CssRef::alignment()); |
210 | 213 | } |
211 | 214 |
@@ -87,6 +87,9 @@ |
||
87 | 87 | return $result; |
88 | 88 | } |
89 | 89 | |
90 | + /** |
|
91 | + * @return string |
|
92 | + */ |
|
90 | 93 | private function getPrefix($element) { |
91 | 94 | $result="input_text"; |
92 | 95 | foreach ( $this->formElementsPrefix as $k => $v ) { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | - |
|
8 | 7 | use Ajax\common\html\html5\HtmlSelect; |
9 | 8 | |
10 | 9 | class HtmlForm extends HtmlBsDoubleElement { |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | public function __construct($identifier) { |
16 | 16 | parent::__construct($identifier, "form"); |
17 | 17 | $this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>'; |
18 | - $this->futureElements=array (); |
|
19 | - $this->formGroups=array (); |
|
18 | + $this->futureElements=array(); |
|
19 | + $this->formGroups=array(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /* |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
27 | 27 | if (isset($js)) { |
28 | 28 | $this->formElementsPrefix=$js->config()->getVar("formElementsPrefix"); |
29 | - foreach ( $this->futureElements as $futureElement ) { |
|
29 | + foreach ($this->futureElements as $futureElement) { |
|
30 | 30 | $futureElementValue=$this->getPrefix($futureElement); |
31 | 31 | $futureElementValues=explode("_", $futureElementValue); |
32 | - switch($futureElementValues [0]) { |
|
32 | + switch ($futureElementValues [0]) { |
|
33 | 33 | case "input": |
34 | 34 | $control=new HtmlInput($futureElement); |
35 | 35 | $control->setClass("form-control"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->addElement($control); |
62 | 62 | } |
63 | 63 | } |
64 | - foreach ( $this->formGroups as $group ) { |
|
64 | + foreach ($this->formGroups as $group) { |
|
65 | 65 | $this->addContent($group); |
66 | 66 | } |
67 | 67 | return parent::compile($js, $view); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | private function getPrefix($element) { |
91 | 91 | $result="input_text"; |
92 | - foreach ( $this->formElementsPrefix as $k => $v ) { |
|
92 | + foreach ($this->formElementsPrefix as $k => $v) { |
|
93 | 93 | if (Text::startsWith($element, $k)) { |
94 | 94 | $result=$v; |
95 | 95 | break; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | public function getElement($name) { |
121 | 121 | $element=null; |
122 | - foreach ( $this->formGroups as $group ) { |
|
122 | + foreach ($this->formGroups as $group) { |
|
123 | 123 | } |
124 | 124 | return $element; |
125 | 125 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray() |
130 | 130 | */ |
131 | 131 | public function fromArray($array) { |
132 | - foreach ( $array as $value ) { |
|
132 | + foreach ($array as $value) { |
|
133 | 133 | if (is_string($value)) { |
134 | 134 | $this->futureElements []=$value; |
135 | 135 | } |
@@ -99,8 +99,9 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | public function addGroup($identifier="") { |
102 | - if ($identifier==="") |
|
103 | - $identifier="form-".$this->identifier; |
|
102 | + if ($identifier==="") { |
|
103 | + $identifier="form-".$this->identifier; |
|
104 | + } |
|
104 | 105 | $group=new HtmlBsDoubleElement($identifier); |
105 | 106 | $group->setTagName("div"); |
106 | 107 | $group->setClass("form-group"); |