Code

51d59ec51aeed61d84627eccd2dc8cfb3539deb6
[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 List headline
40     String that keeps the desired headline. Returned by ObjectList::getHeadline.
42     \sa ObjectList::getHeadline
43    */
44   private $headline;
46   /*!
47     \brief List footer
49     String that keeps the desired footer. Returned by ObjectList::getFooter.
51     \sa ObjectList::getFooter
52    */
53   private $footer;
55   /*!
56     \brief Config
58     Config array that keeps the classes we do lists for, filter information, etc.
59    */
60   private $config;
63   /*! \brief ObjectList constructor
65     The ObjectList is initialized by a list of classes we're interested
66     in. Rest is done by instances of Filter registered in the Registry.
68     \param config Config section that is used to configure this ObjectList
69     \sa Registry
70     \sa Filter
71    */
72         public function __construct(&$config){
74     /* Save current config */
75     $this->config= &$config;
77     /* Load and instanciate classes, extract filter, icons, view hooks, etc. */
78     $this->load();
80   }
83         /*! \brief Function to initialy load object list
85           Internally loads the relevant list of objects depending on eventually
86           defined filter modules. Handles sorting, too.
87          */
88         private function load(){
89     # Crap filling
90     $this->objects= array( array("i", "Testobjekt mit was auch immer", "UPS"),
91                            array("i", "Noch ein Testobjekt", "UPS"),
92                            array("d", "Ein drittes Testobjekt", "UL"));
93     $this->headline= "|{16px}|{90%}Name|{64px}Actions|";
95     $this->footer= "Statistical footer";
96         }
99         /*! \brief Function to reload object list in case of external changes
101           Triggers a reload the relevant list of objects depending on eventually
102           defined filter modules. Handles sorting, too.
103          */
104   public function reload(){
105   }
108         /*! \brief Function to return the iterator object for this class.
110       This function is used internally by PHP to produce an iterator.
112       \return Iterator object
114       \sa ObjectListIterator
115          */
116   public function getIterator() {
117     return new ObjectListIterator($this->objects);
118   }
121         /*! \brief Function to get the desired headline
123       Return the property of headline to the public world.
125       \return headline for current list
126          */
127   public function getHeadline() {
128     return $this->headline;
129   }
132         /*! \brief Function to get the desired footer
134       Return the property of footer to the public world.
136       \return headline for current list
137          */
138   public function getFooter() {
139     return $this->footer;
140   }
144 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
145 ?>