@@ -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); |
@@ -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,19 +95,19 @@ 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 | - if($force===true){ |
|
| 105 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 106 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 104 | + if ($force===true) { |
|
| 105 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 106 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 110 | - for($i=0;$i<$count;$i++){ |
|
| 109 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 110 | + for ($i=0; $i<$count; $i++) { |
|
| 111 | 111 | $this->content[$i]->setValue($values[$i]); |
| 112 | 112 | } |
| 113 | 113 | return $this; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | * {@inheritDoc} |
| 118 | 118 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 119 | 119 | */ |
| 120 | - protected function createItem($value){ |
|
| 121 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 120 | + protected function createItem($value) { |
|
| 121 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 122 | 122 | return $col; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 126 | - if($this->_implicite===true){ |
|
| 125 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 126 | + if ($this->_implicite===true) { |
|
| 127 | 127 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 128 | 128 | } |
| 129 | - return parent::compile($js,$view); |
|
| 129 | + return parent::compile($js, $view); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file |
@@ -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 | } |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -68,10 +68,16 @@ discard block |
||
| 68 | 68 | return $tr; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | + /** |
|
| 72 | + * @param integer $value |
|
| 73 | + */ |
|
| 71 | 74 | public function newRow($value) { |
| 72 | 75 | return $this->createItem($value); |
| 73 | 76 | } |
| 74 | 77 | |
| 78 | + /** |
|
| 79 | + * @param integer $colCount |
|
| 80 | + */ |
|
| 75 | 81 | public function addRow($colCount) { |
| 76 | 82 | return $this->addItem($colCount); |
| 77 | 83 | } |
@@ -97,7 +103,7 @@ discard block |
||
| 97 | 103 | /** |
| 98 | 104 | * |
| 99 | 105 | * @param int $index |
| 100 | - * @return \Ajax\semantic\html\content\HtmlTR |
|
| 106 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 101 | 107 | */ |
| 102 | 108 | public function getRow($index) { |
| 103 | 109 | return $this->getItem($index); |
@@ -141,6 +147,9 @@ discard block |
||
| 141 | 147 | return $this; |
| 142 | 148 | } |
| 143 | 149 | |
| 150 | + /** |
|
| 151 | + * @param integer $colIndex |
|
| 152 | + */ |
|
| 144 | 153 | public function setColValues($colIndex, $values=array()) { |
| 145 | 154 | $count=$this->count(); |
| 146 | 155 | if (\is_array($values) === false) { |
@@ -161,6 +170,9 @@ discard block |
||
| 161 | 170 | return $this; |
| 162 | 171 | } |
| 163 | 172 | |
| 173 | + /** |
|
| 174 | + * @param integer $rowIndex |
|
| 175 | + */ |
|
| 164 | 176 | public function setRowValues($rowIndex, $values=array()) { |
| 165 | 177 | $count=$this->count(); |
| 166 | 178 | if (\is_array($values) === false) { |
@@ -170,6 +182,9 @@ discard block |
||
| 170 | 182 | return $this; |
| 171 | 183 | } |
| 172 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $function |
|
| 187 | + */ |
|
| 173 | 188 | private function colAlign($colIndex, $function) { |
| 174 | 189 | $count=$this->count(); |
| 175 | 190 | for($i=0; $i < $count; $i++) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | 13 | class HtmlTableContent extends HtmlSemCollection { |
| 14 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
| 14 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function setRowCount($rowCount, $colCount) { |
| 36 | 36 | $count=$this->count(); |
| 37 | - for($i=$count; $i < $rowCount; $i++) { |
|
| 37 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 38 | 38 | $this->addItem($colCount); |
| 39 | 39 | } |
| 40 | 40 | /* |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $tr=new HtmlTR("", $value); |
| 63 | 63 | $tr->setContainer($this, $count); |
| 64 | 64 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 65 | - if (isset($value) === true) { |
|
| 65 | + if (isset($value)===true) { |
|
| 66 | 66 | $tr->setColCount($value); |
| 67 | 67 | } |
| 68 | 68 | return $tr; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function setCellValue($row, $col, $value="") { |
| 114 | 114 | $cell=$this->getCell($row, $col); |
| 115 | - if (isset($cell) === true) { |
|
| 115 | + if (isset($cell)===true) { |
|
| 116 | 116 | $cell->setValue($value); |
| 117 | 117 | } |
| 118 | 118 | return $this; |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | public function setValues($values=array()) { |
| 126 | 126 | $count=$this->count(); |
| 127 | 127 | $isArray=true; |
| 128 | - if (\is_array($values) === false) { |
|
| 128 | + if (\is_array($values)===false) { |
|
| 129 | 129 | $values=\array_fill(0, $count, $values); |
| 130 | 130 | $isArray=false; |
| 131 | 131 | } |
| 132 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 133 | - $values=[ $values ]; |
|
| 132 | + if (JArray::dimension($values)==1 && $isArray) |
|
| 133 | + $values=[$values]; |
|
| 134 | 134 | |
| 135 | 135 | $count=\min(\sizeof($values), $count); |
| 136 | 136 | |
| 137 | - for($i=0; $i < $count; $i++) { |
|
| 137 | + for ($i=0; $i<$count; $i++) { |
|
| 138 | 138 | $row=$this->content[$i]; |
| 139 | 139 | $row->setValues($values[$i]); |
| 140 | 140 | } |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function setColValues($colIndex, $values=array()) { |
| 145 | 145 | $count=$this->count(); |
| 146 | - if (\is_array($values) === false) { |
|
| 146 | + if (\is_array($values)===false) { |
|
| 147 | 147 | $values=\array_fill(0, $count, $values); |
| 148 | 148 | } |
| 149 | 149 | $count=\min(\sizeof($values), $count); |
| 150 | - for($i=0; $i < $count; $i++) { |
|
| 150 | + for ($i=0; $i<$count; $i++) { |
|
| 151 | 151 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
| 152 | 152 | } |
| 153 | 153 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | public function addColVariations($colIndex, $variations=array()) { |
| 157 | 157 | $count=$this->count(); |
| 158 | - for($i=0; $i < $count; $i++) { |
|
| 158 | + for ($i=0; $i<$count; $i++) { |
|
| 159 | 159 | $this->getCell($i, $colIndex)->addVariations($variations); |
| 160 | 160 | } |
| 161 | 161 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | public function setRowValues($rowIndex, $values=array()) { |
| 165 | 165 | $count=$this->count(); |
| 166 | - if (\is_array($values) === false) { |
|
| 166 | + if (\is_array($values)===false) { |
|
| 167 | 167 | $values=\array_fill(0, $count, $values); |
| 168 | 168 | } |
| 169 | 169 | $this->getItem($rowIndex)->setValues($values); |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | private function colAlign($colIndex, $function) { |
| 174 | 174 | $count=$this->count(); |
| 175 | - for($i=0; $i < $count; $i++) { |
|
| 175 | + for ($i=0; $i<$count; $i++) { |
|
| 176 | 176 | $index=$this->content[$i]->getColPosition($colIndex); |
| 177 | - if ($index !== NULL) |
|
| 177 | + if ($index!==NULL) |
|
| 178 | 178 | $this->getCell($i, $index)->$function(); |
| 179 | 179 | } |
| 180 | 180 | return $this; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function getColCount() { |
| 208 | 208 | $result=0; |
| 209 | - if ($this->count() > 0) |
|
| 209 | + if ($this->count()>0) |
|
| 210 | 210 | $result=$this->getItem(0)->getColCount(); |
| 211 | 211 | return $result; |
| 212 | 212 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | public function delete($rowIndex, $colIndex=NULL) { |
| 221 | 221 | if (isset($colIndex)) { |
| 222 | 222 | $row=$this->getItem($rowIndex); |
| 223 | - if (isset($row) === true) { |
|
| 223 | + if (isset($row)===true) { |
|
| 224 | 224 | $row->delete($colIndex); |
| 225 | 225 | } |
| 226 | 226 | } else { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function conditionalCellFormat($callback, $format) { |
| 254 | 254 | $rows=$this->content; |
| 255 | - foreach ( $rows as $row ) { |
|
| 255 | + foreach ($rows as $row) { |
|
| 256 | 256 | $row->conditionalCellFormat($callback, $format); |
| 257 | 257 | } |
| 258 | 258 | return $this; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function conditionalRowFormat($callback, $format) { |
| 267 | 267 | $rows=$this->content; |
| 268 | - foreach ( $rows as $row ) { |
|
| 268 | + foreach ($rows as $row) { |
|
| 269 | 269 | $row->conditionalRowFormat($callback, $format); |
| 270 | 270 | } |
| 271 | 271 | return $this; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function applyCells($callback) { |
| 279 | 279 | $rows=$this->content; |
| 280 | - foreach ( $rows as $row ) { |
|
| 280 | + foreach ($rows as $row) { |
|
| 281 | 281 | $row->applyCells($callback); |
| 282 | 282 | } |
| 283 | 283 | return $this; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function applyRows($callback) { |
| 291 | 291 | $rows=$this->content; |
| 292 | - foreach ( $rows as $row ) { |
|
| 292 | + foreach ($rows as $row) { |
|
| 293 | 293 | $row->apply($callback); |
| 294 | 294 | } |
| 295 | 295 | return $this; |
@@ -22,8 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
| 24 | 24 | parent::__construct($identifier, $tagName, ""); |
| 25 | - if (isset($rowCount) && isset($colCount)) |
|
| 26 | - $this->setRowCount($rowCount, $colCount); |
|
| 25 | + if (isset($rowCount) && isset($colCount)) { |
|
| 26 | + $this->setRowCount($rowCount, $colCount); |
|
| 27 | + } |
|
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | /** |
@@ -129,8 +130,9 @@ discard block |
||
| 129 | 130 | $values=\array_fill(0, $count, $values); |
| 130 | 131 | $isArray=false; |
| 131 | 132 | } |
| 132 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 133 | - $values=[ $values ]; |
|
| 133 | + if (JArray::dimension($values) == 1 && $isArray) { |
|
| 134 | + $values=[ $values ]; |
|
| 135 | + } |
|
| 134 | 136 | |
| 135 | 137 | $count=\min(\sizeof($values), $count); |
| 136 | 138 | |
@@ -174,8 +176,9 @@ discard block |
||
| 174 | 176 | $count=$this->count(); |
| 175 | 177 | for($i=0; $i < $count; $i++) { |
| 176 | 178 | $index=$this->content[$i]->getColPosition($colIndex); |
| 177 | - if ($index !== NULL) |
|
| 178 | - $this->getCell($i, $index)->$function(); |
|
| 179 | + if ($index !== NULL) { |
|
| 180 | + $this->getCell($i, $index)->$function(); |
|
| 181 | + } |
|
| 179 | 182 | } |
| 180 | 183 | return $this; |
| 181 | 184 | } |
@@ -206,8 +209,9 @@ discard block |
||
| 206 | 209 | */ |
| 207 | 210 | public function getColCount() { |
| 208 | 211 | $result=0; |
| 209 | - if ($this->count() > 0) |
|
| 210 | - $result=$this->getItem(0)->getColCount(); |
|
| 212 | + if ($this->count() > 0) { |
|
| 213 | + $result=$this->getItem(0)->getColCount(); |
|
| 214 | + } |
|
| 211 | 215 | return $result; |
| 212 | 216 | } |
| 213 | 217 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Set the button value |
| 40 | 40 | * @param string $value |
| 41 | - * @return \Ajax\semantic\html\HtmlButton |
|
| 41 | + * @return HtmlButton |
|
| 42 | 42 | */ |
| 43 | 43 | public function setValue($value) { |
| 44 | 44 | $this->content=$value; |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * define the button style |
| 50 | - * @param string|int $cssStyle |
|
| 51 | - * @return \Ajax\semantic\html\HtmlButton default : "" |
|
| 50 | + * @param string $cssStyle |
|
| 51 | + * @return HtmlButton default : "" |
|
| 52 | 52 | */ |
| 53 | 53 | public function setStyle($cssStyle) { |
| 54 | 54 | return $this->addToProperty("class", $cssStyle); |
@@ -98,7 +98,6 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Add and return a button label |
| 101 | - * @param string $caption |
|
| 102 | 101 | * @param string $before |
| 103 | 102 | * @param string $icon |
| 104 | 103 | * @return \Ajax\semantic\html\elements\HtmlLabel |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | 107 | $this->tagName="div"; |
| 108 | 108 | $this->addToProperty("class", "labeled"); |
| 109 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 109 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | - $label=new HtmlLabel("label-" . $this->identifier, $label, "a"); |
|
| 112 | - if(isset($icon)) |
|
| 111 | + $label=new HtmlLabel("label-".$this->identifier, $label, "a"); |
|
| 112 | + if (isset($icon)) |
|
| 113 | 113 | $label->addIcon($icon); |
| 114 | 114 | $label->setBasic(); |
| 115 | 115 | $this->addContent($label, $before); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function fromArray($array) { |
| 124 | 124 | $array=parent::fromArray($array); |
| 125 | - foreach ( $array as $key => $value ) { |
|
| 125 | + foreach ($array as $key => $value) { |
|
| 126 | 126 | $this->setProperty($key, $value); |
| 127 | 127 | } |
| 128 | 128 | return $array; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | public static function social($identifier, $social, $value=NULL) { |
| 188 | - if ($value === NULL) |
|
| 188 | + if ($value===NULL) |
|
| 189 | 189 | $value=\ucfirst($social); |
| 190 | 190 | $return=new HtmlButton($identifier, $value); |
| 191 | 191 | $return->addIcon($social); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public function asLink($href=NULL) { |
| 208 | - $lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content); |
|
| 208 | + $lnk=new HtmlLink("lnk-".$this->identifier, $href, $this->content); |
|
| 209 | 209 | $this->content=$lnk; |
| 210 | 210 | return $this; |
| 211 | 211 | } |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 59 | - $this->setProperty("tabindex", "0"); |
|
| 60 | - else { |
|
| 58 | + if ($value === true) { |
|
| 59 | + $this->setProperty("tabindex", "0"); |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removeProperty("tabindex"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -109,8 +109,9 @@ discard block |
||
| 109 | 109 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | 111 | $label=new HtmlLabel("label-" . $this->identifier, $label, "a"); |
| 112 | - if(isset($icon)) |
|
| 113 | - $label->addIcon($icon); |
|
| 112 | + if(isset($icon)) { |
|
| 113 | + $label->addIcon($icon); |
|
| 114 | + } |
|
| 114 | 115 | $label->setBasic(); |
| 115 | 116 | $this->addContent($label, $before); |
| 116 | 117 | return $label; |
@@ -185,8 +186,9 @@ discard block |
||
| 185 | 186 | } |
| 186 | 187 | |
| 187 | 188 | public static function social($identifier, $social, $value=NULL) { |
| 188 | - if ($value === NULL) |
|
| 189 | - $value=\ucfirst($social); |
|
| 189 | + if ($value === NULL) { |
|
| 190 | + $value=\ucfirst($social); |
|
| 191 | + } |
|
| 190 | 192 | $return=new HtmlButton($identifier, $value); |
| 191 | 193 | $return->addIcon($social); |
| 192 | 194 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -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); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $icon=JArray::getValue($value, "icon", 0); |
| 26 | 26 | $size=JArray::getValue($value, "size", 1); |
| 27 | 27 | } |
| 28 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 28 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 29 | 29 | if (isset($size)) { |
| 30 | 30 | $iconO->setSize($size); |
| 31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | protected function createCondition($value) { |
| 36 | - return ($value instanceof HtmlIcon) === false; |
|
| 36 | + return ($value instanceof HtmlIcon)===false; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function getIcon($index) { |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * |
| 23 | - * @param string $side |
|
| 24 | 23 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 24 | */ |
| 26 | 25 | public function setPointing($value=Direction::NONE) { |
@@ -91,12 +91,12 @@ |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | - * Adds an image |
|
| 95 | - * @param string $src |
|
| 96 | - * @param string $alt |
|
| 97 | - * @param boolean $before |
|
| 98 | - * @return \Ajax\semantic\html\elements\html5\HtmlImg |
|
| 99 | - */ |
|
| 94 | + * Adds an image |
|
| 95 | + * @param string $src |
|
| 96 | + * @param string $alt |
|
| 97 | + * @param boolean $before |
|
| 98 | + * @return \Ajax\semantic\html\elements\html5\HtmlImg |
|
| 99 | + */ |
|
| 100 | 100 | public function addImage($src, $alt="", $before=true) { |
| 101 | 101 | $img=new HtmlImg("image-" . $this->identifier, $src, $alt); |
| 102 | 102 | $img->setClass(""); |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 25 | */ |
| 26 | 26 | public function setPointing($value=Direction::NONE) { |
| 27 | - if($value==="left" || $value==="right") |
|
| 27 | + if ($value==="left" || $value==="right") |
|
| 28 | 28 | return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
| 29 | 29 | else |
| 30 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 30 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing", true)); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 37 | 37 | */ |
| 38 | 38 | public function toCorner($side="left") { |
| 39 | - return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setHorizontal(){ |
|
| 43 | - return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal")); |
|
| 42 | + public function setHorizontal() { |
|
| 43 | + return $this->addToPropertyCtrl("class", "hozizontal", array("horizontal")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setFloating(){ |
|
| 47 | - return $this->addToPropertyCtrl("class", "floating",array("floating")); |
|
| 46 | + public function setFloating() { |
|
| 47 | + return $this->addToPropertyCtrl("class", "floating", array("floating")); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | return $this->addToProperty("class", "tag"); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setEmpty(){ |
|
| 58 | + public function setEmpty() { |
|
| 59 | 59 | $this->content=NULL; |
| 60 | - return $this->addToPropertyCtrl("class", "empty",array("empty")); |
|
| 60 | + return $this->addToPropertyCtrl("class", "empty", array("empty")); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function setBasic() { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function addEmphasisImage($src, $alt="", $before=true) { |
| 75 | 75 | $this->addToProperty("class", "image"); |
| 76 | - return $this->addImage($src,$alt,$before); |
|
| 76 | + return $this->addImage($src, $alt, $before); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return \Ajax\semantic\html\elements\html5\HtmlImg |
| 85 | 85 | */ |
| 86 | 86 | public function addAvatarImage($src, $alt="", $before=true) { |
| 87 | - $img=$this->addImage($src,$alt,$before); |
|
| 87 | + $img=$this->addImage($src, $alt, $before); |
|
| 88 | 88 | $img->setClass("ui image"); |
| 89 | 89 | $img->asAvatar(); |
| 90 | 90 | return $img; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return \Ajax\semantic\html\elements\html5\HtmlImg |
| 99 | 99 | */ |
| 100 | 100 | public function addImage($src, $alt="", $before=true) { |
| 101 | - $img=new HtmlImg("image-" . $this->identifier, $src, $alt); |
|
| 101 | + $img=new HtmlImg("image-".$this->identifier, $src, $alt); |
|
| 102 | 102 | $img->setClass(""); |
| 103 | 103 | $this->addContent($img, $before); |
| 104 | 104 | return $img; |
@@ -110,21 +110,21 @@ discard block |
||
| 110 | 110 | * @return \Ajax\common\html\HtmlDoubleElement |
| 111 | 111 | */ |
| 112 | 112 | public function addDetail($detail) { |
| 113 | - $div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail"); |
|
| 113 | + $div=new HtmlSemDoubleElement("detail-".$this->identifier, $this->tagName, "detail"); |
|
| 114 | 114 | $div->setContent($detail); |
| 115 | 115 | $this->addContent($div); |
| 116 | 116 | return $div; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function asRibbon($direction=Direction::NONE) { |
| 120 | - return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" )); |
|
| 120 | + return $this->addToPropertyCtrl("class", $direction." ribbon", array("ribbon", "right ribbon", "left ribbon")); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
|
| 124 | - if($direction!==Direction::NONE) |
|
| 125 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 123 | + public function setAttached($side=Side::TOP, $direction=Direction::NONE) { |
|
| 124 | + if ($direction!==Direction::NONE) |
|
| 125 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached", Side::getConstantValues($direction." attached")); |
|
| 126 | 126 | else |
| 127 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 127 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public static function ribbon($identifier, $caption) { |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
| 15 | 15 | parent::__construct($identifier, $tagName, "ui label"); |
| 16 | 16 | $this->content=$caption; |
| 17 | - if (isset($icon)===true) |
|
| 18 | - $this->addIcon($icon); |
|
| 17 | + if (isset($icon)===true) { |
|
| 18 | + $this->addIcon($icon); |
|
| 19 | + } |
|
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | /** |
@@ -24,10 +25,11 @@ discard block |
||
| 24 | 25 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 26 | */ |
| 26 | 27 | public function setPointing($value=Direction::NONE) { |
| 27 | - if($value==="left" || $value==="right") |
|
| 28 | - return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 29 | - else |
|
| 30 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 28 | + if($value==="left" || $value==="right") { |
|
| 29 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 30 | + } else { |
|
| 31 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | /** |
@@ -121,10 +123,11 @@ discard block |
||
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
| 124 | - if($direction!==Direction::NONE) |
|
| 125 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 126 | - else |
|
| 127 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 126 | + if($direction!==Direction::NONE) { |
|
| 127 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 128 | + } else { |
|
| 129 | + return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 130 | + } |
|
| 128 | 131 | } |
| 129 | 132 | |
| 130 | 133 | public static function ribbon($identifier, $caption) { |
@@ -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->getField()->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()->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); |
@@ -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 setActive($index){ |
|
| 75 | + public function setActive($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 |
@@ -62,8 +62,9 @@ |
||
| 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 | 68 | $this->addEventsOnRun($js); |
| 68 | 69 | return $this->_bsComponent; |
| 69 | 70 | } |
@@ -21,6 +21,9 @@ discard block |
||
| 21 | 21 | protected $_params=array("action"=>"nothing","on"=>"hover"); |
| 22 | 22 | protected $input; |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $identifier |
|
| 26 | + */ |
|
| 24 | 27 | public function __construct($identifier, $value="", $items=array()) { |
| 25 | 28 | parent::__construct($identifier, "div"); |
| 26 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
@@ -47,7 +50,7 @@ discard block |
||
| 47 | 50 | /** |
| 48 | 51 | * Insert an item at a position |
| 49 | 52 | * @param mixed $item |
| 50 | - * @param number $position |
|
| 53 | + * @param integer $position |
|
| 51 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 52 | 55 | */ |
| 53 | 56 | public function insertItem($item,$position=0){ |
@@ -205,6 +208,9 @@ discard block |
||
| 205 | 208 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 206 | 209 | } |
| 207 | 210 | |
| 211 | + /** |
|
| 212 | + * @param string $action |
|
| 213 | + */ |
|
| 208 | 214 | public function setAction($action){ |
| 209 | 215 | $this->_params["action"]=$action; |
| 210 | 216 | } |
@@ -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,25 +50,25 @@ 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(\is_array($item)){ |
|
| 64 | + if (\is_array($item)) { |
|
| 65 | 65 | $value=JArray::getValue($item, "value", 1); |
| 66 | 66 | $image=JArray::getValue($item, "image", 2); |
| 67 | 67 | $item=JArray::getValue($item, "item", 0); |
| 68 | 68 | } |
| 69 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 70 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
| 71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 69 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 70 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
| 71 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 72 | 72 | $this->addToProperty("class", "vertical"); |
| 73 | 73 | } |
| 74 | 74 | return $itemO; |
@@ -81,76 +81,76 @@ discard block |
||
| 81 | 81 | $this->addItem($function($object)); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function addInput($name){ |
|
| 85 | - if(!isset($name)) |
|
| 84 | + public function addInput($name) { |
|
| 85 | + if (!isset($name)) |
|
| 86 | 86 | $name="input-".$this->identifier; |
| 87 | 87 | $this->setAction("activate"); |
| 88 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 88 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function addItems($items){ |
|
| 92 | - if(JArray::isAssociative($items)){ |
|
| 93 | - foreach ($items as $k=>$v){ |
|
| 91 | + public function addItems($items) { |
|
| 92 | + if (JArray::isAssociative($items)) { |
|
| 93 | + foreach ($items as $k=>$v) { |
|
| 94 | 94 | $this->addItem($v)->setData($k); |
| 95 | 95 | } |
| 96 | - }else{ |
|
| 97 | - foreach ($items as $item){ |
|
| 96 | + } else { |
|
| 97 | + foreach ($items as $item) { |
|
| 98 | 98 | $this->addItem($item); |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function count(){ |
|
| 103 | + public function count() { |
|
| 104 | 104 | return \sizeof($this->items); |
| 105 | 105 | } |
| 106 | 106 | /** |
| 107 | 107 | * @param boolean $dropdown |
| 108 | 108 | */ |
| 109 | - public function asDropdown($dropdown){ |
|
| 110 | - if($dropdown===false){ |
|
| 109 | + public function asDropdown($dropdown) { |
|
| 110 | + if ($dropdown===false) { |
|
| 111 | 111 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 112 | 112 | $dropdown="menu"; |
| 113 | - }else{ |
|
| 113 | + } else { |
|
| 114 | 114 | $dropdown="dropdown"; |
| 115 | 115 | $this->mClass="menu"; |
| 116 | 116 | } |
| 117 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 117 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function setVertical(){ |
|
| 121 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 120 | + public function setVertical() { |
|
| 121 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function setSimple(){ |
|
| 125 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 124 | + public function setSimple() { |
|
| 125 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function asButton($floating=false){ |
|
| 129 | - if($floating) |
|
| 128 | + public function asButton($floating=false) { |
|
| 129 | + if ($floating) |
|
| 130 | 130 | $this->addToProperty("class", "floating"); |
| 131 | 131 | return $this->addToProperty("class", "button"); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 135 | - if(isset($name)) |
|
| 134 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 135 | + if (isset($name)) |
|
| 136 | 136 | $this->addInput($name); |
| 137 | - if($multiple) |
|
| 137 | + if ($multiple) |
|
| 138 | 138 | $this->addToProperty("class", "multiple"); |
| 139 | 139 | if ($selection) |
| 140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 140 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
| 145 | - $this->asSelect($name,$multiple,$selection); |
|
| 144 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
| 145 | + $this->asSelect($name, $multiple, $selection); |
|
| 146 | 146 | return $this->addToProperty("class", "search"); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 150 | - if(!isset($name)) |
|
| 149 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 150 | + if (!isset($name)) |
|
| 151 | 151 | $name="select-".$this->identifier; |
| 152 | 152 | $this->input=null; |
| 153 | - if($multiple){ |
|
| 153 | + if ($multiple) { |
|
| 154 | 154 | $this->setProperty("multiple", true); |
| 155 | 155 | $this->addToProperty("class", "multiple"); |
| 156 | 156 | } |
@@ -158,32 +158,32 @@ discard block |
||
| 158 | 158 | $this->tagName="select"; |
| 159 | 159 | $this->setProperty("name", $name); |
| 160 | 160 | $this->content=null; |
| 161 | - foreach ($this->items as $item){ |
|
| 161 | + foreach ($this->items as $item) { |
|
| 162 | 162 | $item->asOption(); |
| 163 | 163 | } |
| 164 | 164 | return $this; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function asSubmenu($pointing=NULL){ |
|
| 167 | + public function asSubmenu($pointing=NULL) { |
|
| 168 | 168 | $this->setClass("ui dropdown link item"); |
| 169 | - if(isset($pointing)){ |
|
| 169 | + if (isset($pointing)) { |
|
| 170 | 170 | $this->setPointing($pointing); |
| 171 | 171 | } |
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - public function setPointing($value=Direction::NONE){ |
|
| 176 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 175 | + public function setPointing($value=Direction::NONE) { |
|
| 176 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function setValue($value){ |
|
| 180 | - if(isset($this->input)){ |
|
| 179 | + public function setValue($value) { |
|
| 180 | + if (isset($this->input)) { |
|
| 181 | 181 | $this->input->setProperty("value", $value); |
| 182 | - }else{ |
|
| 182 | + } else { |
|
| 183 | 183 | $this->setProperty("value", $value); |
| 184 | 184 | } |
| 185 | 185 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 186 | - if(isset($textElement)) |
|
| 186 | + if (isset($textElement)) |
|
| 187 | 187 | $textElement->setContent($value); |
| 188 | 188 | return $this; |
| 189 | 189 | } |
@@ -193,23 +193,23 @@ discard block |
||
| 193 | 193 | * @see BaseHtml::run() |
| 194 | 194 | */ |
| 195 | 195 | public function run(JsUtils $js) { |
| 196 | - if($this->propertyContains("class", "simple")===false){ |
|
| 197 | - if(isset($this->_bsComponent)===false) |
|
| 198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 196 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 197 | + if (isset($this->_bsComponent)===false) |
|
| 198 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 199 | 199 | $this->addEventsOnRun($js); |
| 200 | 200 | return $this->_bsComponent; |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public function setCompact(){ |
|
| 204 | + public function setCompact() { |
|
| 205 | 205 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - public function setAction($action){ |
|
| 208 | + public function setAction($action) { |
|
| 209 | 209 | $this->_params["action"]=$action; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - public function setFullTextSearch($value){ |
|
| 212 | + public function setFullTextSearch($value) { |
|
| 213 | 213 | $this->_params["fullTextSearch"]=$value; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | \ No newline at end of file |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | if(!$item instanceof HtmlDropdownItem){ |
| 70 | 70 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
| 71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 71 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 72 | 72 | $this->addToProperty("class", "vertical"); |
| 73 | 73 | } |
| 74 | 74 | return $itemO; |
@@ -82,8 +82,9 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public function addInput($name){ |
| 85 | - if(!isset($name)) |
|
| 86 | - $name="input-".$this->identifier; |
|
| 85 | + if(!isset($name)) { |
|
| 86 | + $name="input-".$this->identifier; |
|
| 87 | + } |
|
| 87 | 88 | $this->setAction("activate"); |
| 88 | 89 | $this->input=new HtmlInput($name,"hidden"); |
| 89 | 90 | } |
@@ -93,7 +94,7 @@ discard block |
||
| 93 | 94 | foreach ($items as $k=>$v){ |
| 94 | 95 | $this->addItem($v)->setData($k); |
| 95 | 96 | } |
| 96 | - }else{ |
|
| 97 | + } else{ |
|
| 97 | 98 | foreach ($items as $item){ |
| 98 | 99 | $this->addItem($item); |
| 99 | 100 | } |
@@ -110,7 +111,7 @@ discard block |
||
| 110 | 111 | if($dropdown===false){ |
| 111 | 112 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 112 | 113 | $dropdown="menu"; |
| 113 | - }else{ |
|
| 114 | + } else{ |
|
| 114 | 115 | $dropdown="dropdown"; |
| 115 | 116 | $this->mClass="menu"; |
| 116 | 117 | } |
@@ -126,18 +127,22 @@ discard block |
||
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | public function asButton($floating=false){ |
| 129 | - if($floating) |
|
| 130 | - $this->addToProperty("class", "floating"); |
|
| 130 | + if($floating) { |
|
| 131 | + $this->addToProperty("class", "floating"); |
|
| 132 | + } |
|
| 131 | 133 | return $this->addToProperty("class", "button"); |
| 132 | 134 | } |
| 133 | 135 | |
| 134 | 136 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 135 | - if(isset($name)) |
|
| 136 | - $this->addInput($name); |
|
| 137 | - if($multiple) |
|
| 138 | - $this->addToProperty("class", "multiple"); |
|
| 139 | - if ($selection) |
|
| 140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 137 | + if(isset($name)) { |
|
| 138 | + $this->addInput($name); |
|
| 139 | + } |
|
| 140 | + if($multiple) { |
|
| 141 | + $this->addToProperty("class", "multiple"); |
|
| 142 | + } |
|
| 143 | + if ($selection) { |
|
| 144 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 145 | + } |
|
| 141 | 146 | return $this; |
| 142 | 147 | } |
| 143 | 148 | |
@@ -147,8 +152,9 @@ discard block |
||
| 147 | 152 | } |
| 148 | 153 | |
| 149 | 154 | public function setSelect($name=NULL,$multiple=false){ |
| 150 | - if(!isset($name)) |
|
| 151 | - $name="select-".$this->identifier; |
|
| 155 | + if(!isset($name)) { |
|
| 156 | + $name="select-".$this->identifier; |
|
| 157 | + } |
|
| 152 | 158 | $this->input=null; |
| 153 | 159 | if($multiple){ |
| 154 | 160 | $this->setProperty("multiple", true); |
@@ -179,12 +185,13 @@ discard block |
||
| 179 | 185 | public function setValue($value){ |
| 180 | 186 | if(isset($this->input)){ |
| 181 | 187 | $this->input->setProperty("value", $value); |
| 182 | - }else{ |
|
| 188 | + } else{ |
|
| 183 | 189 | $this->setProperty("value", $value); |
| 184 | 190 | } |
| 185 | 191 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 186 | - if(isset($textElement)) |
|
| 187 | - $textElement->setContent($value); |
|
| 192 | + if(isset($textElement)) { |
|
| 193 | + $textElement->setContent($value); |
|
| 194 | + } |
|
| 188 | 195 | return $this; |
| 189 | 196 | } |
| 190 | 197 | |
@@ -194,8 +201,9 @@ discard block |
||
| 194 | 201 | */ |
| 195 | 202 | public function run(JsUtils $js) { |
| 196 | 203 | if($this->propertyContains("class", "simple")===false){ |
| 197 | - if(isset($this->_bsComponent)===false) |
|
| 198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 204 | + if(isset($this->_bsComponent)===false) { |
|
| 205 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 206 | + } |
|
| 199 | 207 | $this->addEventsOnRun($js); |
| 200 | 208 | return $this->_bsComponent; |
| 201 | 209 | } |
@@ -14,6 +14,9 @@ discard block |
||
| 14 | 14 | protected $_params=array(); |
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $identifier |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
| 18 | 21 | parent::__construct($identifier, "div","ui modal"); |
| 19 | 22 | if(isset($header)){ |
@@ -27,6 +30,9 @@ discard block |
||
| 27 | 30 | } |
| 28 | 31 | } |
| 29 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $value |
|
| 35 | + */ |
|
| 30 | 36 | public function setHeader($value) { |
| 31 | 37 | $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
| 32 | 38 | return $this; |
@@ -103,6 +109,9 @@ discard block |
||
| 103 | 109 | return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
| 104 | 110 | } |
| 105 | 111 | |
| 112 | + /** |
|
| 113 | + * @param BaseHtml $element |
|
| 114 | + */ |
|
| 106 | 115 | private function addElementInPart($element,$part) { |
| 107 | 116 | $this->content[$part]->addContent($element); |
| 108 | 117 | return $element; |
@@ -145,7 +154,6 @@ discard block |
||
| 145 | 154 | /** |
| 146 | 155 | * render the content of $controller::$action and set the response to the modal content |
| 147 | 156 | * @param JsUtils $js |
| 148 | - * @param string $title The panel title |
|
| 149 | 157 | * @param Controller $initialControllerInstance |
| 150 | 158 | * @param string $controllerName the controller name |
| 151 | 159 | * @param string $actionName the action name |
@@ -15,120 +15,120 @@ discard block |
||
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
| 18 | - parent::__construct($identifier, "div","ui modal"); |
|
| 19 | - if(isset($header)){ |
|
| 18 | + parent::__construct($identifier, "div", "ui modal"); |
|
| 19 | + if (isset($header)) { |
|
| 20 | 20 | $this->setHeader($header); |
| 21 | 21 | } |
| 22 | - if(isset($content)){ |
|
| 22 | + if (isset($content)) { |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | - if(isset($actions)){ |
|
| 25 | + if (isset($actions)) { |
|
| 26 | 26 | $this->setActions($actions); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setHeader($value) { |
| 31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
| 31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setContent($value) { |
| 36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
| 36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActions($actions) { |
| 41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
| 42 | - if(\is_array($actions)){ |
|
| 43 | - foreach ($actions as $action){ |
|
| 41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
| 42 | + if (\is_array($actions)) { |
|
| 43 | + foreach ($actions as $action) { |
|
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - else{ |
|
| 47 | + else { |
|
| 48 | 48 | $this->addAction($actions); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function addAction($action){ |
|
| 54 | - if(!$action instanceof BaseHtml){ |
|
| 53 | + public function addAction($action) { |
|
| 54 | + if (!$action instanceof BaseHtml) { |
|
| 55 | 55 | $class=""; |
| 56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
| 56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
| 57 | 57 | $class="approve"; |
| 58 | 58 | } |
| 59 | - if(\array_search($action, ["Cancel","No"])!==false){ |
|
| 59 | + if (\array_search($action, ["Cancel", "No"])!==false) { |
|
| 60 | 60 | $class="cancel"; |
| 61 | 61 | } |
| 62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
| 63 | - if($class!=="") |
|
| 62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
| 63 | + if ($class!=="") |
|
| 64 | 64 | $action->addToProperty("class", $class); |
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function addContent($content,$before=false){ |
|
| 70 | - $this->content["content"]->addContent($content,$before); |
|
| 69 | + public function addContent($content, $before=false) { |
|
| 70 | + $this->content["content"]->addContent($content, $before); |
|
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function addImageContent($image,$description=NULL){ |
|
| 74 | + public function addImageContent($image, $description=NULL) { |
|
| 75 | 75 | $content=$this->content["content"]; |
| 76 | - if(isset($description)){ |
|
| 77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 78 | - $content->addContent($description,true); |
|
| 76 | + if (isset($description)) { |
|
| 77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 78 | + $content->addContent($description, true); |
|
| 79 | 79 | } |
| 80 | - if($image!==""){ |
|
| 81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 82 | - $content->addContent($img,true); |
|
| 83 | - $content->addToProperty("class","image"); |
|
| 80 | + if ($image!=="") { |
|
| 81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 82 | + $content->addContent($img, true); |
|
| 83 | + $content->addToProperty("class", "image"); |
|
| 84 | 84 | } |
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function addIconContent($icon,$description=NULL){ |
|
| 88 | + public function addIconContent($icon, $description=NULL) { |
|
| 89 | 89 | $content=$this->content["content"]; |
| 90 | - if(isset($description)){ |
|
| 91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 92 | - $content->addContent($description,true); |
|
| 90 | + if (isset($description)) { |
|
| 91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 92 | + $content->addContent($description, true); |
|
| 93 | 93 | } |
| 94 | - if($icon!==""){ |
|
| 95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 96 | - $content->addContent($img,true); |
|
| 97 | - $content->addToProperty("class","image"); |
|
| 94 | + if ($icon!=="") { |
|
| 95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 96 | + $content->addContent($img, true); |
|
| 97 | + $content->addToProperty("class", "image"); |
|
| 98 | 98 | } |
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - private function addContentInPart($content,$uiClass,$part) { |
|
| 103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
| 102 | + private function addContentInPart($content, $uiClass, $part) { |
|
| 103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - private function addElementInPart($element,$part) { |
|
| 106 | + private function addElementInPart($element, $part) { |
|
| 107 | 107 | $this->content[$part]->addContent($element); |
| 108 | 108 | return $element; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function showDimmer($value){ |
|
| 112 | - $value=$value?"show":"hide"; |
|
| 111 | + public function showDimmer($value) { |
|
| 112 | + $value=$value ? "show" : "hide"; |
|
| 113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setInverted(){ |
|
| 117 | + public function setInverted() { |
|
| 118 | 118 | $this->_params["inverted"]=true; |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setBasic(){ |
|
| 122 | + public function setBasic() { |
|
| 123 | 123 | return $this->addToProperty("class", "basic"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function setActive(){ |
|
| 126 | + public function setActive() { |
|
| 127 | 127 | return $this->addToProperty("class", "active"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function setTransition($value){ |
|
| 131 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 130 | + public function setTransition($value) { |
|
| 131 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | * @param string $viewName |
| 139 | 139 | * @param $params The parameters to pass to the view |
| 140 | 140 | */ |
| 141 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 142 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 141 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 142 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | * @param string $controllerName the controller name |
| 151 | 151 | * @param string $actionName the action name |
| 152 | 152 | */ |
| 153 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 154 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 153 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 154 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 162 | 162 | */ |
| 163 | 163 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 164 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 164 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 165 | 165 | return parent::compile($js, $view); |
| 166 | 166 | } |
| 167 | 167 | /* |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | * @see BaseHtml::run() |
| 170 | 170 | */ |
| 171 | 171 | public function run(JsUtils $js) { |
| 172 | - if(isset($this->_bsComponent)===false) |
|
| 173 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 172 | + if (isset($this->_bsComponent)===false) |
|
| 173 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 174 | 174 | $this->addEventsOnRun($js); |
| 175 | 175 | return $this->_bsComponent; |
| 176 | 176 | } |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | foreach ($actions as $action){ |
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | - } |
|
| 47 | - else{ |
|
| 46 | + } else{ |
|
| 48 | 47 | $this->addAction($actions); |
| 49 | 48 | } |
| 50 | 49 | return $this; |
@@ -60,8 +59,9 @@ discard block |
||
| 60 | 59 | $class="cancel"; |
| 61 | 60 | } |
| 62 | 61 | $action=new HtmlButton("action-".$this->identifier,$action); |
| 63 | - if($class!=="") |
|
| 64 | - $action->addToProperty("class", $class); |
|
| 62 | + if($class!=="") { |
|
| 63 | + $action->addToProperty("class", $class); |
|
| 64 | + } |
|
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
| 67 | 67 | } |
@@ -169,8 +169,9 @@ discard block |
||
| 169 | 169 | * @see BaseHtml::run() |
| 170 | 170 | */ |
| 171 | 171 | public function run(JsUtils $js) { |
| 172 | - if(isset($this->_bsComponent)===false) |
|
| 173 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 172 | + if(isset($this->_bsComponent)===false) { |
|
| 173 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 174 | + } |
|
| 174 | 175 | $this->addEventsOnRun($js); |
| 175 | 176 | return $this->_bsComponent; |
| 176 | 177 | } |