Completed
Push — master ( 19a73f...703022 )
by Jean-Christophe
04:09
created

htmlLabeledIconMenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
namespace Ajax\semantic\traits;
3
4
use Ajax\semantic\html\collections\table\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
use Ajax\semantic\html\collections\HtmlBreadcrumb;
10
use Ajax\semantic\html\collections\menus\HtmlIconMenu;
11
use Ajax\semantic\html\collections\menus\HtmlLabeledIconMenu;
12
13
14
trait SemanticHtmlCollectionsTrait {
15
16
	public abstract function addHtmlComponent($htmlComponent);
17
18
	/**
19
	 * @param string $identifier
20
	 * @param int $rowCount
21
	 * @param int $colCount
22
	 * @return HtmlTable
23
	 */
24
	public function htmlTable($identifier, $rowCount, $colCount){
25
		return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount));
26
	}
27
28
	/**
29
	 * Adds a new message
30
	 * @param string $identifier
31
	 * @param string $content
32
	 * @param $styles string|array|NULL
33
	 * @return HtmlMessage
34
	 */
35
	public function htmlMessage($identifier, $content="",$styles=NULL) {
36
		$msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content));
37
		if(isset($msg))
38
			$msg->setStyle($styles);
39
		return $msg;
40
	}
41
42
	/**
43
	 *
44
	 * @param string $identifier
45
	 * @param array $items
46
	 * @return Ajax\semantic\html\collections\HtmlMenu
47
	 */
48
	public function htmlMenu($identifier, $items=array()) {
49
		return $this->addHtmlComponent(new HtmlMenu($identifier, $items));
50
	}
51
52
	/**
53
	 * Adds an icon menu
54
	 * @param string $identifier
55
	 * @param array $items icons
56
	 */
57
	public function htmlIconMenu($identifier, $items=array()) {
58
		return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items));
59
	}
60
61
	/**
62
	 * Adds an labeled icon menu
63
	 * @param string $identifier
64
	 * @param array $items icons
65
	 */
66
	public function htmlLabeledIconMenu($identifier, $items=array()) {
67
		return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items));
68
	}
69
70
	/**
71
	 * Returns a new Semantic Html Breadcrumb
72
	 * @param string $identifier
73
	 * @param array $items
74
	 * @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true
75
	 * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()}
76
	 * @return HtmlBreadcrumb
77
	 */
78
	public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) {
79
		return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction));
80
	}
81
82
83
	/**
84
	 * Returns a new Semantic Form
85
	 * @param string $identifier
86
	 * @param array $elements
87
	 * @return HtmlForm
88
	 */
89
	public function htmlForm($identifier, $elements=array()) {
90
		return $this->addHtmlComponent(new HtmlForm($identifier, $elements));
91
	}
92
93
	/**
94
	 *
95
	 * @param string $identifier
96
	 * @param int $numRows
97
	 * @param int $numCols
98
	 * @param boolean $createCols
99
	 * @param boolean $implicitRows
100
	 * @return HtmlGrid
101
	 */
102
	public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) {
103
		return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows));
104
	}
105
}