[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> adv_search.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: adv_search.php 3437 2007-11-10 00:52:16Z 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.project.php");
  39  require_once (APP_INC_PATH . "class.filter.php");
  40  require_once (APP_INC_PATH . "class.status.php");
  41  require_once (APP_INC_PATH . "class.user.php");
  42  
  43  $tpl = new Template_API();
  44  $tpl->setTemplate("adv_search.tpl.html");
  45  
  46  Auth::checkAuthentication(APP_COOKIE);
  47  
  48  // customers should not be able to see this page
  49  $role_id = Auth::getCurrentRole();
  50  if ($role_id == User::getRoleID('Customer')) {
  51      Auth::redirect(APP_RELATIVE_URL . "list.php");
  52  }
  53  
  54  $prj_id = Auth::getCurrentProject();
  55  
  56  // generate options for assign list. If there are groups and user is above a customer, include groups
  57  $groups = Group::getAssocList($prj_id);
  58  $users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer'));
  59  $assign_options = array(
  60      ""      =>  ev_gettext("Any"),
  61      "-1"    =>  ev_gettext("un-assigned"),
  62      "-2"    =>  ev_gettext("myself and un-assigned"),
  63  );
  64  if (User::getGroupID(Auth::getUserID()) != '') {
  65      $assign_options['-3'] = ev_gettext('myself and my group');
  66      $assign_options['-4'] = ev_gettext('myself, un-assigned and my group');
  67  }
  68  if ((count($groups) > 0) && ( $role_id > User::getRoleID("Customer"))) {
  69      foreach ($groups as $grp_id => $grp_name) {
  70          $assign_options["grp:$grp_id"] = "Group: " . $grp_name;
  71      }
  72  }
  73  $assign_options += $users;
  74  
  75  $tpl->assign(array(
  76      "cats"          => Category::getAssocList($prj_id),
  77      "priorities"    => Priority::getList($prj_id),
  78      "status"        => Status::getAssocStatusList($prj_id),
  79      "users"         => $assign_options,
  80      "releases"      => Release::getAssocList($prj_id, TRUE),
  81      "custom"        => Filter::getListing($prj_id),
  82      "custom_fields" =>  Custom_Field::getListByProject($prj_id, ''),
  83      "reporters"     => Project::getReporters($prj_id)
  84  ));
  85  
  86  if (!empty($_GET["custom_id"])) {
  87      $check_perm = true;
  88      if (Filter::isGlobal($_GET["custom_id"])) {
  89          if ($role_id >= User::getRoleID('Manager')) {
  90              $check_perm = false;
  91          }
  92      }
  93      $tpl->assign("options", Filter::getDetails($_GET["custom_id"], $check_perm));
  94  }
  95  
  96  $tpl->displayTemplate();


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