[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.listbox.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare API - Link box generator                                      *
   4    * http://www.egroupware.org/api                                            *
   5    * This file written by Mark Peters <skeeter@phpgroupware.org>              *
   6    * Creates listboxes using templates                                        *
   7    * Copyright (C) 2000, 2001 Mark Peters                                     *
   8    * -------------------------------------------------------------------------*
   9    * This library is part of the eGroupWare API                               *
  10    * http://www.egroupware.org/api                                            * 
  11    * ------------------------------------------------------------------------ *
  12    * This library is free software; you can redistribute it and/or modify it  *
  13    * under the terms of the GNU Lesser General Public License as published by *
  14    * the Free Software Foundation; either version 2.1 of the License,         *
  15    * or any later version.                                                    *
  16    * This library is distributed in the hope that it will be useful, but      *
  17    * WITHOUT ANY WARRANTY; without even the implied warranty of               *
  18    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
  19    * See the GNU Lesser General Public License for more details.              *
  20    * You should have received a copy of the GNU Lesser General Public License *
  21    * along with this library; if not, write to the Free Software Foundation,  *
  22    * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
  23    \**************************************************************************/
  24  
  25    /* $Id: class.listbox.inc.php 20295 2006-02-15 12:31:25Z  $ */
  26  
  27      require_once (EGW_INCLUDE_ROOT.'/phpgwapi/inc/class.portalbox.inc.php');
  28  
  29      class listbox extends portalbox
  30      {
  31          /*
  32           Set up the Object. You will notice, we have not reserved
  33           memory space for variables. In this circumstance it is not necessary.
  34           */
  35  
  36          /*
  37           This is the constructor for the listbox. The only thing this does
  38           is to call the constructor of the parent class. Why? Well, whilst
  39           PHP manages a certain part of OO, one of the bits it falls down on
  40           (at the moment) is constructors within sub-classes. So, to
  41           be sure that the sub-class is instantiated with the constructor of
  42           the parent class, I simply call the parent constructor. Of course,
  43           if I then wanted to override any of the values, I could easily do so.
  44          */
  45  		function listbox($param)
  46          {
  47              $this->setvar('classname','listbox');
  48              $this->setvar('outerwidth',300);
  49              $this->setvar('innerwidth',300);
  50              $this->setvar('width',300);
  51  
  52              @reset($param);
  53              while(list($key,$value) = each($param))
  54              {
  55                  if($key != 'title' && $key != 'primary' && $key != 'secondary' && $key != 'tertiary')
  56                  {
  57  //echo 'Setting '.$key.':'.$value."<br>\n";
  58                      $this->setvar($key,$value);
  59                  }
  60              }
  61              $this->portalbox($param['title'], $param['primary'], $param['secondary'], $param['tertiary']);
  62              $this->start_template();
  63          }
  64  
  65          /*
  66           This is the only method within the class. Quite simply, as you can see
  67           it draws the table(s), placing the required data in the appropriate place.
  68          */
  69  		function draw($extra_data='')
  70          {
  71              if(count($this->data))
  72              {
  73                  $this->p->parse('row','portal_listbox_header',True);
  74  
  75                  for ($x = 0; $x < count($this->data); $x++)
  76                  {
  77                      $var = Array(
  78                          'text'    => $this->data[$x]['text'],
  79                          'link'    => $this->data[$x]['link']
  80                      );
  81                      $this->p->set_var($var);
  82                      $this->p->parse('row','portal_listbox_link',True);
  83                  }
  84                  $this->p->parse('row','portal_listbox_footer',True);
  85              }
  86              $this->set_internal($extra_data);
  87              return $this->draw_box();
  88          }
  89      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7