[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/manage/ -> reminders.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: reminders.php 3206 2007-01-24 20:24:35Z 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.user.php");
  35  require_once (APP_INC_PATH . "class.project.php");
  36  require_once (APP_INC_PATH . "class.priority.php");
  37  require_once (APP_INC_PATH . "class.reminder.php");
  38  require_once (APP_INC_PATH . "class.issue.php");
  39  
  40  $tpl = new Template_API();
  41  $tpl->setTemplate("manage/index.tpl.html");
  42  
  43  Auth::checkAuthentication(APP_COOKIE);
  44  
  45  $tpl->assign("type", "reminders");
  46  
  47  $role_id = Auth::getCurrentRole();
  48  if (($role_id == User::getRoleID('administrator')) || ($role_id == User::getRoleID('manager'))) {
  49      if ($role_id == User::getRoleID('administrator')) {
  50          $tpl->assign("show_setup_links", true);
  51      }
  52  
  53      if (@$_POST["cat"] == "new") {
  54          $tpl->assign("result", Reminder::insert());
  55      } elseif (@$_POST["cat"] == "update") {
  56          $tpl->assign("result", Reminder::update());
  57      } elseif (@$_POST["cat"] == "delete") {
  58          Reminder::remove();
  59      }
  60  
  61      if (@$_GET["cat"] == "edit") {
  62          $info = Reminder::getDetails($_GET["id"]);
  63          if (!empty($_GET['prj_id'])) {
  64              $info['rem_prj_id'] = $_GET['prj_id'];
  65          }
  66          // only show customers and support levels if the selected project really needs it
  67          $project_has_customer_integration = Customer::hasCustomerIntegration($info['rem_prj_id']);
  68          $tpl->assign("project_has_customer_integration", $project_has_customer_integration);
  69          if ($project_has_customer_integration) {
  70              $tpl->assign("customers", Customer::getAssocList($info['rem_prj_id']));
  71              $backend_uses_support_levels = Customer::doesBackendUseSupportLevels($info['rem_prj_id']);
  72              if ($backend_uses_support_levels) {
  73                  $tpl->assign("support_levels", Customer::getSupportLevelAssocList($info['rem_prj_id']));
  74              }
  75              $tpl->assign("backend_uses_support_levels", $backend_uses_support_levels);
  76          }
  77          $tpl->assign('issues', Reminder::getIssueAssocListByProject($info['rem_prj_id']));
  78          $tpl->assign("info", $info);
  79          // wouldn't make much sense to create a reminder for a 'Not Prioritized' 
  80          // issue, so let's remove that as an option
  81          $priorities = array_flip(Priority::getAssocList($info['rem_prj_id']));
  82          unset($priorities['Not Prioritized']);
  83          $tpl->assign("priorities", array_flip($priorities));
  84      } elseif (@$_GET["cat"] == "change_rank") {
  85          Reminder::changeRank($_GET['id'], $_GET['rank']);
  86      } elseif (!empty($_GET['prj_id'])) {
  87          $tpl->assign("info", array('rem_prj_id' => $_GET['prj_id']));
  88          $tpl->assign('issues', Reminder::getIssueAssocListByProject($_GET['prj_id']));
  89          // wouldn't make much sense to create a reminder for a 'Not Prioritized' 
  90          // issue, so let's remove that as an option
  91          $priorities = array_flip(Priority::getAssocList($_GET['prj_id']));
  92          unset($priorities['Not Prioritized']);
  93          $tpl->assign("priorities", array_flip($priorities));
  94          // only show customers and support levels if the selected project really needs it
  95          $project_has_customer_integration = Customer::hasCustomerIntegration($_GET['prj_id']);
  96          $tpl->assign("project_has_customer_integration", $project_has_customer_integration);
  97          if ($project_has_customer_integration) {
  98              $tpl->assign("customers", Customer::getAssocList($_GET['prj_id']));
  99              $backend_uses_support_levels = Customer::doesBackendUseSupportLevels($_GET['prj_id']);
 100              if ($backend_uses_support_levels) {
 101                  $tpl->assign("support_levels", Customer::getSupportLevelAssocList($_GET['prj_id']));
 102              }
 103              $tpl->assign("backend_uses_support_levels", $backend_uses_support_levels);
 104          }
 105      }
 106  
 107      $tpl->assign("project_list", Project::getAll());
 108      $tpl->assign("list", Reminder::getAdminList());
 109  } else {
 110      $tpl->assign("show_not_allowed_msg", true);
 111  }
 112  
 113  $tpl->displayTemplate();


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