@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
| 7 | 7 | |
| 8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
| 9 | - protected $_params=array (); |
|
| 9 | + protected $_params=array(); |
|
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
| 12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
| 74 | 74 | */ |
| 75 | 75 | public function attachEvent($selector, $action=NULL) { |
| 76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
| 76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
| 77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
| 80 | 80 | } |
| 81 | 81 | $js=\str_replace("%identifier%", $this->identifier, $js); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function attachEvents($events=array()) { |
| 91 | 91 | if (\is_array($events)) { |
| 92 | - foreach ( $events as $action => $selector ) { |
|
| 92 | + foreach ($events as $action => $selector) { |
|
| 93 | 93 | $this->attachEvent($selector, $action); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
| 14 | 14 | $field->setProperty("name", $name); |
| 15 | 15 | $this->setField($field); |
| 16 | - if (isset($label)) |
|
| 17 | - $this->setLabel($label); |
|
| 16 | + if (isset($label)) { |
|
| 17 | + $this->setLabel($label); |
|
| 18 | + } |
|
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | public function setType($checkboxType) { |
@@ -40,8 +41,9 @@ discard block |
||
| 40 | 41 | * @return mixed |
| 41 | 42 | */ |
| 42 | 43 | public function getLabel() { |
| 43 | - if (\array_key_exists("label", $this->content)) |
|
| 44 | - return $this->content["label"]; |
|
| 44 | + if (\array_key_exists("label", $this->content)) { |
|
| 45 | + return $this->content["label"]; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | /** |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function setWidth($width) { |
| 32 | 32 | if (\is_int($width)) { |
| 33 | - $width=Wide::getConstants()["W" . $width]; |
|
| 33 | + $width=Wide::getConstants()["W".$width]; |
|
| 34 | 34 | } |
| 35 | 35 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 36 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
| 36 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function setValue($value) { |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | public function __construct($identifier, $width=NULL) { |
| 21 | 21 | parent::__construct($identifier, "div"); |
| 22 | 22 | $this->setClass("column"); |
| 23 | - if (isset($width)) |
|
| 24 | - $this->setWidth($width); |
|
| 23 | + if (isset($width)) { |
|
| 24 | + $this->setWidth($width); |
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | /** |
@@ -48,10 +49,11 @@ discard block |
||
| 48 | 49 | |
| 49 | 50 | public function addDivider($vertical=true, $content=NULL) { |
| 50 | 51 | $divider=new HtmlDivider("", $content); |
| 51 | - if ($vertical) |
|
| 52 | - $divider->setVertical(); |
|
| 53 | - else |
|
| 54 | - $divider->setHorizontal(); |
|
| 52 | + if ($vertical) { |
|
| 53 | + $divider->setVertical(); |
|
| 54 | + } else { |
|
| 55 | + $divider->setHorizontal(); |
|
| 56 | + } |
|
| 55 | 57 | $this->wrap("", $divider); |
| 56 | 58 | return $divider; |
| 57 | 59 | } |
@@ -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 | } |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
| 9 | 9 | |
| 10 | 10 | trait BaseTrait { |
| 11 | - protected $_variations=[ ]; |
|
| 12 | - protected $_states=[ ]; |
|
| 11 | + protected $_variations=[]; |
|
| 12 | + protected $_states=[]; |
|
| 13 | 13 | protected $_baseClass; |
| 14 | 14 | |
| 15 | 15 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $this->setProperty("class", $this->_baseClass); |
| 38 | 38 | if (\is_string($variations)) |
| 39 | 39 | $variations=\explode(" ", $variations); |
| 40 | - foreach ( $variations as $variation ) { |
|
| 40 | + foreach ($variations as $variation) { |
|
| 41 | 41 | $this->addVariation($variation); |
| 42 | 42 | } |
| 43 | 43 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function addVariations($variations=array()) { |
| 52 | 52 | if (\is_string($variations)) |
| 53 | 53 | $variations=\explode(" ", $variations); |
| 54 | - foreach ( $variations as $variation ) { |
|
| 54 | + foreach ($variations as $variation) { |
|
| 55 | 55 | $this->addVariation($variation); |
| 56 | 56 | } |
| 57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function addStates($states=array()) { |
| 61 | 61 | if (\is_string($states)) |
| 62 | 62 | $states=\explode(" ", $states); |
| 63 | - foreach ( $states as $state ) { |
|
| 63 | + foreach ($states as $state) { |
|
| 64 | 64 | $this->addState($state); |
| 65 | 65 | } |
| 66 | 66 | return $this; |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | $this->setProperty("class", $this->_baseClass); |
| 71 | 71 | if (\is_string($states)) |
| 72 | 72 | $states=\explode(" ", $states); |
| 73 | - foreach ( $states as $state ) { |
|
| 73 | + foreach ($states as $state) { |
|
| 74 | 74 | $this->addState($state); |
| 75 | 75 | } |
| 76 | 76 | return $this; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function addIcon($icon, $before=true) { |
| 80 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
| 80 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function setFloated($direction="right") { |
| 130 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
| 130 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function floatRight() { |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | class JArray { |
| 6 | 6 | |
| 7 | 7 | public static function isAssociative($array) { |
| 8 | - return (array_values($array) !== $array); |
|
| 8 | + return (array_values($array)!==$array); |
|
| 9 | 9 | // return (array_keys($array)!==range(0, count($array)-1)); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | return $array[$key]; |
| 15 | 15 | } |
| 16 | 16 | $values=array_values($array); |
| 17 | - if ($pos < sizeof($values)) |
|
| 17 | + if ($pos<sizeof($values)) |
|
| 18 | 18 | return $values[$pos]; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | $result=NULL; |
| 23 | 23 | if (array_key_exists($key, $array)) { |
| 24 | 24 | $result=$array[$key]; |
| 25 | - if ($condition($result) === true) |
|
| 25 | + if ($condition($result)===true) |
|
| 26 | 26 | return $result; |
| 27 | 27 | } |
| 28 | 28 | $values=array_values($array); |
| 29 | - foreach ( $values as $val ) { |
|
| 30 | - if ($condition($val) === true) |
|
| 29 | + foreach ($values as $val) { |
|
| 30 | + if ($condition($val)===true) |
|
| 31 | 31 | return $val; |
| 32 | 32 | } |
| 33 | 33 | return $result; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public static function getDefaultValue($array, $key, $default=NULL) { |
| 37 | 37 | if (array_key_exists($key, $array)) { |
| 38 | 38 | return $array[$key]; |
| 39 | - } else |
|
| 39 | + }else |
|
| 40 | 40 | return $default; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $result=""; |
| 45 | 45 | if (\is_array($glue)) { |
| 46 | 46 | $size=\sizeof($pieces); |
| 47 | - if ($size > 0) { |
|
| 48 | - for($i=0; $i < $size - 1; $i++) { |
|
| 49 | - $result.=$pieces[$i] . @$glue[$i]; |
|
| 47 | + if ($size>0) { |
|
| 48 | + for ($i=0; $i<$size-1; $i++) { |
|
| 49 | + $result.=$pieces[$i].@$glue[$i]; |
|
| 50 | 50 | } |
| 51 | - $result.=$pieces[$size - 1]; |
|
| 51 | + $result.=$pieces[$size-1]; |
|
| 52 | 52 | } |
| 53 | - } else { |
|
| 53 | + }else { |
|
| 54 | 54 | $result=\implode($glue, $pieces); |
| 55 | 55 | } |
| 56 | 56 | return $result; |
@@ -58,16 +58,16 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public static function dimension($array) { |
| 60 | 60 | if (is_array(reset($array))) { |
| 61 | - $return=self::dimension(reset($array)) + 1; |
|
| 62 | - } else { |
|
| 61 | + $return=self::dimension(reset($array))+1; |
|
| 62 | + }else { |
|
| 63 | 63 | $return=1; |
| 64 | 64 | } |
| 65 | 65 | return $return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public static function sortAssociative($array, $sortedKeys=array()) { |
| 69 | - $newArray=array (); |
|
| 70 | - foreach ( $sortedKeys as $key ) { |
|
| 69 | + $newArray=array(); |
|
| 70 | + foreach ($sortedKeys as $key) { |
|
| 71 | 71 | if (\array_key_exists($key, $array)) { |
| 72 | 72 | $newArray[$key]=$array[$key]; |
| 73 | 73 | } |
@@ -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) { |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function __construct($identifier, $rowCount, $colCount) { |
| 21 | 21 | parent::__construct($identifier, "table", "ui table"); |
| 22 | - $this->content=array (); |
|
| 22 | + $this->content=array(); |
|
| 23 | 23 | $this->setRowCount($rowCount, $colCount); |
| 24 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 24 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @return HtmlTableContent |
| 31 | 31 | */ |
| 32 | 32 | private function getPart($key) { |
| 33 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 33 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 34 | 34 | $this->content[$key]=new HtmlTableContent("", $key); |
| 35 | - if ($key !== "tbody") { |
|
| 35 | + if ($key!=="tbody") { |
|
| 36 | 36 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return boolean |
| 70 | 70 | */ |
| 71 | 71 | public function hasPart($key) { |
| 72 | - return \array_key_exists($key, $this->content) === true; |
|
| 72 | + return \array_key_exists($key, $this->content)===true; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | private function colAlign($colIndex, $function) { |
| 150 | 150 | if (\is_array($colIndex)) { |
| 151 | - foreach ( $colIndex as $cIndex ) { |
|
| 151 | + foreach ($colIndex as $cIndex) { |
|
| 152 | 152 | $this->colAlign($cIndex, $function); |
| 153 | 153 | } |
| 154 | - } else { |
|
| 154 | + }else { |
|
| 155 | 155 | if ($this->hasPart("thead")) { |
| 156 | 156 | $this->getHeader()->$function($colIndex); |
| 157 | 157 | } |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | public function setBasic($very=false) { |
| 168 | 168 | if ($very) |
| 169 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 170 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 169 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
| 170 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function setCollapsing() { |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 229 | 229 | */ |
| 230 | 230 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 231 | - $this->content=JArray::sortAssociative($this->content, [ "thead","tbody","tfoot" ]); |
|
| 231 | + $this->content=JArray::sortAssociative($this->content, ["thead", "tbody", "tfoot"]); |
|
| 232 | 232 | if ($this->propertyContains("class", "sortable")) { |
| 233 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
| 233 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
| 234 | 234 | } |
| 235 | 235 | return parent::compile($js, $view); |
| 236 | 236 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $result=$function($object); |
| 246 | 246 | if (\is_array($result)) { |
| 247 | 247 | return $this->addRow($function($object)); |
| 248 | - } else { |
|
| 248 | + }else { |
|
| 249 | 249 | return $this->getBody()->_addRow($result); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -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 | |
@@ -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 (); |
@@ -96,7 +101,7 @@ discard block |
||
| 96 | 101 | /** |
| 97 | 102 | * Retuns the row at $rowIndex |
| 98 | 103 | * @param int $rowIndex |
| 99 | - * @return \Ajax\semantic\html\content\HtmlTR |
|
| 104 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 100 | 105 | */ |
| 101 | 106 | public function getRow($rowIndex) { |
| 102 | 107 | return $this->getBody()->getRow($rowIndex); |
@@ -172,6 +177,9 @@ discard block |
||
| 172 | 177 | return $this->colAlign($colIndex, "colLeft"); |
| 173 | 178 | } |
| 174 | 179 | |
| 180 | + /** |
|
| 181 | + * @param string $function |
|
| 182 | + */ |
|
| 175 | 183 | private function colAlign($colIndex, $function) { |
| 176 | 184 | if (\is_array($colIndex)) { |
| 177 | 185 | foreach ( $colIndex as $cIndex ) { |
@@ -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 { |
@@ -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,10 +220,10 @@ 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 | - } else { |
|
| 226 | + }else { |
|
| 227 | 227 | $this->removeItem($rowIndex); |
| 228 | 228 | } |
| 229 | 229 | return $this; |
@@ -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 | |
@@ -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++) { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | use Ajax\semantic\html\elements\html5\HtmlLink; |
| 11 | 11 | |
| 12 | 12 | class HtmlTD extends HtmlSemDoubleElement { |
| 13 | - use TextAlignmentTrait,TableElementTrait; |
|
| 13 | + use TextAlignmentTrait, TableElementTrait; |
|
| 14 | 14 | private $_container; |
| 15 | 15 | private $_row; |
| 16 | 16 | private $_col; |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct($identifier, $content=NULL, $tagName="td") { |
| 25 | 25 | parent::__construct($identifier, $tagName, "", $content); |
| 26 | - $this->_variations=[ Variation::COLLAPSING ]; |
|
| 27 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
| 26 | + $this->_variations=[Variation::COLLAPSING]; |
|
| 27 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setContainer($container, $row, $col) { |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function setRowspan($rowspan) { |
| 42 | - $to=min($this->_container->count(), $this->_row + $rowspan - 1); |
|
| 43 | - for($i=$to; $i > $this->_row; $i--) { |
|
| 42 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
| 43 | + for ($i=$to; $i>$this->_row; $i--) { |
|
| 44 | 44 | $this->_container->delete($i, $this->_col); |
| 45 | 45 | } |
| 46 | 46 | $this->setProperty("rowspan", $rowspan); |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function setColspan($colspan) { |
| 59 | - $to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1); |
|
| 60 | - for($i=$to; $i > $this->_col; $i--) { |
|
| 61 | - $this->_container->delete($this->_row, $this->_col + 1); |
|
| 59 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
| 60 | + for ($i=$to; $i>$this->_col; $i--) { |
|
| 61 | + $this->_container->delete($this->_row, $this->_col+1); |
|
| 62 | 62 | } |
| 63 | 63 | $this->setProperty("colspan", $colspan); |
| 64 | 64 | return $this->_container; |
@@ -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 | |
@@ -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 | } |
@@ -9,26 +9,26 @@ discard block |
||
| 9 | 9 | use Ajax\semantic\html\base\constants\State; |
| 10 | 10 | |
| 11 | 11 | class HtmlProgress extends HtmlSemDoubleElement { |
| 12 | - private $_params=array (); |
|
| 12 | + private $_params=array(); |
|
| 13 | 13 | |
| 14 | 14 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
| 15 | 15 | parent::__construct($identifier, "div", "ui progress"); |
| 16 | - if (isset($value) === true) |
|
| 16 | + if (isset($value)===true) |
|
| 17 | 17 | $this->setProperty("data-percent", $value); |
| 18 | 18 | $this->createBar(); |
| 19 | - if (isset($label) === true) |
|
| 19 | + if (isset($label)===true) |
|
| 20 | 20 | $this->setLabel($label); |
| 21 | - $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
|
| 21 | + $this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED]; |
|
| 22 | 22 | $this->addToProperty("class", $attributes); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function setLabel($label) { |
| 26 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
| 26 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
| 27 | 27 | return $this; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | private function createBar() { |
| 31 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
| 31 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
| 32 | 32 | $this->content["bar"]=$bar; |
| 33 | 33 | return $this; |
| 34 | 34 | } |
@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 69 | 69 | */ |
| 70 | 70 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 71 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
| 71 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
| 72 | 72 | return parent::compile($js, $view); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function jsSetValue($value) { |
| 76 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
| 76 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function jsIncValue() { |
| 80 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
| 80 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function jsDecValue() { |
| 84 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
| 84 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return HtmlProgress |
| 96 | 96 | */ |
| 97 | 97 | public function setTextValues($active=false, $error=false, $success=false, $warning=false, $percent="{percent}%", $ratio="{value} of {total}") { |
| 98 | - if (\is_array($active) == true) { |
|
| 98 | + if (\is_array($active)==true) { |
|
| 99 | 99 | $array=$active; |
| 100 | 100 | $active=JArray::getDefaultValue($array, "active", false); |
| 101 | 101 | $success=JArray::getDefaultValue($array, "success", $success); |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
| 104 | 104 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
| 105 | 105 | } |
| 106 | - $this->_params["text"]="%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; |
|
| 106 | + $this->_params["text"]="%{active : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio : ".\var_export($ratio, true)."}%"; |
|
| 107 | 107 | return $this; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function onChange($jsCode) { |
| 111 | - return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%"; |
|
| 111 | + return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%"; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /* |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | * @see BaseHtml::run() |
| 117 | 117 | */ |
| 118 | 118 | public function run(JsUtils $js) { |
| 119 | - if (isset($this->_bsComponent) === false) |
|
| 120 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 119 | + if (isset($this->_bsComponent)===false) |
|
| 120 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
| 121 | 121 | $this->addEventsOnRun($js); |
| 122 | 122 | return $this->_bsComponent; |
| 123 | 123 | } |
@@ -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 { |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 16 | 16 | parent::__construct($identifier, "div", "ui buttons"); |
| 17 | - $this->content=array (); |
|
| 18 | - if ($asIcons === true) |
|
| 17 | + $this->content=array(); |
|
| 18 | + if ($asIcons===true) |
|
| 19 | 19 | $this->asIcons(); |
| 20 | 20 | $this->addElements($elements, $asIcons); |
| 21 | 21 | } |
@@ -24,25 +24,25 @@ discard block |
||
| 24 | 24 | $elementO=$element; |
| 25 | 25 | if (\is_string($element)) { |
| 26 | 26 | if ($asIcon) { |
| 27 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); |
|
| 27 | + $elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content)); |
|
| 28 | 28 | $elementO->asIcon($element); |
| 29 | - } else |
|
| 30 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 29 | + }else |
|
| 30 | + $elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $element); |
|
| 31 | 31 | } |
| 32 | 32 | $this->addContent($elementO); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function addElements($elements, $asIcons=false) { |
| 36 | - foreach ( $elements as $element ) { |
|
| 36 | + foreach ($elements as $element) { |
|
| 37 | 37 | $this->addElement($element, $asIcons); |
| 38 | 38 | } |
| 39 | 39 | return $this; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function insertOr($aferIndex=0, $or="or") { |
| 43 | - $orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or"); |
|
| 43 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
| 44 | 44 | $orElement->setProperty("data-text", $or); |
| 45 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
| 45 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
| 46 | 46 | return $this; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function asIcons() { |
| 58 | - foreach ( $this->content as $item ) { |
|
| 58 | + foreach ($this->content as $item) { |
|
| 59 | 59 | $item->asIcon($item->getContent()); |
| 60 | 60 | } |
| 61 | 61 | return $this->addToProperty("class", "icons"); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 94 | 94 | */ |
| 95 | 95 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 96 | - foreach ( $this->content as $element ) { |
|
| 96 | + foreach ($this->content as $element) { |
|
| 97 | 97 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 98 | 98 | } |
| 99 | 99 | return $this; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function addClasses($classes=array()) { |
| 107 | 107 | $i=0; |
| 108 | - foreach ( $this->content as $button ) { |
|
| 108 | + foreach ($this->content as $button) { |
|
| 109 | 109 | $button->addToProperty("class", $classes[$i++]); |
| 110 | 110 | } |
| 111 | 111 | return $this; |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 16 | 16 | parent::__construct($identifier, "div", "ui buttons"); |
| 17 | 17 | $this->content=array (); |
| 18 | - if ($asIcons === true) |
|
| 19 | - $this->asIcons(); |
|
| 18 | + if ($asIcons === true) { |
|
| 19 | + $this->asIcons(); |
|
| 20 | + } |
|
| 20 | 21 | $this->addElements($elements, $asIcons); |
| 21 | 22 | } |
| 22 | 23 | |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | if ($asIcon) { |
| 27 | 28 | $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); |
| 28 | 29 | $elementO->asIcon($element); |
| 29 | - } else |
|
| 30 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 30 | + } else { |
|
| 31 | + $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | $this->addContent($elementO); |
| 33 | 35 | } |
@@ -75,9 +77,9 @@ discard block |
||
| 75 | 77 | * @return HtmlButton |
| 76 | 78 | */ |
| 77 | 79 | public function getElement($index) { |
| 78 | - if (is_int($index)) |
|
| 79 | - return $this->content[$index]; |
|
| 80 | - else { |
|
| 80 | + if (is_int($index)) { |
|
| 81 | + return $this->content[$index]; |
|
| 82 | + } else { |
|
| 81 | 83 | $elm=$this->getElementById($index, $this->content); |
| 82 | 84 | return $elm; |
| 83 | 85 | } |