phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlDimmer.php
Go to the documentation of this file.
1 <?php
3 
6 use Ajax\JsUtils;
8 
10 
11  private $_container;
12 
13  private $_inverted;
14 
15  public function __construct($identifier, $content = NULL) {
16  parent::__construct($identifier, "div", "ui dimmer");
17  $this->setContent($content);
18  $this->_inverted = false;
19  }
20 
21  public function setContent($content) {
22  $this->content = new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content));
23  return $this;
24  }
25 
26  public function asIcon($icon, $title, $subHeader = NULL) {
27  $header = new HtmlHeader("header-" . $this->identifier);
28  $header->asIcon($icon, $title, $subHeader);
29  if ($this->_inverted === false)
30  $header->setInverted();
31  return $this->setContent($header);
32  }
33 
34  public function asPage() {
35  return $this->addToProperty("class", "page");
36  }
37 
38  public function setInverted($recursive = true) {
39  parent::setInverted($recursive);
40  $this->_inverted = true;
41  return $this;
42  }
43 
44  public function run(JsUtils $js) {
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  }
50  return parent::run($js);
51  }
52 
53  public function jsShow() {
54  if (isset($this->_container))
55  return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");';
56  }
57 
58  public function setBlurring() {
59  return $this->addToProperty("class", "blurring");
60  }
61 
62  public function setParams($_params) {
63  $this->_params = $_params;
64  return $this;
65  }
66 
67  public function setContainer($_container) {
68  $this->_container = $_container;
69  return $this;
70  }
71 
72  public function setClosable($closable) {
73  $this->_params['closable'] = $closable;
74  return $this;
75  }
76 }
addToProperty($name, $value, $separator=" ")
asIcon($icon, $title, $subHeader=NULL)
Definition: HtmlDimmer.php:26
__construct($identifier, $content=NULL)
Definition: HtmlDimmer.php:15
semantic(Semantic $semantic=NULL)
getter or setter of the Semantic-UI variable
Definition: JsUtils.php:159
Base class for Semantic double elements.
JQuery PHP library.
Definition: JsUtils.php:23
Semantic Header component.
Definition: HtmlHeader.php:19
setInverted($recursive=true)
can be formatted to appear on dark backgrounds
Definition: BaseTrait.php:166