[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/projectmanager/inc/ -> class.projectmanager_widget.inc.php (source)

   1  <?php
   2  /**************************************************************************\
   3  * eGroupWare - ProjectManager - eTemplates Widgets                         *
   4  * http://www.egroupware.org                                                *
   5  * Written and (c) 2005 by Ralf Becker <RalfBecker@outdoor-training.de>     *
   6  * --------------------------------------------                             *
   7  *  This program is free software; you can redistribute it and/or modify it *
   8  *  under the terms of the GNU General Public License as published by the   *
   9  *  Free Software Foundation; either version 2 of the License, or (at your  *
  10  *  option) any later version.                                              *
  11  \**************************************************************************/
  12  
  13  /* $Id: class.projectmanager_widget.inc.php 20226 2006-01-11 05:15:43Z ralfbecker $ */
  14  
  15  /**
  16   * ProjectManager: eTemplate widgets
  17   *
  18   * The Select Price Widget show the pricelist of the project with pm_id=$content['pm_id']!!!
  19   *
  20   * @package projectmanager
  21   * @author RalfBecker-AT-outdoor-training.de
  22   * @copyright (c) 2005 by RalfBecker-AT-outdoor-training.de
  23   * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
  24   */
  25  class projectmanager_widget
  26  {
  27      /** 
  28       * @var array $public_functions exported methods of this class
  29       */
  30      var $public_functions = array(
  31          'pre_process' => True,
  32      );
  33      /**
  34       * @var array $human_name availible extensions and there names for the editor
  35       */
  36      var $human_name = array(
  37          'projectmanager-select'    => 'Select Project',
  38          'projectmanager-pricelist' => 'Select Price',
  39      );
  40  
  41      /**
  42       * Constructor of the extension
  43       *
  44       * @param string $ui '' for html
  45       */
  46  	function projectmanager_widget($ui)
  47      {
  48          $this->ui = $ui;
  49      }
  50  
  51      /**
  52       * pre-processing of the extension
  53       *
  54       * This function is called before the extension gets rendered
  55       *
  56       * @param string $name form-name of the control
  57       * @param mixed &$value value / existing content, can be modified
  58       * @param array &$cell array with the widget, can be modified for ui-independent widgets 
  59       * @param array &$readonlys names of widgets as key, to be made readonly
  60       * @param mixed &$extension_data data the extension can store persisten between pre- and post-process
  61       * @param object &$tmpl reference to the template we belong too
  62       * @return boolean true if extra label is allowed, false otherwise
  63       */
  64  	function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
  65      {
  66          static $pricelist = array();
  67          // check if user has rights to run projectmanager
  68          if (!$GLOBALS['egw_info']['user']['apps']['projectmanager'])
  69          {
  70              $cell = $tmpl->empty_cell();
  71              $value = '';
  72              return false;
  73          }
  74          list($rows,$type,$type2,$type3) = explode(',',$cell['size']);
  75  
  76          $extension_data['type'] = $cell['type'];
  77  
  78          switch ($cell['type'])
  79          {
  80              case 'projectmanager-select':
  81                  if (!is_object($GLOBALS['boprojectmanager']))
  82                  {
  83                      CreateObject('projectmanager.boprojectmanager');    // assigns itselft to $GLOBALS['boprojectmanager']
  84                  }
  85                  $cell['sel_options'] = $GLOBALS['boprojectmanager']->link_query('');
  86                  if (!$cell['help']) $cell['help'] = /*lang(*/ 'Select a project' /*)*/;
  87                  break;
  88  
  89              case 'projectmanager-pricelist':
  90                  $pm_id = (int) $tmpl->content['pm_id'];
  91                  // some caching for the pricelist, in case it's needed multiple times
  92                  if (!isset($pricelist[$pm_id]))
  93                  {
  94                      if (!is_object($this->pricelist))
  95                      {
  96                          $this->pricelist =& CreateObject('projectmanager.bopricelist');
  97                      }
  98                      $pricelist[$pm_id] = $this->pricelist->pricelist($pm_id);
  99                  }
 100                  $cell['sel_options'] = $pricelist[$pm_id];
 101                  if (!$cell['help']) $cell['help'] = /*lang(*/ 'Select a price' /*)*/;
 102                  break;
 103          }
 104          $cell['no_lang'] = True;
 105          $cell['type'] = 'select';
 106          if ($rows > 1)
 107          {
 108              unset($cell['sel_options']['']);
 109          }
 110          return True;    // extra Label Ok
 111      }
 112  }


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