@@ -14,60 +14,60 @@ |
||
| 14 | 14 | protected $params; |
| 15 | 15 | protected $semElement; |
| 16 | 16 | |
| 17 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
| 17 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
| 18 | 18 | $this->semElement=$semElement; |
| 19 | 19 | $this->title=$title; |
| 20 | 20 | $this->content=$content; |
| 21 | - $this->setAttributes($variation,$params); |
|
| 21 | + $this->setAttributes($variation, $params); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function setHtml($html) { |
| 25 | - $this->html= $html; |
|
| 25 | + $this->html=$html; |
|
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function setAttributes($variation=NULL,$params=array()){ |
|
| 29 | + public function setAttributes($variation=NULL, $params=array()) { |
|
| 30 | 30 | $this->variation=$variation; |
| 31 | 31 | $this->params=$params; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function onShow($jsCode){ |
|
| 34 | + public function onShow($jsCode) { |
|
| 35 | 35 | $this->params["onShow"]=$jsCode; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function compile(JsUtils $js=NULL){ |
|
| 39 | - if(JString::isNotNull($this->title)){ |
|
| 38 | + public function compile(JsUtils $js=NULL) { |
|
| 39 | + if (JString::isNotNull($this->title)) { |
|
| 40 | 40 | $this->semElement->addToProperty("data-title", $this->title); |
| 41 | 41 | } |
| 42 | - if(JString::isNotNull($this->content)){ |
|
| 42 | + if (JString::isNotNull($this->content)) { |
|
| 43 | 43 | $this->semElement->addToProperty("data-content", $this->content); |
| 44 | 44 | } |
| 45 | - if(JString::isNotNull($this->html)){ |
|
| 45 | + if (JString::isNotNull($this->html)) { |
|
| 46 | 46 | $html=$this->html; |
| 47 | - if(\is_array($html)){ |
|
| 47 | + if (\is_array($html)) { |
|
| 48 | 48 | \array_walk($html, function(&$item) use($js){ |
| 49 | - if($item instanceof HtmlSemDoubleElement){ |
|
| 49 | + if ($item instanceof HtmlSemDoubleElement) { |
|
| 50 | 50 | $comp=$item->compile($js); |
| 51 | - if(isset($js)){ |
|
| 51 | + if (isset($js)) { |
|
| 52 | 52 | $bs=$item->run($js); |
| 53 | - if(isset($bs)) |
|
| 53 | + if (isset($bs)) |
|
| 54 | 54 | $this->params['onShow']=$bs->getScript(); |
| 55 | 55 | } |
| 56 | 56 | $item=$comp; |
| 57 | 57 | } |
| 58 | 58 | }); |
| 59 | - $html=\implode("",$html); |
|
| 59 | + $html=\implode("", $html); |
|
| 60 | 60 | } |
| 61 | 61 | $html=\str_replace("\"", "'", $html); |
| 62 | 62 | $this->semElement->addToProperty("data-html", $html); |
| 63 | 63 | } |
| 64 | - if(JString::isNotNull($this->variation)){ |
|
| 64 | + if (JString::isNotNull($this->variation)) { |
|
| 65 | 65 | $this->semElement->addToProperty("data-variation", $this->variation); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function run(JsUtils $js){ |
|
| 70 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
| 69 | + public function run(JsUtils $js) { |
|
| 70 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | \ No newline at end of file |