[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/timesheet/inc/ -> class.datasource_timesheet.inc.php (source)

   1  <?php
   2  /**************************************************************************\
   3  * eGroupWare - ProjectManager - DataSource for TimeSheet                   *
   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.datasource_timesheet.inc.php 21268 2006-04-08 06:25:07Z ralfbecker $ */
  14  
  15  include_once (EGW_INCLUDE_ROOT.'/projectmanager/inc/class.datasource.inc.php');
  16  include_once ('class.botimesheet.inc.php');
  17  
  18  /**
  19   * DataSource for the TimeSheet
  20   *
  21   * @package timesheet
  22   * @author RalfBecker-AT-outdoor-training.de
  23   * @copyright (c) 2005 by RalfBecker-AT-outdoor-training.de
  24   * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
  25   */
  26  class datasource_timesheet extends datasource
  27  {
  28      /**
  29       * Constructor
  30       */
  31  	function datasource_timesheet()
  32      {
  33          $this->datasource(TIMESHEET_APP);
  34          
  35          $this->valid = PM_REAL_START|PM_REAL_END|PM_USED_TIME|PM_USED_BUDGET|PM_USED_QUANTITY|
  36              PM_PRICELIST_ID|PM_UNITPRICE|PM_RESOURCES|PM_DETAILS|PM_COMPLETION;
  37      }
  38      
  39      /**
  40       * get an entry from the underlaying app (if not given) and convert it into a datasource array
  41       * 
  42       * @param mixed $data_id id as used in the link-class for that app, or complete entry as array
  43       * @return array/boolean array with the data supported by that source or false on error (eg. not found, not availible)
  44       */
  45  	function get($data_id)
  46      {
  47          // we use $GLOBALS['bocal'] as an already running instance is availible there
  48          if (!is_object($GLOBALS['botimesheet']))
  49          {
  50              $GLOBALS['botimesheet'] =& new botimesheet();
  51          }
  52          if (!is_array($data_id))
  53          {
  54              if (!(int) $data_id || !($data = $GLOBALS['botimesheet']->read((int) $data_id)))
  55              {
  56                  return false;
  57              }
  58          }
  59          else
  60          {
  61              $data =& $data_id;
  62          }
  63          $ds = array(
  64              'pe_title'       => $GLOBALS['botimesheet']->link_title($data),
  65              'pe_real_start'  => $data['ts_start'],
  66              'pe_resources'   => array($data['ts_owner']),
  67              'pe_details'     => $data['ts_description'] ? nl2br($data['ts_description']) : '',
  68              'pl_id'          => $data['pl_id'],
  69              'pe_unitprice'   => $data['ts_unitprice'],
  70              'pe_used_quantity' => $data['ts_quantity'],
  71              'pe_used_budget' => $data['ts_quantity'] * $data['ts_unitprice'],
  72              'pe_completion'  => 100,
  73          );
  74          if ($data['ts_duration'])
  75          {
  76              $ds['pe_real_end'] = $data['ts_start'] + 60*$data['ts_duration'];
  77              $ds['pe_used_time'] = $data['ts_duration'];
  78          }
  79          if ($this->debug)
  80          {
  81              echo "datasource_timesheet($data_id) data="; _debug_array($data);
  82              echo "datasource="; _debug_array($ds);
  83          }
  84          return $ds;
  85      }
  86  
  87      /**
  88       * Copy method (usally copies a projectelement) returns only false to prevent copying
  89       *
  90       * @param array $element source project element representing an InfoLog entry, $element['pe_app_id'] = info_id
  91       * @param int $target target project id
  92       * @param array $target_data=null data of target-project, atm not used by the infolog datasource
  93       * @return array/boolean array(info_id,link_id) on success, false otherwise
  94       */
  95  	function copy($element,$target,$extra=null)
  96      {
  97          return false;
  98      }
  99  }


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