Code

Added filter iterrator, corrected objectlists
[gosa.git] / include / class_ObjectList.inc
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 }
15  
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(
73                             array("dn" => "cn=Demo client,ou=systems,dc=gonicus,dc=de", "cn" => "Demo client", "_icon" => "s_terminal.png", "_actions" => "ED"),
74                             array("dn" => "cn=Demo client2,ou=systems,dc=gonicus,dc=de", "cn" => "Demo client2", "_icon" => "s_terminal.png", "_actions" => "ED"),
75                             array("dn" => "cn=Printer,ou=systems,dc=gonicus,dc=de", "cn" => "Printer", "_icon" => "s_printer.png", "_actions" => "ED"),
76                             array("dn" => "cn=Server,ou=systems,dc=gonicus,dc=de", "cn" => "Server", "_icon" => "s_server.png", "_actions" => "ED"),
77                            );
78         }
81         /*! \brief Function to reload object list in case of external changes
83           Triggers a reload the relevant list of objects depending on eventually
84           defined filter modules. Handles sorting, too.
85          */
86   public function reload(){
87   }
90         /*! \brief Function to return the iterator object for this class.
92       This function is used internally by PHP to produce an iterator.
94       \return Iterator object
96       \sa ObjectListIterator
97          */
98   public function getIterator() {
99     return new ObjectListIterator($this->objects);
100   }
104 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
105 ?>