Code

Added filter iterrator, corrected objectlists
[gosa.git] / include / class_ObjectListViewport.inc
1 <?php
3 /*! \brief   Exception implementation for ObjectListViewport
4     \author  Cajus Pollmeier <pollmeier@gonicus.de>
5     \version 1.00
6     \date    2007/11/02
8     This class handles the exceptions occuring in ObjectListViewport.
9  */
10 class ObjectListViewportException extends Exception {
11         public function __construct($message, $code = 0) {
12                 parent::__construct($message, $code);
13         }
14 }
15  
17 /*! \brief   Implementation for ObjectListViewport
18     \author  Cajus Pollmeier <pollmeier@gonicus.de>
19     \version 1.00
20     \date    2007/11/02
22     This class handles painting of ObjectList objects.
24     \sa ObjectList
25  */
26 class ObjectListViewport {
28   # DUMMY values ---->
29   private $headline= "|{16px}|{90%}Name|{64px}Actions|";
30   private $footer= "Statistics with no information currently";
31   # <--- DUMMY values.
33   /*!
34     \brief Container for objects
36     This variable stores the ObjectList object to be displayed.
37    */
38         private $objects;
41   /*! \brief ObjectListViewport constructor
43     The ObjectListViewport class renders/handles the ObjectList defined by $config.
45     \param config Config section that is used to configure this ObjectListViewport
46    */
47         public function __construct($config){
49     /* Load and instanciate classes, extract filter, icons, view hooks, etc. */
50     $this->objects= new ObjectList($config);
51   }
53         /*! \brief Handles _POST / _GET events
55             Processes the list of registered plugins to do their eventHandler and adapt
56       internal objectlist according to this.
57          */
58   public function eventHandler(){
59     /* Reloads the list if things have changed interally */
60     $this->objects->reload();
61   }
64         /*! \brief Renders headline into a string
66             Gets the headline description from the ObjectList object and renders it.
68       \return HTML rendered headline
69          */
70   private function renderHeadline(){
71     # Dummy implementation. Use pre-defined headline.
72     $buffer= $this->headline."\n";
74     return $buffer;
75   }
78         /*! \brief Renders footer into a string
80             Gets the footer description from the ObjectList object and renders it.
82       \return HTML rendered footer
83          */
84   private function renderFooter(){
85     # Dummy implementation. Use pre-defined footer.
86     $buffer= $this->footer;
87     return "|".$buffer."|\n";
88   }
91         /*! \brief Renders entries from the ObjectList iterator into a string
93             Gets the entry descriptions from the ObjectList object and renders them.
95       \return HTML rendered list entries
96          */
97   private function renderEntry($entry){
99     # Dummy implenetation. It is interested in icon, cn and action
100     $buffer= "|".$entry['_icon']."|".$entry['cn']."|".$entry['_actions']."|";
102     return $buffer."\n";
103   }
106         /*! \brief Renders complete ObjectList into a string
108       \return HTML rendered list
109          */
110   public function render() {
111     /* Generate fixed headline */
112     $buffer= $this->renderHeadline();
114     /* Apply current filter */
115     $filterIterator = new ObjectListFilterIterator($this->objects->getIterator(), 'dummy');
116     foreach ($this->objects as $value){
117       $buffer.= $this->renderEntry($value);
118     }
120     /* Generate footer */
121     $buffer.= $this->renderFooter();
123     return ($buffer);
124   }
128 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
129 ?>