phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlHeader.php
Go to the documentation of this file.
1 <?php
2 
4 
11 
21  protected $image;
22 
23  public function __construct($identifier, $niveau=1, $content=NULL, $type="page") {
24  parent::__construct($identifier, "div", "ui header");
25  $this->_template='<%tagName% id="%identifier%" %properties%>%image%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>';
26  if (isset($type)) {
27  if ($type == "page") {
28  $this->asPageHeader($niveau);
29  } else
30  $this->asContentHeader($niveau);
31  }
32  $this->content=$content;
33  }
34 
35  public function asPageHeader($niveau) {
36  $this->tagName="h" . $niveau;
37  }
38 
39  public function asContentHeader($niveau) {
40  $this->tagName="div";
41  if (\is_int($niveau)) {
42  $niveau=HeaderSize::getConstantValues()[$niveau];
43  }
44  $this->setSize($niveau);
45  }
46 
47  public function asIcon($icon, $title, $subHeader=NULL) {
48  $this->addToProperty("class", "icon");
49  $this->image=new HtmlIcon("icon-" . $this->identifier, $icon);
50  return $this->asTitle($title, $subHeader);
51  }
52 
53  public function asImage($src, $title, $subHeader=NULL) {
54  $this->image=new HtmlImg("img-" . $this->identifier, $src, $title);
55  return $this->asTitle($title, $subHeader);
56  }
57 
58  public function asTitle($title, $subHeader=NULL) {
59  if (!\is_object($title)) {
60  $this->content=new HtmlDoubleElement("content-" . $this->identifier, "div");
61  $this->content->setContent($title);
62  } else {
63  $this->content=$title;
64  }
65  $this->content->setClass("content");
66  if (isset($subHeader)) {
67  $sub=new HtmlDoubleElement("subheader-" . $this->identifier, "div");
68  $sub->setClass("sub header");
69  $sub->setContent($subHeader);
70  $this->content->addContent($sub);
71  }
72  return $this;
73  }
74 
75  public function getImage() {
76  return $this->image;
77  }
78 
79  public function setCircular() {
80  if (isset($this->image)) {
81  $this->image->setCircular();
82  }
83  return $this;
84  }
85 
86  public function setDividing() {
87  return $this->addToProperty("class", "dividing");
88  }
89 
90  public function setBlock() {
91  return $this->addToProperty("class", "block");
92  }
93 
94  public static function image($identifier, $image, $niveau=1, $header=NULL, $subHeader=NULL) {
95  $result=new HtmlHeader($identifier, $niveau, $header);
96  $result->asImage($image, $header, $subHeader);
97  $result->getImage()->addToProperty("class", "mini rounded");
98  return $result;
99  }
100 }
asImage($src, $title, $subHeader=NULL)
Definition: HtmlHeader.php:53
addToProperty($name, $value, $separator=" ")
static image($identifier, $image, $niveau=1, $header=NULL, $subHeader=NULL)
Definition: HtmlHeader.php:94
Semantic Icon component.
Definition: HtmlIcon.php:14
static getConstantValues($postFix="", $prefixBefore=false)
Definition: BaseEnum.php:29
asIcon($icon, $title, $subHeader=NULL)
Definition: HtmlHeader.php:47
Base class for Semantic double elements.
__construct($identifier, $niveau=1, $content=NULL, $type="page")
Definition: HtmlHeader.php:23
Semantic Header component.
Definition: HtmlHeader.php:19
asTitle($title, $subHeader=NULL)
Definition: HtmlHeader.php:58