@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 10 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 11 | |
| 12 | -class HtmlStep extends HtmlSemCollection{ |
|
| 12 | +class HtmlStep extends HtmlSemCollection { |
|
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | |
| 15 | - public function __construct( $identifier,$steps=array()){ |
|
| 16 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 15 | + public function __construct($identifier, $steps=array()) { |
|
| 16 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 17 | 17 | $this->addItems($steps); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 24 | 24 | */ |
| 25 | 25 | protected function createItem($value) { |
| 26 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 26 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 27 | 27 | return $itemO; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,50 +31,50 @@ discard block |
||
| 31 | 31 | * @param string|array $step |
| 32 | 32 | * @return HtmlStepItem |
| 33 | 33 | */ |
| 34 | - public function addStep($step){ |
|
| 34 | + public function addStep($step) { |
|
| 35 | 35 | return $this->addItem($step); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function setOrdered(){ |
|
| 38 | + public function setOrdered() { |
|
| 39 | 39 | return $this->addToProperty("class", "ordered"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function isOrdered(){ |
|
| 42 | + public function isOrdered() { |
|
| 43 | 43 | return $this->propertyContains("class", "ordered"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setVertical(){ |
|
| 46 | + public function setVertical() { |
|
| 47 | 47 | return $this->addToProperty("class", "vertical"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - protected function defineActiveStep(){ |
|
| 50 | + protected function defineActiveStep() { |
|
| 51 | 51 | $activestep=$this->_activeStep; |
| 52 | 52 | $count=$this->count(); |
| 53 | - if($this->isOrdered()){ |
|
| 54 | - for($i=0;$i<$count;$i++){ |
|
| 53 | + if ($this->isOrdered()) { |
|
| 54 | + for ($i=0; $i<$count; $i++) { |
|
| 55 | 55 | $step=$this->content[$i]; |
| 56 | 56 | $step->removeStatus(); |
| 57 | - if($i<$activestep) |
|
| 57 | + if ($i<$activestep) |
|
| 58 | 58 | $step->setCompleted(); |
| 59 | 59 | elseif ($i===$activestep) |
| 60 | 60 | $step->setActive(); |
| 61 | 61 | else |
| 62 | 62 | $step->setDisabled(); |
| 63 | 63 | } |
| 64 | - }else{ |
|
| 65 | - foreach ($this->content as $step){ |
|
| 64 | + }else { |
|
| 65 | + foreach ($this->content as $step) { |
|
| 66 | 66 | $step->removeStatus(); |
| 67 | 67 | } |
| 68 | - if($activestep<$count) |
|
| 68 | + if ($activestep<$count) |
|
| 69 | 69 | $this->content[$activestep]->setActive(); |
| 70 | 70 | } |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 75 | - if(isset($this->_activeStep)===true && \is_numeric($this->_activeStep)) |
|
| 75 | + if (isset($this->_activeStep)===true && \is_numeric($this->_activeStep)) |
|
| 76 | 76 | $this->defineActiveStep(); |
| 77 | - return parent::compile($js,$view); |
|
| 77 | + return parent::compile($js, $view); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function setActiveStep($_activeStep) { |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 86 | - if(isset($toElement)){ |
|
| 87 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 85 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 86 | + if (isset($toElement)) { |
|
| 87 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 88 | 88 | } |
| 89 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 89 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function asLink(){ |
|
| 93 | - foreach ($this->content as $step){ |
|
| 92 | + public function asLink() { |
|
| 93 | + foreach ($this->content as $step) { |
|
| 94 | 94 | $step->asLink(); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
@@ -5,5 +5,5 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | abstract class StepStatus extends BaseEnum { |
| 8 | - const ACTIVE="active",COMPLETED="completed",DISABLED="disabled",NONE=""; |
|
| 8 | + const ACTIVE="active", COMPLETED="completed", DISABLED="disabled", NONE=""; |
|
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file |
@@ -10,23 +10,23 @@ |
||
| 10 | 10 | * @param string $value |
| 11 | 11 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 12 | 12 | */ |
| 13 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
| 14 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
| 13 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
| 14 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function textCenterAligned(){ |
|
| 17 | + public function textCenterAligned() { |
|
| 18 | 18 | return $this->setTextAlignment(TextAlignment::CENTER); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function textJustified(){ |
|
| 21 | + public function textJustified() { |
|
| 22 | 22 | return $this->setTextAlignment(TextAlignment::JUSTIFIED); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function textRightAligned(){ |
|
| 25 | + public function textRightAligned() { |
|
| 26 | 26 | return $this->setTextAlignment(TextAlignment::RIGHT); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function textLeftAligned(){ |
|
| 29 | + public function textLeftAligned() { |
|
| 30 | 30 | return $this->setTextAlignment(); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @param int $max |
| 14 | 14 | * @param string $icon star or heart |
| 15 | 15 | */ |
| 16 | - public function __construct($identifier, $value,$max=5,$icon="") { |
|
| 16 | + public function __construct($identifier, $value, $max=5, $icon="") { |
|
| 17 | 17 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
| 18 | 18 | $this->setValue($value); |
| 19 | 19 | $this->setMax($max); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
| 25 | 25 | */ |
| 26 | - public function setValue($value){ |
|
| 26 | + public function setValue($value) { |
|
| 27 | 27 | $this->setProperty("data-rating", $value); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setMax($max){ |
|
| 30 | + public function setMax($max) { |
|
| 31 | 31 | $this->setProperty("data-max-rating", $max); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,20 +35,20 @@ discard block |
||
| 35 | 35 | * {@inheritDoc} |
| 36 | 36 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 37 | 37 | */ |
| 38 | - public function run(JsUtils $js){ |
|
| 38 | + public function run(JsUtils $js) { |
|
| 39 | 39 | parent::run($js); |
| 40 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
| 40 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function asStar(){ |
|
| 43 | + public function asStar() { |
|
| 44 | 44 | return $this->setIcon(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function asHeart(){ |
|
| 47 | + public function asHeart() { |
|
| 48 | 48 | return $this->setIcon("heart"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function setIcon($icon="star"){ |
|
| 52 | - return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]); |
|
| 51 | + public function setIcon($icon="star") { |
|
| 52 | + return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @param int $rowCount |
| 14 | 14 | * @param int $colCount |
| 15 | 15 | */ |
| 16 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
| 16 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
| 17 | 17 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
| 16 | 16 | use CheckboxTrait; |
| 17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
| 18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
| 18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function slider($identifier, $label="", $value=NULL) { |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | if (\is_string($end)) { |
| 30 | 30 | $label=$end; |
| 31 | 31 | \array_pop($fields); |
| 32 | - } else |
|
| 32 | + }else |
|
| 33 | 33 | $label=NULL; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | if (isset($label)) |
| 37 | 37 | $this->setLabel($label); |
| 38 | - foreach ( $fields as $field ) { |
|
| 38 | + foreach ($fields as $field) { |
|
| 39 | 39 | $this->addItem($field); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if ($this->_equalWidth) { |
| 66 | 66 | $count=$this->count(); |
| 67 | 67 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
| 68 | - } else |
|
| 68 | + }else |
|
| 69 | 69 | $this->addToProperty("class", "fields"); |
| 70 | 70 | return parent::compile($js, $view); |
| 71 | 71 | } |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
| 99 | - $fields=array (); |
|
| 99 | + $fields=array(); |
|
| 100 | 100 | $i=0; |
| 101 | - foreach ( $items as $val => $caption ) { |
|
| 101 | + foreach ($items as $val => $caption) { |
|
| 102 | 102 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
| 103 | 103 | if ($val===$value) { |
| 104 | 104 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
| 115 | - $fields=array (); |
|
| 115 | + $fields=array(); |
|
| 116 | 116 | $i=0; |
| 117 | - foreach ( $items as $val => $caption ) { |
|
| 117 | + foreach ($items as $val => $caption) { |
|
| 118 | 118 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
| 119 | 119 | if (\array_search($val, $values)!==false) { |
| 120 | 120 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -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 | } |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 35 | 35 | */ |
| 36 | 36 | public function setType($type="") { |
| 37 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 37 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActiveItem($index) { |
| 41 | 41 | $item=$this->getItem($index); |
| 42 | - if ($item !== null) { |
|
| 42 | + if ($item!==null) { |
|
| 43 | 43 | $item->addToProperty("class", "active"); |
| 44 | 44 | } |
| 45 | 45 | return $this; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | private function getItemToInsert($item) { |
| 49 | 49 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon) { |
| 50 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
| 50 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
| 51 | 51 | $itemO->setContent($item); |
| 52 | 52 | $item=$itemO; |
| 53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | private function afterInsert($item) { |
| 58 | 58 | if (!$item instanceof HtmlMenu) |
| 59 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 59 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 60 | 60 | else { |
| 61 | 61 | $this->setSecondary(); |
| 62 | 62 | } |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function generateMenuAsItem($menu, $header=null) { |
| 89 | 89 | $count=$this->count(); |
| 90 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 90 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 91 | 91 | if (isset($header)) { |
| 92 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 92 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 93 | 93 | $headerItem->setContent($header); |
| 94 | 94 | $item->addContent($headerItem); |
| 95 | 95 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 107 | 107 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 108 | 108 | $value=$this->addItem($value); |
| 109 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 109 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 110 | 110 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 111 | 111 | $this->wrap("", $popup); |
| 112 | 112 | return $popup; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | public function addDropdownAsItem($value, $items=NULL) { |
| 116 | 116 | $dd=$value; |
| 117 | 117 | if (\is_string($value)) { |
| 118 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 118 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 119 | 119 | } |
| 120 | 120 | return $this->addItem($dd); |
| 121 | 121 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 128 | 128 | */ |
| 129 | 129 | protected function createItem($value) { |
| 130 | - $itemO=new HtmlLink("item-" . \sizeof($this->content), "", $value); |
|
| 130 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
| 131 | 131 | return $itemO->setClass("item"); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -140,28 +140,28 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function setVertical() { |
| 143 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 143 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | public function setPosition($value="right") { |
| 147 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 147 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function setPointing($value=Direction::NONE) { |
| 151 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 151 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function asTab($vertical=false) { |
| 155 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 155 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
| 156 | 156 | $item->setTagName("a"); |
| 157 | 157 | }); |
| 158 | - if ($vertical === true) |
|
| 158 | + if ($vertical===true) |
|
| 159 | 159 | $this->setVertical(); |
| 160 | 160 | return $this->addToProperty("class", "tabular"); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function asPagination() { |
| 164 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 164 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
| 165 | 165 | $item->setTagName("a"); |
| 166 | 166 | }); |
| 167 | 167 | return $this->addToProperty("class", "pagination"); |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function setWidth($width) { |
| 200 | 200 | if (\is_int($width)) { |
| 201 | - $width=Wide::getConstants()["W" . $width]; |
|
| 201 | + $width=Wide::getConstants()["W".$width]; |
|
| 202 | 202 | } |
| 203 | 203 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 204 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 204 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public function addImage($identifier, $src="", $alt="") { |