[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/manage/ -> column_display.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: column_display.php 3206 2007-01-24 20:24:35Z glen $
  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.user.php");
  34  require_once (APP_INC_PATH . "class.display_column.php");
  35  require_once (APP_INC_PATH . "db_access.php");
  36  
  37  $prj_id = $_REQUEST['prj_id'];
  38  
  39  $tpl = new Template_API();
  40  $tpl->setTemplate("manage/index.tpl.html");
  41  
  42  Auth::checkAuthentication(APP_COOKIE);
  43  
  44  $tpl->assign("type", "column_display");
  45  
  46  $role_id = Auth::getCurrentRole();
  47  if (($role_id == User::getRoleID('administrator')) || ($role_id == User::getRoleID('manager'))) {
  48      if ($role_id == User::getRoleID('administrator')) {
  49          $tpl->assign("show_setup_links", true);
  50      }
  51  
  52      if (@$_POST["cat"] == "save") {
  53          $tpl->assign("result", Display_Column::save());
  54      }
  55  
  56      $page = 'list_issues';
  57      $available = Display_Column::getAllColumns($page);
  58      $selected = Display_Column::getSelectedColumns($prj_id, $page);
  59      
  60      // re-order available array to match rank
  61      $available_ordered = array();
  62      foreach ($selected as $field_name => $field_info) {
  63          $available_ordered[$field_name] = $available[$field_name];
  64          unset($available[$field_name]);
  65      }
  66      if (count($available) > 0) {
  67          $available_ordered += $available;
  68      }
  69      
  70      $excluded_roles = array();
  71      if (!Customer::hasCustomerIntegration($prj_id)) {
  72          $excluded_roles[] = "customer";
  73      }
  74      $user_roles = User::getRoles($excluded_roles);
  75      $user_roles[9] = "Never Display";
  76      
  77      // generate ranks
  78      $ranks = array();
  79      for ($i = 1; $i <= count($available_ordered); $i++) {
  80          $ranks[$i] = $i;
  81      }
  82      
  83      $tpl->assign(array(
  84          "available" =>  $available_ordered,
  85          "selected"  =>  $selected,
  86          "user_roles"=>  $user_roles,
  87          "page"      =>  $page,
  88          "ranks"     =>  $ranks,
  89          "prj_id"    =>  $prj_id,
  90          "project_name"  =>  Project::getName($prj_id)
  91      ));
  92  } else {
  93      $tpl->assign("show_not_allowed_msg", true);
  94  }
  95  
  96  $tpl->displayTemplate();


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