Skip to content

Commit 18a30ff

Browse files
committed
Update htmlDimmer
1 parent e756b09 commit 18a30ff

File tree

3 files changed

+58
-41
lines changed

3 files changed

+58
-41
lines changed

Ajax/common/BaseGui.php

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,72 @@
11
<?php
2-
32
namespace Ajax\common;
43

5-
64
use Ajax\common\components\SimpleComponent;
75
use Ajax\JsUtils;
86
use Ajax\common\html\BaseHtml;
97

108
/**
119
* BaseGui Phalcon library
10+
*
1211
* @author jcheron
13-
* @version 1.001
12+
* @version 1.02
1413
*/
1514

1615
/**
1716
* BaseGui
1817
*/
1918
class BaseGui {
19+
2020
protected $autoCompile;
21+
2122
protected $components;
23+
2224
protected $htmlComponents;
25+
2326
/**
2427
*
2528
* @var \Ajax\JsUtils
2629
*/
2730
protected $js;
2831

29-
public function __construct($autoCompile=true) {
30-
$this->autoCompile=$autoCompile;
31-
$this->components=array ();
32-
$this->htmlComponents=array ();
32+
public function __construct($autoCompile = true) {
33+
$this->autoCompile = $autoCompile;
34+
$this->components = array();
35+
$this->htmlComponents = array();
3336
}
3437

3538
public function isAutoCompile() {
3639
return $this->autoCompile;
3740
}
3841

3942
public function setAutoCompile($autoCompile) {
40-
$this->autoCompile=$autoCompile;
43+
$this->autoCompile = $autoCompile;
4144
return $this;
4245
}
4346

44-
public function compile($internal=false) {
45-
if ($internal===false&&$this->autoCompile===true)
47+
public function compile($internal = false) {
48+
if ($internal === false && $this->autoCompile === true)
4649
throw new \Exception("Impossible to compile if autoCompile is set to 'true'");
47-
foreach ( $this->components as $component ) {
50+
foreach ($this->components as $component) {
4851
$component->compile();
4952
}
5053
}
5154

5255
public function setJs(JsUtils $js) {
53-
$this->js=$js;
56+
$this->js = $js;
5457
}
5558

5659
public function addComponent(SimpleComponent $component, $attachTo, $params) {
57-
if ($this->autoCompile){
58-
if($attachTo!=null){
59-
if(!isset($this->components [$attachTo])){
60-
$this->components [$attachTo]=$component;
60+
if ($this->autoCompile) {
61+
if ($attachTo != null) {
62+
if (! isset($this->components[$attachTo])) {
63+
$this->components[$attachTo] = $component;
64+
} else {
65+
$this->components[] = $component;
6166
}
6267
$component->attach($attachTo);
63-
}else{
64-
$this->components []=$component;
68+
} else {
69+
$this->components[] = $component;
6570
}
6671
}
6772
if (isset($params))
@@ -71,17 +76,17 @@ public function addComponent(SimpleComponent $component, $attachTo, $params) {
7176
}
7277

7378
public function addHtmlComponent(BaseHtml $htmlComponent) {
74-
$this->htmlComponents [$htmlComponent->getIdentifier()]=$htmlComponent;
79+
$this->htmlComponents[$htmlComponent->getIdentifier()] = $htmlComponent;
7580
return $htmlComponent;
7681
}
7782

78-
public function compileHtml(JsUtils $js=NULL, &$view=NULL) {
79-
foreach ( $this->htmlComponents as $htmlComponent ) {
83+
public function compileHtml(JsUtils $js = NULL, &$view = NULL) {
84+
foreach ($this->htmlComponents as $htmlComponent) {
8085
$htmlComponent->compile($js, $view);
8186
}
8287
}
83-
84-
public function matchHtmlComponents($callback){
85-
return array_filter($this->htmlComponents,$callback);
88+
89+
public function matchHtmlComponents($callback) {
90+
return array_filter($this->htmlComponents, $callback);
8691
}
8792
}

Ajax/semantic/components/Dimmer.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
namespace Ajax\semantic\components;
43

54
use Ajax\JsUtils;
@@ -8,14 +7,18 @@ class Dimmer extends SimpleSemExtComponent {
87

98
public function __construct(JsUtils $js) {
109
parent::__construct($js);
11-
$this->uiName="dimmer";
10+
$this->uiName = "dimmer";
1211
}
1312

14-
public function setOn($value=false) {
15-
$this->params["on"]=$value;
13+
public function setOn($value = false) {
14+
$this->params["on"] = $value;
1615
}
1716

1817
public function setOpacity($value) {
19-
$this->params["opacity"]=$value;
18+
$this->params["opacity"] = $value;
19+
}
20+
21+
public function setClosable($value) {
22+
$this->params["closable"] = $value;
2023
}
2124
}
Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
namespace Ajax\semantic\html\modules;
43

54
use Ajax\semantic\html\base\HtmlSemDoubleElement;
@@ -8,22 +7,24 @@
87
use Ajax\common\html\HtmlSingleElement;
98

109
class HtmlDimmer extends HtmlSemDoubleElement {
10+
1111
private $_container;
12+
1213
private $_inverted;
1314

14-
public function __construct($identifier, $content=NULL) {
15+
public function __construct($identifier, $content = NULL) {
1516
parent::__construct($identifier, "div", "ui dimmer");
1617
$this->setContent($content);
17-
$this->_inverted=false;
18+
$this->_inverted = false;
1819
}
1920

2021
public function setContent($content) {
21-
$this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content));
22+
$this->content = new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content));
2223
return $this;
2324
}
2425

25-
public function asIcon($icon, $title, $subHeader=NULL) {
26-
$header=new HtmlHeader("header-" . $this->identifier);
26+
public function asIcon($icon, $title, $subHeader = NULL) {
27+
$header = new HtmlHeader("header-" . $this->identifier);
2728
$header->asIcon($icon, $title, $subHeader);
2829
if ($this->_inverted === false)
2930
$header->setInverted();
@@ -34,15 +35,18 @@ public function asPage() {
3435
return $this->addToProperty("class", "page");
3536
}
3637

37-
public function setInverted($recursive=true) {
38+
public function setInverted($recursive = true) {
3839
parent::setInverted($recursive);
39-
$this->_inverted=true;
40+
$this->_inverted = true;
4041
return $this;
4142
}
4243

4344
public function run(JsUtils $js) {
44-
if ($this->_container instanceof HtmlSingleElement)
45-
$this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params);
45+
if ($this->_container instanceof HtmlSingleElement) {
46+
$this->_bsComponent = $js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params);
47+
} else {
48+
$this->_bsComponent = $js->semantic()->dimmer("#" . $this->identifier, $this->_params);
49+
}
4650
return parent::run($js);
4751
}
4852

@@ -56,12 +60,17 @@ public function setBlurring() {
5660
}
5761

5862
public function setParams($_params) {
59-
$this->_params=$_params;
63+
$this->_params = $_params;
6064
return $this;
6165
}
6266

6367
public function setContainer($_container) {
64-
$this->_container=$_container;
68+
$this->_container = $_container;
69+
return $this;
70+
}
71+
72+
public function setClosable($closable) {
73+
$this->_params['closable'] = $closable;
6574
return $this;
6675
}
6776
}

0 commit comments

Comments
 (0)