30
30
require_once dirname(__FILE__) . '/../../init.php';
32
32
$tpl = new Template_Helper();
33
$tpl->setTemplate("manage/index.tpl.html");
33
$tpl->setTemplate("manage/reminder_actions.tpl.html");
35
35
Auth::checkAuthentication(APP_COOKIE);
37
$tpl->assign("type", "reminder_actions");
39
37
$rem_id = @$_POST['rem_id'] ? $_POST['rem_id'] : $_GET['rem_id'];
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);
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']);
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']);
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')));
67
$tpl->assign("show_not_allowed_msg", true);
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;
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),
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),
59
} elseif (@$_POST["cat"] == "delete") {
60
@Reminder_Action::remove($_POST['items']);
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']);
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')));
70
75
$tpl->displayTemplate();