@@ -10,12 +10,12 @@ |
||
10 | 10 | * @author jc |
11 | 11 | * |
12 | 12 | */ |
13 | -class Visibility extends SimpleSemExtComponent{ |
|
13 | +class Visibility extends SimpleSemExtComponent { |
|
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | 17 | $this->uiName="visibility"; |
18 | - $this->params=["once"=>false,"observeChanges"=>true]; |
|
18 | + $this->params=["once"=>false, "observeChanges"=>true]; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setOnce($value=false) { |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | |
32 | 32 | public function __construct($identifier, $rowCount, $colCount) { |
33 | 33 | parent::__construct($identifier, "table", "ui table"); |
34 | - $this->content=array (); |
|
34 | + $this->content=array(); |
|
35 | 35 | $this->setRowCount($rowCount, $colCount); |
36 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
37 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
36 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
37 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
38 | 38 | $this->_afterCompileEvents=[]; |
39 | 39 | } |
40 | 40 | |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | * @return HtmlTableContent |
45 | 45 | */ |
46 | 46 | public function getPart($key) { |
47 | - if (\array_key_exists($key, $this->content) === false) { |
|
47 | + if (\array_key_exists($key, $this->content)===false) { |
|
48 | 48 | $this->content[$key]=new HtmlTableContent("", $key); |
49 | - if ($key !== "tbody") { |
|
49 | + if ($key!=="tbody") { |
|
50 | 50 | $this->content[$key]->setRowCount(1, $this->_colCount); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | return $this->content[$key]; |
54 | 54 | } |
55 | 55 | |
56 | - protected function _getFirstPart(){ |
|
57 | - if(isset($this->content["thead"])){ |
|
56 | + protected function _getFirstPart() { |
|
57 | + if (isset($this->content["thead"])) { |
|
58 | 58 | return $this->content["thead"]; |
59 | 59 | } |
60 | 60 | return $this->content["tbody"]; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return boolean |
100 | 100 | */ |
101 | 101 | public function hasPart($key) { |
102 | - return \array_key_exists($key, $this->content) === true; |
|
102 | + return \array_key_exists($key, $this->content)===true; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | return $this->colAlign($colIndex, "colLeft"); |
233 | 233 | } |
234 | 234 | |
235 | - public function setColAlignment($colIndex,$alignment){ |
|
236 | - switch ($alignment){ |
|
235 | + public function setColAlignment($colIndex, $alignment) { |
|
236 | + switch ($alignment) { |
|
237 | 237 | case TextAlignment::LEFT: |
238 | 238 | $function="colLeft"; |
239 | 239 | break; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | private function colAlign($colIndex, $function) { |
257 | 257 | if (\is_array($colIndex)) { |
258 | - foreach ( $colIndex as $cIndex ) { |
|
258 | + foreach ($colIndex as $cIndex) { |
|
259 | 259 | $this->colAlign($cIndex, $function); |
260 | 260 | } |
261 | 261 | } else { |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @see HtmlSemDoubleElement::compile() |
317 | 317 | */ |
318 | 318 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
319 | - if(\sizeof($this->_compileParts)<3){ |
|
319 | + if (\sizeof($this->_compileParts)<3) { |
|
320 | 320 | $this->_template="%content%"; |
321 | 321 | $this->refresh($js); |
322 | 322 | } |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
328 | - parent::compile_once($js,$view); |
|
328 | + parent::compile_once($js, $view); |
|
329 | 329 | if ($this->propertyContains("class", "sortable")) { |
330 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
330 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | public function fromDatabaseObject($object, $function) { |
341 | 341 | $result=$function($object); |
342 | 342 | if (\is_array($result)) { |
343 | - $result= $this->addRow($function($object)); |
|
343 | + $result=$this->addRow($function($object)); |
|
344 | 344 | } else { |
345 | - $result= $this->getBody()->_addRow($result); |
|
345 | + $result=$this->getBody()->_addRow($result); |
|
346 | 346 | } |
347 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
348 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
349 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
347 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
348 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
349 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
350 | 350 | } |
351 | 351 | return $result; |
352 | 352 | } |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | return $this; |
362 | 362 | } |
363 | 363 | |
364 | - public function refresh($js){ |
|
364 | + public function refresh($js) { |
|
365 | 365 | $this->_footer=$this->getFooter(); |
366 | - if(isset($js)){ |
|
367 | - $js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");',true); |
|
366 | + if (isset($js)) { |
|
367 | + $js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");', true); |
|
368 | 368 | } |
369 | 369 | //$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
370 | 370 | } |
371 | 371 | |
372 | - public function run(JsUtils $js){ |
|
373 | - if(isset($this->_activeRowSelector)){ |
|
372 | + public function run(JsUtils $js) { |
|
373 | + if (isset($this->_activeRowSelector)) { |
|
374 | 374 | $this->_activeRowSelector->run(); |
375 | 375 | } |
376 | - $result= parent::run($js); |
|
377 | - if(isset($this->_footer)) |
|
376 | + $result=parent::run($js); |
|
377 | + if (isset($this->_footer)) |
|
378 | 378 | $this->_footer->run($js); |
379 | 379 | return $result; |
380 | 380 | } |
@@ -397,47 +397,47 @@ discard block |
||
397 | 397 | * @param boolean $multiple |
398 | 398 | * @return HtmlTable |
399 | 399 | */ |
400 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
401 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
400 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
401 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
402 | 402 | return $this; |
403 | 403 | } |
404 | 404 | |
405 | - public function hideColumn($colIndex){ |
|
406 | - if(isset($this->content["thead"])){ |
|
405 | + public function hideColumn($colIndex) { |
|
406 | + if (isset($this->content["thead"])) { |
|
407 | 407 | $this->content["thead"]->hideColumn($colIndex); |
408 | 408 | } |
409 | 409 | $this->content["tbody"]->hideColumn($colIndex); |
410 | - if(isset($this->content["tfoot"])){ |
|
410 | + if (isset($this->content["tfoot"])) { |
|
411 | 411 | $this->content["tfoot"]->hideColumn($colIndex); |
412 | 412 | } |
413 | 413 | return $this; |
414 | 414 | } |
415 | 415 | |
416 | - public function setColWidth($colIndex,$width){ |
|
416 | + public function setColWidth($colIndex, $width) { |
|
417 | 417 | $part=$this->_getFirstPart(); |
418 | - if($part!==null && $part->count()>0) |
|
418 | + if ($part!==null && $part->count()>0) |
|
419 | 419 | $part->getCell(0, $colIndex)->setWidth($width); |
420 | 420 | return $this; |
421 | 421 | } |
422 | 422 | |
423 | - public function setColWidths($widths){ |
|
423 | + public function setColWidths($widths) { |
|
424 | 424 | $part=$this->_getFirstPart(); |
425 | - if($part!==null && $part->count()>0){ |
|
425 | + if ($part!==null && $part->count()>0) { |
|
426 | 426 | $count=$part->getColCount(); |
427 | - if(!\is_array($widths)){ |
|
427 | + if (!\is_array($widths)) { |
|
428 | 428 | $widths=\array_fill(0, $count, $widths); |
429 | 429 | } |
430 | - $max=\min(\sizeof($widths),$count); |
|
431 | - for($i=0;$i<$max;$i++){ |
|
430 | + $max=\min(\sizeof($widths), $count); |
|
431 | + for ($i=0; $i<$max; $i++) { |
|
432 | 432 | $part->getCell(0, $i)->setWidth($widths[$i]); |
433 | 433 | } |
434 | 434 | } |
435 | 435 | return $this; |
436 | 436 | } |
437 | 437 | |
438 | - public function mergeIdentiqualValues($colIndex,$function="strip_tags"){ |
|
438 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
439 | 439 | $body=$this->getBody(); |
440 | - $body->mergeIdentiqualValues($colIndex,$function); |
|
440 | + $body->mergeIdentiqualValues($colIndex, $function); |
|
441 | 441 | return $this; |
442 | 442 | } |
443 | 443 | /** |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @param mixed $_innerScript |
452 | 452 | */ |
453 | 453 | public function setInnerScript($_innerScript) { |
454 | - $this->_innerScript = $_innerScript; |
|
454 | + $this->_innerScript=$_innerScript; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | * @author jc |
9 | 9 | * @property HtmlTable $_self |
10 | 10 | */ |
11 | -trait TableTrait{ |
|
11 | +trait TableTrait { |
|
12 | 12 | |
13 | 13 | abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
14 | 14 | abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
15 | 15 | |
16 | - protected function addToPropertyTable($property,$value){ |
|
16 | + protected function addToPropertyTable($property, $value) { |
|
17 | 17 | return $this->_self->addToProperty($property, $value); |
18 | 18 | } |
19 | 19 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | public function setBasic($very=false) { |
25 | 25 | $table=$this->_self; |
26 | 26 | if ($very) |
27 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
28 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
27 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
28 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function setCompact($very=false) { |
32 | 32 | $table=$this->_self; |
33 | 33 | if ($very) |
34 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
35 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
34 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
35 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function setCollapsing() { |
@@ -71,37 +71,37 @@ discard block |
||
71 | 71 | return $this->addToPropertyTable("class", "striped"); |
72 | 72 | } |
73 | 73 | |
74 | - public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){ |
|
75 | - return $this->onRow("click", $jsCode,$stopPropagation,$preventDefault); |
|
74 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
75 | + return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault); |
|
76 | 76 | } |
77 | 77 | |
78 | - public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){ |
|
79 | - return $this->_self->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault); |
|
78 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
79 | + return $this->_self->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
80 | 80 | } |
81 | 81 | |
82 | - public function getOnRow($event, $url, $responseElement="", $parameters=array()){ |
|
83 | - $parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]); |
|
84 | - return $this->_self->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters); |
|
82 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
83 | + $parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]); |
|
84 | + return $this->_self->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters); |
|
85 | 85 | } |
86 | 86 | |
87 | - public function onPageChange($jsCode){ |
|
87 | + public function onPageChange($jsCode) { |
|
88 | 88 | $this->_self->_addEvent("pageChange", $jsCode); |
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | - public function onSearchTerminate($jsCode){ |
|
92 | + public function onSearchTerminate($jsCode) { |
|
93 | 93 | $this->_self->_addEvent("searchTerminate", $jsCode); |
94 | 94 | return $this; |
95 | 95 | } |
96 | 96 | |
97 | - public function getEventsScript(){ |
|
97 | + public function getEventsScript() { |
|
98 | 98 | return $this->_self->getBsComponent()->getScript(); |
99 | 99 | } |
100 | 100 | |
101 | 101 | public function addEventsOnRun(JsUtils $js=NULL) { |
102 | 102 | $script=parent::addEventsOnRun($js); |
103 | 103 | $innerScript=$this->_self->getInnerScript(); |
104 | - if(!isset($innerScript)){ |
|
104 | + if (!isset($innerScript)) { |
|
105 | 105 | $this->_self->setInnerScript($script); |
106 | 106 | } |
107 | 107 | return $script; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $event |
22 | 22 | * @param boolean $multiple |
23 | 23 | */ |
24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
25 | 25 | $this->table=$table; |
26 | 26 | $this->class=$class; |
27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function run(){ |
|
58 | + public function run() { |
|
59 | 59 | $multiple=""; |
60 | - if(!$this->multiple){ |
|
60 | + if (!$this->multiple) { |
|
61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
62 | 62 | } |
63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
@@ -6,30 +6,30 @@ discard block |
||
6 | 6 | |
7 | 7 | use Ajax\semantic\html\elements\HtmlIcon; |
8 | 8 | |
9 | -class HtmlPaginationMenu extends HtmlMenu{ |
|
9 | +class HtmlPaginationMenu extends HtmlMenu { |
|
10 | 10 | private $_page; |
11 | 11 | private $_pages; |
12 | 12 | private $_max; |
13 | - public function __construct( $identifier, $items=array() ){ |
|
14 | - parent::__construct( $identifier,$items); |
|
13 | + public function __construct($identifier, $items=array()) { |
|
14 | + parent::__construct($identifier, $items); |
|
15 | 15 | $this->_pages=$items; |
16 | 16 | } |
17 | 17 | /** |
18 | 18 | * {@inheritDoc} |
19 | 19 | * @see \Ajax\common\html\BaseHtml::compile() |
20 | 20 | */ |
21 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
22 | - $max=$this->_max;//\sizeof($this->content); |
|
23 | - foreach ($this->content as $item){ |
|
21 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
22 | + $max=$this->_max; //\sizeof($this->content); |
|
23 | + foreach ($this->content as $item) { |
|
24 | 24 | $item->addClass("pageNum"); |
25 | 25 | } |
26 | - $this->insertItem(new HtmlIcon("", "left chevron"))->setProperty("data-page", \max([1,$this->_page-1]))->addToProperty("class","_firstPage no-active"); |
|
27 | - $this->addItem(new HtmlIcon("", "right chevron"))->setProperty("data-page", \min([$max,$this->_page+1]))->setProperty("data-max", $max)->addToProperty("class","_lastPage no-active"); |
|
26 | + $this->insertItem(new HtmlIcon("", "left chevron"))->setProperty("data-page", \max([1, $this->_page-1]))->addToProperty("class", "_firstPage no-active"); |
|
27 | + $this->addItem(new HtmlIcon("", "right chevron"))->setProperty("data-page", \min([$max, $this->_page+1]))->setProperty("data-max", $max)->addToProperty("class", "_lastPage no-active"); |
|
28 | 28 | $this->asPagination(); |
29 | - return parent::compile($js,$view); |
|
29 | + return parent::compile($js, $view); |
|
30 | 30 | } |
31 | 31 | |
32 | - public function setActivePage($page){ |
|
32 | + public function setActivePage($page) { |
|
33 | 33 | $index=$page-$this->_pages[0]; |
34 | 34 | $item=$this->setActiveItem($index); |
35 | 35 | $this->_page=$page; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param mixed $_max |
44 | 44 | */ |
45 | 45 | public function setMax($_max) { |
46 | - $this->_max = $_max; |
|
46 | + $this->_max=$_max; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | * @return HtmlMenu |
42 | 42 | */ |
43 | 43 | public function setType($type="") { |
44 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
44 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function setActiveItem($index) { |
48 | 48 | $item=$this->getItem($index); |
49 | - if ($item !== null) { |
|
49 | + if ($item!==null) { |
|
50 | 50 | $item->addToProperty("class", "active"); |
51 | 51 | } |
52 | 52 | return $this; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | private function getItemToInsert($item) { |
56 | 56 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) { |
57 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
57 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
58 | 58 | $itemO->addClass("no-active"); |
59 | 59 | $item=$itemO; |
60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | private function afterInsert($item) { |
65 | 65 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
66 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
66 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
67 | 67 | else { |
68 | 68 | $this->setSecondary(); |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function addItem($item) { |
80 | 80 | $number=$item; |
81 | 81 | $item=parent::addItem($this->getItemToInsert($item)); |
82 | - if(\is_int($number)) |
|
82 | + if (\is_int($number)) |
|
83 | 83 | $item->setProperty("data-page", $number); |
84 | 84 | return $this->afterInsert($item); |
85 | 85 | } |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | |
98 | 98 | public function generateMenuAsItem($menu, $header=null) { |
99 | 99 | $count=$this->count(); |
100 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
100 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
101 | 101 | if (isset($header)) { |
102 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
102 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
103 | 103 | $headerItem->setContent($header); |
104 | 104 | $item->addContent($headerItem); |
105 | 105 | $this->_itemHeader=$headerItem; |
106 | 106 | } |
107 | - if(\is_array($menu)){ |
|
108 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
107 | + if (\is_array($menu)) { |
|
108 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
109 | 109 | } |
110 | 110 | $menu->setClass("menu"); |
111 | 111 | $item->addContent($menu); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
121 | 121 | $value->addContent(new HtmlIcon("", "dropdown")); |
122 | 122 | $value=$this->addItem($value); |
123 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
123 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
124 | 124 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
125 | 125 | $this->wrap("", $popup); |
126 | 126 | return $popup; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function addDropdownAsItem($value, $items=NULL) { |
130 | 130 | $dd=$value; |
131 | 131 | if (\is_string($value)) { |
132 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
132 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
133 | 133 | } |
134 | 134 | $this->addItem($dd); |
135 | 135 | return $dd; |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * @see HtmlCollection::createItem() |
143 | 143 | */ |
144 | 144 | protected function createItem($value) { |
145 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
145 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
146 | 146 | $itemO->setTagName("a"); |
147 | 147 | $itemO->setContent($value); |
148 | 148 | return $itemO; |
149 | 149 | } |
150 | 150 | |
151 | 151 | public function setSecondary($value=true) { |
152 | - if($value) |
|
152 | + if ($value) |
|
153 | 153 | $this->addToProperty("class", "secondary"); |
154 | 154 | else |
155 | 155 | $this->removePropertyValue("class", "secondary"); |
@@ -157,28 +157,28 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | public function setVertical() { |
160 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
160 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function setPosition($value="right") { |
164 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
164 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | public function setPointing($value=Direction::NONE) { |
168 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
168 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | public function asTab($vertical=false) { |
172 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
172 | + $this->apply(function(HtmlDoubleElement &$item) { |
|
173 | 173 | $item->setTagName("a"); |
174 | 174 | }); |
175 | - if ($vertical === true) |
|
175 | + if ($vertical===true) |
|
176 | 176 | $this->setVertical(); |
177 | 177 | return $this->addToProperty("class", "tabular"); |
178 | 178 | } |
179 | 179 | |
180 | 180 | public function asPagination() { |
181 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
181 | + $this->apply(function(HtmlDoubleElement &$item) { |
|
182 | 182 | $item->setTagName("a"); |
183 | 183 | }); |
184 | 184 | return $this->addToProperty("class", "pagination"); |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function setWidth($width) { |
217 | 217 | if (\is_int($width)) { |
218 | - $width=Wide::getConstants()["W" . $width]; |
|
218 | + $width=Wide::getConstants()["W".$width]; |
|
219 | 219 | } |
220 | 220 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
221 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
221 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | public function addImage($identifier, $src="", $alt="") { |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | return $this->_itemHeader; |
234 | 234 | } |
235 | 235 | |
236 | - public function setHasContainer(){ |
|
237 | - return $this->wrapContent("<div class='ui container'>","</div>"); |
|
236 | + public function setHasContainer() { |
|
237 | + return $this->wrapContent("<div class='ui container'>", "</div>"); |
|
238 | 238 | } |
239 | 239 | |
240 | - public function run(JsUtils $js){ |
|
241 | - if($this->identifier!=="" && !isset($this->_bsComponent)) |
|
242 | - $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false); |
|
243 | - $result= parent::run($js); |
|
240 | + public function run(JsUtils $js) { |
|
241 | + if ($this->identifier!=="" && !isset($this->_bsComponent)) |
|
242 | + $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false); |
|
243 | + $result=parent::run($js); |
|
244 | 244 | return $result->setItemSelector(".item"); |
245 | 245 | } |
246 | 246 | } |
@@ -5,20 +5,20 @@ |
||
5 | 5 | use Ajax\common\html\HtmlDoubleElement; |
6 | 6 | use Ajax\common\html\HtmlCollection; |
7 | 7 | |
8 | -class HtmlDatalist extends HtmlCollection{ |
|
8 | +class HtmlDatalist extends HtmlCollection { |
|
9 | 9 | |
10 | - public function __construct($identifier){ |
|
11 | - parent::__construct($identifier,"datalist"); |
|
10 | + public function __construct($identifier) { |
|
11 | + parent::__construct($identifier, "datalist"); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | protected function createItem($value) { |
15 | - $elm= new HtmlDoubleElement("","option"); |
|
15 | + $elm=new HtmlDoubleElement("", "option"); |
|
16 | 16 | $elm->setProperty("value", $value->getContent()); |
17 | 17 | $elm->setContent($value); |
18 | 18 | return $elm; |
19 | 19 | } |
20 | 20 | |
21 | - protected function createCondition($value){ |
|
21 | + protected function createCondition($value) { |
|
22 | 22 | return true; |
23 | 23 | } |
24 | 24 | } |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | |
26 | 26 | protected function createItem($value) { |
27 | 27 | $count=$this->count(); |
28 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
28 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
29 | 29 | return $item; |
30 | 30 | } |
31 | 31 | |
32 | 32 | public function addHeader($niveau, $content) { |
33 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
33 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
34 | 34 | $this->wrap($header); |
35 | 35 | return $header; |
36 | 36 | } |
37 | 37 | |
38 | - public function getItemPart($index,$partName="header"){ |
|
38 | + public function getItemPart($index, $partName="header") { |
|
39 | 39 | return $this->getItem($index)->getPart($partName); |
40 | 40 | } |
41 | 41 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | return $this->contentAs($tagName); |
44 | 44 | } |
45 | 45 | |
46 | - public function asLinks($hrefs=[],$target=NUll) { |
|
47 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
48 | - return parent::asLinks($hrefs,$target); |
|
46 | + public function asLinks($hrefs=[], $target=NUll) { |
|
47 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
48 | + return parent::asLinks($hrefs, $target); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function addList($items=array()) { |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @return HtmlListItem |
59 | 59 | */ |
60 | - public function getItem($index){ |
|
60 | + public function getItem($index) { |
|
61 | 61 | return parent::getItem($index); |
62 | 62 | } |
63 | 63 | |
64 | - protected function getItemToAdd($item){ |
|
64 | + protected function getItemToAdd($item) { |
|
65 | 65 | $itemO=parent::getItemToAdd($item); |
66 | - if($itemO instanceof AbstractCheckbox) |
|
66 | + if ($itemO instanceof AbstractCheckbox) |
|
67 | 67 | $itemO->addClass("item"); |
68 | 68 | return $itemO; |
69 | 69 | } |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function run(JsUtils $js) { |
84 | - if ($this->_hasCheckedList === true) { |
|
85 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
86 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
84 | + if ($this->_hasCheckedList===true) { |
|
85 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
86 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
87 | 87 | $jsCode=\str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode); |
88 | 88 | $jsCode=\str_replace("%onChange%", $this->_ckItemChange, $jsCode); |
89 | 89 | $this->executeOnRun($jsCode); |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | return parent::run($js); |
92 | 92 | } |
93 | 93 | |
94 | - protected function addFollowPoints(){ |
|
94 | + protected function addFollowPoints() { |
|
95 | 95 | $count=$this->count(); |
96 | - for ($i=$this->_maxVisible;$i<$count;$i++){ |
|
96 | + for ($i=$this->_maxVisible; $i<$count; $i++) { |
|
97 | 97 | $this->getItem($i)->addClass("notVisible")->setProperty("style", "display: none;"); |
98 | 98 | } |
99 | 99 | $item=$this->addItem("..."); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $item->onClick('$(this).hide();$("#'.$this->identifier.' .notVisible").show();'); |
102 | 102 | } |
103 | 103 | |
104 | - public function onCkItemChange($jsCode){ |
|
104 | + public function onCkItemChange($jsCode) { |
|
105 | 105 | $this->_ckItemChange=$jsCode; |
106 | 106 | } |
107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param boolean $fireOnInit |
110 | 110 | */ |
111 | 111 | public function setFireOnInit($fireOnInit) { |
112 | - $this->_fireOnInit = $fireOnInit; |
|
112 | + $this->_fireOnInit=$fireOnInit; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function setRelaxed() { |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | * {@inheritDoc} |
133 | 133 | * @see \Ajax\common\html\HtmlCollection::compile() |
134 | 134 | */ |
135 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
136 | - if(isset($this->_maxVisible) && $this->_maxVisible<$this->count()){ |
|
135 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
136 | + if (isset($this->_maxVisible) && $this->_maxVisible<$this->count()) { |
|
137 | 137 | $this->addFollowPoints(); |
138 | - if(isset($js)){ |
|
138 | + if (isset($js)) { |
|
139 | 139 | $visibility=new Visibility($js); |
140 | 140 | $visibility->attach("#".$this->identifier); |
141 | 141 | $visibility->setOnTopVisible("$(this).children('.notVisible').hide();$(this).find('.points').show();"); |
142 | 142 | $visibility->compile($js); |
143 | 143 | } |
144 | 144 | } |
145 | - return parent::compile ($js,$view); |
|
145 | + return parent::compile($js, $view); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -153,42 +153,42 @@ discard block |
||
153 | 153 | * @param string $notAllChecked |
154 | 154 | * @return HtmlList |
155 | 155 | */ |
156 | - public function addCheckedList($items=array(), $masterItem=NULL, $values=array(),$notAllChecked=false,$name=null) { |
|
156 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) { |
|
157 | 157 | $count=$this->count(); |
158 | - $identifier=$this->identifier . "-" . $count; |
|
158 | + $identifier=$this->identifier."-".$count; |
|
159 | 159 | if (isset($masterItem)) { |
160 | - if(\is_array($masterItem)){ |
|
161 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0],@$masterItem[1]); |
|
162 | - if(isset($name)) |
|
160 | + if (\is_array($masterItem)) { |
|
161 | + $masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]); |
|
162 | + if (isset($name)) |
|
163 | 163 | $masterO->setName($name); |
164 | - if(isset($masterItem[1])){ |
|
165 | - if(\array_search($masterItem[1], $values)!==false){ |
|
164 | + if (isset($masterItem[1])) { |
|
165 | + if (\array_search($masterItem[1], $values)!==false) { |
|
166 | 166 | $masterO->getDataField()->setProperty("checked", ""); |
167 | 167 | } |
168 | 168 | } |
169 | - }else{ |
|
170 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
169 | + } else { |
|
170 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
171 | 171 | } |
172 | - if($notAllChecked){ |
|
172 | + if ($notAllChecked) { |
|
173 | 173 | $masterO->getDataField()->addClass("_notAllChecked"); |
174 | 174 | } |
175 | 175 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
176 | 176 | $masterO->setClass("item"); |
177 | 177 | $this->addItem($masterO); |
178 | 178 | } |
179 | - $fields=array (); |
|
179 | + $fields=array(); |
|
180 | 180 | $i=0; |
181 | - foreach ( $items as $val => $caption ) { |
|
182 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
183 | - if (\array_search($val, $values) !== false) { |
|
181 | + foreach ($items as $val => $caption) { |
|
182 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
183 | + if (\array_search($val, $values)!==false) { |
|
184 | 184 | $itemO->getDataField()->setProperty("checked", ""); |
185 | 185 | } |
186 | - if(isset($name)) |
|
186 | + if (isset($name)) |
|
187 | 187 | $itemO->setName($name); |
188 | 188 | $itemO->setClass("item"); |
189 | 189 | $fields[]=$itemO; |
190 | 190 | } |
191 | - if (isset($masterO) === true) { |
|
191 | + if (isset($masterO)===true) { |
|
192 | 192 | $list=new HtmlList("", $fields); |
193 | 193 | $list->setClass("list"); |
194 | 194 | $masterO->addContent($list); |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | return $this; |
200 | 200 | } |
201 | 201 | |
202 | - public function setIcons($icons){ |
|
203 | - if(!\is_array($icons)){ |
|
202 | + public function setIcons($icons) { |
|
203 | + if (!\is_array($icons)) { |
|
204 | 204 | $icons=\array_fill(0, \sizeof($this->content), $icons); |
205 | 205 | } |
206 | - $max=\min(\sizeof($icons),\sizeof($this->content)); |
|
207 | - for($i=0;$i<$max;$i++){ |
|
206 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
207 | + for ($i=0; $i<$max; $i++) { |
|
208 | 208 | $this->content[$i]->addIcon($icons[$i]); |
209 | 209 | } |
210 | 210 | return $this; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param mixed $_maxVisible |
221 | 221 | */ |
222 | 222 | public function setMaxVisible($_maxVisible) { |
223 | - $this->_maxVisible = $_maxVisible; |
|
223 | + $this->_maxVisible=$_maxVisible; |
|
224 | 224 | return $this; |
225 | 225 | } |
226 | 226 |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @return HtmlButton |
43 | 43 | */ |
44 | 44 | public function setValue($value) { |
45 | - if(is_array($this->content)){ |
|
46 | - foreach ($this->content as $i=>$content){ |
|
47 | - if(is_string($content)){ |
|
45 | + if (is_array($this->content)) { |
|
46 | + foreach ($this->content as $i=>$content) { |
|
47 | + if (is_string($content)) { |
|
48 | 48 | $this->content[$i]=$value; |
49 | 49 | return $this; |
50 | 50 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | public function setFocusable($value=true) { |
67 | - if ($value === true) |
|
67 | + if ($value===true) |
|
68 | 68 | $this->setProperty("tabindex", "0"); |
69 | 69 | else { |
70 | 70 | $this->removeProperty("tabindex"); |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | public function setAnimated($content, $animation="") { |
76 | 76 | $this->setTagName("div"); |
77 | - $this->addToProperty("class", "animated " . $animation); |
|
78 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
77 | + $this->addToProperty("class", "animated ".$animation); |
|
78 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
79 | 79 | $visible->setClass("visible content"); |
80 | 80 | $visible->setContent($this->content); |
81 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
81 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
82 | 82 | $hidden->setClass("hidden content"); |
83 | 83 | $hidden->setContent($content); |
84 | - $this->content=array ($visible,$hidden ); |
|
84 | + $this->content=array($visible, $hidden); |
|
85 | 85 | return $hidden; |
86 | 86 | } |
87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function asIcon($icon) { |
94 | 94 | $iconO=$icon; |
95 | 95 | if (\is_string($icon)) { |
96 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
96 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
97 | 97 | } |
98 | 98 | $this->addToProperty("class", "icon"); |
99 | 99 | $this->content=$iconO; |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | * @return HtmlLabel |
114 | 114 | */ |
115 | 115 | public function addLabel($label, $before=false, $icon=NULL) { |
116 | - $this->tagName="div";$prefix=""; |
|
117 | - if($before) |
|
116 | + $this->tagName="div"; $prefix=""; |
|
117 | + if ($before) |
|
118 | 118 | $prefix="left "; |
119 | 119 | $this->addToProperty("class", $prefix."labeled"); |
120 | 120 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
121 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
122 | - if($isIcon){ |
|
121 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
122 | + if ($isIcon) { |
|
123 | 123 | $this->content->addClass("icon"); |
124 | 124 | } |
125 | 125 | $this->content->setTagName("div"); |
126 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
126 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
127 | 127 | $label->setBasic(); |
128 | 128 | $this->addContent($label, $before); |
129 | 129 | return $label; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function fromArray($array) { |
137 | 137 | $array=parent::fromArray($array); |
138 | - foreach ( $array as $key => $value ) { |
|
138 | + foreach ($array as $key => $value) { |
|
139 | 139 | $this->setProperty($key, $value); |
140 | 140 | } |
141 | 141 | return $array; |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | return $this->addToProperty("class", "positive"); |
150 | 150 | } |
151 | 151 | |
152 | - public function setColor($color){ |
|
153 | - if(\is_array($this->content)){ |
|
154 | - foreach ($this->content as $content){ |
|
155 | - if($content instanceof HtmlButton) |
|
152 | + public function setColor($color) { |
|
153 | + if (\is_array($this->content)) { |
|
154 | + foreach ($this->content as $content) { |
|
155 | + if ($content instanceof HtmlButton) |
|
156 | 156 | $content->setColor($color); |
157 | 157 | } |
158 | 158 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return HtmlButton |
211 | 211 | */ |
212 | 212 | public static function social($identifier, $social, $value=NULL) { |
213 | - if ($value === NULL) |
|
213 | + if ($value===NULL) |
|
214 | 214 | $value=\ucfirst($social); |
215 | 215 | $return=new HtmlButton($identifier, $value); |
216 | 216 | $return->addIcon($social); |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | * {@inheritDoc} |
248 | 248 | * @see HtmlSemDoubleElement::asLink() |
249 | 249 | */ |
250 | - public function asLink($href=NULL,$target=NULL) { |
|
251 | - parent::asLink($href,$target); |
|
250 | + public function asLink($href=NULL, $target=NULL) { |
|
251 | + parent::asLink($href, $target); |
|
252 | 252 | return $this; |
253 | 253 | } |
254 | 254 | |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | * @param string $icon |
262 | 262 | * @return HtmlButtonGroups |
263 | 263 | */ |
264 | - public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
265 | - $result=new HtmlButtonGroups($identifier,[$value]); |
|
266 | - $dd=$result->addDropdown($items,$asCombo); |
|
267 | - if(isset($icon) && $dd instanceof HtmlDropdown) |
|
264 | + public static function dropdown($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
265 | + $result=new HtmlButtonGroups($identifier, [$value]); |
|
266 | + $dd=$result->addDropdown($items, $asCombo); |
|
267 | + if (isset($icon) && $dd instanceof HtmlDropdown) |
|
268 | 268 | $dd->setIcon($icon); |
269 | 269 | return $result; |
270 | 270 | } |