include_once APP_INC_PATH . "class.status.php";
include_once APP_INC_PATH . "class.reminder.php";
include_once APP_INC_PATH . "class.reminder_action.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "reminder_conditions");
$rem_id = @$HTTP_POST_VARS['rem_id'] ? $HTTP_POST_VARS['rem_id'] : $HTTP_GET_VARS['rem_id'];
$rma_id = @$HTTP_POST_VARS['rma_id'] ? $HTTP_POST_VARS['rma_id'] : $HTTP_GET_VARS['rma_id'];
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
    if ($role_id == User::getRoleID('administrator')) {
        $tpl->assign("show_setup_links", true);
    }
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", Reminder_Condition::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", Reminder_Condition::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        Reminder_Condition::remove();
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $info = Reminder_Condition::getDetails($HTTP_GET_VARS["id"]);
        if (!empty($HTTP_GET_VARS['field'])) {
            $info['rlc_rmf_id'] = $HTTP_GET_VARS['field'];
        } else {
            $HTTP_GET_VARS['field'] = $info['rlc_rmf_id'];
        }
        $tpl->assign("info", $info);
    }
    if (!empty($HTTP_GET_VARS['field'])) {
예제 #2
0
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/reminder_conditions.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$rem_id = @$_POST['rem_id'] ? $_POST['rem_id'] : $_GET['rem_id'];
$rma_id = @$_POST['rma_id'] ? $_POST['rma_id'] : $_GET['rma_id'];
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('manager')) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'new') {
    $res = Reminder_Condition::insert();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the condition was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new condition.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new condition.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    $res = Reminder_Condition::update();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the condition was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the condition.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this condition.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    Reminder_Condition::remove();
}
if (@$_GET['cat'] == 'edit') {
    $info = Reminder_Condition::getDetails($_GET['id']);
    if (!empty($_GET['field'])) {
        $info['rlc_rmf_id'] = $_GET['field'];
    } else {
        $_GET['field'] = $info['rlc_rmf_id'];
    }
    $tpl->assign('info', $info);