@@ -11,6 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $baseClass |
|
| 16 | + */ |
|
| 14 | 17 | public function __construct($identifier, $baseClass,$content=NULL) { |
| 15 | 18 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 19 | $this->content=array(); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\semantic\html\elements\HtmlIcon; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\service\JArray; |
| 10 | 9 | use Ajax\semantic\html\elements\html5\HtmlImg; |
| 11 | 10 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
| 14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 16 | $this->content=array(); |
| 17 | 17 | $this->initContent($content); |
@@ -19,53 +19,53 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | abstract protected function initContent($content); |
| 21 | 21 | |
| 22 | - public function setIcon($icon){ |
|
| 22 | + public function setIcon($icon) { |
|
| 23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setImage($image){ |
|
| 26 | + public function setImage($image) { |
|
| 27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
| 28 | 28 | $image->asAvatar(); |
| 29 | 29 | $this->content["image"]=$image; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private function createContent(){ |
|
| 33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
| 32 | + private function createContent() { |
|
| 33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
| 34 | 34 | return $this->content["content"]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
| 38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
| 39 | - if(\array_key_exists("content", $this->content)===false){ |
|
| 37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
| 38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
| 39 | + if (\array_key_exists("content", $this->content)===false) { |
|
| 40 | 40 | $this->createContent(); |
| 41 | 41 | } |
| 42 | 42 | $this->content["content"]->addContent($title); |
| 43 | - if(isset($description)){ |
|
| 44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
| 43 | + if (isset($description)) { |
|
| 44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
| 45 | 45 | $this->content["content"]->addContent($description); |
| 46 | 46 | } |
| 47 | 47 | return $this; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getPart($partName="header"){ |
|
| 51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
| 50 | + public function getPart($partName="header") { |
|
| 51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
| 52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setActive($value=true){ |
|
| 56 | - if($value){ |
|
| 55 | + public function setActive($value=true) { |
|
| 56 | + if ($value) { |
|
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function asLink($href=NULL,$part=NULL){ |
|
| 66 | + public function asLink($href=NULL, $part=NULL) { |
|
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 68 | + if (isset($href)) |
|
| 69 | 69 | $this->setProperty("href", $href); |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 78 | */ |
| 79 | 79 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 80 | + if (\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
| 82 | 82 | return parent::compile($js, $view); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else{ |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function asLink($href=NULL,$part=NULL){ |
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 69 | - $this->setProperty("href", $href); |
|
| 68 | + if(isset($href)) { |
|
| 69 | + $this->setProperty("href", $href); |
|
| 70 | + } |
|
| 70 | 71 | return $this; |
| 71 | 72 | } |
| 72 | 73 | |
@@ -77,8 +78,9 @@ discard block |
||
| 77 | 78 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 79 | */ |
| 79 | 80 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 81 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
| 82 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 83 | + } |
|
| 82 | 84 | return parent::compile($js, $view); |
| 83 | 85 | } |
| 84 | 86 | } |
| 85 | 87 | \ No newline at end of file |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
| 26 | 29 | parent::__construct( $identifier,"div","row"); |
| 27 | 30 | $this->_implicite=$implicite; |
@@ -55,7 +58,7 @@ discard block |
||
| 55 | 58 | /** |
| 56 | 59 | * return the col at $index |
| 57 | 60 | * @param int $index |
| 58 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
| 61 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 59 | 62 | */ |
| 60 | 63 | public function getCol($index){ |
| 61 | 64 | return $this->getItem($index); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\constants\Wide; |
| 6 | 6 | use Ajax\semantic\html\base\constants\Color; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 10 | 9 | use Ajax\semantic\html\base\traits\TextAlignmentTrait; |
| 11 | 10 | |
@@ -29,10 +29,11 @@ |
||
| 29 | 29 | if(isset($numCols)){ |
| 30 | 30 | $numCols=min(16,$numCols); |
| 31 | 31 | $numCols=max(1,$numCols); |
| 32 | - if($colSizing) |
|
| 33 | - $width=(int)(16/$numCols); |
|
| 34 | - else |
|
| 35 | - $this->_colSize=16/$numCols; |
|
| 32 | + if($colSizing) { |
|
| 33 | + $width=(int)(16/$numCols); |
|
| 34 | + } else { |
|
| 35 | + $this->_colSize=16/$numCols; |
|
| 36 | + } |
|
| 36 | 37 | for ($i=0;$i<$numCols;$i++){ |
| 37 | 38 | $this->addItem($width); |
| 38 | 39 | } |
@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
| 19 | +class HtmlGridRow extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | |
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
| 26 | - parent::__construct( $identifier,"div","row"); |
|
| 25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
| 26 | + parent::__construct($identifier, "div", "row"); |
|
| 27 | 27 | $this->_implicite=$implicite; |
| 28 | 28 | $width=null; |
| 29 | - if(isset($numCols)){ |
|
| 30 | - $numCols=min(16,$numCols); |
|
| 31 | - $numCols=max(1,$numCols); |
|
| 32 | - if($colSizing) |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | + $numCols=min(16, $numCols); |
|
| 31 | + $numCols=max(1, $numCols); |
|
| 32 | + if ($colSizing) |
|
| 33 | 33 | $width=(int)(16/$numCols); |
| 34 | 34 | else |
| 35 | 35 | $this->_colSize=16/$numCols; |
| 36 | - for ($i=0;$i<$numCols;$i++){ |
|
| 36 | + for ($i=0; $i<$numCols; $i++) { |
|
| 37 | 37 | $this->addItem($width); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @param int $width |
| 45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 46 | 46 | */ |
| 47 | - public function setWidth($width){ |
|
| 48 | - if(\is_int($width)){ |
|
| 47 | + public function setWidth($width) { |
|
| 48 | + if (\is_int($width)) { |
|
| 49 | 49 | $width=Wide::getConstants()["W".$width]; |
| 50 | 50 | } |
| 51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
| 57 | 57 | * @param int $index |
| 58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCol($index){ |
|
| 60 | + public function getCol($index) { |
|
| 61 | 61 | return $this->getItem($index); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
| 64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
| 65 | 65 | $this->setWidth($colsCount); |
| 66 | - if($toCreate===true){ |
|
| 66 | + if ($toCreate===true) { |
|
| 67 | 67 | $count=$this->count(); |
| 68 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 69 | 69 | $this->addItem(null); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addCols($colCount){ |
|
| 76 | - for($i=0;$i<$colCount;$i++){ |
|
| 75 | + public function addCols($colCount) { |
|
| 76 | + for ($i=0; $i<$colCount; $i++) { |
|
| 77 | 77 | $this->addItem(null); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addCol($width=NULL){ |
|
| 82 | + public function addCol($width=NULL) { |
|
| 83 | 83 | return $this->addItem($width); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * stretch the row contents to take up the entire column height |
| 88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 89 | 89 | */ |
| 90 | - public function setStretched(){ |
|
| 90 | + public function setStretched() { |
|
| 91 | 91 | return $this->addToProperty("class", "stretched"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | * @param string $color |
| 96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 97 | 97 | */ |
| 98 | - public function setColor($color){ |
|
| 99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 98 | + public function setColor($color) { |
|
| 99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setValues($values,$force=false){ |
|
| 102 | + public function setValues($values, $force=false) { |
|
| 103 | 103 | $count=$this->count(); |
| 104 | 104 | $valuesSize=\sizeof($values); |
| 105 | - if($force===true){ |
|
| 106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
| 107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 105 | + if ($force===true) { |
|
| 106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - $count=\min(array($this->count(),$valuesSize)); |
|
| 111 | - for($i=0;$i<$count;$i++){ |
|
| 110 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 111 | + for ($i=0; $i<$count; $i++) { |
|
| 112 | 112 | $this->content[$i]->setValue($values[$i]); |
| 113 | 113 | } |
| 114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | * {@inheritDoc} |
| 119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 120 | 120 | */ |
| 121 | - protected function createItem($value){ |
|
| 122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 121 | + protected function createItem($value) { |
|
| 122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 123 | 123 | return $col; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 127 | - if($this->_implicite===true){ |
|
| 126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 127 | + if ($this->_implicite===true) { |
|
| 128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 129 | 129 | } |
| 130 | - return parent::compile($js,$view); |
|
| 130 | + return parent::compile($js, $view); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | \ No newline at end of file |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | private $_container; |
| 19 | 19 | private $_row; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $identifier |
|
| 23 | + */ |
|
| 21 | 24 | public function __construct($identifier) { |
| 22 | 25 | parent::__construct($identifier, "tr", ""); |
| 23 | 26 | $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
@@ -105,17 +105,20 @@ discard block |
||
| 105 | 105 | $max=\min($colIndex, $rows[$i]->count()); |
| 106 | 106 | for($j=0; $j < $max; $j++) { |
| 107 | 107 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
| 108 | - if ($rowspan + $i > $this->_row) |
|
| 109 | - $pos++; |
|
| 108 | + if ($rowspan + $i > $this->_row) { |
|
| 109 | + $pos++; |
|
| 110 | + } |
|
| 110 | 111 | } |
| 111 | 112 | } |
| 112 | - if ($pos > $colIndex) |
|
| 113 | - return NULL; |
|
| 113 | + if ($pos > $colIndex) { |
|
| 114 | + return NULL; |
|
| 115 | + } |
|
| 114 | 116 | $count=$this->count(); |
| 115 | 117 | for($i=0; $i < $count; $i++) { |
| 116 | 118 | $pos+=$this->content[$i]->getColspan(); |
| 117 | - if ($pos >= $colIndex + 1) |
|
| 118 | - return $i; |
|
| 119 | + if ($pos >= $colIndex + 1) { |
|
| 120 | + return $i; |
|
| 121 | + } |
|
| 119 | 122 | } |
| 120 | 123 | return null; |
| 121 | 124 | } |
@@ -138,8 +141,9 @@ discard block |
||
| 138 | 141 | public function containsStr($needle) { |
| 139 | 142 | $cells=$this->content; |
| 140 | 143 | foreach ( $cells as $cell ) { |
| 141 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 142 | - return true; |
|
| 144 | + if (\strpos($cell->getContent(), $needle) !== false) { |
|
| 145 | + return true; |
|
| 146 | + } |
|
| 143 | 147 | } |
| 144 | 148 | return false; |
| 145 | 149 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function __construct($identifier) { |
| 22 | 22 | parent::__construct($identifier, "tr", ""); |
| 23 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
| 23 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function setColCount($colCount) { |
| 27 | 27 | $count=$this->count(); |
| 28 | - for($i=$count; $i < $colCount; $i++) { |
|
| 28 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 29 | 29 | $item=$this->addItem(NULL); |
| 30 | 30 | $item->setTagName($this->_tdTagName); |
| 31 | 31 | } |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | if (!\is_array($values)) { |
| 69 | 69 | $values=\array_fill(0, $count, $values); |
| 70 | 70 | } else { |
| 71 | - if (JArray::isAssociative($values) === true) { |
|
| 71 | + if (JArray::isAssociative($values)===true) { |
|
| 72 | 72 | $values=\array_values($values); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | $count=\min(\sizeof($values), $count); |
| 76 | 76 | |
| 77 | - for($i=0; $i < $count; $i++) { |
|
| 77 | + for ($i=0; $i<$count; $i++) { |
|
| 78 | 78 | $cell=$this->content[$i]; |
| 79 | 79 | $cell->setValue($values[$i]); |
| 80 | 80 | } |
@@ -101,20 +101,20 @@ discard block |
||
| 101 | 101 | public function getColPosition($colIndex) { |
| 102 | 102 | $pos=0; |
| 103 | 103 | $rows=$this->_container->getContent(); |
| 104 | - for($i=0; $i < $this->_row; $i++) { |
|
| 104 | + for ($i=0; $i<$this->_row; $i++) { |
|
| 105 | 105 | $max=\min($colIndex, $rows[$i]->count()); |
| 106 | - for($j=0; $j < $max; $j++) { |
|
| 106 | + for ($j=0; $j<$max; $j++) { |
|
| 107 | 107 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
| 108 | - if ($rowspan + $i > $this->_row) |
|
| 108 | + if ($rowspan+$i>$this->_row) |
|
| 109 | 109 | $pos++; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | - if ($pos > $colIndex) |
|
| 112 | + if ($pos>$colIndex) |
|
| 113 | 113 | return NULL; |
| 114 | 114 | $count=$this->count(); |
| 115 | - for($i=0; $i < $count; $i++) { |
|
| 115 | + for ($i=0; $i<$count; $i++) { |
|
| 116 | 116 | $pos+=$this->content[$i]->getColspan(); |
| 117 | - if ($pos >= $colIndex + 1) |
|
| 117 | + if ($pos>=$colIndex+1) |
|
| 118 | 118 | return $i; |
| 119 | 119 | } |
| 120 | 120 | return null; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function conditionalCellFormat($callback, $format) { |
| 124 | 124 | $cells=$this->content; |
| 125 | - foreach ( $cells as $cell ) { |
|
| 125 | + foreach ($cells as $cell) { |
|
| 126 | 126 | $cell->conditionalCellFormat($callback, $format); |
| 127 | 127 | } |
| 128 | 128 | return $this; |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function containsStr($needle) { |
| 139 | 139 | $cells=$this->content; |
| 140 | - foreach ( $cells as $cell ) { |
|
| 141 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 140 | + foreach ($cells as $cell) { |
|
| 141 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
| 142 | 142 | return true; |
| 143 | 143 | } |
| 144 | 144 | return false; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | public function applyCells($callback) { |
| 153 | 153 | $cells=$this->content; |
| 154 | - foreach ( $cells as $cell ) { |
|
| 154 | + foreach ($cells as $cell) { |
|
| 155 | 155 | $cell->apply($callback); |
| 156 | 156 | } |
| 157 | 157 | return $this; |
@@ -13,6 +13,9 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class HtmlIconGroups extends HtmlSemCollection { |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $identifier |
|
| 18 | + */ |
|
| 16 | 19 | public function __construct($identifier, $icons=array(), $size="") { |
| 17 | 20 | parent::__construct($identifier, "i", "icons"); |
| 18 | 21 | $this->addItems($icons); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $icon=JArray::getValue($value, "icon", 0); |
| 27 | 27 | $size=JArray::getValue($value, "size", 1); |
| 28 | 28 | } |
| 29 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 29 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 30 | 30 | if (isset($size)) { |
| 31 | 31 | $iconO->setSize($size); |
| 32 | 32 | } |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | protected function createCondition($value) { |
| 37 | - return ($value instanceof HtmlIcon) === false; |
|
| 37 | + return ($value instanceof HtmlIcon)===false; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getIcon($index) { |
| 41 | 41 | return $this->content[$index]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function run(JsUtils $js){ |
|
| 45 | - $result= parent::run($js); |
|
| 44 | + public function run(JsUtils $js) { |
|
| 45 | + $result=parent::run($js); |
|
| 46 | 46 | return $result->setItemSelector("i"); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -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); |
@@ -22,6 +25,9 @@ discard block |
||
| 22 | 25 | return $item; |
| 23 | 26 | } |
| 24 | 27 | |
| 28 | + /** |
|
| 29 | + * @param integer $niveau |
|
| 30 | + */ |
|
| 25 | 31 | public function addHeader($niveau, $content) { |
| 26 | 32 | $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
| 27 | 33 | $this->wrap($header); |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function createItem($value) { |
| 20 | 20 | $count=$this->count(); |
| 21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 22 | 22 | return $item; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addHeader($niveau, $content) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 27 | 27 | $this->wrap($header); |
| 28 | 28 | return $header; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getItemPart($index,$partName="header"){ |
|
| 31 | + public function getItemPart($index, $partName="header") { |
|
| 32 | 32 | return $this->getItem($index)->getPart($partName); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asLink() { |
| 40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 41 | 41 | return $this->contentAs("a"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function run(JsUtils $js) { |
| 63 | - if ($this->_hasCheckedList === true) { |
|
| 64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 63 | + if ($this->_hasCheckedList===true) { |
|
| 64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 66 | 66 | $this->executeOnRun($jsCode); |
| 67 | 67 | } |
| 68 | 68 | return parent::run($js); |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
| 88 | 88 | $count=$this->count(); |
| 89 | - $identifier=$this->identifier . "-" . $count; |
|
| 89 | + $identifier=$this->identifier."-".$count; |
|
| 90 | 90 | if (isset($masterItem)) { |
| 91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 92 | 92 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
| 93 | 93 | $masterO->setClass("item"); |
| 94 | 94 | $this->addItem($masterO); |
| 95 | 95 | } |
| 96 | - $fields=array (); |
|
| 96 | + $fields=array(); |
|
| 97 | 97 | $i=0; |
| 98 | - foreach ( $items as $val => $caption ) { |
|
| 99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 100 | - if (\array_search($val, $values) !== false) { |
|
| 98 | + foreach ($items as $val => $caption) { |
|
| 99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 100 | + if (\array_search($val, $values)!==false) { |
|
| 101 | 101 | $itemO->getField()->setProperty("checked", ""); |
| 102 | 102 | } |
| 103 | 103 | $itemO->setClass("item"); |
| 104 | 104 | $fields[]=$itemO; |
| 105 | 105 | } |
| 106 | - if (isset($masterO) === true) { |
|
| 106 | + if (isset($masterO)===true) { |
|
| 107 | 107 | $list=new HtmlList("", $fields); |
| 108 | 108 | $list->setClass("list"); |
| 109 | 109 | $masterO->addContent($list); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 6 | 6 | use Ajax\semantic\html\content\HtmlStepItem; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 9 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 10 | |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 10 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 11 | |
| 12 | -class HtmlStep extends HtmlSemCollection{ |
|
| 12 | +class HtmlStep extends HtmlSemCollection { |
|
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | |
| 15 | - public function __construct( $identifier,$steps=array()){ |
|
| 16 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 15 | + public function __construct($identifier, $steps=array()) { |
|
| 16 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 17 | 17 | $this->addItems($steps); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 24 | 24 | */ |
| 25 | 25 | protected function createItem($value) { |
| 26 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 26 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 27 | 27 | return $itemO; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,50 +31,50 @@ discard block |
||
| 31 | 31 | * @param string|array $step |
| 32 | 32 | * @return HtmlStepItem |
| 33 | 33 | */ |
| 34 | - public function addStep($step){ |
|
| 34 | + public function addStep($step) { |
|
| 35 | 35 | return $this->addItem($step); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function setOrdered(){ |
|
| 38 | + public function setOrdered() { |
|
| 39 | 39 | return $this->addToProperty("class", "ordered"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function isOrdered(){ |
|
| 42 | + public function isOrdered() { |
|
| 43 | 43 | return $this->propertyContains("class", "ordered"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setVertical(){ |
|
| 46 | + public function setVertical() { |
|
| 47 | 47 | return $this->addToProperty("class", "vertical"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - protected function defineActiveStep(){ |
|
| 50 | + protected function defineActiveStep() { |
|
| 51 | 51 | $activestep=$this->_activeStep; |
| 52 | 52 | $count=$this->count(); |
| 53 | - if($this->isOrdered()){ |
|
| 54 | - for($i=0;$i<$count;$i++){ |
|
| 53 | + if ($this->isOrdered()) { |
|
| 54 | + for ($i=0; $i<$count; $i++) { |
|
| 55 | 55 | $step=$this->content[$i]; |
| 56 | 56 | $step->removeStatus(); |
| 57 | - if($i<$activestep) |
|
| 57 | + if ($i<$activestep) |
|
| 58 | 58 | $step->setCompleted(); |
| 59 | 59 | elseif ($i===$activestep) |
| 60 | 60 | $step->setActive(); |
| 61 | 61 | else |
| 62 | 62 | $step->setDisabled(); |
| 63 | 63 | } |
| 64 | - }else{ |
|
| 65 | - foreach ($this->content as $step){ |
|
| 64 | + } else { |
|
| 65 | + foreach ($this->content as $step) { |
|
| 66 | 66 | $step->removeStatus(); |
| 67 | 67 | } |
| 68 | - if($activestep<$count) |
|
| 68 | + if ($activestep<$count) |
|
| 69 | 69 | $this->content[$activestep]->setActive(); |
| 70 | 70 | } |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 75 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 75 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | 76 | $this->defineActiveStep(); |
| 77 | - return parent::compile($js,$view); |
|
| 77 | + return parent::compile($js, $view); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function setActiveStep($_activeStep) { |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 86 | - if(isset($toElement)){ |
|
| 87 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 85 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 86 | + if (isset($toElement)) { |
|
| 87 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 88 | 88 | } |
| 89 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 89 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function asLink(){ |
|
| 93 | - foreach ($this->content as $step){ |
|
| 92 | + public function asLink() { |
|
| 93 | + foreach ($this->content as $step) { |
|
| 94 | 94 | $step->asLink(); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
@@ -54,26 +54,29 @@ |
||
| 54 | 54 | for($i=0;$i<$count;$i++){ |
| 55 | 55 | $step=$this->content[$i]; |
| 56 | 56 | $step->removeStatus(); |
| 57 | - if($i<$activestep) |
|
| 58 | - $step->setCompleted(); |
|
| 59 | - elseif ($i===$activestep) |
|
| 60 | - $step->setActive(); |
|
| 61 | - else |
|
| 62 | - $step->setDisabled(); |
|
| 57 | + if($i<$activestep) { |
|
| 58 | + $step->setCompleted(); |
|
| 59 | + } elseif ($i===$activestep) { |
|
| 60 | + $step->setActive(); |
|
| 61 | + } else { |
|
| 62 | + $step->setDisabled(); |
|
| 63 | + } |
|
| 63 | 64 | } |
| 64 | - }else{ |
|
| 65 | + } else{ |
|
| 65 | 66 | foreach ($this->content as $step){ |
| 66 | 67 | $step->removeStatus(); |
| 67 | 68 | } |
| 68 | - if($activestep<$count) |
|
| 69 | - $this->content[$activestep]->setActive(); |
|
| 69 | + if($activestep<$count) { |
|
| 70 | + $this->content[$activestep]->setActive(); |
|
| 71 | + } |
|
| 70 | 72 | } |
| 71 | 73 | return $this; |
| 72 | 74 | } |
| 73 | 75 | |
| 74 | 76 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 75 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | - $this->defineActiveStep(); |
|
| 77 | + if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) { |
|
| 78 | + $this->defineActiveStep(); |
|
| 79 | + } |
|
| 77 | 80 | return parent::compile($js,$view); |
| 78 | 81 | } |
| 79 | 82 | |
@@ -12,6 +12,9 @@ |
||
| 12 | 12 | class HtmlStep extends HtmlSemCollection{ |
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $identifier |
|
| 17 | + */ |
|
| 15 | 18 | public function __construct( $identifier,$steps=array()){ |
| 16 | 19 | parent::__construct( $identifier,"div", "ui steps"); |
| 17 | 20 | $this->addItems($steps); |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
| 14 | 17 | parent::__construct( $identifier, "div", "ui accordion"); |
| 15 | 18 | } |
@@ -29,6 +32,9 @@ discard block |
||
| 29 | 32 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $title |
|
| 37 | + */ |
|
| 32 | 38 | public function addPanel($title,$content){ |
| 33 | 39 | return $this->addItem([$title,$content]); |
| 34 | 40 | } |
@@ -6,31 +6,31 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | 8 | |
| 9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
| 9 | +class HtmlAccordion extends HtmlSemCollection { |
|
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
| 14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
| 13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
| 14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function createItem($value){ |
|
| 18 | + protected function createItem($value) { |
|
| 19 | 19 | $count=$this->count(); |
| 20 | 20 | $title=$value; |
| 21 | 21 | $content=NULL; |
| 22 | - if(\is_array($value)){ |
|
| 23 | - $title=@$value[0];$content=@$value[1]; |
|
| 22 | + if (\is_array($value)) { |
|
| 23 | + $title=@$value[0]; $content=@$value[1]; |
|
| 24 | 24 | } |
| 25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
| 25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function createCondition($value){ |
|
| 28 | + protected function createCondition($value) { |
|
| 29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function addPanel($title,$content){ |
|
| 33 | - return $this->addItem([$title,$content]); |
|
| 32 | + public function addPanel($title, $content) { |
|
| 33 | + return $this->addItem([$title, $content]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $action a Phalcon action |
| 43 | 43 | * @param array $params |
| 44 | 44 | */ |
| 45 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 46 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 45 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 46 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | * @param string $viewName |
| 55 | 55 | * @param $params The parameters to pass to the view |
| 56 | 56 | */ |
| 57 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 58 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 57 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 58 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 59 | 59 | } |
| 60 | 60 | /* |
| 61 | 61 | * (non-PHPdoc) |
| 62 | 62 | * @see BaseHtml::run() |
| 63 | 63 | */ |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - if(isset($this->_bsComponent)===false) |
|
| 66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 65 | + if (isset($this->_bsComponent)===false) |
|
| 66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
| 67 | 67 | $this->addEventsOnRun($js); |
| 68 | 68 | return $this->_bsComponent; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function setStyled(){ |
|
| 71 | + public function setStyled() { |
|
| 72 | 72 | return $this->addToProperty("class", "styled"); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function activate($index){ |
|
| 75 | + public function activate($index) { |
|
| 76 | 76 | $this->getItem($index)->setActive(true); |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setExclusive($value){ |
|
| 80 | + public function setExclusive($value) { |
|
| 81 | 81 | $this->params["exclusive"]=$value; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -34,8 +34,9 @@ |
||
| 34 | 34 | * @see BaseHtml::run() |
| 35 | 35 | */ |
| 36 | 36 | public function run(JsUtils $js) { |
| 37 | - if(isset($this->_bsComponent)===false) |
|
| 38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 37 | + if(isset($this->_bsComponent)===false) { |
|
| 38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 39 | + } |
|
| 39 | 40 | $this->addEventsOnRun($js); |
| 40 | 41 | return $this->_bsComponent; |
| 41 | 42 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @param string $value default : swing |
| 31 | 31 | */ |
| 32 | 32 | public function setEasing($value) { |
| 33 | - $this->setParamCtrl("easing", $value, array ( |
|
| 33 | + $this->setParamCtrl("easing", $value, array( |
|
| 34 | 34 | "linear", |
| 35 | 35 | "swing", |
| 36 | 36 | "easeInQuad", |
@@ -74,8 +74,9 @@ |
||
| 74 | 74 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 75 | 75 | if (!$typeCtrl($value)) { |
| 76 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position"); |
| 77 | - } else |
|
| 78 | - $this->setParam($key, $value); |
|
| 77 | + } else { |
|
| 78 | + $this->setParam($key, $value); |
|
| 79 | + } |
|
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | /* |