@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | class HtmlList extends HtmlSemCollection{ |
11 | 11 | protected $_hasCheckedList; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $identifier |
|
15 | + */ |
|
13 | 16 | public function __construct( $identifier, $items=array()){ |
14 | 17 | parent::__construct( $identifier, "div", "ui list"); |
15 | 18 | $this->addItems($items); |
@@ -27,6 +30,9 @@ discard block |
||
27 | 30 | return $item; |
28 | 31 | } |
29 | 32 | |
33 | + /** |
|
34 | + * @param integer $niveau |
|
35 | + */ |
|
30 | 36 | public function addHeader($niveau,$content){ |
31 | 37 | return $this->wrap(new HtmlHeader("header-".$this->identifier,$niveau,$content,"page")); |
32 | 38 | } |
@@ -7,86 +7,86 @@ |
||
7 | 7 | use Ajax\semantic\html\collections\form\HtmlFormCheckbox; |
8 | 8 | use Ajax\JsUtils; |
9 | 9 | |
10 | -class HtmlList extends HtmlSemCollection{ |
|
10 | +class HtmlList extends HtmlSemCollection { |
|
11 | 11 | protected $_hasCheckedList; |
12 | 12 | |
13 | - public function __construct( $identifier, $items=array()){ |
|
14 | - parent::__construct( $identifier, "div", "ui list"); |
|
13 | + public function __construct($identifier, $items=array()) { |
|
14 | + parent::__construct($identifier, "div", "ui list"); |
|
15 | 15 | $this->addItems($items); |
16 | 16 | $this->_hasCheckedList=false; |
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | - protected function createItem($value){ |
|
20 | + protected function createItem($value) { |
|
21 | 21 | $count=$this->count(); |
22 | - if(\is_array($value)){ |
|
22 | + if (\is_array($value)) { |
|
23 | 23 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
24 | 24 | $item->addIcon($value[1]); |
25 | 25 | }else |
26 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
26 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
27 | 27 | return $item; |
28 | 28 | } |
29 | 29 | |
30 | - public function addHeader($niveau,$content){ |
|
31 | - return $this->wrap(new HtmlHeader("header-".$this->identifier,$niveau,$content,"page")); |
|
30 | + public function addHeader($niveau, $content) { |
|
31 | + return $this->wrap(new HtmlHeader("header-".$this->identifier, $niveau, $content, "page")); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function itemsAs($tagName){ |
|
34 | + public function itemsAs($tagName) { |
|
35 | 35 | return $this->contentAs($tagName); |
36 | 36 | } |
37 | 37 | |
38 | - public function asLink(){ |
|
38 | + public function asLink() { |
|
39 | 39 | $this->addToPropertyCtrl("class", "link", array("link")); |
40 | 40 | return $this->contentAs("a"); |
41 | 41 | } |
42 | 42 | |
43 | - public function addList($items=array()){ |
|
44 | - $list=new HtmlList("",$items); |
|
43 | + public function addList($items=array()) { |
|
44 | + $list=new HtmlList("", $items); |
|
45 | 45 | $list->setClass("list"); |
46 | 46 | return $this->addItem($list); |
47 | 47 | } |
48 | 48 | |
49 | - public function setCelled(){ |
|
49 | + public function setCelled() { |
|
50 | 50 | return $this->addToProperty("class", "celled"); |
51 | 51 | } |
52 | 52 | |
53 | - public function run(JsUtils $js){ |
|
54 | - if($this->_hasCheckedList===true){ |
|
53 | + public function run(JsUtils $js) { |
|
54 | + if ($this->_hasCheckedList===true) { |
|
55 | 55 | $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
56 | - $jsCode=\str_replace("%identifier%","#".$this->identifier,$jsCode); |
|
56 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
57 | 57 | $this->executeOnRun($jsCode); |
58 | 58 | } |
59 | 59 | return parent::run($js); |
60 | 60 | } |
61 | 61 | |
62 | - public function setRelaxed(){ |
|
62 | + public function setRelaxed() { |
|
63 | 63 | return $this->addToProperty("class", "relaxed"); |
64 | 64 | } |
65 | 65 | |
66 | - public function addCheckedList($items=array(),$masterItem=NULL,$values=array()){ |
|
66 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
|
67 | 67 | $count=$this->count(); |
68 | 68 | $identifier=$this->identifier."-".$count; |
69 | - if(isset($masterItem)){ |
|
70 | - $masterO=new HtmlFormCheckbox("master-".$identifier,$masterItem); |
|
71 | - $masterO->getField()->addToProperty("class","master"); |
|
69 | + if (isset($masterItem)) { |
|
70 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
71 | + $masterO->getField()->addToProperty("class", "master"); |
|
72 | 72 | $masterO->setClass("item"); |
73 | 73 | $this->addItem($masterO); |
74 | 74 | } |
75 | 75 | $fields=array(); |
76 | 76 | $i=0; |
77 | - foreach ($items as $val=>$caption){ |
|
78 | - $itemO=new HtmlFormCheckbox($identifier."-".$i++,$caption,$val,"child"); |
|
79 | - if(\array_search($val, $values)!==false){ |
|
77 | + foreach ($items as $val=>$caption) { |
|
78 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
79 | + if (\array_search($val, $values)!==false) { |
|
80 | 80 | $itemO->getInput()->getField()->setProperty("checked", ""); |
81 | 81 | } |
82 | 82 | $itemO->setClass("item"); |
83 | 83 | $fields[]=$itemO; |
84 | 84 | } |
85 | - if(isset($masterO)===true){ |
|
86 | - $list=new HtmlList("",$fields); |
|
85 | + if (isset($masterO)===true) { |
|
86 | + $list=new HtmlList("", $fields); |
|
87 | 87 | $list->setClass("list"); |
88 | 88 | $masterO->addContent($list); |
89 | - }else{ |
|
89 | + }else { |
|
90 | 90 | $this->addList($fields); |
91 | 91 | } |
92 | 92 | $this->_hasCheckedList=true; |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | if(\is_array($value)){ |
23 | 23 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
24 | 24 | $item->addIcon($value[1]); |
25 | - }else |
|
26 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
25 | + } else { |
|
26 | + $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
27 | + } |
|
27 | 28 | return $item; |
28 | 29 | } |
29 | 30 | |
@@ -86,7 +87,7 @@ discard block |
||
86 | 87 | $list=new HtmlList("",$fields); |
87 | 88 | $list->setClass("list"); |
88 | 89 | $masterO->addContent($list); |
89 | - }else{ |
|
90 | + } else{ |
|
90 | 91 | $this->addList($fields); |
91 | 92 | } |
92 | 93 | $this->_hasCheckedList=true; |
@@ -15,26 +15,26 @@ discard block |
||
15 | 15 | protected $_equalWidth; |
16 | 16 | protected $_name; |
17 | 17 | |
18 | - public function __construct($identifier, $fields=array(),$equalWidth=true) { |
|
18 | + public function __construct($identifier, $fields=array(), $equalWidth=true) { |
|
19 | 19 | parent::__construct($identifier, "div"); |
20 | 20 | $this->_equalWidth=$equalWidth; |
21 | 21 | $this->addItems($fields); |
22 | 22 | } |
23 | 23 | |
24 | - public function addFields($fields=NULL,$label=NULL){ |
|
25 | - if(!$fields instanceof HtmlFormFields){ |
|
26 | - if(\is_array($fields)===false){ |
|
27 | - $fields = \func_get_args(); |
|
24 | + public function addFields($fields=NULL, $label=NULL) { |
|
25 | + if (!$fields instanceof HtmlFormFields) { |
|
26 | + if (\is_array($fields)===false) { |
|
27 | + $fields=\func_get_args(); |
|
28 | 28 | $end=\end($fields); |
29 | - if(\is_string($end)){ |
|
29 | + if (\is_string($end)) { |
|
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | 32 | }else $label=NULL; |
33 | 33 | } |
34 | 34 | } |
35 | - if(isset($label)) |
|
35 | + if (isset($label)) |
|
36 | 36 | $this->setLabel($label); |
37 | - foreach ($fields as $field){ |
|
37 | + foreach ($fields as $field) { |
|
38 | 38 | $this->addItem($field); |
39 | 39 | } |
40 | 40 | return $this; |
@@ -44,40 +44,40 @@ discard block |
||
44 | 44 | * @param string|HtmlSemDoubleElement $label |
45 | 45 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
46 | 46 | */ |
47 | - public function setLabel($label){ |
|
47 | + public function setLabel($label) { |
|
48 | 48 | $labelO=$label; |
49 | - if(\is_string($label)){ |
|
50 | - $labelO=new HtmlSemDoubleElement("","label","",$label); |
|
49 | + if (\is_string($label)) { |
|
50 | + $labelO=new HtmlSemDoubleElement("", "label", "", $label); |
|
51 | 51 | } |
52 | - $this->insertItem($labelO,0); |
|
52 | + $this->insertItem($labelO, 0); |
|
53 | 53 | return $labelO; |
54 | 54 | } |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $item=parent::addItem($item); |
57 | 57 | $item->setContainer($this); |
58 | 58 | return $item; |
59 | 59 | } |
60 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
61 | - if($this->_equalWidth){ |
|
60 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
61 | + if ($this->_equalWidth) { |
|
62 | 62 | $count=$this->count(); |
63 | 63 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
64 | 64 | }else |
65 | - $this->addToProperty("class","fields"); |
|
66 | - return parent::compile($js,$view); |
|
65 | + $this->addToProperty("class", "fields"); |
|
66 | + return parent::compile($js, $view); |
|
67 | 67 | } |
68 | 68 | |
69 | - public function setWidth($index,$width){ |
|
69 | + public function setWidth($index, $width) { |
|
70 | 70 | $this->_equalWidth=false; |
71 | 71 | return $this->getItem($index)->setWidth($width); |
72 | 72 | } |
73 | 73 | |
74 | - public function setInline(){ |
|
74 | + public function setInline() { |
|
75 | 75 | $this->_equalWidth=false; |
76 | 76 | $this->addToProperty("class", "inline"); |
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | - public function setGrouped(){ |
|
80 | + public function setGrouped() { |
|
81 | 81 | $this->_equalWidth=false; |
82 | 82 | $this->addToProperty("class", "grouped"); |
83 | 83 | } |
@@ -91,34 +91,34 @@ discard block |
||
91 | 91 | return $this; |
92 | 92 | } |
93 | 93 | |
94 | - public static function radios($name,$items=array(),$label=NULL,$value=null,$type=NULL){ |
|
94 | + public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
|
95 | 95 | $fields=array(); |
96 | 96 | $i=0; |
97 | - foreach ($items as $val=>$caption){ |
|
98 | - $itemO=new HtmlFormRadio($name."-".$i++,$name,$caption,$val,$type); |
|
99 | - if($val===$value){ |
|
97 | + foreach ($items as $val=>$caption) { |
|
98 | + $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
|
99 | + if ($val===$value) { |
|
100 | 100 | $itemO->getInput()->getField()->setProperty("checked", ""); |
101 | 101 | } |
102 | 102 | $fields[]=$itemO; |
103 | 103 | } |
104 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
105 | - if(isset($label)) |
|
104 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
105 | + if (isset($label)) |
|
106 | 106 | $radios->setLabel($label)->setProperty("for", $name); |
107 | 107 | return $radios; |
108 | 108 | } |
109 | 109 | |
110 | - public static function checkeds($name,$items=array(),$label=NULL,$values=array(),$type=NULL){ |
|
110 | + public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
|
111 | 111 | $fields=array(); |
112 | 112 | $i=0; |
113 | - foreach ($items as $val=>$caption){ |
|
114 | - $itemO=new HtmlFormCheckbox($name."-".$i++,$name,$caption,$val,$type); |
|
115 | - if(\array_search($val, $values)!==false){ |
|
113 | + foreach ($items as $val=>$caption) { |
|
114 | + $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
|
115 | + if (\array_search($val, $values)!==false) { |
|
116 | 116 | $itemO->getInput()->getField()->setProperty("checked", ""); |
117 | 117 | } |
118 | 118 | $fields[]=$itemO; |
119 | 119 | } |
120 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
121 | - if(isset($label)) |
|
120 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
121 | + if (isset($label)) |
|
122 | 122 | $radios->setLabel($label)->setProperty("for", $name); |
123 | 123 | return $radios; |
124 | 124 | } |
@@ -29,11 +29,14 @@ discard block |
||
29 | 29 | if(\is_string($end)){ |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - }else $label=NULL; |
|
32 | + } else { |
|
33 | + $label=NULL; |
|
34 | + } |
|
33 | 35 | } |
34 | 36 | } |
35 | - if(isset($label)) |
|
36 | - $this->setLabel($label); |
|
37 | + if(isset($label)) { |
|
38 | + $this->setLabel($label); |
|
39 | + } |
|
37 | 40 | foreach ($fields as $field){ |
38 | 41 | $this->addItem($field); |
39 | 42 | } |
@@ -61,8 +64,9 @@ discard block |
||
61 | 64 | if($this->_equalWidth){ |
62 | 65 | $count=$this->count(); |
63 | 66 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
64 | - }else |
|
65 | - $this->addToProperty("class","fields"); |
|
67 | + } else { |
|
68 | + $this->addToProperty("class","fields"); |
|
69 | + } |
|
66 | 70 | return parent::compile($js,$view); |
67 | 71 | } |
68 | 72 | |
@@ -102,8 +106,9 @@ discard block |
||
102 | 106 | $fields[]=$itemO; |
103 | 107 | } |
104 | 108 | $radios=new HtmlFormFields("fields-".$name,$fields); |
105 | - if(isset($label)) |
|
106 | - $radios->setLabel($label)->setProperty("for", $name); |
|
109 | + if(isset($label)) { |
|
110 | + $radios->setLabel($label)->setProperty("for", $name); |
|
111 | + } |
|
107 | 112 | return $radios; |
108 | 113 | } |
109 | 114 | |
@@ -118,8 +123,9 @@ discard block |
||
118 | 123 | $fields[]=$itemO; |
119 | 124 | } |
120 | 125 | $radios=new HtmlFormFields("fields-".$name,$fields); |
121 | - if(isset($label)) |
|
122 | - $radios->setLabel($label)->setProperty("for", $name); |
|
126 | + if(isset($label)) { |
|
127 | + $radios->setLabel($label)->setProperty("for", $name); |
|
128 | + } |
|
123 | 129 | return $radios; |
124 | 130 | } |
125 | 131 |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | } |
18 | 18 | protected $mClass="menu"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
20 | + protected $items=array(); |
|
21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
22 | 22 | protected $input; |
23 | 23 | |
24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
25 | 25 | parent::__construct($identifier, "div"); |
26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
27 | 27 | $this->setProperty("class", "ui dropdown"); |
28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
29 | 29 | $content->setClass("text"); |
30 | 30 | $content->setContent($value); |
31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
32 | 32 | $this->content=array($content); |
33 | 33 | $this->tagName="div"; |
34 | 34 | $this->addItems($items); |
35 | 35 | } |
36 | 36 | |
37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
39 | 39 | $this->items[]=$itemO; |
40 | 40 | return $itemO; |
41 | 41 | } |
42 | 42 | |
43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
44 | - $this->addIconP($icon,$before,$labeled); |
|
43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
44 | + $this->addIconP($icon, $before, $labeled); |
|
45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
46 | 46 | } |
47 | 47 | /** |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | * @param number $position |
51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
52 | 52 | */ |
53 | - public function insertItem($item,$position=0){ |
|
53 | + public function insertItem($item, $position=0) { |
|
54 | 54 | $itemO=$this->beforeAddItem($item); |
55 | - $start = array_slice($this->items, 0, $position); |
|
56 | - $end = array_slice($this->items, $position); |
|
57 | - $start[] = $item; |
|
55 | + $start=array_slice($this->items, 0, $position); |
|
56 | + $end=array_slice($this->items, $position); |
|
57 | + $start[]=$item; |
|
58 | 58 | $this->items=array_merge($start, $end); |
59 | 59 | return $itemO; |
60 | 60 | } |
61 | 61 | |
62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
63 | 63 | $itemO=$item; |
64 | - if(!$item instanceof HtmlDropdownItem){ |
|
65 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
66 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
64 | + if (!$item instanceof HtmlDropdownItem) { |
|
65 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
66 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
67 | 67 | $this->addToProperty("class", "vertical"); |
68 | 68 | } |
69 | 69 | return $itemO; |
@@ -76,76 +76,76 @@ discard block |
||
76 | 76 | $this->addItem($function($object)); |
77 | 77 | } |
78 | 78 | |
79 | - public function addInput($name){ |
|
80 | - if(!isset($name)) |
|
79 | + public function addInput($name) { |
|
80 | + if (!isset($name)) |
|
81 | 81 | $name="input-".$this->identifier; |
82 | 82 | $this->setAction("activate"); |
83 | - $this->input=new HtmlInput($name,"hidden"); |
|
83 | + $this->input=new HtmlInput($name, "hidden"); |
|
84 | 84 | } |
85 | 85 | |
86 | - public function addItems($items){ |
|
87 | - if(JArray::isAssociative($items)){ |
|
88 | - foreach ($items as $k=>$v){ |
|
86 | + public function addItems($items) { |
|
87 | + if (JArray::isAssociative($items)) { |
|
88 | + foreach ($items as $k=>$v) { |
|
89 | 89 | $this->addItem($v)->setData($k); |
90 | 90 | } |
91 | - }else{ |
|
92 | - foreach ($items as $item){ |
|
91 | + }else { |
|
92 | + foreach ($items as $item) { |
|
93 | 93 | $this->addItem($item); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - public function count(){ |
|
98 | + public function count() { |
|
99 | 99 | return \sizeof($this->items); |
100 | 100 | } |
101 | 101 | /** |
102 | 102 | * @param boolean $dropdown |
103 | 103 | */ |
104 | - public function asDropdown($dropdown){ |
|
105 | - if($dropdown===false){ |
|
104 | + public function asDropdown($dropdown) { |
|
105 | + if ($dropdown===false) { |
|
106 | 106 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
107 | 107 | $dropdown="menu"; |
108 | - }else{ |
|
108 | + }else { |
|
109 | 109 | $dropdown="dropdown"; |
110 | 110 | $this->mClass="menu"; |
111 | 111 | } |
112 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
112 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
113 | 113 | } |
114 | 114 | |
115 | - public function setVertical(){ |
|
116 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
115 | + public function setVertical() { |
|
116 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
117 | 117 | } |
118 | 118 | |
119 | - public function setSimple(){ |
|
120 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
119 | + public function setSimple() { |
|
120 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
121 | 121 | } |
122 | 122 | |
123 | - public function asButton($floating=false){ |
|
124 | - if($floating) |
|
123 | + public function asButton($floating=false) { |
|
124 | + if ($floating) |
|
125 | 125 | $this->addToProperty("class", "floating"); |
126 | 126 | return $this->addToProperty("class", "button"); |
127 | 127 | } |
128 | 128 | |
129 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
130 | - if(isset($name)) |
|
129 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
130 | + if (isset($name)) |
|
131 | 131 | $this->addInput($name); |
132 | - if($multiple) |
|
132 | + if ($multiple) |
|
133 | 133 | $this->addToProperty("class", "multiple"); |
134 | 134 | if ($selection) |
135 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
135 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
139 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
140 | - $this->asSelect($name,$multiple,$selection); |
|
139 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
140 | + $this->asSelect($name, $multiple, $selection); |
|
141 | 141 | return $this->addToProperty("class", "search"); |
142 | 142 | } |
143 | 143 | |
144 | - public function setSelect($name=NULL,$multiple=false){ |
|
145 | - if(!isset($name)) |
|
144 | + public function setSelect($name=NULL, $multiple=false) { |
|
145 | + if (!isset($name)) |
|
146 | 146 | $name="select-".$this->identifier; |
147 | 147 | $this->input=null; |
148 | - if($multiple){ |
|
148 | + if ($multiple) { |
|
149 | 149 | $this->setProperty("multiple", true); |
150 | 150 | $this->addToProperty("class", "multiple"); |
151 | 151 | } |
@@ -153,32 +153,32 @@ discard block |
||
153 | 153 | $this->tagName="select"; |
154 | 154 | $this->setProperty("name", $name); |
155 | 155 | $this->content=null; |
156 | - foreach ($this->items as $item){ |
|
156 | + foreach ($this->items as $item) { |
|
157 | 157 | $item->asOption(); |
158 | 158 | } |
159 | 159 | return $this; |
160 | 160 | } |
161 | 161 | |
162 | - public function asSubmenu($pointing=NULL){ |
|
162 | + public function asSubmenu($pointing=NULL) { |
|
163 | 163 | $this->setClass("ui dropdown link item"); |
164 | - if(isset($pointing)){ |
|
164 | + if (isset($pointing)) { |
|
165 | 165 | $this->setPointing($pointing); |
166 | 166 | } |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | - public function setPointing($value=Direction::NONE){ |
|
171 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
170 | + public function setPointing($value=Direction::NONE) { |
|
171 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function setValue($value){ |
|
175 | - if(isset($this->input)){ |
|
174 | + public function setValue($value) { |
|
175 | + if (isset($this->input)) { |
|
176 | 176 | $this->input->setProperty("value", $value); |
177 | - }else{ |
|
177 | + }else { |
|
178 | 178 | $this->setProperty("value", $value); |
179 | 179 | } |
180 | 180 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
181 | - if(isset($textElement)) |
|
181 | + if (isset($textElement)) |
|
182 | 182 | $textElement->setContent($value); |
183 | 183 | return $this; |
184 | 184 | } |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | * @see BaseHtml::run() |
189 | 189 | */ |
190 | 190 | public function run(JsUtils $js) { |
191 | - if($this->propertyContains("class", "simple")===false){ |
|
192 | - if(isset($this->_bsComponent)===false) |
|
193 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
191 | + if ($this->propertyContains("class", "simple")===false) { |
|
192 | + if (isset($this->_bsComponent)===false) |
|
193 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
194 | 194 | $this->addEventsOnRun($js); |
195 | 195 | return $this->_bsComponent; |
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - public function setAction($action){ |
|
199 | + public function setAction($action) { |
|
200 | 200 | $this->_params["action"]=$action; |
201 | 201 | } |
202 | 202 | |
203 | - public function setFullTextSearch($value){ |
|
203 | + public function setFullTextSearch($value) { |
|
204 | 204 | $this->_params["fullTextSearch"]=$value; |
205 | 205 | } |
206 | 206 | } |
207 | 207 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $itemO=$item; |
64 | 64 | if(!$item instanceof HtmlDropdownItem){ |
65 | 65 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
66 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
66 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
67 | 67 | $this->addToProperty("class", "vertical"); |
68 | 68 | } |
69 | 69 | return $itemO; |
@@ -77,8 +77,9 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addInput($name){ |
80 | - if(!isset($name)) |
|
81 | - $name="input-".$this->identifier; |
|
80 | + if(!isset($name)) { |
|
81 | + $name="input-".$this->identifier; |
|
82 | + } |
|
82 | 83 | $this->setAction("activate"); |
83 | 84 | $this->input=new HtmlInput($name,"hidden"); |
84 | 85 | } |
@@ -88,7 +89,7 @@ discard block |
||
88 | 89 | foreach ($items as $k=>$v){ |
89 | 90 | $this->addItem($v)->setData($k); |
90 | 91 | } |
91 | - }else{ |
|
92 | + } else{ |
|
92 | 93 | foreach ($items as $item){ |
93 | 94 | $this->addItem($item); |
94 | 95 | } |
@@ -105,7 +106,7 @@ discard block |
||
105 | 106 | if($dropdown===false){ |
106 | 107 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
107 | 108 | $dropdown="menu"; |
108 | - }else{ |
|
109 | + } else{ |
|
109 | 110 | $dropdown="dropdown"; |
110 | 111 | $this->mClass="menu"; |
111 | 112 | } |
@@ -121,18 +122,22 @@ discard block |
||
121 | 122 | } |
122 | 123 | |
123 | 124 | public function asButton($floating=false){ |
124 | - if($floating) |
|
125 | - $this->addToProperty("class", "floating"); |
|
125 | + if($floating) { |
|
126 | + $this->addToProperty("class", "floating"); |
|
127 | + } |
|
126 | 128 | return $this->addToProperty("class", "button"); |
127 | 129 | } |
128 | 130 | |
129 | 131 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
130 | - if(isset($name)) |
|
131 | - $this->addInput($name); |
|
132 | - if($multiple) |
|
133 | - $this->addToProperty("class", "multiple"); |
|
134 | - if ($selection) |
|
135 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
132 | + if(isset($name)) { |
|
133 | + $this->addInput($name); |
|
134 | + } |
|
135 | + if($multiple) { |
|
136 | + $this->addToProperty("class", "multiple"); |
|
137 | + } |
|
138 | + if ($selection) { |
|
139 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
140 | + } |
|
136 | 141 | return $this; |
137 | 142 | } |
138 | 143 | |
@@ -142,8 +147,9 @@ discard block |
||
142 | 147 | } |
143 | 148 | |
144 | 149 | public function setSelect($name=NULL,$multiple=false){ |
145 | - if(!isset($name)) |
|
146 | - $name="select-".$this->identifier; |
|
150 | + if(!isset($name)) { |
|
151 | + $name="select-".$this->identifier; |
|
152 | + } |
|
147 | 153 | $this->input=null; |
148 | 154 | if($multiple){ |
149 | 155 | $this->setProperty("multiple", true); |
@@ -174,12 +180,13 @@ discard block |
||
174 | 180 | public function setValue($value){ |
175 | 181 | if(isset($this->input)){ |
176 | 182 | $this->input->setProperty("value", $value); |
177 | - }else{ |
|
183 | + } else{ |
|
178 | 184 | $this->setProperty("value", $value); |
179 | 185 | } |
180 | 186 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
181 | - if(isset($textElement)) |
|
182 | - $textElement->setContent($value); |
|
187 | + if(isset($textElement)) { |
|
188 | + $textElement->setContent($value); |
|
189 | + } |
|
183 | 190 | return $this; |
184 | 191 | } |
185 | 192 | |
@@ -189,8 +196,9 @@ discard block |
||
189 | 196 | */ |
190 | 197 | public function run(JsUtils $js) { |
191 | 198 | if($this->propertyContains("class", "simple")===false){ |
192 | - if(isset($this->_bsComponent)===false) |
|
193 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
199 | + if(isset($this->_bsComponent)===false) { |
|
200 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
201 | + } |
|
194 | 202 | $this->addEventsOnRun($js); |
195 | 203 | return $this->_bsComponent; |
196 | 204 | } |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * @param boolean $asIcons |
40 | 40 | * @return HtmlButtonGroups |
41 | 41 | */ |
42 | - public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
|
43 | - return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
|
42 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
43 | + return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string $content |
50 | 50 | * @return HtmlContainer |
51 | 51 | */ |
52 | - public function htmlContainer($identifier,$content=""){ |
|
52 | + public function htmlContainer($identifier, $content="") { |
|
53 | 53 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
54 | 54 | } |
55 | 55 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param string $content |
59 | 59 | * @return HtmlDivider |
60 | 60 | */ |
61 | - public function htmlDivider($identifier,$content="",$tagName="div"){ |
|
62 | - return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
|
61 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
62 | + return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * @param string $type |
70 | 70 | * @return HtmlHeader |
71 | 71 | */ |
72 | - public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
|
73 | - return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
|
72 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
73 | + return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $icon |
79 | 79 | * @return HtmlIcon |
80 | 80 | */ |
81 | - public function htmlIcon($identifier,$icon){ |
|
81 | + public function htmlIcon($identifier, $icon) { |
|
82 | 82 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
83 | 83 | } |
84 | 84 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * @param array $icons |
89 | 89 | * @return HtmlIconGroups |
90 | 90 | */ |
91 | - public function htmlIconGroups($identifier,$size="",$icons=array()){ |
|
92 | - $group=new HtmlIconGroups($identifier,$size); |
|
93 | - if(JArray::isAssociative($icons)){ |
|
94 | - foreach ($icons as $icon=>$size){ |
|
95 | - $group->add($icon,$size); |
|
91 | + public function htmlIconGroups($identifier, $size="", $icons=array()) { |
|
92 | + $group=new HtmlIconGroups($identifier, $size); |
|
93 | + if (JArray::isAssociative($icons)) { |
|
94 | + foreach ($icons as $icon=>$size) { |
|
95 | + $group->add($icon, $size); |
|
96 | 96 | } |
97 | - }else{ |
|
98 | - foreach ($icons as $icon){ |
|
97 | + }else { |
|
98 | + foreach ($icons as $icon) { |
|
99 | 99 | $group->add($icon); |
100 | 100 | } |
101 | 101 | } |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @param string $placeholder |
111 | 111 | * @return HtmlInput |
112 | 112 | */ |
113 | - public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
|
114 | - return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
|
113 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
114 | + return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @param string $tagName |
121 | 121 | * @return HtmlLabel |
122 | 122 | */ |
123 | - public function htmlLabel($identifier,$content="",$tagName="div"){ |
|
124 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
|
123 | + public function htmlLabel($identifier, $content="", $tagName="div") { |
|
124 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName)); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * @param array $items |
131 | 131 | * @return HtmlList |
132 | 132 | */ |
133 | - public function htmlList($identifier,$items=array()){ |
|
134 | - return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
|
133 | + public function htmlList($identifier, $items=array()) { |
|
134 | + return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * @param string $content |
141 | 141 | * @return HtmlSegment |
142 | 142 | */ |
143 | - public function htmlSegment($identifier, $content=""){ |
|
144 | - return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
|
143 | + public function htmlSegment($identifier, $content="") { |
|
144 | + return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | * @param array $items the segments |
151 | 151 | * @return HtmlSegmentGroups |
152 | 152 | */ |
153 | - public function htmlSegmentGroups($identifier, $items=array()){ |
|
154 | - return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
|
153 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
154 | + return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
|
155 | 155 | } |
156 | 156 | |
157 | - public function htmlCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
158 | - return $this->addHtmlComponent(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
157 | + public function htmlCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
158 | + return $this->addHtmlComponent(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | \ No newline at end of file |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | 18 | protected $_template; |
19 | 19 | protected $tagName; |
20 | - protected $properties=array (); |
|
21 | - protected $_events=array (); |
|
20 | + protected $properties=array(); |
|
21 | + protected $_events=array(); |
|
22 | 22 | protected $_wrapBefore=array(); |
23 | 23 | protected $_wrapAfter=array(); |
24 | 24 | protected $_bsComponent; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function addToProperty($name, $value, $separator=" ") { |
59 | 59 | $v=@$this->properties[$name]; |
60 | - if (isset($v)&&$v!=="") |
|
60 | + if (isset($v) && $v!=="") |
|
61 | 61 | $v=$v.$separator.$value; |
62 | 62 | else |
63 | 63 | $v=$value; |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
74 | 74 | $result=$this->getTemplate($js); |
75 | - foreach ( $this as $key => $value ) { |
|
76 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
75 | + foreach ($this as $key => $value) { |
|
76 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
77 | 77 | if (is_array($value)) { |
78 | 78 | $v=PropertyWrapper::wrap($value, $js); |
79 | - } else { |
|
79 | + }else { |
|
80 | 80 | $v=$value; |
81 | 81 | } |
82 | 82 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (isset($view)===true) { |
89 | 89 | $controls=$view->getVar("q"); |
90 | 90 | if (isset($controls)===false) { |
91 | - $controls=array (); |
|
91 | + $controls=array(); |
|
92 | 92 | } |
93 | 93 | $controls [$this->identifier]=$result; |
94 | 94 | $view->setVar("q", $controls); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | if (array_search($value, $typeCtrl)===false) { |
102 | 102 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
103 | 103 | } |
104 | - } else { |
|
104 | + }else { |
|
105 | 105 | if (!$typeCtrl($value)) { |
106 | 106 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
107 | 107 | } |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | return true; |
110 | 110 | } |
111 | 111 | |
112 | - protected function propertyContains($propertyName,$value){ |
|
112 | + protected function propertyContains($propertyName, $value) { |
|
113 | 113 | $values=$this->getProperty($propertyName); |
114 | - if(isset($values)){ |
|
114 | + if (isset($values)) { |
|
115 | 115 | return JString::contains($values, $value); |
116 | 116 | } |
117 | 117 | return false; |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | return $this; |
139 | 139 | } |
140 | 140 | |
141 | - protected function removePropertyValue($name,$value){ |
|
141 | + protected function removePropertyValue($name, $value) { |
|
142 | 142 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
143 | 143 | return $this; |
144 | 144 | } |
145 | 145 | |
146 | - protected function removeProperty($name){ |
|
147 | - if(\array_key_exists($name, $this->properties)) |
|
146 | + protected function removeProperty($name) { |
|
147 | + if (\array_key_exists($name, $this->properties)) |
|
148 | 148 | unset($this->properties[$name]); |
149 | 149 | return $this; |
150 | 150 | } |
@@ -201,28 +201,28 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | public function fromArray($array) { |
204 | - foreach ( $this as $key => $value ) { |
|
204 | + foreach ($this as $key => $value) { |
|
205 | 205 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
206 | 206 | $setter="set".ucfirst($key); |
207 | 207 | $this->$setter($array [$key]); |
208 | 208 | unset($array [$key]); |
209 | 209 | } |
210 | 210 | } |
211 | - foreach ( $array as $key => $value ) { |
|
211 | + foreach ($array as $key => $value) { |
|
212 | 212 | if (method_exists($this, $key)) { |
213 | 213 | try { |
214 | 214 | $this->$key($value); |
215 | 215 | unset($array [$key]); |
216 | - } catch ( \Exception $e ) { |
|
216 | + } catch (\Exception $e) { |
|
217 | 217 | // Nothing to do |
218 | 218 | } |
219 | - } else { |
|
219 | + }else { |
|
220 | 220 | $setter="set".ucfirst($key); |
221 | 221 | if (method_exists($this, $setter)) { |
222 | 222 | try { |
223 | 223 | $this->$setter($value); |
224 | 224 | unset($array [$key]); |
225 | - } catch ( \Exception $e ) { |
|
225 | + } catch (\Exception $e) { |
|
226 | 226 | // Nothing to do |
227 | 227 | } |
228 | 228 | } |
@@ -231,21 +231,21 @@ discard block |
||
231 | 231 | return $array; |
232 | 232 | } |
233 | 233 | |
234 | - public function fromDatabaseObjects($objects,$function) { |
|
235 | - if(isset($objects)){ |
|
236 | - foreach ($objects as $object){ |
|
237 | - $this->fromDatabaseObject($object,$function); |
|
234 | + public function fromDatabaseObjects($objects, $function) { |
|
235 | + if (isset($objects)) { |
|
236 | + foreach ($objects as $object) { |
|
237 | + $this->fromDatabaseObject($object, $function); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | return $this; |
241 | 241 | } |
242 | 242 | |
243 | - public function fromDatabaseObject($object,$function){ |
|
243 | + public function fromDatabaseObject($object, $function) { |
|
244 | 244 | |
245 | 245 | } |
246 | 246 | |
247 | 247 | public function wrap($before, $after="") { |
248 | - if(isset($before)){ |
|
248 | + if (isset($before)) { |
|
249 | 249 | $this->_wrapBefore[]=$before; |
250 | 250 | } |
251 | 251 | $this->_wrapAfter[]=$after; |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | if (array_key_exists($event, $this->_events)) { |
267 | 267 | if (is_array($this->_events [$event])) { |
268 | 268 | $this->_events [$event] []=$jsCode; |
269 | - } else { |
|
270 | - $this->_events [$event]=array ( |
|
269 | + }else { |
|
270 | + $this->_events [$event]=array( |
|
271 | 271 | $this->_events [$event], |
272 | 272 | $jsCode |
273 | 273 | ); |
274 | 274 | } |
275 | - } else { |
|
275 | + }else { |
|
276 | 276 | $this->_events [$event]=$jsCode; |
277 | 277 | } |
278 | 278 | return $this; |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | |
293 | 293 | public function addEventsOnRun(JsUtils $js) { |
294 | 294 | if (isset($this->_bsComponent)) { |
295 | - foreach ( $this->_events as $event => $jsCode ) { |
|
295 | + foreach ($this->_events as $event => $jsCode) { |
|
296 | 296 | $code=$jsCode; |
297 | 297 | if (is_array($jsCode)) { |
298 | 298 | $code=""; |
299 | - foreach ( $jsCode as $jsC ) { |
|
299 | + foreach ($jsCode as $jsC) { |
|
300 | 300 | if ($jsC instanceof AjaxCall) { |
301 | 301 | $code.="\n".$jsC->compile($js); |
302 | - } else { |
|
302 | + }else { |
|
303 | 303 | $code.="\n".$jsC; |
304 | 304 | } |
305 | 305 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
316 | - $params=array ( |
|
316 | + $params=array( |
|
317 | 317 | "url" => $url, |
318 | 318 | "responseElement" => $responseElement |
319 | 319 | ); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | if (is_array($elements)) { |
353 | 353 | $flag=false; |
354 | 354 | $index=0; |
355 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
355 | + while (!$flag && $index<sizeof($elements)) { |
|
356 | 356 | if ($elements [$index] instanceof BaseHtml) |
357 | 357 | $flag=($elements [$index]->getIdentifier()===$identifier); |
358 | 358 | $index++; |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | return null; |
367 | 367 | } |
368 | 368 | |
369 | - public function __toString(){ |
|
369 | + public function __toString() { |
|
370 | 370 | return $this->compile(); |
371 | 371 | } |
372 | 372 | |
@@ -382,29 +382,29 @@ discard block |
||
382 | 382 | if (is_array($value)) { |
383 | 383 | $value=implode(",", $value); |
384 | 384 | } |
385 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
385 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
386 | 386 | $value='"'.$value.'"'; |
387 | 387 | } |
388 | 388 | return $value; |
389 | 389 | } |
390 | 390 | |
391 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
391 | + public function jsDoJquery($jqueryCall, $param="") { |
|
392 | 392 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
393 | 393 | } |
394 | 394 | |
395 | - public function executeOnRun($jsCode){ |
|
395 | + public function executeOnRun($jsCode) { |
|
396 | 396 | return $this->_addEvent("execute", $jsCode); |
397 | 397 | } |
398 | 398 | |
399 | - public function jsHtml($content=""){ |
|
400 | - return $this->jsDoJquery("html",$content); |
|
399 | + public function jsHtml($content="") { |
|
400 | + return $this->jsDoJquery("html", $content); |
|
401 | 401 | } |
402 | 402 | |
403 | - public function jsShow(){ |
|
403 | + public function jsShow() { |
|
404 | 404 | return $this->jsDoJquery("show"); |
405 | 405 | } |
406 | 406 | |
407 | - public function jsHide(){ |
|
407 | + public function jsHide() { |
|
408 | 408 | return $this->jsDoJquery("hide"); |
409 | 409 | } |
410 | 410 |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct(JsUtils $js) { |
18 | 18 | parent::__construct($js); |
19 | - $this->events=array (); |
|
19 | + $this->events=array(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function compileEvents() { |
23 | - foreach ( $this->events as $event => $jsCode ) { |
|
24 | - if($event=="execute"){ |
|
23 | + foreach ($this->events as $event => $jsCode) { |
|
24 | + if ($event=="execute") { |
|
25 | 25 | $this->jquery_code_for_compile []=$jsCode; |
26 | 26 | }else |
27 | 27 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $result=implode("\n", $this->jquery_code_for_compile); |
33 | 33 | $result=str_ireplace("\"%", "", $result); |
34 | 34 | $result=str_ireplace("%\"", "", $result); |
35 | - $result=str_replace(array ( |
|
35 | + $result=str_replace(array( |
|
36 | 36 | "\\n", |
37 | 37 | "\\r", |
38 | 38 | "\\t" |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function getScript() { |
44 | 44 | $allParams=$this->params; |
45 | - $this->jquery_code_for_compile=array (); |
|
45 | + $this->jquery_code_for_compile=array(); |
|
46 | 46 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
47 | 47 | $this->compileEvents(); |
48 | 48 | return $this->compileJQueryCode(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if (is_array($typeCtrl)) { |
70 | 70 | if (array_search($value, $typeCtrl)===false) |
71 | 71 | throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
72 | - } else { |
|
72 | + }else { |
|
73 | 73 | if (!$typeCtrl($value)) { |
74 | 74 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
75 | 75 | } |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | foreach ( $this->events as $event => $jsCode ) { |
24 | 24 | if($event=="execute"){ |
25 | 25 | $this->jquery_code_for_compile []=$jsCode; |
26 | - }else |
|
27 | - $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
|
26 | + } else { |
|
27 | + $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | } |
30 | 31 | |
@@ -67,8 +68,9 @@ discard block |
||
67 | 68 | |
68 | 69 | protected function setParamCtrl($key, $value, $typeCtrl) { |
69 | 70 | if (is_array($typeCtrl)) { |
70 | - if (array_search($value, $typeCtrl)===false) |
|
71 | - throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
71 | + if (array_search($value, $typeCtrl)===false) { |
|
72 | + throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
73 | + } |
|
72 | 74 | } else { |
73 | 75 | if (!$typeCtrl($value)) { |
74 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |