@@ -11,12 +11,24 @@ |
||
| 11 | 11 | protected $_states=[ ]; |
| 12 | 12 | protected $_baseClass; |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $name |
|
| 16 | + */ |
|
| 14 | 17 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
| 15 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $name |
|
| 21 | + */ |
|
| 16 | 22 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
| 17 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $name |
|
| 26 | + */ |
|
| 18 | 27 | protected abstract function addToPropertyCtrlCheck($name, $value, $typeCtrl); |
| 19 | 28 | |
| 29 | + /** |
|
| 30 | + * @param string $name |
|
| 31 | + */ |
|
| 20 | 32 | public abstract function addToProperty($name, $value, $separator=" "); |
| 21 | 33 | |
| 22 | 34 | public function addVariation($variation) { |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function setVariations($variations) { |
| 36 | 36 | $this->setProperty("class", $this->_baseClass); |
| 37 | - if (\is_string($variations)) |
|
| 38 | - $variations=\explode(" ", $variations); |
|
| 37 | + if (\is_string($variations)) { |
|
| 38 | + $variations=\explode(" ", $variations); |
|
| 39 | + } |
|
| 39 | 40 | foreach ( $variations as $variation ) { |
| 40 | 41 | $this->addVariation($variation); |
| 41 | 42 | } |
@@ -48,8 +49,9 @@ discard block |
||
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | public function addVariations($variations=array()) { |
| 51 | - if (\is_string($variations)) |
|
| 52 | - $variations=\explode(" ", $variations); |
|
| 52 | + if (\is_string($variations)) { |
|
| 53 | + $variations=\explode(" ", $variations); |
|
| 54 | + } |
|
| 53 | 55 | foreach ( $variations as $variation ) { |
| 54 | 56 | $this->addVariation($variation); |
| 55 | 57 | } |
@@ -57,8 +59,9 @@ discard block |
||
| 57 | 59 | } |
| 58 | 60 | |
| 59 | 61 | public function addStates($states=array()) { |
| 60 | - if (\is_string($states)) |
|
| 61 | - $states=\explode(" ", $states); |
|
| 62 | + if (\is_string($states)) { |
|
| 63 | + $states=\explode(" ", $states); |
|
| 64 | + } |
|
| 62 | 65 | foreach ( $states as $state ) { |
| 63 | 66 | $this->addState($state); |
| 64 | 67 | } |
@@ -67,8 +70,9 @@ discard block |
||
| 67 | 70 | |
| 68 | 71 | public function setStates($states) { |
| 69 | 72 | $this->setProperty("class", $this->_baseClass); |
| 70 | - if (\is_string($states)) |
|
| 71 | - $states=\explode(" ", $states); |
|
| 73 | + if (\is_string($states)) { |
|
| 74 | + $states=\explode(" ", $states); |
|
| 75 | + } |
|
| 72 | 76 | foreach ( $states as $state ) { |
| 73 | 77 | $this->addState($state); |
| 74 | 78 | } |
@@ -17,6 +17,11 @@ discard block |
||
| 17 | 17 | class HtmlTable extends HtmlSemDoubleElement { |
| 18 | 18 | private $_colCount; |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $identifier |
|
| 22 | + * @param integer $rowCount |
|
| 23 | + * @param integer $colCount |
|
| 24 | + */ |
|
| 20 | 25 | public function __construct($identifier, $rowCount, $colCount) { |
| 21 | 26 | parent::__construct($identifier, "table", "ui table"); |
| 22 | 27 | $this->content=array (); |
@@ -146,6 +151,9 @@ discard block |
||
| 146 | 151 | return $this->colAlign($colIndex, "colLeft"); |
| 147 | 152 | } |
| 148 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $function |
|
| 156 | + */ |
|
| 149 | 157 | private function colAlign($colIndex, $function) { |
| 150 | 158 | if (\is_array($colIndex)) { |
| 151 | 159 | foreach ( $colIndex as $cIndex ) { |
@@ -165,8 +165,9 @@ |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function setBasic($very=false) { |
| 168 | - if ($very) |
|
| 169 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 168 | + if ($very) { |
|
| 169 | + $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 170 | + } |
|
| 170 | 171 | return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 171 | 172 | } |
| 172 | 173 | |
@@ -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); |
@@ -170,6 +176,9 @@ discard block |
||
| 170 | 176 | return $this; |
| 171 | 177 | } |
| 172 | 178 | |
| 179 | + /** |
|
| 180 | + * @param string $function |
|
| 181 | + */ |
|
| 173 | 182 | private function colAlign($colIndex, $function) { |
| 174 | 183 | $count=$this->count(); |
| 175 | 184 | for($i=0; $i < $count; $i++) { |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Set the button value |
| 39 | 39 | * @param string $value |
| 40 | - * @return \Ajax\semantic\html\HtmlButton |
|
| 40 | + * @return HtmlButton |
|
| 41 | 41 | */ |
| 42 | 42 | public function setValue($value) { |
| 43 | 43 | $this->content=$value; |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * define the button style |
| 49 | - * @param string|int $cssStyle |
|
| 50 | - * @return \Ajax\semantic\html\HtmlButton default : "" |
|
| 49 | + * @param string $cssStyle |
|
| 50 | + * @return HtmlButton default : "" |
|
| 51 | 51 | */ |
| 52 | 52 | public function setStyle($cssStyle) { |
| 53 | 53 | return $this->addToProperty("class", $cssStyle); |
@@ -10,6 +10,11 @@ |
||
| 10 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
| 11 | 11 | private $_params=array (); |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + * @param integer $value |
|
| 16 | + * @param string $label |
|
| 17 | + */ |
|
| 13 | 18 | public function __construct($identifier, $value=NULL, $label=NULL) { |
| 14 | 19 | parent::__construct($identifier, "div", "ui progress"); |
| 15 | 20 | if (isset($value) === true) |
@@ -12,11 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($identifier, $value=NULL, $label=NULL) { |
| 14 | 14 | parent::__construct($identifier, "div", "ui progress"); |
| 15 | - if (isset($value) === true) |
|
| 16 | - $this->setProperty("data-percent", $value); |
|
| 15 | + if (isset($value) === true) { |
|
| 16 | + $this->setProperty("data-percent", $value); |
|
| 17 | + } |
|
| 17 | 18 | $this->createBar(); |
| 18 | - if (isset($label) === true) |
|
| 19 | - $this->setLabel($label); |
|
| 19 | + if (isset($label) === true) { |
|
| 20 | + $this->setLabel($label); |
|
| 21 | + } |
|
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | public function setLabel($label) { |
@@ -93,8 +95,9 @@ discard block |
||
| 93 | 95 | * @see BaseHtml::run() |
| 94 | 96 | */ |
| 95 | 97 | public function run(JsUtils $js) { |
| 96 | - if (isset($this->_bsComponent) === false) |
|
| 97 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 98 | + if (isset($this->_bsComponent) === false) { |
|
| 99 | + $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 100 | + } |
|
| 98 | 101 | $this->addEventsOnRun($js); |
| 99 | 102 | return $this->_bsComponent; |
| 100 | 103 | } |
@@ -56,6 +56,9 @@ discard block |
||
| 56 | 56 | return $this->addComponent(new Accordion($this->js), $attachTo, $params); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + /** |
|
| 60 | + * @param string $attachTo |
|
| 61 | + */ |
|
| 59 | 62 | public function sticky($attachTo=NULL, $params=NULL) { |
| 60 | 63 | return $this->addComponent(new Sticky($this->js), $attachTo, $params); |
| 61 | 64 | } |
@@ -64,10 +67,16 @@ discard block |
||
| 64 | 67 | return $this->addComponent(new Checkbox($this->js), $attachTo, $params); |
| 65 | 68 | } |
| 66 | 69 | |
| 70 | + /** |
|
| 71 | + * @param string $attachTo |
|
| 72 | + */ |
|
| 67 | 73 | public function rating($attachTo=NULL, $params=NULL) { |
| 68 | 74 | return $this->addComponent(new Rating($this->js), $attachTo, $params); |
| 69 | 75 | } |
| 70 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string $attachTo |
|
| 79 | + */ |
|
| 71 | 80 | public function progress($attachTo=NULL, $params=NULL) { |
| 72 | 81 | return $this->addComponent(new Progress($this->js), $attachTo, $params); |
| 73 | 82 | } |
@@ -14,21 +14,24 @@ discard block |
||
| 14 | 14 | return $array[$key]; |
| 15 | 15 | } |
| 16 | 16 | $values=array_values($array); |
| 17 | - if ($pos < sizeof($values)) |
|
| 18 | - return $values[$pos]; |
|
| 17 | + if ($pos < sizeof($values)) { |
|
| 18 | + return $values[$pos]; |
|
| 19 | + } |
|
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
| 22 | 23 | $result=NULL; |
| 23 | 24 | if (array_key_exists($key, $array)) { |
| 24 | 25 | $result=$array[$key]; |
| 25 | - if ($condition($result) === true) |
|
| 26 | - return $result; |
|
| 26 | + if ($condition($result) === true) { |
|
| 27 | + return $result; |
|
| 28 | + } |
|
| 27 | 29 | } |
| 28 | 30 | $values=array_values($array); |
| 29 | 31 | foreach ( $values as $val ) { |
| 30 | - if ($condition($val) === true) |
|
| 31 | - return $val; |
|
| 32 | + if ($condition($val) === true) { |
|
| 33 | + return $val; |
|
| 34 | + } |
|
| 32 | 35 | } |
| 33 | 36 | return $result; |
| 34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
| 36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
| 37 | 40 | if (array_key_exists($key, $array)) { |
| 38 | 41 | return $array[$key]; |
| 39 | - } else |
|
| 40 | - return $default; |
|
| 42 | + } else { |
|
| 43 | + return $default; |
|
| 44 | + } |
|
| 41 | 45 | } |
| 42 | 46 | |
| 43 | 47 | public static function implode($glue, $pieces) { |
@@ -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 | } |
@@ -66,15 +66,17 @@ |
||
| 66 | 66 | |
| 67 | 67 | public function getColspan() { |
| 68 | 68 | $colspan=1; |
| 69 | - if (\array_key_exists("colspan", $this->properties)) |
|
| 70 | - $colspan=$this->getProperty("colspan"); |
|
| 69 | + if (\array_key_exists("colspan", $this->properties)) { |
|
| 70 | + $colspan=$this->getProperty("colspan"); |
|
| 71 | + } |
|
| 71 | 72 | return $colspan; |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | public function getRowspan() { |
| 75 | 76 | $rowspan=1; |
| 76 | - if (\array_key_exists("rowspan", $this->properties)) |
|
| 77 | - $rowspan=$this->getProperty("rowspan"); |
|
| 77 | + if (\array_key_exists("rowspan", $this->properties)) { |
|
| 78 | + $rowspan=$this->getProperty("rowspan"); |
|
| 79 | + } |
|
| 78 | 80 | return $rowspan; |
| 79 | 81 | } |
| 80 | 82 | |