[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/reports/ -> workload_date_range.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  // @(#) $Id: workload_date_range.php 3499 2007-12-05 07:00:18Z balsdorf $
  29  //
  30  require_once(dirname(__FILE__) . "/../init.php");
  31  require_once (APP_INC_PATH . "class.template.php");
  32  require_once (APP_INC_PATH . "class.auth.php");
  33  require_once (APP_INC_PATH . "class.report.php");
  34  require_once (APP_INC_PATH . "class.session.php");
  35  require_once (APP_INC_PATH . "class.category.php");
  36  require_once (APP_INC_PATH . "db_access.php");
  37  
  38  $tpl = new Template_API();
  39  $tpl->setTemplate("reports/workload_date_range.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  $prj_id = Auth::getCurrentProject();
  49  
  50  $types = array(
  51      "individual"    =>  "Individual",
  52      "aggregate"     =>  "Aggregate"
  53  );
  54  
  55  
  56  if (count(@$_REQUEST["start"]) > 0 &&
  57          (@$_REQUEST["start"]["Year"] != 0) &&
  58          (@$_REQUEST["start"]["Month"] != 0) &&
  59          (@$_REQUEST["start"]["Day"] != 0)) {
  60      $start_date = join("-", $_REQUEST["start"]);
  61  } else {
  62      // if empty start date, set to be a month ago
  63      $start_date = date("Y-m-d", time() - MONTH);
  64  }
  65  if (count(@$_REQUEST["end"]) > 0 &&
  66          (@$_REQUEST["end"]["Year"] != 0) &&
  67          (@$_REQUEST["end"]["Month"] != 0) &&
  68          (@$_REQUEST["end"]["Day"] != 0)) {
  69      $end_date = join("-", $_REQUEST["end"]);
  70  } else {
  71      $end_date = date("Y-m-d");
  72  }
  73  
  74  
  75  if (!empty($_REQUEST["interval"])) {
  76      $data = Report::getWorkloadByDateRange($_REQUEST["interval"], $_REQUEST["type"], $start_date, date('Y-m-d', (strtotime($end_date) + DAY)), @$_REQUEST['category']);
  77      Session::set("workload_date_range_data", $data);
  78      $tpl->assign("data", $data);
  79    //  echo "<pre>";print_r($data);echo "</pre>";
  80  }
  81  
  82  $tpl->assign(array(
  83      "interval"  =>  @$_REQUEST["interval"],
  84      "types" =>  $types,
  85      "type"  =>  @$_REQUEST["type"],
  86      "start_date"    =>  $start_date,
  87      "end_date"  =>  $end_date,
  88      'categories'    =>  Category::getAssocList($prj_id),
  89      'category'  =>  @$_REQUEST['category'],
  90  ));
  91  $tpl->displayTemplate();


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