$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'])) {
        $field_title = Reminder_Condition::getFieldTitle($HTTP_GET_VARS['field']);
        if (Reminder_Condition::canFieldBeCompared($HTTP_GET_VARS['field'])) {
            $tpl->assign(array('show_field_options' => 'yes', 'comparable_fields' => Reminder_Condition::getFieldAdminList(true)));
        } elseif (strtolower($field_title) == 'status') {