|
1
|
|
|
<?php |
|
2
|
|
|
namespace Ajax\semantic\traits; |
|
3
|
|
|
|
|
4
|
|
|
use Ajax\semantic\html\collections\HtmlTable; |
|
5
|
|
|
use Ajax\semantic\html\collections\HtmlMessage; |
|
6
|
|
|
use Ajax\semantic\html\collections\menus\HtmlMenu; |
|
7
|
|
|
use Ajax\semantic\html\collections\form\HtmlForm; |
|
8
|
|
|
use Ajax\semantic\html\collections\HtmlGrid; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
trait SemanticHtmlCollectionsTrait { |
|
12
|
|
|
|
|
13
|
|
|
public abstract function addHtmlComponent($htmlComponent); |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @param string $identifier |
|
17
|
|
|
* @param int $rowCount |
|
18
|
|
|
* @param int $colCount |
|
19
|
|
|
* @return HtmlTable |
|
20
|
|
|
*/ |
|
21
|
|
|
public function htmlTable($identifier, $rowCount, $colCount){ |
|
22
|
|
|
return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Adds a new message |
|
27
|
|
|
* @param string $identifier |
|
28
|
|
|
* @param string $content |
|
29
|
|
|
* @param $styles string|array|NULL |
|
30
|
|
|
* @return HtmlMessage |
|
31
|
|
|
*/ |
|
32
|
|
|
public function htmlMessage($identifier, $content="",$styles=NULL) { |
|
33
|
|
|
$msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
34
|
|
|
if(isset($msg)) |
|
35
|
|
|
$msg->setStyle($styles); |
|
36
|
|
|
return $msg; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* |
|
41
|
|
|
* @param string $identifier |
|
42
|
|
|
* @param array $items |
|
43
|
|
|
* @return Ajax\semantic\html\collections\HtmlMenu |
|
44
|
|
|
*/ |
|
45
|
|
|
public function htmlMenu($identifier, $items=array()) { |
|
46
|
|
|
return $this->addHtmlComponent(new HtmlMenu($identifier, $items)); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Returns a new Semantic Form |
|
52
|
|
|
* @param string $identifier |
|
53
|
|
|
* @param array $elements |
|
54
|
|
|
* @return HtmlForm |
|
55
|
|
|
*/ |
|
56
|
|
|
public function htmlForm($identifier, $elements=array()) { |
|
57
|
|
|
return $this->addHtmlComponent(new HtmlForm($identifier, $elements)); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* |
|
62
|
|
|
* @param string $identifier |
|
63
|
|
|
* @param int $numRows |
|
64
|
|
|
* @param int $numCols |
|
65
|
|
|
* @param boolean $createCols |
|
66
|
|
|
* @param boolean $implicitRows |
|
67
|
|
|
* @return HtmlGrid |
|
68
|
|
|
*/ |
|
69
|
|
|
public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
70
|
|
|
return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows)); |
|
71
|
|
|
} |
|
72
|
|
|
} |