~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to htdocs/manage/reminder_actions.php

First merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
// +----------------------------------------------------------------------+
6
6
// | Copyright (c) 2003 - 2008 MySQL AB                                   |
7
7
// | Copyright (c) 2008 - 2010 Sun Microsystem Inc.                       |
8
 
// | Copyright (c) 2011 - 2012 Eventum Team.                              |
 
8
// | Copyright (c) 2011 - 2013 Eventum Team.                              |
9
9
// |                                                                      |
10
10
// | This program is free software; you can redistribute it and/or modify |
11
11
// | it under the terms of the GNU General Public License as published by |
30
30
require_once dirname(__FILE__) . '/../../init.php';
31
31
 
32
32
$tpl = new Template_Helper();
33
 
$tpl->setTemplate("manage/index.tpl.html");
 
33
$tpl->setTemplate("manage/reminder_actions.tpl.html");
34
34
 
35
35
Auth::checkAuthentication(APP_COOKIE);
36
36
 
37
 
$tpl->assign("type", "reminder_actions");
38
 
 
39
37
$rem_id = @$_POST['rem_id'] ? $_POST['rem_id'] : $_GET['rem_id'];
40
38
 
41
39
$role_id = Auth::getCurrentRole();
42
 
if (($role_id == User::getRoleID('administrator')) || ($role_id == User::getRoleID('manager'))) {
43
 
    if ($role_id == User::getRoleID('administrator')) {
44
 
        $tpl->assign("show_setup_links", true);
45
 
    }
46
 
 
47
 
    if (@$_POST["cat"] == "new") {
48
 
        $tpl->assign("result", Reminder_Action::insert());
49
 
    } elseif (@$_POST["cat"] == "update") {
50
 
        $tpl->assign("result", Reminder_Action::update());
51
 
    } elseif (@$_POST["cat"] == "delete") {
52
 
        @Reminder_Action::remove($_POST['items']);
53
 
    }
54
 
 
55
 
    if (@$_GET["cat"] == "edit") {
56
 
        $tpl->assign("info", Reminder_Action::getDetails($_GET["id"]));
57
 
    } elseif (@$_GET["cat"] == "change_rank") {
58
 
        Reminder_Action::changeRank($_GET['rem_id'], $_GET['id'], $_GET['rank']);
59
 
    }
60
 
 
61
 
    $tpl->assign("rem_id", $rem_id);
62
 
    $tpl->assign("rem_title", Reminder::getTitle($rem_id));
63
 
    $tpl->assign("action_types", Reminder_Action::getActionTypeList());
64
 
    $tpl->assign("list", Reminder_Action::getAdminList($rem_id));
65
 
    $tpl->assign("user_options", User::getActiveAssocList(Reminder::getProjectID($rem_id), User::getRoleID('Customer')));
66
 
} else {
67
 
    $tpl->assign("show_not_allowed_msg", true);
68
 
}
 
40
if ($role_id < User::getRoleID('manager')) {
 
41
    Misc::setMessage("Sorry, you are not allowed to access this page.", Misc::MSG_ERROR);
 
42
    $tpl->displayTemplate();exit;
 
43
}
 
44
 
 
45
if (@$_POST["cat"] == "new") {
 
46
    $res = Reminder_Action::insert();
 
47
    Misc::mapMessages($res, array(
 
48
            1   =>  array(ev_gettext('Thank you, the action was added successfully.'), Misc::MSG_INFO),
 
49
            -1  =>  array(ev_gettext('An error occurred while trying to add the new action.'), Misc::MSG_ERROR),
 
50
            -2  =>  array(ev_gettext('Please enter the title for this new action.'), Misc::MSG_ERROR),
 
51
    ));
 
52
} elseif (@$_POST["cat"] == "update") {
 
53
    $res = Reminder_Action::update();
 
54
    Misc::mapMessages($res, array(
 
55
            1   =>  array(ev_gettext('Thank you, the action was updated successfully.'), Misc::MSG_INFO),
 
56
            -1  =>  array(ev_gettext('An error occurred while trying to update the action.'), Misc::MSG_ERROR),
 
57
            -2  =>  array(ev_gettext('Please enter the title for this action.'), Misc::MSG_ERROR),
 
58
    ));
 
59
} elseif (@$_POST["cat"] == "delete") {
 
60
    @Reminder_Action::remove($_POST['items']);
 
61
}
 
62
 
 
63
if (@$_GET["cat"] == "edit") {
 
64
    $tpl->assign("info", Reminder_Action::getDetails($_GET["id"]));
 
65
} elseif (@$_GET["cat"] == "change_rank") {
 
66
    Reminder_Action::changeRank($_GET['rem_id'], $_GET['id'], $_GET['rank']);
 
67
}
 
68
 
 
69
$tpl->assign("rem_id", $rem_id);
 
70
$tpl->assign("rem_title", Reminder::getTitle($rem_id));
 
71
$tpl->assign("action_types", Reminder_Action::getActionTypeList());
 
72
$tpl->assign("list", Reminder_Action::getAdminList($rem_id));
 
73
$tpl->assign("user_options", User::getActiveAssocList(Reminder::getProjectID($rem_id), User::getRoleID('Customer')));
69
74
 
70
75
$tpl->displayTemplate();