[ 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.portalbox.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare API - Portal Box manager                                      *
   4    * This file written by Joseph Engo <jengo@phpgroupware.org>                *
   5    * Helps manage the portal boxes for eGroupWares main page                  *
   6    * Copyright (C) 2000, 2001  Joseph Engo                                    *
   7    * -------------------------------------------------------------------------*
   8    * This library is part of the eGroupWare API                               *
   9    * http://www.egroupware.org/api                                            * 
  10    * ------------------------------------------------------------------------ *
  11    * This library is free software; you can redistribute it and/or modify it  *
  12    * under the terms of the GNU Lesser General Public License as published by *
  13    * the Free Software Foundation; either version 2.1 of the License,         *
  14    * or any later version.                                                    *
  15    * This library is distributed in the hope that it will be useful, but      *
  16    * WITHOUT ANY WARRANTY; without even the implied warranty of               *
  17    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
  18    * See the GNU Lesser General Public License for more details.              *
  19    * You should have received a copy of the GNU Lesser General Public License *
  20    * along with this library; if not, write to the Free Software Foundation,  *
  21    * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
  22    \**************************************************************************/
  23  
  24    /* $Id: class.portalbox.inc.php 15134 2004-05-05 12:06:13Z reinerj $ */
  25  
  26      class portalbox
  27      {
  28          //Set up the Object, reserving memory space for variables
  29  
  30          var $outerwidth;
  31          var $outerbordercolor;
  32          var $outerborderwidth = 1;
  33          var $titlebgcolor;
  34          var $width;
  35          var $innerwidth;
  36          var $innerbgcolor;
  37          var $controls;
  38          var $header_background_image;
  39          var $classname;
  40          var $up;
  41          var $down;
  42          var $close;
  43          var $question;
  44          var $edit;
  45          
  46          var $data = Array();
  47  
  48          // Textual variables
  49          var $title;
  50  
  51          // Template
  52          var $p;
  53  
  54          /*
  55          Use these functions to get and set the values of this
  56          object's variables. This is good OO practice, as it means
  57          that datatype checking can be completed and errors raised accordingly.
  58          */
  59  		function setvar($var,$value='')
  60          {
  61              if ($value=='')
  62              {
  63                  global $$var;
  64                  $value = $$var;
  65              }
  66              $this->$var = $value;
  67              // echo $var." = ".$this->$var."<br>\n";
  68          }
  69  
  70  		function getvar($var='')
  71          {
  72              if ($var=='' || !isset($this->$var))
  73              {
  74                  echo 'Programming Error: '.$this->getvar('classname').'->getvar('.$var.')!<br>'."\n";
  75                  $GLOBALS['phpgw']->common->phpgw_exit();
  76              }
  77              //echo "Var = ".$var."<br>\n";
  78              //echo $var." = ".$this->$var."<br>\n";
  79              return $this->$var;
  80          }
  81  
  82          /*
  83          This is the constructor for the object.
  84          */
  85  		function portalbox($title='', $primary='', $secondary='', $tertiary='')
  86          {
  87              $this->setvar('title',$title);
  88              // echo 'After SetVar Title = '.$this->getvar('title')."<br>\n";
  89              $this->setvar('titlebgcolor',$primary);
  90              $this->setvar('innerbgcolor',$secondary);
  91              $this->setvar('outerbordercolor',$tertiary);
  92          }
  93  
  94  		function start_template()
  95          {
  96              $this->p = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('home'));
  97              $this->p->set_file(
  98                  array(
  99                      'PORTAL'    => 'portal.tpl'
 100                  )
 101              );
 102  
 103              $this->p->set_block('PORTAL','portal_box','portal_box');
 104              $this->p->set_block('PORTAL','portal_row','portal_row');
 105              $this->p->set_block('PORTAL','portal_listbox_header','portal_listbox_header');
 106              $this->p->set_block('PORTAL','portal_listbox_link','portal_listbox_link');
 107              $this->p->set_block('PORTAL','portal_listbox_footer','portal_listbox_footer');
 108              $this->p->set_block('PORTAL','portal_control','portal_control');
 109              $this->p->set_block('PORTAL','link_field','link_field');
 110  
 111              $var = Array(
 112                  'outer_border'    => $this->getvar('outerborderwidth'),
 113                  'outer_width'    => $this->getvar('width'),
 114                  'outer_bordercolor'    => $this->getvar('outerbordercolor'),
 115                  'outer_bgcolor'    => $this->getvar('titlebgcolor'),
 116                  'title'    => $this->getvar('title'),
 117                  'inner_width'    => $this->getvar('width'),
 118                  'inner_bgcolor'    => $this->getvar('innerbgcolor'),
 119                  'header_background_image'    => $this->getvar('header_background_image'),
 120                  'control_link'    => ''
 121              );
 122              $this->p->set_var($var);
 123              $this->p->set_var('row','',False);
 124          }
 125  
 126  		function set_controls($control='',$control_param='')
 127          {
 128              if($control != '' && $control_param != '')
 129              {
 130                  $this->setvar($control,$GLOBALS['phpgw']->link($control_param['url'],'app='.$control_param['app'].'&control='.$control));
 131              }
 132          }
 133  
 134  		function set_internal($data='')
 135          {
 136              if($data=='' && !count($this->data))
 137              {
 138                  $data = '<td>&nbsp;</td>';
 139              }
 140              $this->p->set_var('output',$data);
 141              $this->p->parse('row','portal_row',true);
 142          }
 143  
 144  		function draw_box()
 145          {
 146              $control = '';
 147              if($this->up || $this->down || $this->close || $this->question || $this->edit)
 148              {
 149                  $control_array = Array(
 150                      'up',
 151                      'down',
 152                      /*'question',
 153                      'close',
 154                      'edit'*/
 155                  );
 156                  @reset($control_array);
 157                  while(list($key,$param) = each($control_array))
 158                  {
 159                      if(isset($this->$param) && $this->$param)
 160                      {
 161                          $image_width = 15;
 162                          if($param == 'edit')
 163                          {
 164                              $image_width = 30;
 165                          }
 166                          $this->p->set_var('link_field_data','<a href="'.$this->$param.'"><img src="'.$GLOBALS['phpgw']->common->image('phpgwapi',$param.'.button').'" border="0" width="'.$image_width.'" height="15" alt="'.lang($param).'"></a>');
 167                          $this->p->parse('control_link','link_field',True);
 168                      }
 169                  }
 170                  $this->p->parse('portal_controls','portal_control',True);
 171              }
 172              return $this->p->fp('out','portal_box');
 173          }
 174      }


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