[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/reports/ -> custom_fields.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: custom_fields.php 3364 2007-08-27 09:58:52Z 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.custom_field.php");
  35  require_once (APP_INC_PATH . "db_access.php");
  36  
  37  $tpl = new Template_API();
  38  $tpl->setTemplate("reports/custom_fields.tpl.html");
  39  
  40  Auth::checkAuthentication(APP_COOKIE);
  41  
  42  if (Auth::getCurrentRole() <= User::getRoleID("Customer")) {
  43      echo "Invalid role";
  44      exit;
  45  }
  46  
  47  $prj_id = Auth::getCurrentProject();
  48  
  49  // get list of fields and convert info useful arrays
  50  $fields = Custom_Field::getListByProject($prj_id, '');
  51  $custom_fields = array();
  52  $options = array();
  53  if (is_array($fields) && count($fields) > 0) {
  54      foreach ($fields as $field) {
  55          $custom_fields[$field["fld_id"]] = $field["fld_title"];
  56          $options[$field["fld_id"]] = Custom_Field::getOptions($field["fld_id"]);
  57      }
  58  } else {
  59      echo ev_gettext("No custom fields for this project");
  60      exit;
  61  }
  62  
  63  if ((!empty($_REQUEST['start']['Year'])) && (!empty($_REQUEST['start']['Month'])) &&(!empty($_REQUEST['start']['Day']))) {
  64      $start = join('-', $_REQUEST['start']);
  65  } else {
  66      $start = false;
  67  }
  68  if ((!empty($_REQUEST['end']['Year'])) && (!empty($_REQUEST['end']['Month'])) &&(!empty($_REQUEST['end']['Day']))) {
  69      $end = join('-', $_REQUEST['end']);
  70  } else {
  71      $end = false;
  72  }
  73  
  74  if (count(@$_GET['custom_field']) > 0) {
  75      $data = Report::getCustomFieldReport(@$_GET["custom_field"], @$_GET["custom_options"], @$_GET["group_by"], $start, $end, true, @$_REQUEST['interval'],
  76                          @$_REQUEST['assignee']);
  77  }
  78  
  79  if (($start == false) || ($end = false)) {
  80      $start = '--';
  81      $end = '--';
  82  }
  83  
  84  $tpl->assign(array(
  85      "custom_fields" =>  $custom_fields,
  86      "custom_field"  =>  @$_GET["custom_field"],
  87      "options"   =>  $options,
  88      "custom_options"    =>  @$_GET["custom_options"],
  89      "group_by"      =>  @$_GET["group_by"],
  90      "selected_options"  => @$_REQUEST['custom_options'],
  91      "data"  =>  @$data,
  92      "start_date"=>  $start,
  93      "end_date"  =>  $end,
  94      "assignees" =>  Project::getUserAssocList($prj_id, 'active', User::getRoleID("Customer")),
  95      "assignee"  =>  @$_REQUEST['assignee'],
  96  ));
  97  
  98  if (isset($_GET["custom_field"])) {
  99      $tpl->assign(array(
 100          "field_info"  =>  Custom_Field::getDetails($_GET['custom_field'])
 101      ));
 102  }
 103  
 104  $tpl->displayTemplate();


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