@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function setClass($classNames) { |
| 16 | - if(\is_array($classNames)){ |
|
| 16 | + if (\is_array($classNames)) { |
|
| 17 | 17 | $classNames=implode(" ", $classNames); |
| 18 | 18 | } |
| 19 | 19 | $this->setProperty("class", $classNames); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function addClass($classNames) { |
| 24 | - if(\is_array($classNames)){ |
|
| 24 | + if (\is_array($classNames)) { |
|
| 25 | 25 | $classNames=implode(" ", $classNames); |
| 26 | 26 | } |
| 27 | 27 | $this->addToProperty("class", $classNames); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setStyle($value){ |
|
| 41 | + public function setStyle($value) { |
|
| 42 | 42 | $this->setProperty("style", $value); |
| 43 | 43 | return $this; |
| 44 | 44 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function fromArray($array) { |
| 59 | 59 | $array=parent::fromArray($array); |
| 60 | - foreach ( $array as $key => $value ) { |
|
| 60 | + foreach ($array as $key => $value) { |
|
| 61 | 61 | $this->setProperty($key, $value); |
| 62 | 62 | } |
| 63 | 63 | return $array; |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | * @param string $tagName container tagName |
| 173 | 173 | * @return HtmlListgroup |
| 174 | 174 | */ |
| 175 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
| 176 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
| 175 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
| 176 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
| 177 | 177 | $listGroup->addItems($items); |
| 178 | 178 | return $this->addHtmlComponent($listGroup); |
| 179 | 179 | } |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | * @param string $onClick |
| 199 | 199 | * @return HtmlSplitbutton |
| 200 | 200 | */ |
| 201 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 202 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
| 201 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 202 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @param string $identifier |
| 208 | 208 | * @return HtmlInputgroup |
| 209 | 209 | */ |
| 210 | - public function htmlInputgroup($identifier){ |
|
| 210 | + public function htmlInputgroup($identifier) { |
|
| 211 | 211 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | * @param callable $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 220 | 220 | * @return HtmlBreadcrumbs |
| 221 | 221 | */ |
| 222 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 223 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$startIndex,$hrefFunction)); |
|
| 222 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 223 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $startIndex, $hrefFunction)); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | * @param int $active The active page |
| 233 | 233 | * @return HtmlPagination |
| 234 | 234 | */ |
| 235 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
| 236 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
| 235 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
| 236 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param int $numCols |
| 245 | 245 | * @return HtmlGridSystem |
| 246 | 246 | */ |
| 247 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
| 248 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
| 247 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
| 248 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
| 249 | 249 | } |
| 250 | 250 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | private function addFunction($jsCode) { |
| 17 | 17 | if (!JString::startsWith($jsCode, "function")) |
| 18 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
| 18 | + $jsCode="%function(){".$jsCode."}%"; |
|
| 19 | 19 | return $jsCode; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null) |
| 51 | 51 | * @return DialogButton |
| 52 | 52 | */ |
| 53 | - public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay",$parameters=[]) { |
|
| 54 | - return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement,$parameters) . ";$( this ).dialog( 'close' );"); |
|
| 53 | + public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[]) { |
|
| 54 | + return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters).";$( this ).dialog( 'close' );"); |
|
| 55 | 55 | } |
| 56 | 56 | } |
@@ -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 HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCol($index){ |
|
| 60 | + public function getCol($index) { |
|
| 61 | 61 | return $this->getItem($index); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
| 64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
| 65 | 65 | $this->setWidth($colsCount); |
| 66 | - if($toCreate===true){ |
|
| 66 | + if ($toCreate===true) { |
|
| 67 | 67 | $count=$this->count(); |
| 68 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 69 | 69 | $this->addItem(null); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addCols($colCount){ |
|
| 76 | - for($i=0;$i<$colCount;$i++){ |
|
| 75 | + public function addCols($colCount) { |
|
| 76 | + for ($i=0; $i<$colCount; $i++) { |
|
| 77 | 77 | $this->addItem(null); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addCol($width=NULL){ |
|
| 82 | + public function addCol($width=NULL) { |
|
| 83 | 83 | return $this->addItem($width); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * stretch the row contents to take up the entire column height |
| 88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 89 | 89 | */ |
| 90 | - public function setStretched(){ |
|
| 90 | + public function setStretched() { |
|
| 91 | 91 | return $this->addToProperty("class", "stretched"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | * @param string $color |
| 96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 97 | 97 | */ |
| 98 | - public function setColor($color){ |
|
| 99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 98 | + public function setColor($color) { |
|
| 99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setValues($values,$force=false){ |
|
| 102 | + public function setValues($values, $force=false) { |
|
| 103 | 103 | $count=$this->count(); |
| 104 | 104 | $valuesSize=\sizeof($values); |
| 105 | - if($force===true){ |
|
| 106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
| 107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 105 | + if ($force===true) { |
|
| 106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - $count=\min(array($this->count(),$valuesSize)); |
|
| 111 | - for($i=0;$i<$count;$i++){ |
|
| 110 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 111 | + for ($i=0; $i<$count; $i++) { |
|
| 112 | 112 | $this->content[$i]->setValue($values[$i]); |
| 113 | 113 | } |
| 114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | * {@inheritDoc} |
| 119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 120 | 120 | */ |
| 121 | - protected function createItem($value){ |
|
| 122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 121 | + protected function createItem($value) { |
|
| 122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 123 | 123 | return $col; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 127 | - if($this->_implicite===true){ |
|
| 126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 127 | + if ($this->_implicite===true) { |
|
| 128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 129 | 129 | } |
| 130 | - return parent::compile($js,$view); |
|
| 130 | + return parent::compile($js, $view); |
|
| 131 | 131 | } |
| 132 | 132 | } |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 11 | use Ajax\common\html\HtmlCollection; |
| 12 | 12 | |
| 13 | -class HtmlStep extends HtmlSemCollection{ |
|
| 13 | +class HtmlStep extends HtmlSemCollection { |
|
| 14 | 14 | protected $_activeStep; |
| 15 | 15 | protected $_startStep; |
| 16 | 16 | |
| 17 | - public function __construct( $identifier,$steps=array()){ |
|
| 18 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 17 | + public function __construct($identifier, $steps=array()) { |
|
| 18 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 19 | 19 | $this->addItems($steps); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @see HtmlCollection::createItem() |
| 26 | 26 | */ |
| 27 | 27 | protected function createItem($value) { |
| 28 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 28 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 29 | 29 | return $itemO; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -33,50 +33,50 @@ discard block |
||
| 33 | 33 | * @param string|array $step |
| 34 | 34 | * @return HtmlStepItem |
| 35 | 35 | */ |
| 36 | - public function addStep($step){ |
|
| 36 | + public function addStep($step) { |
|
| 37 | 37 | return $this->addItem($step); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function setOrdered(){ |
|
| 40 | + public function setOrdered() { |
|
| 41 | 41 | return $this->addToProperty("class", "ordered"); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function isOrdered(){ |
|
| 44 | + public function isOrdered() { |
|
| 45 | 45 | return $this->propertyContains("class", "ordered"); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function setVertical(){ |
|
| 48 | + public function setVertical() { |
|
| 49 | 49 | return $this->addToProperty("class", "vertical"); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected function defineActiveStep(){ |
|
| 52 | + protected function defineActiveStep() { |
|
| 53 | 53 | $activestep=$this->_activeStep; |
| 54 | 54 | $count=$this->count(); |
| 55 | - if(!$this->isOrdered()){ |
|
| 56 | - for($i=$this->_startStep;$i<$count;$i++){ |
|
| 55 | + if (!$this->isOrdered()) { |
|
| 56 | + for ($i=$this->_startStep; $i<$count; $i++) { |
|
| 57 | 57 | $step=$this->content[$i]; |
| 58 | 58 | $step->removeStatus(); |
| 59 | - if($i<$activestep) |
|
| 59 | + if ($i<$activestep) |
|
| 60 | 60 | $step->setCompleted(); |
| 61 | 61 | elseif ($i===$activestep) |
| 62 | 62 | $step->setActive(); |
| 63 | 63 | else |
| 64 | 64 | $step->setDisabled(); |
| 65 | 65 | } |
| 66 | - }else{ |
|
| 67 | - foreach ($this->content as $step){ |
|
| 66 | + } else { |
|
| 67 | + foreach ($this->content as $step) { |
|
| 68 | 68 | $step->removeStatus(); |
| 69 | 69 | } |
| 70 | - if($activestep<$count) |
|
| 70 | + if ($activestep<$count) |
|
| 71 | 71 | $this->content[$activestep]->setActive(); |
| 72 | 72 | } |
| 73 | 73 | return $this; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 77 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 77 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 78 | 78 | $this->defineActiveStep(); |
| 79 | - return parent::compile($js,$view); |
|
| 79 | + return parent::compile($js, $view); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function setActiveStep($_activeStep) { |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | return $this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 88 | - if(isset($toElement)){ |
|
| 89 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 87 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 88 | + if (isset($toElement)) { |
|
| 89 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 90 | 90 | } |
| 91 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 91 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function setStartStep($_startStep) { |
@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\common\html\HtmlCollection; |
| 8 | 8 | |
| 9 | -class HtmlAccordionMenu extends HtmlMenu{ |
|
| 9 | +class HtmlAccordionMenu extends HtmlMenu { |
|
| 10 | 10 | protected $params=array(); |
| 11 | 11 | |
| 12 | - public function __construct( $identifier, $items=array() ){ |
|
| 13 | - parent::__construct( $identifier, $items); |
|
| 12 | + public function __construct($identifier, $items=array()) { |
|
| 13 | + parent::__construct($identifier, $items); |
|
| 14 | 14 | $this->addToProperty("class", "accordion"); |
| 15 | 15 | $this->setVertical(); |
| 16 | 16 | } |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | protected function createItem($value) { |
| 23 | 23 | $title=$value; |
| 24 | 24 | $content=""; |
| 25 | - if(\is_array($value)){ |
|
| 26 | - $title=@$value[0];$content=@$value[1]; |
|
| 25 | + if (\is_array($value)) { |
|
| 26 | + $title=@$value[0]; $content=@$value[1]; |
|
| 27 | 27 | } |
| 28 | 28 | $itemO=new HtmlAccordionMenuItem("item-".$this->identifier."-".$this->count(), $title, $content); |
| 29 | 29 | return $itemO->setClass("item"); |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | * @see BaseHtml::run() |
| 35 | 35 | */ |
| 36 | 36 | public function run(JsUtils $js) { |
| 37 | - if(isset($this->_bsComponent)===false) |
|
| 38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 37 | + if (isset($this->_bsComponent)===false) |
|
| 38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
| 39 | 39 | $this->addEventsOnRun($js); |
| 40 | 40 | return $this->_bsComponent; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function setExclusive($value){ |
|
| 43 | + public function setExclusive($value) { |
|
| 44 | 44 | $this->params["exclusive"]=$value; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | use Ajax\common\html\BaseHtml; |
| 9 | 9 | |
| 10 | 10 | |
| 11 | -class HtmlShape extends HtmlSemCollection{ |
|
| 11 | +class HtmlShape extends HtmlSemCollection { |
|
| 12 | 12 | |
| 13 | 13 | protected $_params=array(); |
| 14 | 14 | protected $_autoActive=true; |
| 15 | 15 | |
| 16 | - public function __construct( $identifier, $sides){ |
|
| 17 | - parent::__construct( $identifier, "div", "ui shape"); |
|
| 16 | + public function __construct($identifier, $sides) { |
|
| 17 | + parent::__construct($identifier, "div", "ui shape"); |
|
| 18 | 18 | $this->_template='<%tagName% id="%identifier%" %properties%><div class="sides">%wrapContentBefore%%content%%wrapContentAfter%</div></%tagName%>'; |
| 19 | 19 | $this->addItems($sides); |
| 20 | 20 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 25 | 25 | */ |
| 26 | - protected function createItem($value){ |
|
| 27 | - if(\is_object($value)===false){ |
|
| 28 | - $value=new HtmlSemDoubleElement("","div","content",$value); |
|
| 26 | + protected function createItem($value) { |
|
| 27 | + if (\is_object($value)===false) { |
|
| 28 | + $value=new HtmlSemDoubleElement("", "div", "content", $value); |
|
| 29 | 29 | } |
| 30 | 30 | return new HtmlShapeItem("side-".$this->identifier."-".$this->count(), $value); |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * {@inheritDoc} |
| 35 | 35 | * @see \Ajax\common\html\HtmlCollection::createCondition() |
| 36 | 36 | */ |
| 37 | - protected function createCondition($value){ |
|
| 37 | + protected function createCondition($value) { |
|
| 38 | 38 | return ($value instanceof HtmlShapeItem)===false; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param int $index |
| 43 | 43 | * @return \Ajax\semantic\html\content\HtmlShapeItem |
| 44 | 44 | */ |
| 45 | - public function getSide($index){ |
|
| 45 | + public function getSide($index) { |
|
| 46 | 46 | return $this->getItem($index); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -50,96 +50,96 @@ discard block |
||
| 50 | 50 | * @param int $index |
| 51 | 51 | * @return mixed|NULL |
| 52 | 52 | */ |
| 53 | - public function getSideContent($index){ |
|
| 54 | - $item= $this->getItem($index); |
|
| 55 | - if(isset($item)) |
|
| 53 | + public function getSideContent($index) { |
|
| 54 | + $item=$this->getItem($index); |
|
| 55 | + if (isset($item)) |
|
| 56 | 56 | return $item->getContent(); |
| 57 | 57 | return null; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function jsDo($action){ |
|
| 60 | + public function jsDo($action) { |
|
| 61 | 61 | return "$('#".$this->identifier."').shape('".$action."');"; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function jsFlipLeft(){ |
|
| 64 | + public function jsFlipLeft() { |
|
| 65 | 65 | return $this->jsDo("flip left"); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function jsFlipRight(){ |
|
| 68 | + public function jsFlipRight() { |
|
| 69 | 69 | return $this->jsDo("flip right"); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function jsFlipUp(){ |
|
| 72 | + public function jsFlipUp() { |
|
| 73 | 73 | return $this->jsDo("flip up"); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function jsFlipDown(){ |
|
| 76 | + public function jsFlipDown() { |
|
| 77 | 77 | return $this->jsDo("flip down"); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function jsFlipOver(){ |
|
| 80 | + public function jsFlipOver() { |
|
| 81 | 81 | return $this->jsDo("flip over"); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function jsFlipBack(){ |
|
| 84 | + public function jsFlipBack() { |
|
| 85 | 85 | return $this->jsDo("flip back"); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - private function doActionOn($element,$event,$what){ |
|
| 89 | - if($element instanceof BaseHtml){ |
|
| 90 | - return $element->on($event, $what,true,true); |
|
| 88 | + private function doActionOn($element, $event, $what) { |
|
| 89 | + if ($element instanceof BaseHtml) { |
|
| 90 | + return $element->on($event, $what, true, true); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function flipLeftOn($element,$event){ |
|
| 94 | + public function flipLeftOn($element, $event) { |
|
| 95 | 95 | return $this->doActionOn($element, $event, $this->jsFlipLeft()); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function flipRightOn($element,$event){ |
|
| 98 | + public function flipRightOn($element, $event) { |
|
| 99 | 99 | return $this->doActionOn($element, $event, $this->jsFlipRight()); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function flipUpOn($element,$event){ |
|
| 102 | + public function flipUpOn($element, $event) { |
|
| 103 | 103 | return $this->doActionOn($element, $event, $this->jsFlipUp()); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function flipDownOn($element,$event){ |
|
| 106 | + public function flipDownOn($element, $event) { |
|
| 107 | 107 | return $this->doActionOn($element, $event, $this->jsFlipDown()); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function flipBackOn($element,$event){ |
|
| 110 | + public function flipBackOn($element, $event) { |
|
| 111 | 111 | return $this->doActionOn($element, $event, $this->jsFlipBack()); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function flipOverOn($element,$event){ |
|
| 114 | + public function flipOverOn($element, $event) { |
|
| 115 | 115 | return $this->doActionOn($element, $event, $this->jsFlipOver()); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function setActiveSide($index){ |
|
| 118 | + public function setActiveSide($index) { |
|
| 119 | 119 | $side=$this->getSide($index); |
| 120 | - if(isset($side)){ |
|
| 120 | + if (isset($side)) { |
|
| 121 | 121 | $side->setActive(true); |
| 122 | 122 | } |
| 123 | 123 | return $this; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function asCube(){ |
|
| 126 | + public function asCube() { |
|
| 127 | 127 | return $this->addToPropertyCtrl("class", "cube", ["cube"]); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function asText(){ |
|
| 130 | + public function asText() { |
|
| 131 | 131 | return $this->addToPropertyCtrl("class", "text", ["text"]); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function setWidth($width="initial"){ |
|
| 134 | + public function setWidth($width="initial") { |
|
| 135 | 135 | $this->_params["width"]=$width; |
| 136 | 136 | } |
| 137 | - public function onChange($jsCode){ |
|
| 138 | - return $this->_params["onChange"]="%function(){" . $jsCode . "}%"; |
|
| 137 | + public function onChange($jsCode) { |
|
| 138 | + return $this->_params["onChange"]="%function(){".$jsCode."}%"; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function beforeChange($jsCode){ |
|
| 142 | - return $this->_params["beforeChange"]="%function(){" . $jsCode . "}%"; |
|
| 141 | + public function beforeChange($jsCode) { |
|
| 142 | + return $this->_params["beforeChange"]="%function(){".$jsCode."}%"; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /* |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | * @see BaseHtml::run() |
| 148 | 148 | */ |
| 149 | 149 | public function run(JsUtils $js) { |
| 150 | - if (isset($this->_bsComponent) === false) |
|
| 151 | - $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
| 150 | + if (isset($this->_bsComponent)===false) |
|
| 151 | + $this->_bsComponent=$js->semantic()->shape("#".$this->identifier, $this->_params); |
|
| 152 | 152 | $this->addEventsOnRun($js); |
| 153 | 153 | return $this->_bsComponent; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 157 | - if($this->_autoActive) |
|
| 157 | + if ($this->_autoActive) |
|
| 158 | 158 | $this->setActiveSide(0); |
| 159 | - return parent::compile($js,$view); |
|
| 159 | + return parent::compile($js, $view); |
|
| 160 | 160 | } |
| 161 | 161 | } |
@@ -15,36 +15,36 @@ discard block |
||
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
| 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; |
@@ -54,17 +54,17 @@ discard block |
||
| 54 | 54 | * @param string|BaseHtml $action |
| 55 | 55 | * @return HtmlButton |
| 56 | 56 | */ |
| 57 | - public function addAction($action){ |
|
| 58 | - if(!$action instanceof BaseHtml){ |
|
| 57 | + public function addAction($action) { |
|
| 58 | + if (!$action instanceof BaseHtml) { |
|
| 59 | 59 | $class=""; |
| 60 | - if(\array_search($action, ["Okay","Yes","Validate"])!==false){ |
|
| 60 | + if (\array_search($action, ["Okay", "Yes", "Validate"])!==false) { |
|
| 61 | 61 | $class="approve"; |
| 62 | 62 | } |
| 63 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
| 63 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
| 64 | 64 | $class="cancel"; |
| 65 | 65 | } |
| 66 | - $action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()),$action); |
|
| 67 | - if($class!=="") |
|
| 66 | + $action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()), $action); |
|
| 67 | + if ($class!=="") |
|
| 68 | 68 | $action->addToProperty("class", $class); |
| 69 | 69 | } |
| 70 | 70 | return $this->addElementInPart($action, "actions"); |
@@ -74,66 +74,66 @@ discard block |
||
| 74 | 74 | * @param int $index |
| 75 | 75 | * @return HtmlButton |
| 76 | 76 | */ |
| 77 | - public function getAction($index){ |
|
| 77 | + public function getAction($index) { |
|
| 78 | 78 | return $this->content["actions"]->getContent()[$index]; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function addContent($content,$before=false){ |
|
| 82 | - $this->content["content"]->addContent($content,$before); |
|
| 81 | + public function addContent($content, $before=false) { |
|
| 82 | + $this->content["content"]->addContent($content, $before); |
|
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addImageContent($image,$description=NULL){ |
|
| 86 | + public function addImageContent($image, $description=NULL) { |
|
| 87 | 87 | $content=$this->content["content"]; |
| 88 | - if(isset($description)){ |
|
| 89 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 90 | - $content->addContent($description,true); |
|
| 88 | + if (isset($description)) { |
|
| 89 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 90 | + $content->addContent($description, true); |
|
| 91 | 91 | } |
| 92 | - if($image!==""){ |
|
| 93 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 94 | - $content->addContent($img,true); |
|
| 95 | - $content->addToProperty("class","image"); |
|
| 92 | + if ($image!=="") { |
|
| 93 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 94 | + $content->addContent($img, true); |
|
| 95 | + $content->addToProperty("class", "image"); |
|
| 96 | 96 | } |
| 97 | 97 | return $this; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function addIconContent($icon,$description=NULL){ |
|
| 100 | + public function addIconContent($icon, $description=NULL) { |
|
| 101 | 101 | $content=$this->content["content"]; |
| 102 | - if(isset($description)){ |
|
| 103 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 104 | - $content->addContent($description,true); |
|
| 102 | + if (isset($description)) { |
|
| 103 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 104 | + $content->addContent($description, true); |
|
| 105 | 105 | } |
| 106 | - if($icon!==""){ |
|
| 107 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 108 | - $content->addContent($img,true); |
|
| 109 | - $content->addToProperty("class","image"); |
|
| 106 | + if ($icon!=="") { |
|
| 107 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 108 | + $content->addContent($img, true); |
|
| 109 | + $content->addToProperty("class", "image"); |
|
| 110 | 110 | } |
| 111 | 111 | return $this; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - private function addElementInPart($element,$part) { |
|
| 114 | + private function addElementInPart($element, $part) { |
|
| 115 | 115 | $this->content[$part]->addContent($element); |
| 116 | 116 | return $element; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function showDimmer($value){ |
|
| 120 | - $value=$value?"show":"hide"; |
|
| 119 | + public function showDimmer($value) { |
|
| 120 | + $value=$value ? "show" : "hide"; |
|
| 121 | 121 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function setInverted($recursive=true){ |
|
| 125 | + public function setInverted($recursive=true) { |
|
| 126 | 126 | $this->_params["inverted"]=true; |
| 127 | 127 | return $this; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function setBasic(){ |
|
| 130 | + public function setBasic() { |
|
| 131 | 131 | return $this->addToProperty("class", "basic"); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - public function setTransition($value){ |
|
| 136 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 135 | + public function setTransition($value) { |
|
| 136 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @param string $viewName |
| 144 | 144 | * @param array $params The parameters to pass to the view |
| 145 | 145 | */ |
| 146 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 147 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 146 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 147 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @param string $actionName the action name |
| 156 | 156 | * @param array $params |
| 157 | 157 | */ |
| 158 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 159 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 158 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 159 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 167 | 167 | */ |
| 168 | 168 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 169 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 169 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 170 | 170 | return parent::compile($js, $view); |
| 171 | 171 | } |
| 172 | 172 | /* |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | * @see BaseHtml::run() |
| 175 | 175 | */ |
| 176 | 176 | public function run(JsUtils $js) { |
| 177 | - if(isset($this->_bsComponent)===false) |
|
| 178 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 177 | + if (isset($this->_bsComponent)===false) |
|
| 178 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 179 | 179 | $this->addEventsOnRun($js); |
| 180 | 180 | return $this->_bsComponent; |
| 181 | 181 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | return $this->jsDo("hide"); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - public function onHidden($js){ |
|
| 191 | + public function onHidden($js) { |
|
| 192 | 192 | $this->_params["onHidden"]=$js; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 42 | 42 | * @param callable $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 43 | 43 | */ |
| 44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 45 | - parent::__construct($identifier,"ol"); |
|
| 44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 45 | + parent::__construct($identifier, "ol"); |
|
| 46 | 46 | $this->startIndex=$startIndex; |
| 47 | 47 | $this->setProperty("class", "breadcrumb"); |
| 48 | 48 | $this->content=array(); |
| 49 | 49 | $this->autoActive=$autoActive; |
| 50 | 50 | $this->absolutePaths; |
| 51 | - $this->_hrefFunction=function (HtmlDoubleElement $e){return $e->getContent();}; |
|
| 52 | - if(isset($hrefFunction)){ |
|
| 51 | + $this->_hrefFunction=function(HtmlDoubleElement $e) {return $e->getContent(); }; |
|
| 52 | + if (isset($hrefFunction)) { |
|
| 53 | 53 | $this->_hrefFunction=$hrefFunction; |
| 54 | 54 | } |
| 55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * @param string $href |
| 61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
| 62 | 62 | */ |
| 63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 64 | 64 | $size=sizeof($this->content); |
| 65 | - if(\is_array($element)){ |
|
| 65 | + if (\is_array($element)) { |
|
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + } else if ($element instanceof HtmlLink) { |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 72 | - if(isset($glyph)){ |
|
| 70 | + } else { |
|
| 71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 72 | + if (isset($glyph)) { |
|
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $elm->wrap("<li>","</li>"); |
|
| 76 | + $elm->wrap("<li>", "</li>"); |
|
| 77 | 77 | $this->content[]=$elm; |
| 78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 79 | 79 | return $elm; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setActive($index=null){ |
|
| 83 | - if(!isset($index)){ |
|
| 82 | + public function setActive($index=null) { |
|
| 83 | + if (!isset($index)) { |
|
| 84 | 84 | $index=sizeof($this->content)-1; |
| 85 | 85 | } |
| 86 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 86 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 87 | 87 | $li->setClass("active"); |
| 88 | 88 | $li->setContent($this->content[$index]->getContent()); |
| 89 | 89 | $this->content[$index]=$li; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function addElements($elements){ |
|
| 93 | - foreach ( $elements as $element ) { |
|
| 92 | + public function addElements($elements) { |
|
| 93 | + foreach ($elements as $element) { |
|
| 94 | 94 | $this->addElement($element); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function fromArray($array){ |
|
| 99 | + public function fromArray($array) { |
|
| 100 | 100 | $array=parent::fromArray($array); |
| 101 | 101 | $this->addElements($array); |
| 102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $separator |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function getHref($index=null,$separator="/"){ |
|
| 112 | - if(!isset($index)){ |
|
| 111 | + public function getHref($index=null, $separator="/") { |
|
| 112 | + if (!isset($index)) { |
|
| 113 | 113 | $index=sizeof($this->content); |
| 114 | 114 | } |
| 115 | - if($this->absolutePaths===true){ |
|
| 115 | + if ($this->absolutePaths===true) { |
|
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 117 | + } else { |
|
| 118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 125 | 125 | */ |
| 126 | 126 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 127 | - if($this->autoActive){ |
|
| 127 | + if ($this->autoActive) { |
|
| 128 | 128 | $this->setActive(); |
| 129 | 129 | } |
| 130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 143 | 143 | */ |
| 144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 145 | - foreach ($this->content as $element){ |
|
| 146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 145 | + foreach ($this->content as $element) { |
|
| 146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 147 | 147 | } |
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setAutoActive($autoActive) { |
| 152 | - $this->autoActive = $autoActive; |
|
| 152 | + $this->autoActive=$autoActive; |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 157 | - foreach ($this->content as $element){ |
|
| 157 | + foreach ($this->content as $element) { |
|
| 158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | * @param string $targetSelector the target of the get |
| 167 | 167 | * @return HtmlBreadcrumbs |
| 168 | 168 | */ |
| 169 | - public function autoGetOnClick($targetSelector){ |
|
| 170 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 169 | + public function autoGetOnClick($targetSelector) { |
|
| 170 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - public function contentAsString(){ |
|
| 174 | - if($this->autoActive){ |
|
| 173 | + public function contentAsString() { |
|
| 174 | + if ($this->autoActive) { |
|
| 175 | 175 | $this->setActive(); |
| 176 | 176 | } |
| 177 | 177 | return parent::contentAsString(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function getElement($index){ |
|
| 180 | + public function getElement($index) { |
|
| 181 | 181 | return $this->content[$index]; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param mixed $glyph |
| 187 | 187 | * @param int $index |
| 188 | 188 | */ |
| 189 | - public function addGlyph($glyph,$index=0){ |
|
| 189 | + public function addGlyph($glyph, $index=0) { |
|
| 190 | 190 | $elm=$this->getElement($index); |
| 191 | 191 | return $elm->wrapContentWithGlyph($glyph); |
| 192 | 192 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param object $dispatcher the request dispatcher |
| 198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 199 | 199 | */ |
| 200 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
| 200 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 201 | 201 | $this->startIndex=$startIndex; |
| 202 | 202 | return $this->addElements($js->fromDispatcher($dispatcher)); |
| 203 | 203 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 210 | 210 | */ |
| 211 | 211 | public function setHrefFunction($_hrefFunction) { |
| 212 | - $this->_hrefFunction = $_hrefFunction; |
|
| 212 | + $this->_hrefFunction=$_hrefFunction; |
|
| 213 | 213 | return $this; |
| 214 | 214 | } |
| 215 | 215 | |