[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/reports/ -> estimated_dev_time.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                              |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: Bryan Alsdorf <bryan@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  require_once(dirname(__FILE__) . "/../init.php");
  29  require_once (APP_INC_PATH . "class.template.php");
  30  require_once (APP_INC_PATH . "class.auth.php");
  31  require_once (APP_INC_PATH . "class.report.php");
  32  require_once (APP_INC_PATH . "class.date.php");
  33  require_once (APP_INC_PATH . "db_access.php");
  34  require_once (APP_INC_PATH . "class.customer.php");
  35  require_once (APP_INC_PATH . "class.customer_stats_report.php");
  36  require_once (APP_INC_PATH . "class.session.php");
  37  
  38  $tpl = new Template_API();
  39  $tpl->setTemplate("reports/estimated_dev_time.tpl.html");
  40  
  41  Auth::checkAuthentication(APP_COOKIE);
  42  
  43  if (Auth::getCurrentRole() <= User::getRoleID("Customer")) {
  44      echo "Invalid role";
  45      exit;
  46  }
  47  
  48  $sql = "SELECT
  49              prc_id,
  50              prc_title,
  51              SUM(iss_dev_time) as dev_time
  52          FROM
  53              " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,
  54              " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_category,
  55              " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status
  56          WHERE
  57              iss_prc_id = prc_id AND
  58              iss_sta_id = sta_id AND
  59              sta_is_closed != 1 AND
  60              iss_prj_id = " . Auth::getCurrentProject() . "
  61          GROUP BY
  62              iss_prc_id";
  63  $res = $GLOBALS["db_api"]->dbh->getAll($sql, DB_FETCHMODE_ASSOC);
  64  if (PEAR::isError($res)) {
  65      Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
  66      return false;
  67  }
  68  $total = 0;
  69  foreach ($res as $id => $row) {
  70      $total += $row['dev_time'];
  71      $res[$id]['dev_time'] = str_replace(" ", "&nbsp;", str_pad($row['dev_time'], 5, ' ', STR_PAD_LEFT));
  72  }
  73  $res[] = array(
  74      'dev_time'  =>  str_replace(" ", "&nbsp;", str_pad($total, 5, ' ', STR_PAD_LEFT)),
  75      'prc_title' =>  'Total'
  76  );
  77  $tpl->assign("data", $res);
  78  
  79  $tpl->displayTemplate();


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7