@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | namespace Ajax\common\traits; |
3 | 3 | use Ajax\common\BaseGui; |
4 | 4 | |
5 | -trait JsUtilsInternalTrait{ |
|
5 | +trait JsUtilsInternalTrait { |
|
6 | 6 | |
7 | - protected $jquery_code_for_compile=array (); |
|
8 | - protected $jquery_code_for_compile_at_last=array (); |
|
7 | + protected $jquery_code_for_compile=array(); |
|
8 | + protected $jquery_code_for_compile_at_last=array(); |
|
9 | 9 | |
10 | 10 | protected function _addToCompile($jsScript) { |
11 | 11 | $this->jquery_code_for_compile[]=$jsScript; |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | * @param BaseGui $library |
16 | 16 | * @param mixed $view |
17 | 17 | */ |
18 | - protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL){ |
|
18 | + protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL) { |
|
19 | 19 | if ($library!=NULL) { |
20 | - if(isset($view)) |
|
20 | + if (isset($view)) |
|
21 | 21 | $library->compileHtml($this, $view); |
22 | 22 | if ($library->isAutoCompile()) { |
23 | 23 | $library->compile(true); |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | - protected function defer($script){ |
|
28 | + protected function defer($script) { |
|
29 | 29 | $result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};"; |
30 | 30 | $result.="window.defer(function(){".$script."})"; |
31 | 31 | return $result; |
32 | 32 | } |
33 | 33 | |
34 | - protected function ready($script){ |
|
34 | + protected function ready($script) { |
|
35 | 35 | $result='$(document).ready(function() {'."\n"; |
36 | 36 | $result.=$script.'})'; |
37 | 37 | return $result; |
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function minify($input) { |
41 | - if(trim($input) === "") return $input; |
|
41 | + if (trim($input)==="") return $input; |
|
42 | 42 | return preg_replace( |
43 | 43 | array( |
44 | 44 | // Remove comment(s) |
@@ -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,59 +19,59 @@ 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 createContent(){ |
|
39 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
38 | + private function createContent() { |
|
39 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
40 | 40 | return $this->content["content"]; |
41 | 41 | } |
42 | 42 | |
43 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
44 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
45 | - if(\array_key_exists("content", $this->content)===false){ |
|
43 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
44 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
45 | + if (\array_key_exists("content", $this->content)===false) { |
|
46 | 46 | $this->createContent(); |
47 | 47 | } |
48 | 48 | $this->content["content"]->addContent($title); |
49 | - if(isset($description)){ |
|
50 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
49 | + if (isset($description)) { |
|
50 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
51 | 51 | $this->content["content"]->addContent($description); |
52 | 52 | } |
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
56 | - public function getPart($partName="header"){ |
|
57 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
56 | + public function getPart($partName="header") { |
|
57 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
58 | 58 | return $this->getElementByPropertyValue("class", $partName, $content); |
59 | 59 | } |
60 | 60 | |
61 | - public function setActive($value=true){ |
|
62 | - if($value){ |
|
61 | + public function setActive($value=true) { |
|
62 | + if ($value) { |
|
63 | 63 | $this->setTagName("div"); |
64 | 64 | $this->removeProperty("href"); |
65 | 65 | $this->addToPropertyCtrl("class", "active", array("active")); |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | $this->removePropertyValue("class", "active"); |
68 | 68 | } |
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
72 | - public function asLink($href=NULL,$part=NULL){ |
|
72 | + public function asLink($href=NULL, $part=NULL) { |
|
73 | 73 | $this->setTagName("a"); |
74 | - if(isset($href)) |
|
74 | + if (isset($href)) |
|
75 | 75 | $this->setProperty("href", $href); |
76 | 76 | return $this; |
77 | 77 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
84 | 84 | */ |
85 | 85 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
86 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
87 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
86 | + if (\is_array($this->content) && JArray::isAssociative($this->content)) |
|
87 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
88 | 88 | return parent::compile($js, $view); |
89 | 89 | } |
90 | 90 | } |
@@ -8,53 +8,53 @@ |
||
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)){ |
|
15 | - if(JArray::isAssociative($content)===false){ |
|
13 | + protected function initContent($content) { |
|
14 | + if (\is_array($content)) { |
|
15 | + if (JArray::isAssociative($content)===false) { |
|
16 | 16 | $icon=@$content[0]; |
17 | 17 | $title=@$content[1]; |
18 | 18 | $desc=@$content[2]; |
19 | 19 | $status=@$content[3]; |
20 | - }else{ |
|
20 | + } else { |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $title=@$content["title"]; |
23 | 23 | $desc=@$content["description"]; |
24 | 24 | $status=@$content["status"]; |
25 | 25 | } |
26 | - if(isset($icon)){ |
|
26 | + if (isset($icon)) { |
|
27 | 27 | $this->setIcon($icon); |
28 | 28 | } |
29 | - if(isset($status)){ |
|
29 | + if (isset($status)) { |
|
30 | 30 | $this->setStatus($status); |
31 | 31 | } |
32 | - if(isset($title)){ |
|
33 | - $this->setTitle($title,$desc); |
|
32 | + if (isset($title)) { |
|
33 | + $this->setTitle($title, $desc); |
|
34 | 34 | } |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - public function setActive($value=true){ |
|
41 | - if($value) |
|
40 | + public function setActive($value=true) { |
|
41 | + if ($value) |
|
42 | 42 | $this->setStatus(StepStatus::ACTIVE); |
43 | 43 | else |
44 | 44 | $this->setStatus(StepStatus::NONE); |
45 | 45 | return $this; |
46 | 46 | } |
47 | 47 | |
48 | - public function setCompleted(){ |
|
49 | - $this->removePropertyValues("class", [StepStatus::COMPLETED,StepStatus::DISABLED]); |
|
48 | + public function setCompleted() { |
|
49 | + $this->removePropertyValues("class", [StepStatus::COMPLETED, StepStatus::DISABLED]); |
|
50 | 50 | return $this->setStatus(StepStatus::COMPLETED); |
51 | 51 | } |
52 | 52 | |
53 | - public function setStatus($status){ |
|
53 | + public function setStatus($status) { |
|
54 | 54 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
55 | 55 | } |
56 | 56 | |
57 | - public function removeStatus(){ |
|
57 | + public function removeStatus() { |
|
58 | 58 | $this->removePropertyValues("class", StepStatus::getConstants()); |
59 | 59 | } |
60 | 60 | } |
@@ -9,12 +9,12 @@ 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 | protected $_startStep; |
15 | 15 | |
16 | - public function __construct( $identifier,$steps=array()){ |
|
17 | - parent::__construct( $identifier,"div", "ui steps"); |
|
16 | + public function __construct($identifier, $steps=array()) { |
|
17 | + parent::__construct($identifier, "div", "ui steps"); |
|
18 | 18 | $this->addItems($steps); |
19 | 19 | } |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
25 | 25 | */ |
26 | 26 | protected function createItem($value) { |
27 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
27 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
28 | 28 | return $itemO; |
29 | 29 | } |
30 | 30 | |
@@ -32,50 +32,50 @@ discard block |
||
32 | 32 | * @param string|array $step |
33 | 33 | * @return HtmlStepItem |
34 | 34 | */ |
35 | - public function addStep($step){ |
|
35 | + public function addStep($step) { |
|
36 | 36 | return $this->addItem($step); |
37 | 37 | } |
38 | 38 | |
39 | - public function setOrdered(){ |
|
39 | + public function setOrdered() { |
|
40 | 40 | return $this->addToProperty("class", "ordered"); |
41 | 41 | } |
42 | 42 | |
43 | - public function isOrdered(){ |
|
43 | + public function isOrdered() { |
|
44 | 44 | return $this->propertyContains("class", "ordered"); |
45 | 45 | } |
46 | 46 | |
47 | - public function setVertical(){ |
|
47 | + public function setVertical() { |
|
48 | 48 | return $this->addToProperty("class", "vertical"); |
49 | 49 | } |
50 | 50 | |
51 | - protected function defineActiveStep(){ |
|
51 | + protected function defineActiveStep() { |
|
52 | 52 | $activestep=$this->_activeStep; |
53 | 53 | $count=$this->count(); |
54 | - if(!$this->isOrdered()){ |
|
55 | - for($i=$this->_startStep;$i<$count;$i++){ |
|
54 | + if (!$this->isOrdered()) { |
|
55 | + for ($i=$this->_startStep; $i<$count; $i++) { |
|
56 | 56 | $step=$this->content[$i]; |
57 | 57 | $step->removeStatus(); |
58 | - if($i<$activestep) |
|
58 | + if ($i<$activestep) |
|
59 | 59 | $step->setCompleted(); |
60 | 60 | elseif ($i===$activestep) |
61 | 61 | $step->setActive(); |
62 | 62 | else |
63 | 63 | $step->setDisabled(); |
64 | 64 | } |
65 | - }else{ |
|
66 | - foreach ($this->content as $step){ |
|
65 | + } else { |
|
66 | + foreach ($this->content as $step) { |
|
67 | 67 | $step->removeStatus(); |
68 | 68 | } |
69 | - if($activestep<$count) |
|
69 | + if ($activestep<$count) |
|
70 | 70 | $this->content[$activestep]->setActive(); |
71 | 71 | } |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
76 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
76 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
77 | 77 | $this->defineActiveStep(); |
78 | - return parent::compile($js,$view); |
|
78 | + return parent::compile($js, $view); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function setActiveStep($_activeStep) { |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
87 | - if(isset($toElement)){ |
|
88 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
86 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
87 | + if (isset($toElement)) { |
|
88 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
89 | 89 | } |
90 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
90 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
91 | 91 | } |
92 | 92 | |
93 | - public function asLink(){ |
|
94 | - foreach ($this->content as $step){ |
|
93 | + public function asLink() { |
|
94 | + foreach ($this->content as $step) { |
|
95 | 95 | $step->asLink(); |
96 | 96 | } |
97 | 97 | return $this; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | 17 | class HtmlMessage extends HtmlSemDoubleElement { |
18 | - use AttachedTrait,HasTimeoutTrait; |
|
18 | + use AttachedTrait, HasTimeoutTrait; |
|
19 | 19 | protected $icon; |
20 | 20 | protected $close; |
21 | 21 | |
@@ -32,35 +32,35 @@ discard block |
||
32 | 32 | * @param string|HtmlSemDoubleElement $header |
33 | 33 | * @return \Ajax\semantic\html\collections\HtmlMessage |
34 | 34 | */ |
35 | - public function addHeader($header){ |
|
35 | + public function addHeader($header) { |
|
36 | 36 | $headerO=$header; |
37 | - if(\is_string($header)){ |
|
38 | - $headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div"); |
|
37 | + if (\is_string($header)) { |
|
38 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
39 | 39 | $headerO->setClass("header"); |
40 | 40 | $headerO->setContent($header); |
41 | 41 | } |
42 | - return $this->addContent($headerO,true); |
|
42 | + return $this->addContent($headerO, true); |
|
43 | 43 | } |
44 | 44 | |
45 | - public function setHeader($header){ |
|
45 | + public function setHeader($header) { |
|
46 | 46 | return $this->addHeader($header); |
47 | 47 | } |
48 | 48 | |
49 | - public function setIcon($icon){ |
|
49 | + public function setIcon($icon) { |
|
50 | 50 | $this->addToProperty("class", "icon"); |
51 | - $this->wrapContent("<div class='content'>","</div>"); |
|
51 | + $this->wrapContent("<div class='content'>", "</div>"); |
|
52 | 52 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
56 | - public function addLoader($loaderIcon="notched circle"){ |
|
56 | + public function addLoader($loaderIcon="notched circle") { |
|
57 | 57 | $this->setIcon($loaderIcon); |
58 | 58 | $this->icon->addToIcon("loading"); |
59 | 59 | return $this; |
60 | 60 | } |
61 | 61 | |
62 | - public function setDismissable($dismiss=true){ |
|
63 | - if($dismiss===true) |
|
62 | + public function setDismissable($dismiss=true) { |
|
63 | + if ($dismiss===true) |
|
64 | 64 | $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
65 | 65 | else |
66 | 66 | $this->close=NULL; |
@@ -71,43 +71,43 @@ discard block |
||
71 | 71 | * {@inheritDoc} |
72 | 72 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
73 | 73 | */ |
74 | - public function run(JsUtils $js){ |
|
75 | - if(!isset($this->_bsComponent)){ |
|
76 | - if(isset($this->close)){ |
|
74 | + public function run(JsUtils $js) { |
|
75 | + if (!isset($this->_bsComponent)) { |
|
76 | + if (isset($this->close)) { |
|
77 | 77 | $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition})"); |
78 | 78 | } |
79 | - if(isset($this->_timeout)){ |
|
80 | - $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true); |
|
79 | + if (isset($this->_timeout)) { |
|
80 | + $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | return parent::run($js); |
84 | 84 | } |
85 | 85 | |
86 | - public function setState($visible=true){ |
|
87 | - $visible=($visible===true)?"visible":"hidden"; |
|
88 | - return $this->addToPropertyCtrl("class", $visible, array("visible","hidden")); |
|
86 | + public function setState($visible=true) { |
|
87 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
88 | + return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden")); |
|
89 | 89 | } |
90 | 90 | |
91 | - public function setVariation($value="floating"){ |
|
92 | - return $this->addToPropertyCtrl("class", $value, array("floating","compact")); |
|
91 | + public function setVariation($value="floating") { |
|
92 | + return $this->addToPropertyCtrl("class", $value, array("floating", "compact")); |
|
93 | 93 | } |
94 | 94 | |
95 | - public function setStyle($style){ |
|
95 | + public function setStyle($style) { |
|
96 | 96 | return $this->addToPropertyCtrl("class", $style, Style::getConstants()); |
97 | 97 | } |
98 | 98 | |
99 | - public function setError(){ |
|
99 | + public function setError() { |
|
100 | 100 | return $this->setStyle("error"); |
101 | 101 | } |
102 | 102 | |
103 | - public function setWarning(){ |
|
103 | + public function setWarning() { |
|
104 | 104 | return $this->setStyle("warning"); |
105 | 105 | } |
106 | 106 | |
107 | - public function setMessage($message){ |
|
108 | - if(\is_array($this->content)){ |
|
107 | + public function setMessage($message) { |
|
108 | + if (\is_array($this->content)) { |
|
109 | 109 | $this->content[\sizeof($this->content)-1]=$message; |
110 | - }else |
|
110 | + } else |
|
111 | 111 | $this->setContent($message); |
112 | 112 | } |
113 | 113 |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | protected $image; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $content=NULL) { |
12 | - parent::__construct($identifier,"item",$content); |
|
12 | + parent::__construct($identifier, "item", $content); |
|
13 | 13 | } |
14 | - protected function initContent($content){ |
|
15 | - if(\is_array($content)){ |
|
16 | - if(JArray::isAssociative($content)===false){ |
|
14 | + protected function initContent($content) { |
|
15 | + if (\is_array($content)) { |
|
16 | + if (JArray::isAssociative($content)===false) { |
|
17 | 17 | $icon=@$content[0]; |
18 | 18 | $title=@$content[1]; |
19 | 19 | $desc=@$content[2]; |
20 | - }else{ |
|
20 | + } else { |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $image=@$content["image"]; |
23 | 23 | $title=@$content["title"]; |
@@ -25,38 +25,38 @@ discard block |
||
25 | 25 | $desc=@$content["description"]; |
26 | 26 | $items=@$content["items"]; |
27 | 27 | } |
28 | - if(isset($icon)){ |
|
28 | + if (isset($icon)) { |
|
29 | 29 | $this->setIcon($icon); |
30 | 30 | } |
31 | - if(isset($image)){ |
|
31 | + if (isset($image)) { |
|
32 | 32 | $this->setImage($image); |
33 | 33 | } |
34 | - if(isset($title)){ |
|
35 | - $this->setTitle($title,$desc); |
|
36 | - }elseif (isset($header)){ |
|
37 | - $this->setTitle($header,$desc,"header"); |
|
34 | + if (isset($title)) { |
|
35 | + $this->setTitle($title, $desc); |
|
36 | + }elseif (isset($header)) { |
|
37 | + $this->setTitle($header, $desc, "header"); |
|
38 | 38 | } |
39 | - if(isset($items)){ |
|
39 | + if (isset($items)) { |
|
40 | 40 | $this->addList($items); |
41 | 41 | } |
42 | - }else{ |
|
42 | + } else { |
|
43 | 43 | $this->setContent($content); |
44 | 44 | } |
45 | 45 | } |
46 | - public function addList($items=array(),$ordered=false) { |
|
46 | + public function addList($items=array(), $ordered=false) { |
|
47 | 47 | $list=new HtmlList("", $items); |
48 | - if($ordered) |
|
48 | + if ($ordered) |
|
49 | 49 | $list->setOrdered(); |
50 | 50 | $list->setClass("list"); |
51 | 51 | $this->content["list"]=$list; |
52 | 52 | return $list; |
53 | 53 | } |
54 | 54 | |
55 | - public function getList(){ |
|
55 | + public function getList() { |
|
56 | 56 | return $this->content["list"]; |
57 | 57 | } |
58 | 58 | |
59 | - public function getItem($index){ |
|
59 | + public function getItem($index) { |
|
60 | 60 | return $this->getList()->getItem($index); |
61 | 61 | } |
62 | 62 | } |
@@ -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 | } |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function createItem($value) { |
21 | 21 | $count=$this->count(); |
22 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
22 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
23 | 23 | return $item; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function addHeader($niveau, $content) { |
27 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
27 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
28 | 28 | $this->wrap($header); |
29 | 29 | return $header; |
30 | 30 | } |
31 | 31 | |
32 | - public function getItemPart($index,$partName="header"){ |
|
32 | + public function getItemPart($index, $partName="header") { |
|
33 | 33 | return $this->getItem($index)->getPart($partName); |
34 | 34 | } |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | public function asLink() { |
41 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
41 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
42 | 42 | return $this->contentAs("a"); |
43 | 43 | } |
44 | 44 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | return $this->addItem($list); |
49 | 49 | } |
50 | 50 | |
51 | - protected function getItemToAdd($item){ |
|
51 | + protected function getItemToAdd($item) { |
|
52 | 52 | $itemO=parent::getItemToAdd($item); |
53 | - if($itemO instanceof AbstractCheckbox) |
|
53 | + if ($itemO instanceof AbstractCheckbox) |
|
54 | 54 | $itemO->addClass("item"); |
55 | 55 | return $itemO; |
56 | 56 | } |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | public function run(JsUtils $js) { |
71 | - if ($this->_hasCheckedList === true) { |
|
72 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
73 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
71 | + if ($this->_hasCheckedList===true) { |
|
72 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
73 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
74 | 74 | $this->executeOnRun($jsCode); |
75 | 75 | } |
76 | 76 | return parent::run($js); |
@@ -100,42 +100,42 @@ discard block |
||
100 | 100 | * @param string $notAllChecked |
101 | 101 | * @return HtmlList |
102 | 102 | */ |
103 | - public function addCheckedList($items=array(), $masterItem=NULL, $values=array(),$notAllChecked=false,$name=null) { |
|
103 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) { |
|
104 | 104 | $count=$this->count(); |
105 | - $identifier=$this->identifier . "-" . $count; |
|
105 | + $identifier=$this->identifier."-".$count; |
|
106 | 106 | if (isset($masterItem)) { |
107 | - if(\is_array($masterItem)){ |
|
108 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0],@$masterItem[1]); |
|
109 | - if(isset($name)) |
|
107 | + if (\is_array($masterItem)) { |
|
108 | + $masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]); |
|
109 | + if (isset($name)) |
|
110 | 110 | $masterO->setName($name); |
111 | - if(isset($masterItem[1])){ |
|
112 | - if(\array_search($masterItem[1], $values)!==false){ |
|
111 | + if (isset($masterItem[1])) { |
|
112 | + if (\array_search($masterItem[1], $values)!==false) { |
|
113 | 113 | $masterO->getDataField()->setProperty("checked", ""); |
114 | 114 | } |
115 | 115 | } |
116 | - }else{ |
|
117 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
116 | + } else { |
|
117 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
118 | 118 | } |
119 | - if($notAllChecked){ |
|
119 | + if ($notAllChecked) { |
|
120 | 120 | $masterO->getDataField()->addClass("_notAllChecked"); |
121 | 121 | } |
122 | 122 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
123 | 123 | $masterO->setClass("item"); |
124 | 124 | $this->addItem($masterO); |
125 | 125 | } |
126 | - $fields=array (); |
|
126 | + $fields=array(); |
|
127 | 127 | $i=0; |
128 | - foreach ( $items as $val => $caption ) { |
|
129 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
130 | - if (\array_search($val, $values) !== false) { |
|
128 | + foreach ($items as $val => $caption) { |
|
129 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
130 | + if (\array_search($val, $values)!==false) { |
|
131 | 131 | $itemO->getDataField()->setProperty("checked", ""); |
132 | 132 | } |
133 | - if(isset($name)) |
|
133 | + if (isset($name)) |
|
134 | 134 | $itemO->setName($name); |
135 | 135 | $itemO->setClass("item"); |
136 | 136 | $fields[]=$itemO; |
137 | 137 | } |
138 | - if (isset($masterO) === true) { |
|
138 | + if (isset($masterO)===true) { |
|
139 | 139 | $list=new HtmlList("", $fields); |
140 | 140 | $list->setClass("list"); |
141 | 141 | $masterO->addContent($list); |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | - public function setIcons($icons){ |
|
150 | - if(!\is_array($icons)){ |
|
149 | + public function setIcons($icons) { |
|
150 | + if (!\is_array($icons)) { |
|
151 | 151 | $icons=\array_fill(0, \sizeof($this->content), $icons); |
152 | 152 | } |
153 | - $max=\min(\sizeof($icons),\sizeof($this->content)); |
|
154 | - for($i=0;$i<$max;$i++){ |
|
153 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
154 | + for ($i=0; $i<$max; $i++) { |
|
155 | 155 | $this->content[$i]->addIcon($icons[$i]); |
156 | 156 | } |
157 | 157 | return $this; |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
39 | 39 | } |
40 | 40 | |
41 | - public function getField(){ |
|
41 | + public function getField() { |
|
42 | 42 | return $this->content["field"]; |
43 | 43 | } |
44 | 44 | |
45 | - public function getHtmlCk(){ |
|
45 | + public function getHtmlCk() { |
|
46 | 46 | return $this->content["field"]; |
47 | 47 | } |
48 | 48 | |
49 | - public function setName($name){ |
|
49 | + public function setName($name) { |
|
50 | 50 | $this->getDataField()->setProperty("name", $name); |
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 | |
54 | - public function getDataField(){ |
|
55 | - $field= $this->getField(); |
|
56 | - if($field instanceof AbstractCheckbox) |
|
54 | + public function getDataField() { |
|
55 | + $field=$this->getField(); |
|
56 | + if ($field instanceof AbstractCheckbox) |
|
57 | 57 | $field=$field->getField(); |
58 | 58 | return $field; |
59 | 59 | } |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | * @param boolean $value |
64 | 64 | * @return HtmlFormField |
65 | 65 | */ |
66 | - public function setChecked($value=true){ |
|
67 | - if($value===true){ |
|
66 | + public function setChecked($value=true) { |
|
67 | + if ($value===true) { |
|
68 | 68 | $this->getDataField()->setProperty("checked", "checked"); |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | $this->getDataField()->removeProperty("checked"); |
71 | 71 | } |
72 | 72 | return $this; |