phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlViewContent.php
Go to the documentation of this file.
1<?php
2
4
12
14 public function __construct($identifier, $content=array()) {
15 parent::__construct($identifier, "div", "content",[]);
16 $this->setContent($content);
17 }
18
19 public function setContent($value){
20 if (\is_array($value)) {
21 $header=JArray::getValue($value, "header", 0);
22 $metas=JArray::getValue($value, "metas", 1);
23 $description=JArray::getValue($value, "description", 2);
24 $image=JArray::getValue($value, "image", 3);
25 $extra=JArray::getValue($value, "extra", 4);
26 if (isset($image)) {
27 $this->addImage($image);
28 }
29 $this->addHeaderContent($header, $metas, $description,$extra);
30 } else
31 $this->addContent($value);
32 }
33
34 public function addElement($content, $baseClass="") {
35 $count=\sizeof($this->content);
36 $result=new HtmlViewContent("element-" . $count . "-" . $this->identifier, $content);
37 $result->setClass($baseClass);
38 $this->addContent($result);
39 return $result;
40 }
41
42 public function addMeta($value, $direction=Direction::LEFT) {
43 if (\array_key_exists("meta", $this->content) === false) {
44 $this->content["meta"]=new HtmlSemDoubleElement("meta-" . $this->identifier, "div", "meta", array ());
45 }
46 if ($direction === Direction::RIGHT) {
47 $value=new HtmlSemDoubleElement("", "span", "", $value);
48 $value->setFloated($direction);
49 }
50 $this->content["meta"]->addContent($value);
51 return $this->content["meta"];
52 }
53
54 public function addExtra($value) {
55 if (\array_key_exists("extra", $this->content) === false) {
56 $this->content["extra"]=new HtmlSemDoubleElement("extra-" . $this->identifier, "div", "extra", array ());
57 }
58 $this->content["extra"]->addContent($value);
59 return $this->content["extra"];
60 }
61
62 public function addImage($src="", $alt="", $size=NULL) {
63 $image=new HtmlImg("img-", $src, $alt);
64 if (isset($size))
65 $image->setSize($size);
66 $this->content['image']=$image;
67 return $image;
68 }
69
77 public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){
78 $buttons=new HtmlButtonGroups("buttons-".$this->identifier,$elements,$asIcons);
79 $this->addElementInPart($buttons,$part, $before,true);
80 return $buttons;
81 }
82
83 public function addMetas($metas) {
84 if (\is_array($metas)) {
85 foreach ( $metas as $meta ) {
86 $this->addMeta($meta);
87 }
88 } else
89 $this->addMeta($metas);
90 return $this;
91 }
92
93 public function addContentIcon($icon, $caption=NULL, $direction=Direction::LEFT) {
94 if ($direction === Direction::RIGHT) {
95 if (isset($caption)) {
96 $result=new HtmlSemDoubleElement("", "span", "", $caption);
97 $result->addIcon($icon);
98 $this->addContent($result);
99 } else {
100 $result=new HtmlIcon("", $icon);
101 $this->addContent($result);
102 }
103 $result->setFloated($direction);
104 } else {
105 $this->addIcon($icon);
106 $result=$this->addContent($caption);
107 }
108 return $result;
109 }
110
111 public function addContentText($caption, $direction=Direction::LEFT) {
112 if ($direction === Direction::RIGHT) {
113 $result=new HtmlSemDoubleElement("", "span", "", $caption);
114 $this->addContent($result);
115 $result->setFloated($direction);
116 } else
117 $result=$this->addContent($caption);
118 return $result;
119 }
120
121 public function addContentIcons($icons, $direction=Direction::LEFT) {
122 foreach ( $icons as $icon ) {
123 $this->addContentIcon($icon, NULL, $direction);
124 }
125 return $this;
126 }
127
128 public function addHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) {
129 if(isset($header))
130 $this->addElement($header, "header");
131 $this->addMetas($metas);
132 if (isset($description)) {
133 $this->addElement($description, "description");
134 }
135 if(isset($extra)){
136 $this->addExtra($extra);
137 }
138 return $this;
139 }
140
141 public function compile(JsUtils $js=NULL, &$view=NULL) {
142 return parent::compile($js, $view);
143 }
144}
JQuery PHP library.
Definition JsUtils.php:23
addContent($content, $before=false)
Base class for Semantic double elements.
addElementInPart($element, $partKey, $before=false, $force=false)
addMeta($value, $direction=Direction::LEFT)
compile(JsUtils $js=NULL, &$view=NULL)
{{}BaseHtml::compile()}
addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false)
addContentIcons($icons, $direction=Direction::LEFT)
addContentText($caption, $direction=Direction::LEFT)
addHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL)
addContentIcon($icon, $caption=NULL, $direction=Direction::LEFT)
Semantic UI Buttongroups component.
Semantic Icon component.
Definition HtmlIcon.php:14