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