[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> list.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: João Prado Maia <jpm@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: list.php 3258 2007-02-14 23:25:56Z glen $
  29  
  30  require_once(dirname(__FILE__) . "/init.php");
  31  require_once (APP_INC_PATH . "db_access.php");
  32  require_once (APP_INC_PATH . "class.template.php");
  33  require_once (APP_INC_PATH . "class.auth.php");
  34  require_once (APP_INC_PATH . "class.category.php");
  35  require_once (APP_INC_PATH . "class.priority.php");
  36  require_once (APP_INC_PATH . "class.misc.php");
  37  require_once (APP_INC_PATH . "class.release.php");
  38  require_once (APP_INC_PATH . "class.issue.php");
  39  require_once (APP_INC_PATH . "class.project.php");
  40  require_once (APP_INC_PATH . "class.filter.php");
  41  require_once (APP_INC_PATH . "class.status.php");
  42  require_once (APP_INC_PATH . "class.user.php");
  43  require_once (APP_INC_PATH . "class.group.php");
  44  require_once (APP_INC_PATH . "class.display_column.php");
  45  require_once (APP_INC_PATH . "class.search_profile.php");
  46  
  47  $tpl = new Template_API();
  48  $tpl->setTemplate("list.tpl.html");
  49  
  50  Auth::checkAuthentication(APP_COOKIE);
  51  $usr_id = Auth::getUserID();
  52  $prj_id = Auth::getCurrentProject();
  53  
  54  $pagerRow = Issue::getParam('pagerRow');
  55  if (empty($pagerRow)) {
  56      $pagerRow = 0;
  57  }
  58  $rows = Issue::getParam('rows');
  59  if (empty($rows)) {
  60      $rows = APP_DEFAULT_PAGER_SIZE;
  61  }
  62  
  63  if (@$_REQUEST['view'] == 'my_assignments') {
  64      $profile = Search_Profile::getProfile($usr_id, $prj_id, 'issue');
  65      Search_Profile::remove($usr_id, $prj_id, 'issue');
  66      Auth::redirect(APP_RELATIVE_URL . "list.php?users=$usr_id&hide_closed=1&rows=$rows&sort_by=" .
  67              $profile['sort_by'] . "&sort_order=" . $profile['sort_order']);
  68  }
  69  
  70  $options = Issue::saveSearchParams();
  71  $tpl->assign("options", $options);
  72  $tpl->assign("sorting", Issue::getSortingInfo($options));
  73  
  74  // generate options for assign list. If there are groups and user is above a customer, include groups
  75  $groups = Group::getAssocList($prj_id);
  76  $users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer'));
  77  $assign_options = array(
  78      ""      =>  ev_gettext("Any"),
  79      "-1"    =>  ev_gettext("un-assigned"),
  80      "-2"    =>  ev_gettext("myself and un-assigned")
  81  );
  82  if (User::getGroupID($usr_id) != '') {
  83      $assign_options['-3'] = ev_gettext('myself and my group');
  84      $assign_options['-4'] = ev_gettext('myself, un-assigned and my group');
  85  }
  86  if ((count($groups) > 0) && (Auth::getCurrentRole() > User::getRoleID("Customer"))) {
  87      foreach ($groups as $grp_id => $grp_name) {
  88          $assign_options["grp:$grp_id"] = ev_gettext("Group") . ": " . $grp_name;
  89      }
  90  }
  91  $assign_options += $users;
  92  
  93  // get display values for custom fields
  94  $custom_fields_display = array();
  95  if ((is_array($options['custom_field'])) && (count($options['custom_field']) > 0)) {
  96      foreach ($options['custom_field'] as $fld_id => $search_value) {
  97          if (empty($search_value)) {
  98              continue;
  99          }
 100          $field = Custom_Field::getDetails($fld_id);
 101          if (($field['fld_type'] == 'combo') || ($field['fld_type'] == 'multiple')) {
 102              $custom_fields_display[$fld_id] = join(', ', Custom_Field::getOptions($fld_id, $search_value));
 103          }
 104      }
 105  }
 106  
 107  $list = Issue::getListing($prj_id, $options, $pagerRow, $rows);
 108  $tpl->assign("list", $list["list"]);
 109  $tpl->assign("list_info", $list["info"]);
 110  $tpl->assign("csv_data", base64_encode(@$list["csv"]));
 111  
 112  $tpl->assign("columns", Display_Column::getColumnsToDisplay($prj_id, 'list_issues'));
 113  $tpl->assign("priorities", Priority::getAssocList($prj_id));
 114  $tpl->assign("status", Status::getAssocStatusList($prj_id));
 115  $tpl->assign("open_status", Status::getAssocStatusList($prj_id, false));
 116  $tpl->assign("users", $users);
 117  $tpl->assign("assign_options", $assign_options);
 118  $tpl->assign("custom", Filter::getAssocList($prj_id));
 119  $tpl->assign("csts", Filter::getListing(true));
 120  $tpl->assign("filter_info", Filter::getFiltersInfo());
 121  $tpl->assign("categories", Category::getAssocList($prj_id));
 122  $tpl->assign("releases", Release::getAssocList($prj_id, true));
 123  $tpl->assign("available_releases", Release::getAssocList($prj_id));
 124  $tpl->assign("groups", $groups);
 125  $tpl->assign("custom_fields_display", $custom_fields_display);
 126  $tpl->assign("reporters", Project::getReporters($prj_id));
 127  
 128  $prefs = Prefs::get($usr_id);
 129  $tpl->assign("refresh_rate", $prefs['list_refresh_rate'] * 60);
 130  $tpl->assign("refresh_page", "list.php");
 131  
 132  $tpl->displayTemplate();


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