[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/manage/ -> users.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: users.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.project.php");
  35  require_once (APP_INC_PATH . "db_access.php");
  36  
  37  $tpl = new Template_API();
  38  $tpl->setTemplate("manage/index.tpl.html");
  39  
  40  Auth::checkAuthentication(APP_COOKIE);
  41  
  42  $tpl->assign("type", "users");
  43  
  44  $role_id = Auth::getCurrentRole();
  45  if (($role_id == User::getRoleID('administrator')) || ($role_id == User::getRoleID('manager'))) {
  46      if ($role_id == User::getRoleID('administrator')) {
  47          $tpl->assign("show_setup_links", true);
  48          $excluded_roles = array('customer');
  49      } else {
  50          $excluded_roles = array('customer', 'administrator');
  51      }
  52  
  53      if (@$_POST["cat"] == "new") {
  54          $tpl->assign("result", User::insert());
  55      } elseif (@$_POST["cat"] == "update") {
  56          $tpl->assign("result", User::update());
  57      } elseif (@$_POST["cat"] == "change_status") {
  58          User::changeStatus();
  59      }
  60  
  61      $project_roles = array();
  62      $project_list = Project::getAll();
  63      if (@$_GET["cat"] == "edit") {
  64          $info = User::getDetails($_GET["id"]);
  65          $tpl->assign("info", $info);
  66      }
  67      foreach ($project_list as $prj_id => $prj_title) {
  68          if (@$info['roles'][$prj_id]['pru_role'] == User::getRoleID('Customer')) {
  69              if (count($excluded_roles) == 1) {
  70                  $excluded_roles = false;
  71              } else {
  72                  $excluded_roles = array('administrator');
  73              }
  74          }
  75          if (@$info['roles'][$prj_id]['pru_role'] == User::getRoleID("administrator")) {
  76              $excluded_roles = false;
  77          }
  78          $project_roles[$prj_id] = $user_roles = array(0 => "No Access") + User::getRoles($excluded_roles);
  79      }
  80      if (@$_GET['show_customers'] == 1) {
  81          $show_customer = true;
  82      } else {
  83          $show_customer = false;
  84      }
  85      $tpl->assign("list", User::getList($show_customer));
  86      $tpl->assign("project_list", $project_list);
  87      $tpl->assign("project_roles", $project_roles);
  88  } else {
  89      $tpl->assign("show_not_allowed_msg", true);
  90  }
  91  
  92  $tpl->displayTemplate();


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