@@ -10,61 +10,61 @@ |
||
10 | 10 | * @param string $identifier |
11 | 11 | * @param object $modelInstance |
12 | 12 | */ |
13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
15 | 15 | } |
16 | 16 | |
17 | - protected function getDefaultModelInstance(){ |
|
17 | + protected function getDefaultModelInstance() { |
|
18 | 18 | return new UserModel(); |
19 | 19 | } |
20 | 20 | |
21 | - public static function regular($identifier,$modelInstance=null){ |
|
22 | - return new FormAccount($identifier,$modelInstance, |
|
23 | - ["message","login","password","passwordConf","email","submit","error"], |
|
21 | + public static function regular($identifier, $modelInstance=null) { |
|
22 | + return new FormAccount($identifier, $modelInstance, |
|
23 | + ["message", "login", "password", "passwordConf", "email", "submit", "error"], |
|
24 | 24 | ["message"=>[["icon"=>"sign in"]], |
25 | 25 | "input0"=>[["rules"=>"empty"]], |
26 | - "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
|
27 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
26 | + "input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]], |
|
27 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
28 | 28 | "input3"=>[["rules"=>"email"]], |
29 | 29 | "submit"=>["green fluid"], |
30 | 30 | "message2"=>[["error"=>true]]], |
31 | - ["Account","login","password","passwordConf","email","submit","error"], |
|
32 | - ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
|
33 | - [0,1,3,4,5,6]); |
|
31 | + ["Account", "login", "password", "passwordConf", "email", "submit", "error"], |
|
32 | + ["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
33 | + [0, 1, 3, 4, 5, 6]); |
|
34 | 34 | } |
35 | 35 | |
36 | - public static function smallInline($identifier,$modelInstance=null){ |
|
37 | - $result=new FormAccount($identifier,$modelInstance, |
|
38 | - ["login","password","submit"], |
|
39 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
40 | - ["login","password","submit"], |
|
41 | - ["","","Connection"], |
|
36 | + public static function smallInline($identifier, $modelInstance=null) { |
|
37 | + $result=new FormAccount($identifier, $modelInstance, |
|
38 | + ["login", "password", "submit"], |
|
39 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
40 | + ["login", "password", "submit"], |
|
41 | + ["", "", "Connection"], |
|
42 | 42 | [2]); |
43 | 43 | $result->addDividerBefore(0, "Connection"); |
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - public static function small($identifier,$modelInstance=null){ |
|
48 | - $result=new FormAccount($identifier,$modelInstance, |
|
49 | - ["login","password","passwordConf","email","submit"], |
|
47 | + public static function small($identifier, $modelInstance=null) { |
|
48 | + $result=new FormAccount($identifier, $modelInstance, |
|
49 | + ["login", "password", "passwordConf", "email", "submit"], |
|
50 | 50 | [ |
51 | 51 | "input0"=>[["rules"=>"empty"]], |
52 | - "input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]], |
|
53 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
52 | + "input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]], |
|
53 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
54 | 54 | "input3"=>[["rules"=>"email"]], |
55 | 55 | "submit"=>["green basic"]], |
56 | - ["login","password","passwordConf","email","submit"], |
|
57 | - ["Login","Password","Password confirmation","Email address","Creation"], |
|
58 | - [1,2]); |
|
56 | + ["login", "password", "passwordConf", "email", "submit"], |
|
57 | + ["Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
58 | + [1, 2]); |
|
59 | 59 | $result->addDividerBefore(0, "Creation"); |
60 | 60 | return $result; |
61 | 61 | } |
62 | 62 | |
63 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
64 | - $result=self::regular($identifier,$modelInstance); |
|
65 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
66 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
67 | - $result->addWrapper("error", null,"</div>"); |
|
63 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
64 | + $result=self::regular($identifier, $modelInstance); |
|
65 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
66 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
67 | + $result->addWrapper("error", null, "</div>"); |
|
68 | 68 | return $result; |
69 | 69 | } |
70 | 70 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | trait LabeledIconTrait { |
14 | 14 | |
15 | 15 | abstract public function addToProperty($name, $value, $separator=" "); |
16 | - abstract public function addContent($content,$before=false); |
|
16 | + abstract public function addContent($content, $before=false); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Adds an icon before or after |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | * @param boolean $labeled |
23 | 23 | * @return \Ajax\semantic\html\elements\HtmlIcon |
24 | 24 | */ |
25 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
25 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
26 | 26 | $iconO=$icon; |
27 | - if(\is_string($icon)){ |
|
27 | + if (\is_string($icon)) { |
|
28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
29 | 29 | } |
30 | - if($labeled!==false){ |
|
31 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
30 | + if ($labeled!==false) { |
|
31 | + $direction=($before===true) ?Direction::LEFT : Direction::RIGHT; |
|
32 | 32 | $this->addToProperty("class", $direction." labeled icon"); |
33 | 33 | $this->tagName="div"; |
34 | 34 | } |
35 | - $this->addContent($iconO,$before); |
|
35 | + $this->addContent($iconO, $before); |
|
36 | 36 | return $iconO; |
37 | 37 | } |
38 | 38 | } |
@@ -55,26 +55,29 @@ |
||
55 | 55 | for($i=$this->_startStep;$i<$count;$i++){ |
56 | 56 | $step=$this->content[$i]; |
57 | 57 | $step->removeStatus(); |
58 | - if($i<$activestep) |
|
59 | - $step->setCompleted(); |
|
60 | - elseif ($i===$activestep) |
|
61 | - $step->setActive(); |
|
62 | - else |
|
63 | - $step->setDisabled(); |
|
58 | + if($i<$activestep) { |
|
59 | + $step->setCompleted(); |
|
60 | + } elseif ($i===$activestep) { |
|
61 | + $step->setActive(); |
|
62 | + } else { |
|
63 | + $step->setDisabled(); |
|
64 | + } |
|
64 | 65 | } |
65 | - }else{ |
|
66 | + } else{ |
|
66 | 67 | foreach ($this->content as $step){ |
67 | 68 | $step->removeStatus(); |
68 | 69 | } |
69 | - if($activestep<$count) |
|
70 | - $this->content[$activestep]->setActive(); |
|
70 | + if($activestep<$count) { |
|
71 | + $this->content[$activestep]->setActive(); |
|
72 | + } |
|
71 | 73 | } |
72 | 74 | return $this; |
73 | 75 | } |
74 | 76 | |
75 | 77 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
76 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
77 | - $this->defineActiveStep(); |
|
78 | + if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) { |
|
79 | + $this->defineActiveStep(); |
|
80 | + } |
|
78 | 81 | return parent::compile($js,$view); |
79 | 82 | } |
80 | 83 |
@@ -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) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
13 | 13 | private $_container; |
14 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
14 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
15 | 15 | parent::__construct($identifier, "div"); |
16 | 16 | $this->_container=$container; |
17 | 17 | $this->setClass("ui popup"); |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::addList() |
25 | 25 | */ |
26 | - public function addList($items=array(),$header=NULL){ |
|
27 | - if(!$this->content instanceof HtmlGrid){ |
|
28 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
26 | + public function addList($items=array(), $header=NULL) { |
|
27 | + if (!$this->content instanceof HtmlGrid) { |
|
28 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
29 | 29 | } |
30 | 30 | $grid=$this->content; |
31 | 31 | |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | $colCount++; |
34 | 34 | $grid->setColsCount($colCount); |
35 | 35 | |
36 | - $list=new HtmlList("",$items); |
|
36 | + $list=new HtmlList("", $items); |
|
37 | 37 | $list->asLink(); |
38 | - if(isset($header)){ |
|
39 | - $list->addHeader(4,$header); |
|
38 | + if (isset($header)) { |
|
39 | + $list->addHeader(4, $header); |
|
40 | 40 | } |
41 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
41 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
42 | 42 | $grid->setDivided()->setRelaxed(true); |
43 | 43 | return $list; |
44 | 44 | } |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * A popup can have no maximum width and continue to flow to fit its content |
48 | 48 | */ |
49 | - public function setFlowing(){ |
|
49 | + public function setFlowing() { |
|
50 | 50 | return $this->addToProperty("class", "flowing"); |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * A popup can provide more basic formatting |
55 | 55 | */ |
56 | - public function setBasic(){ |
|
56 | + public function setBasic() { |
|
57 | 57 | return $this->addToProperty("class", "basic"); |
58 | 58 | } |
59 | 59 | |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | * {@inheritDoc} |
62 | 62 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
63 | 63 | */ |
64 | - public function run(JsUtils $js){ |
|
64 | + public function run(JsUtils $js) { |
|
65 | 65 | parent::run($js); |
66 | 66 | $this->_params["popup"]="#".$this->identifier; |
67 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
67 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
68 | 68 | } |
69 | 69 | |
70 | - public function setOn($event="click"){ |
|
70 | + public function setOn($event="click") { |
|
71 | 71 | $this->_params["on"]=$event; |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function setInline($value=true){ |
|
75 | + public function setInline($value=true) { |
|
76 | 76 | $this->_params["inline"]=$value; |
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | - public function setPosition($position){ |
|
80 | + public function setPosition($position) { |
|
81 | 81 | $this->_params["position"]=$position; |
82 | 82 | return $this; |
83 | 83 | } |
@@ -3,26 +3,26 @@ |
||
3 | 3 | use Ajax\semantic\html\base\constants\Transition; |
4 | 4 | |
5 | 5 | class AjaxTransition { |
6 | - public static function none($responseElement,$jqueryDone="html"){ |
|
6 | + public static function none($responseElement, $jqueryDone="html") { |
|
7 | 7 | return $responseElement.".".$jqueryDone."( data )"; |
8 | 8 | } |
9 | 9 | |
10 | - public static function jqFade($responseElement,$jqueryDone="html"){ |
|
10 | + public static function jqFade($responseElement, $jqueryDone="html") { |
|
11 | 11 | return $responseElement.".hide().{$jqueryDone}( data ).fadeIn()"; |
12 | 12 | } |
13 | 13 | |
14 | - public static function jqSlide($responseElement,$jqueryDone="html"){ |
|
14 | + public static function jqSlide($responseElement, $jqueryDone="html") { |
|
15 | 15 | return $responseElement.".hide().{$jqueryDone}( data ).slideDown()"; |
16 | 16 | } |
17 | 17 | |
18 | - public static function random($responseElement,$jqueryDone="html"){ |
|
18 | + public static function random($responseElement, $jqueryDone="html") { |
|
19 | 19 | $transitions=Transition::getConstantValues(); |
20 | - $transition=$transitions[\rand(0,\sizeof($transitions)-1)]; |
|
21 | - return self::__callStatic($transition, [$responseElement,$jqueryDone]); |
|
20 | + $transition=$transitions[\rand(0, \sizeof($transitions)-1)]; |
|
21 | + return self::__callStatic($transition, [$responseElement, $jqueryDone]); |
|
22 | 22 | } |
23 | 23 | |
24 | - public static function __callStatic($name, $arguments){ |
|
25 | - if(\sizeof($arguments)==2){ |
|
24 | + public static function __callStatic($name, $arguments) { |
|
25 | + if (\sizeof($arguments)==2) { |
|
26 | 26 | $responseElement=$arguments[0]; |
27 | 27 | $jqueryDone=$arguments[1]; |
28 | 28 | $name=JString::camelCaseToSeparated($name); |
@@ -25,8 +25,9 @@ |
||
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | 27 | foreach ( $input as $v ) { |
28 | - if (\is_object($v) || \is_array($v)) |
|
29 | - return true; |
|
28 | + if (\is_object($v) || \is_array($v)) { |
|
29 | + return true; |
|
30 | + } |
|
30 | 31 | } |
31 | 32 | return false; |
32 | 33 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | } |
13 | 13 | $output=""; |
14 | 14 | if (\is_array($input)) { |
15 | - if (sizeof($input) > 0) { |
|
16 | - if (self::containsElement($input) === false) { |
|
15 | + if (sizeof($input)>0) { |
|
16 | + if (self::containsElement($input)===false) { |
|
17 | 17 | $output=self::wrapStrings($input, $separator=' ', $valueQuote='"'); |
18 | 18 | } else { |
19 | 19 | $output=self::wrapObjects($input, $js, $view, $separator, $valueQuote); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
27 | + foreach ($input as $v) { |
|
28 | 28 | if (\is_object($v) || \is_array($v)) |
29 | 29 | return true; |
30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function wrapStrings($input, $separator=' ', $valueQuote='"') { |
35 | - if (JArray::isAssociative($input) === true) { |
|
36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
35 | + if (JArray::isAssociative($input)===true) { |
|
36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
38 | 38 | }, $input, array_keys($input))); |
39 | 39 | } else { |
40 | 40 | $result=implode($separator, $input); |
@@ -43,30 +43,30 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function wrapObjects($input, $js=NULL, $view=null, $separator=' ', $valueQuote='"') { |
46 | - return implode($separator, array_map(function ($v) use($js, $view,$separator, $valueQuote) { |
|
47 | - if(\is_string($v)){ |
|
46 | + return implode($separator, array_map(function($v) use($js, $view, $separator, $valueQuote) { |
|
47 | + if (\is_string($v)) { |
|
48 | 48 | return $v; |
49 | 49 | } |
50 | - if ($v instanceof BaseHtml){ |
|
51 | - return $v->compile($js,$view); |
|
50 | + if ($v instanceof BaseHtml) { |
|
51 | + return $v->compile($js, $view); |
|
52 | 52 | } |
53 | 53 | if (\is_array($v)) { |
54 | - return self::wrap($v, $js, $view,$separator, $valueQuote); |
|
54 | + return self::wrap($v, $js, $view, $separator, $valueQuote); |
|
55 | 55 | } |
56 | - if(!\is_callable($v)){ |
|
56 | + if (!\is_callable($v)) { |
|
57 | 57 | return $v; |
58 | 58 | } |
59 | 59 | }, $input)); |
60 | 60 | } |
61 | 61 | |
62 | - protected static function wrapValue($value,$js=NULL, $separator=' ', $valueQuote='"'){ |
|
62 | + protected static function wrapValue($value, $js=NULL, $separator=' ', $valueQuote='"') { |
|
63 | 63 | if (\is_array($value)) { |
64 | 64 | return self::wrap($value, $js, $separator, $valueQuote); |
65 | 65 | } |
66 | - if ($value instanceof BaseHtml){ |
|
66 | + if ($value instanceof BaseHtml) { |
|
67 | 67 | return $value->compile($js); |
68 | 68 | } |
69 | - if(!\is_callable($value)){ |
|
69 | + if (!\is_callable($value)) { |
|
70 | 70 | return $value; |
71 | 71 | } |
72 | 72 | return ''; |
@@ -8,46 +8,46 @@ |
||
8 | 8 | class HtmlStepItem extends HtmlAbsractItem { |
9 | 9 | |
10 | 10 | public function __construct($identifier, $content) { |
11 | - parent::__construct($identifier,"step",$content); |
|
11 | + parent::__construct($identifier, "step", $content); |
|
12 | 12 | } |
13 | - protected function initContent($content){ |
|
14 | - if(\is_array($content)){ |
|
13 | + protected function initContent($content) { |
|
14 | + if (\is_array($content)) { |
|
15 | 15 | $icon=JArray::getValue($content, "icon", 0); |
16 | 16 | $title=JArray::getValue($content, "title", 1); |
17 | 17 | $desc=JArray::getValue($content, "description", 2); |
18 | 18 | $status=JArray::getValue($content, "status", 3); |
19 | - if(isset($icon)){ |
|
19 | + if (isset($icon)) { |
|
20 | 20 | $this->setIcon($icon); |
21 | 21 | } |
22 | - if(isset($status)){ |
|
22 | + if (isset($status)) { |
|
23 | 23 | $this->setStatus($status); |
24 | 24 | } |
25 | - if(isset($title)){ |
|
26 | - $this->setTitle($title,$desc); |
|
25 | + if (isset($title)) { |
|
26 | + $this->setTitle($title, $desc); |
|
27 | 27 | } |
28 | - }else{ |
|
28 | + } else { |
|
29 | 29 | $this->setContent($content); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - public function setActive($value=true){ |
|
34 | - if($value) |
|
33 | + public function setActive($value=true) { |
|
34 | + if ($value) |
|
35 | 35 | $this->setStatus(StepStatus::ACTIVE); |
36 | 36 | else |
37 | 37 | $this->setStatus(StepStatus::NONE); |
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | - public function setCompleted(){ |
|
42 | - $this->removePropertyValues("class", [StepStatus::COMPLETED,StepStatus::DISABLED]); |
|
41 | + public function setCompleted() { |
|
42 | + $this->removePropertyValues("class", [StepStatus::COMPLETED, StepStatus::DISABLED]); |
|
43 | 43 | return $this->setStatus(StepStatus::COMPLETED); |
44 | 44 | } |
45 | 45 | |
46 | - public function setStatus($status){ |
|
46 | + public function setStatus($status) { |
|
47 | 47 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
48 | 48 | } |
49 | 49 | |
50 | - public function removeStatus(){ |
|
50 | + public function removeStatus() { |
|
51 | 51 | $this->removePropertyValues("class", StepStatus::getConstants()); |
52 | 52 | } |
53 | 53 | } |
@@ -25,16 +25,17 @@ |
||
25 | 25 | if(isset($title)){ |
26 | 26 | $this->setTitle($title,$desc); |
27 | 27 | } |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | $this->setContent($content); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function setActive($value=true){ |
34 | - if($value) |
|
35 | - $this->setStatus(StepStatus::ACTIVE); |
|
36 | - else |
|
37 | - $this->setStatus(StepStatus::NONE); |
|
34 | + if($value) { |
|
35 | + $this->setStatus(StepStatus::ACTIVE); |
|
36 | + } else { |
|
37 | + $this->setStatus(StepStatus::NONE); |
|
38 | + } |
|
38 | 39 | return $this; |
39 | 40 | } |
40 | 41 |
@@ -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; |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public function removeIcon(){ |
27 | - if(isset($this->content["icon"])) |
|
28 | - unset($this->content["icon"]); |
|
27 | + if(isset($this->content["icon"])) { |
|
28 | + unset($this->content["icon"]); |
|
29 | + } |
|
29 | 30 | return $this; |
30 | 31 | } |
31 | 32 | |
@@ -77,7 +78,7 @@ discard block |
||
77 | 78 | $this->setTagName("div"); |
78 | 79 | $this->removeProperty("href"); |
79 | 80 | $this->addToPropertyCtrl("class", "active", array("active")); |
80 | - }else{ |
|
81 | + } else{ |
|
81 | 82 | $this->removePropertyValue("class", "active"); |
82 | 83 | } |
83 | 84 | return $this; |
@@ -85,8 +86,9 @@ discard block |
||
85 | 86 | |
86 | 87 | public function asLink($href=NULL,$part=NULL){ |
87 | 88 | $this->setTagName("a"); |
88 | - if(isset($href)) |
|
89 | - $this->setProperty("href", $href); |
|
89 | + if(isset($href)) { |
|
90 | + $this->setProperty("href", $href); |
|
91 | + } |
|
90 | 92 | return $this; |
91 | 93 | } |
92 | 94 | |
@@ -97,8 +99,9 @@ discard block |
||
97 | 99 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
98 | 100 | */ |
99 | 101 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
100 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
101 | - $this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]); |
|
102 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
103 | + $this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]); |
|
104 | + } |
|
102 | 105 | return parent::compile($js, $view); |
103 | 106 | } |
104 | 107 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
13 | 13 | |
14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
15 | 15 | parent::__construct($identifier, "div", $baseClass); |
16 | 16 | $this->content=array(); |
17 | 17 | $this->initContent($content); |
@@ -19,76 +19,76 @@ discard block |
||
19 | 19 | |
20 | 20 | abstract protected function initContent($content); |
21 | 21 | |
22 | - public function setIcon($icon){ |
|
22 | + public function setIcon($icon) { |
|
23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
24 | 24 | } |
25 | 25 | |
26 | - public function removeIcon(){ |
|
27 | - if(isset($this->content["icon"])) |
|
26 | + public function removeIcon() { |
|
27 | + if (isset($this->content["icon"])) |
|
28 | 28 | unset($this->content["icon"]); |
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
32 | - public function setImage($image){ |
|
32 | + public function setImage($image) { |
|
33 | 33 | $image=new HtmlImg("icon-".$this->identifier, $image); |
34 | 34 | $image->asAvatar(); |
35 | 35 | $this->content["image"]=$image; |
36 | 36 | } |
37 | 37 | |
38 | - private function _getContent($key="content",$baseClass="content"){ |
|
39 | - if(!is_array($this->content)){ |
|
38 | + private function _getContent($key="content", $baseClass="content") { |
|
39 | + if (!is_array($this->content)) { |
|
40 | 40 | $this->content=[$this->content]; |
41 | 41 | } |
42 | - if(\array_key_exists($key, $this->content)===false){ |
|
43 | - $this->content[$key]=new HtmlSemDoubleElement($key."-".$this->identifier,"div",$baseClass); |
|
42 | + if (\array_key_exists($key, $this->content)===false) { |
|
43 | + $this->content[$key]=new HtmlSemDoubleElement($key."-".$this->identifier, "div", $baseClass); |
|
44 | 44 | } |
45 | 45 | return $this->content[$key]; |
46 | 46 | } |
47 | 47 | |
48 | - private function _getRightContent(){ |
|
49 | - return $this->_getContent("right-content","right floated content"); |
|
48 | + private function _getRightContent() { |
|
49 | + return $this->_getContent("right-content", "right floated content"); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function addContent($content,$before=false){ |
|
53 | - $this->_getContent("content")->addContent($content,$before); |
|
52 | + public function addContent($content, $before=false) { |
|
53 | + $this->_getContent("content")->addContent($content, $before); |
|
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
57 | - public function addRightContent($content,$before=false){ |
|
58 | - $this->_getRightContent()->addContent($content,$before); |
|
57 | + public function addRightContent($content, $before=false) { |
|
58 | + $this->_getRightContent()->addContent($content, $before); |
|
59 | 59 | return $this; |
60 | 60 | } |
61 | 61 | |
62 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
63 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
62 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
63 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
64 | 64 | $content=$this->_getContent(); |
65 | 65 | $content->addContent($title); |
66 | - if(isset($description)){ |
|
67 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
66 | + if (isset($description)) { |
|
67 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
68 | 68 | $content->addContent($description); |
69 | 69 | } |
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | - public function getPart($partName="header"){ |
|
74 | - $content=\array_merge($this->_getContent()->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
73 | + public function getPart($partName="header") { |
|
74 | + $content=\array_merge($this->_getContent()->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
75 | 75 | return $this->getElementByPropertyValue("class", $partName, $content); |
76 | 76 | } |
77 | 77 | |
78 | - public function setActive($value=true){ |
|
79 | - if($value){ |
|
78 | + public function setActive($value=true) { |
|
79 | + if ($value) { |
|
80 | 80 | $this->setTagName("div"); |
81 | 81 | $this->removeProperty("href"); |
82 | 82 | $this->addToPropertyCtrl("class", "active", array("active")); |
83 | - }else{ |
|
83 | + } else { |
|
84 | 84 | $this->removePropertyValue("class", "active"); |
85 | 85 | } |
86 | 86 | return $this; |
87 | 87 | } |
88 | 88 | |
89 | - public function asLink($href=NULL,$part=NULL){ |
|
89 | + public function asLink($href=NULL, $part=NULL) { |
|
90 | 90 | $this->setTagName("a"); |
91 | - if(isset($href)) |
|
91 | + if (isset($href)) |
|
92 | 92 | $this->setProperty("href", $href); |
93 | 93 | return $this; |
94 | 94 | } |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
101 | 101 | */ |
102 | 102 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
103 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
104 | - $this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]); |
|
103 | + if (\is_array($this->content) && JArray::isAssociative($this->content)) |
|
104 | + $this->content=JArray::sortAssociative($this->content, ["right-content", "icon", "image", "content"]); |
|
105 | 105 | return parent::compile($js, $view); |
106 | 106 | } |
107 | 107 | } |