1
|
|
|
<?php |
2
|
|
|
namespace Germania\Websites; |
3
|
|
|
|
4
|
|
|
class Website extends WebsiteAbstract implements WebsiteInterface |
5
|
|
|
{ |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Sets the page ID. |
10
|
|
|
* |
11
|
|
|
* @param mixed $id the id |
12
|
|
|
* |
13
|
|
|
* @return self |
14
|
|
|
*/ |
15
|
2 |
|
public function setId($id) |
16
|
|
|
{ |
17
|
2 |
|
$this->id = $id; |
18
|
|
|
|
19
|
2 |
|
return $this; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Sets the page title. |
25
|
|
|
* |
26
|
|
|
* @param mixed $title the title |
27
|
|
|
* |
28
|
|
|
* @return self |
29
|
|
|
*/ |
30
|
2 |
|
public function setTitle($title) |
31
|
|
|
{ |
32
|
2 |
|
$this->title = $title; |
33
|
|
|
|
34
|
2 |
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Sets the page route. |
40
|
|
|
* |
41
|
|
|
* @param mixed $route the route |
42
|
|
|
* |
43
|
|
|
* @return self |
44
|
|
|
*/ |
45
|
2 |
|
public function setRoute($route) |
46
|
|
|
{ |
47
|
2 |
|
$this->route = $route; |
48
|
|
|
|
49
|
2 |
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Sets the page route name. |
55
|
|
|
* |
56
|
|
|
* @param mixed $route_name the route name |
57
|
|
|
* |
58
|
|
|
* @return self |
59
|
|
|
*/ |
60
|
2 |
|
public function setRouteName($route_name) |
61
|
|
|
{ |
62
|
2 |
|
$this->route_name = $route_name; |
63
|
|
|
|
64
|
2 |
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Sets the allowed HTTP methods to "call" this website with. |
70
|
|
|
* |
71
|
|
|
* @param array $via The HTTP verbs |
72
|
|
|
* |
73
|
|
|
* @return self |
74
|
|
|
*/ |
75
|
2 |
|
public function setVia( array $via ) |
76
|
|
|
{ |
77
|
2 |
|
$this->via = $via; |
78
|
|
|
|
79
|
2 |
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Sets the content file for this page. |
85
|
|
|
* |
86
|
|
|
* @param mixed $content_file the php include |
87
|
|
|
* |
88
|
|
|
* @return self |
89
|
|
|
*/ |
90
|
2 |
|
public function setContentFile($content_file) |
91
|
|
|
{ |
92
|
2 |
|
$this->content_file = $content_file; |
93
|
|
|
|
94
|
2 |
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Sets the Controller class for this page. |
100
|
|
|
* |
101
|
|
|
* @param mixed $controller the php class |
102
|
|
|
* |
103
|
|
|
* @return self |
104
|
|
|
*/ |
105
|
2 |
|
public function setController($controller) |
106
|
|
|
{ |
107
|
2 |
|
$this->controller = $controller; |
108
|
|
|
|
109
|
2 |
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Sets the page template file. |
115
|
|
|
* |
116
|
|
|
* @param mixed $template the template |
117
|
|
|
* |
118
|
|
|
* @return self |
119
|
|
|
*/ |
120
|
2 |
|
public function setTemplate($template) |
121
|
|
|
{ |
122
|
2 |
|
$this->template = $template; |
123
|
|
|
|
124
|
2 |
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Sets the DOM ID for this page. |
130
|
|
|
* |
131
|
|
|
* @param mixed $dom_id the dom id |
132
|
|
|
* |
133
|
|
|
* @return self |
134
|
|
|
*/ |
135
|
|
|
public function setDomId($dom_id) |
136
|
2 |
|
{ |
137
|
|
|
$this->dom_id = $dom_id; |
138
|
2 |
|
|
139
|
|
|
return $this; |
140
|
2 |
|
} |
141
|
|
|
|
142
|
|
|
|
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Sets custom Stylesheets |
146
|
|
|
* |
147
|
|
|
* @param array $css |
148
|
|
|
* |
149
|
|
|
* @return self |
150
|
|
|
*/ |
151
|
2 |
|
public function setStylesheets( $css ) |
152
|
|
|
{ |
153
|
2 |
|
$this->stylesheets = $css; |
154
|
|
|
|
155
|
2 |
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Sets custom Javascripts |
161
|
|
|
* |
162
|
|
|
* @param array $js |
163
|
|
|
* |
164
|
|
|
* @return self |
165
|
|
|
*/ |
166
|
|
|
public function setJavascripts( $js ) |
167
|
|
|
{ |
168
|
|
|
$this->javascripts = $js; |
169
|
|
|
|
170
|
6 |
|
return $this; |
171
|
|
|
} |
172
|
6 |
|
|
173
|
6 |
|
|
174
|
|
|
|
175
|
6 |
|
|
176
|
6 |
|
/** |
177
|
|
|
* Checks if the page is marked 'active'. |
178
|
|
|
* |
179
|
|
|
* If no parameter is set, the current active state will be returned. |
180
|
|
|
* |
181
|
|
|
* @param mixed $is_active 'active' flag. Defaults to null. |
182
|
|
|
* |
183
|
|
|
* @return self|bool The page instance or active state (TRUE id greater than 0, else FALSE) |
184
|
|
|
*/ |
185
|
|
|
public function isActive($is_active = null) |
186
|
|
|
{ |
187
|
|
|
if (is_null($is_active)) { |
188
|
|
|
return $this->is_active > 0; |
189
|
|
|
} |
190
|
|
|
$this->is_active = $is_active; |
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
} |
194
|
|
|
|