|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ajax; |
|
4
|
|
|
|
|
5
|
|
|
use Ajax\common\BaseGui; |
|
6
|
|
|
use Ajax\semantic\html\modules\HtmlDropdown; |
|
7
|
|
|
use Ajax\semantic\html\modules\HtmlPopup; |
|
8
|
|
|
use Ajax\common\html\BaseHtml; |
|
9
|
|
|
use Ajax\semantic\html\collections\menus\HtmlIconMenu; |
|
10
|
|
|
use Ajax\semantic\html\collections\menus\HtmlLabeledIconMenu; |
|
11
|
|
|
use Ajax\semantic\html\collections\HtmlBreadcrumb; |
|
12
|
|
|
use Ajax\semantic\html\modules\HtmlAccordion; |
|
13
|
|
|
use Ajax\semantic\components\Accordion; |
|
14
|
|
|
use Ajax\semantic\html\collections\menus\HtmlAccordionMenu; |
|
15
|
|
|
use Ajax\semantic\traits\SemanticComponentsTrait; |
|
16
|
|
|
use Ajax\semantic\traits\SemanticHtmlElementsTrait; |
|
17
|
|
|
use Ajax\semantic\html\modules\HtmlSticky; |
|
18
|
|
|
use Ajax\semantic\traits\SemanticHtmlCollectionsTrait; |
|
19
|
|
|
use Ajax\semantic\traits\SemanticHtmlModulesTrait; |
|
20
|
|
|
use Ajax\semantic\traits\SemanticHtmlViewsTrait; |
|
21
|
|
|
use function Composer\Autoload\includeFile; |
|
22
|
|
|
|
|
23
|
|
|
class Semantic extends BaseGui { |
|
24
|
|
|
use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
25
|
|
|
SemanticHtmlModulesTrait,SemanticHtmlViewsTrait; |
|
26
|
|
|
|
|
27
|
|
|
private $language; |
|
28
|
|
|
|
|
29
|
|
|
public function __construct($autoCompile=true) { |
|
30
|
|
|
parent::__construct($autoCompile=true); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Adds an icon menu |
|
36
|
|
|
* @param string $identifier |
|
37
|
|
|
* @param array $items icons |
|
38
|
|
|
*/ |
|
39
|
|
|
public function htmlIconMenu($identifier, $items=array()) { |
|
40
|
|
|
return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items)); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Adds an labeled icon menu |
|
45
|
|
|
* @param string $identifier |
|
46
|
|
|
* @param array $items icons |
|
47
|
|
|
*/ |
|
48
|
|
|
public function htmlLabeledIconMenu($identifier, $items=array()) { |
|
49
|
|
|
return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items)); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* |
|
54
|
|
|
* @param string $identifier |
|
55
|
|
|
* @param string $value |
|
56
|
|
|
* @param array $items |
|
57
|
|
|
*/ |
|
58
|
|
|
public function htmlDropdown($identifier, $value="", $items=array()) { |
|
59
|
|
|
return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items)); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* |
|
64
|
|
|
* @param string $identifier |
|
65
|
|
|
* @param mixed $content |
|
66
|
|
|
* @return HtmlPopup |
|
67
|
|
|
*/ |
|
68
|
|
|
public function htmlPopup(BaseHtml $container, $identifier, $content) { |
|
69
|
|
|
return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content)); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Returns a new Semantic Html Breadcrumb |
|
74
|
|
|
* @param string $identifier |
|
75
|
|
|
* @param array $items |
|
76
|
|
|
* @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true |
|
77
|
|
|
* @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
|
78
|
|
|
* @return HtmlBreadcrumb |
|
79
|
|
|
*/ |
|
80
|
|
|
public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
81
|
|
|
return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction)); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Returns a new Semantic Accordion |
|
86
|
|
|
* @param string $identifier |
|
87
|
|
|
* @return HtmlAccordion |
|
88
|
|
|
*/ |
|
89
|
|
|
public function htmlAccordion($identifier) { |
|
90
|
|
|
return $this->addHtmlComponent(new HtmlAccordion($identifier)); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Return a new Semantic Menu Accordion |
|
95
|
|
|
* @param string $identifier |
|
96
|
|
|
* @return HtmlAccordion |
|
97
|
|
|
*/ |
|
98
|
|
|
public function htmlAccordionMenu($identifier, $items=array()) { |
|
99
|
|
|
return $this->addHtmlComponent(new HtmlAccordionMenu($identifier, $items)); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Returns a new Semantic Sticky |
|
105
|
|
|
* @param string $identifier |
|
106
|
|
|
* @param array $content |
|
107
|
|
|
* @return HtmlSticky |
|
108
|
|
|
*/ |
|
109
|
|
|
public function htmlSticky($identifier, $content=array()) { |
|
110
|
|
|
return $this->addHtmlComponent(new HtmlSticky($identifier, $content)); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function setLanguage($language){ |
|
114
|
|
|
if($language!==$this->language){ |
|
115
|
|
|
$file=\realpath(dirname(__FILE__)."/semantic/components/validation/languages/".$language.".js"); |
|
116
|
|
|
if(\file_exists($file)){ |
|
117
|
|
|
$script=\file_get_contents($file); |
|
118
|
|
|
$this->js->exec($script,true); |
|
119
|
|
|
$this->language=$language; |
|
120
|
|
|
} |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
} |