1 <?php
3 /*! \brief Exception implementation for ObjectList
4 \author Cajus Pollmeier <pollmeier@gonicus.de>
5 \version 1.00
6 \date 2007/11/02
8 This class handles the exceptions occuring in ObjectList.
9 */
10 class ObjectListException extends Exception {
11 public function __construct($message, $code = 0) {
12 parent::__construct($message, $code);
13 }
14 }
17 /*! \brief Implementation for keeping a list of objects
18 \author Cajus Pollmeier <pollmeier@gonicus.de>
19 \version 1.00
20 \date 2007/11/02
22 The class ObjectList handles a list of objects found in the database
23 based on an optional filter modules. This objects can be iterated
24 directly.
26 \sa ObjectListIterator
27 */
28 class ObjectList implements IteratorAggregate {
30 /*!
31 \brief Container for objects
33 This variable stores the list of objects.
34 */
35 private $objects;
37 /*!
38 \brief Config
40 Config array that keeps the classes we do lists for, filter information, etc.
41 */
42 private $config;
45 /*! \brief ObjectList constructor
47 The ObjectList is initialized by a list of classes we're interested
48 in. Rest is done by instances of Filter registered in the Registry.
50 \param config Config section that is used to configure this ObjectList
51 \sa Registry
52 \sa Filter
53 */
54 public function __construct(&$config){
56 /* Save current config */
57 $this->config= &$config;
59 /* Load and instanciate classes, extract filter, icons, view hooks, etc. */
60 $this->load();
62 }
65 /*! \brief Function to initialy load object list
67 Internally loads the relevant list of objects depending on eventually
68 defined filter modules. Handles sorting, too.
69 */
70 private function load(){
71 # Crap filling
72 $this->objects= array(
74 array("dn" => "cn=1aherbertskiste,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
75 "cn" => "1aherbertskiste",
76 "_icon" => "select_workstation.png",
77 "_actions" => "CPSREDX",
78 "objectClass" => array('gotoWorkstation')),
80 array("dn" => "cn=72:9c:13:e9:72:2b,ou=incoming,o=Landeshauptstadt München,c=de",
81 "cn" => "72:9c:13:e9:72:2b",
82 "_icon" => "select_newsystem.png",
83 "_actions" => "CPSREDX",
84 "objectClass" => array('gotoWorkstation')),
86 array("dn" => "cn=8f:9c:d0:d5:42:c0,ou=incoming,o=Landeshauptstadt München,c=de",
87 "cn" => "8f:9c:d0:d5:42:c0",
88 "_icon" => "select_newsystem.png",
89 "_actions" => "CPSREDX",
90 "objectClass" => array('gotoWorkstation')),
92 array("dn" => "cn=a.b_c,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
93 "cn" => "a.b_c",
94 "_icon" => "select_printer.png",
95 "_actions" => "CPSREDX",
96 "objectClass" => array('gotoWorkstation')),
98 array("dn" => "cn=a5:35:77:86:ff:ca,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
99 "cn" => "a5:35:77:86:ff:ca",
100 "_icon" => "select_workstation.png",
101 "_actions" => "CPSREDX",
102 "objectClass" => array('gotoWorkstation')),
104 array("dn" => "cn=cl1--141,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
105 "cn" => "cl1--141",
106 "_icon" => "select_workstation.png",
107 "_actions" => "CPSREDX",
108 "objectClass" => array('gotoWorkstation')),
110 array("dn" => "cn=d9:57:9d:08:2c:65,ou=incoming,o=Landeshauptstadt München,c=de",
111 "cn" => "d9:57:9d:08:2c:65",
112 "_icon" => "select_newsystem.png",
113 "_actions" => "CPSREDX",
114 "objectClass" => array('gotoWorkstation')),
116 array("dn" => "cn=dyn-111,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
117 "cn" => "dyn-111",
118 "_icon" => "select_server.png",
119 "_actions" => "CPSREDX",
120 "objectClass" => array('gotoWorkstation')),
122 array("dn" => "cn=e3:b4:43:51:f6:13,ou=incoming,o=Landeshauptstadt München,c=de",
123 "cn" => "e3:b4:43:51:f6:13",
124 "_icon" => "select_newsystem.png",
125 "_actions" => "CPSREDX",
126 "objectClass" => array('gotoWorkstation')),
128 array("dn" => "cn=f2:d7:ef:92:e6:43,ou=incoming,o=Landeshauptstadt München,c=de",
129 "cn" => "f2:d7:ef:92:e6:43",
130 "_icon" => "select_newsystem.png",
131 "_actions" => "CPSREDX",
132 "objectClass" => array('gotoWorkstation')),
134 array("dn" => "cn=f9:fa:4e:f8:1a:40,ou=incoming,o=Landeshauptstadt München,c=de",
135 "cn" => "f9:fa:4e:f8:1a:40",
136 "_icon" => "select_newsystem.png",
137 "_actions" => "CPSREDX",
138 "objectClass" => array('gotoWorkstation')),
140 array("dn" => "cn=hu_ber-test.gonicus.de,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
141 "cn" => "hu_ber-test.gonicus.de",
142 "_icon" => "select_printer.png",
143 "_actions" => "CPSREDX",
144 "objectClass" => array('gotoWorkstation')),
146 array("dn" => "cn=loghost-01,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
147 "cn" => "loghost-01",
148 "_icon" => "select_server.png",
149 "_actions" => "CPSREDX",
150 "objectClass" => array('gotoWorkstation')),
152 array("dn" => "cn=ntp.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
153 "cn" => "ntp.jp.",
154 "_icon" => "select_server.png",
155 "_actions" => "CPSREDX",
156 "objectClass" => array('gotoWorkstation')),
158 array("dn" => "cn=phone-1.gonicus.de.,ou=phones,ou=systems,o=Landeshauptstadt München,c=de",
159 "cn" => "phone-1.gonicus.de.",
160 "_icon" => "select_phone.png",
161 "_actions" => "CPSREDX",
162 "objectClass" => array('gotoWorkstation')),
164 array("dn" => "cn=printer.222,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
165 "cn" => "printer.222",
166 "_icon" => "select_printer.png",
167 "_actions" => "CPSREDX",
168 "objectClass" => array('gotoWorkstation')),
170 array("dn" => "cn=printer,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
171 "cn" => "printer",
172 "_icon" => "select_printer.png",
173 "_actions" => "CPSREDX",
174 "objectClass" => array('gotoWorkstation')),
176 array("dn" => "cn=shares.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
177 "cn" => "shares.jp. [Share server]",
178 "_icon" => "select_server.png",
179 "_actions" => "CPSREDX",
180 "objectClass" => array('gotoWorkstation')),
182 array("dn" => "cn=terminal.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
183 "cn" => "terminal.jp.",
184 "_icon" => "select_server.png",
185 "_actions" => "CPSREDX",
186 "objectClass" => array('gotoWorkstation')),
188 array("dn" => "cn=test.test.etst,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
189 "cn" => "test.test.etst",
190 "_icon" => "select_printer.png",
191 "_actions" => "CPSREDX",
192 "objectClass" => array('gotoWorkstation')),
194 array("dn" => "cn=tester,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
195 "cn" => "tester",
196 "_icon" => "select_printer.png",
197 "_actions" => "CPSREDX",
198 "objectClass" => array('gotoWorkstation')),
200 array("dn" => "cn=vserver-04.intranet.gonicus.de,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
201 "cn" => "vserver-04.intranet.gonicus.de [Mail Server]",
202 "_icon" => "select_server.png",
203 "_actions" => "CPSREDX",
204 "objectClass" => array('gotoWorkstation')),
206 array("dn" => "cn=workstation,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
207 "cn" => "workstation",
208 "_icon" => "select_workstation.png",
209 "_actions" => "CPSREDX",
210 "objectClass" => array('gotoWorkstation')),
211 array("dn" => "cn=1aherbertskiste,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
212 "cn" => "1aherbertskiste",
213 "_icon" => "select_workstation.png",
214 "_actions" => "CPSREDX",
215 "objectClass" => array('gotoWorkstation')),
217 array("dn" => "cn=72:9c:13:e9:72:2b,ou=incoming,o=Landeshauptstadt München,c=de",
218 "cn" => "72:9c:13:e9:72:2b",
219 "_icon" => "select_newsystem.png",
220 "_actions" => "CPSREDX",
221 "objectClass" => array('gotoWorkstation')),
223 array("dn" => "cn=8f:9c:d0:d5:42:c0,ou=incoming,o=Landeshauptstadt München,c=de",
224 "cn" => "8f:9c:d0:d5:42:c0",
225 "_icon" => "select_newsystem.png",
226 "_actions" => "CPSREDX",
227 "objectClass" => array('gotoWorkstation')),
229 array("dn" => "cn=a.b_c,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
230 "cn" => "a.b_c",
231 "_icon" => "select_printer.png",
232 "_actions" => "CPSREDX",
233 "objectClass" => array('gotoWorkstation')),
235 array("dn" => "cn=a5:35:77:86:ff:ca,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
236 "cn" => "a5:35:77:86:ff:ca",
237 "_icon" => "select_workstation.png",
238 "_actions" => "CPSREDX",
239 "objectClass" => array('gotoWorkstation')),
241 array("dn" => "cn=cl1--141,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
242 "cn" => "cl1--141",
243 "_icon" => "select_workstation.png",
244 "_actions" => "CPSREDX",
245 "objectClass" => array('gotoWorkstation')),
247 array("dn" => "cn=d9:57:9d:08:2c:65,ou=incoming,o=Landeshauptstadt München,c=de",
248 "cn" => "d9:57:9d:08:2c:65",
249 "_icon" => "select_newsystem.png",
250 "_actions" => "CPSREDX",
251 "objectClass" => array('gotoWorkstation')),
253 array("dn" => "cn=dyn-111,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
254 "cn" => "dyn-111",
255 "_icon" => "select_server.png",
256 "_actions" => "CPSREDX",
257 "objectClass" => array('gotoWorkstation')),
259 array("dn" => "cn=e3:b4:43:51:f6:13,ou=incoming,o=Landeshauptstadt München,c=de",
260 "cn" => "e3:b4:43:51:f6:13",
261 "_icon" => "select_newsystem.png",
262 "_actions" => "CPSREDX",
263 "objectClass" => array('gotoWorkstation')),
265 array("dn" => "cn=f2:d7:ef:92:e6:43,ou=incoming,o=Landeshauptstadt München,c=de",
266 "cn" => "f2:d7:ef:92:e6:43",
267 "_icon" => "select_newsystem.png",
268 "_actions" => "CPSREDX",
269 "objectClass" => array('gotoWorkstation')),
271 array("dn" => "cn=f9:fa:4e:f8:1a:40,ou=incoming,o=Landeshauptstadt München,c=de",
272 "cn" => "f9:fa:4e:f8:1a:40",
273 "_icon" => "select_newsystem.png",
274 "_actions" => "CPSREDX",
275 "objectClass" => array('gotoWorkstation')),
277 array("dn" => "cn=hu_ber-test.gonicus.de,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
278 "cn" => "hu_ber-test.gonicus.de",
279 "_icon" => "select_printer.png",
280 "_actions" => "CPSREDX",
281 "objectClass" => array('gotoWorkstation')),
283 array("dn" => "cn=loghost-01,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
284 "cn" => "loghost-01",
285 "_icon" => "select_server.png",
286 "_actions" => "CPSREDX",
287 "objectClass" => array('gotoWorkstation')),
289 array("dn" => "cn=ntp.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
290 "cn" => "ntp.jp.",
291 "_icon" => "select_server.png",
292 "_actions" => "CPSREDX",
293 "objectClass" => array('gotoWorkstation')),
295 array("dn" => "cn=phone-1.gonicus.de.,ou=phones,ou=systems,o=Landeshauptstadt München,c=de",
296 "cn" => "phone-1.gonicus.de.",
297 "_icon" => "select_phone.png",
298 "_actions" => "CPSREDX",
299 "objectClass" => array('gotoWorkstation')),
301 array("dn" => "cn=printer.222,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
302 "cn" => "printer.222",
303 "_icon" => "select_printer.png",
304 "_actions" => "CPSREDX",
305 "objectClass" => array('gotoWorkstation')),
307 array("dn" => "cn=printer,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
308 "cn" => "printer",
309 "_icon" => "select_printer.png",
310 "_actions" => "CPSREDX",
311 "objectClass" => array('gotoWorkstation')),
313 array("dn" => "cn=shares.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
314 "cn" => "shares.jp. [Share server]",
315 "_icon" => "select_server.png",
316 "_actions" => "CPSREDX",
317 "objectClass" => array('gotoWorkstation')),
319 array("dn" => "cn=terminal.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
320 "cn" => "terminal.jp.",
321 "_icon" => "select_server.png",
322 "_actions" => "CPSREDX",
323 "objectClass" => array('gotoWorkstation')),
325 array("dn" => "cn=test.test.etst,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
326 "cn" => "test.test.etst",
327 "_icon" => "select_printer.png",
328 "_actions" => "CPSREDX",
329 "objectClass" => array('gotoWorkstation')),
331 array("dn" => "cn=tester,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
332 "cn" => "tester",
333 "_icon" => "select_printer.png",
334 "_actions" => "CPSREDX",
335 "objectClass" => array('gotoWorkstation')),
337 array("dn" => "cn=vserver-04.intranet.gonicus.de,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
338 "cn" => "vserver-04.intranet.gonicus.de [Mail Server]",
339 "_icon" => "select_server.png",
340 "_actions" => "CPSREDX",
341 "objectClass" => array('gotoWorkstation')),
343 array("dn" => "cn=workstation,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
344 "cn" => "workstation",
345 "_icon" => "select_workstation.png",
346 "_actions" => "CPSREDX",
347 "objectClass" => array('gotoWorkstation'))
349 );
350 }
353 /*! \brief Function to reload object list in case of external changes
355 Triggers a reload the relevant list of objects depending on eventually
356 defined filter modules. Handles sorting, too.
357 */
358 public function reload(){
359 }
362 /*! \brief Function to return the iterator object for this class.
364 This function is used internally by PHP to produce an iterator.
366 \return Iterator object
368 \sa ObjectListIterator
369 */
370 public function getIterator() {
371 return new ObjectListIterator($this->objects);
372 }
374 }
376 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
377 ?>