예제 #1
0
 /**
  * Method used to remove reminders by using the administrative
  * interface of the system.
  *
  * @access  public
  * @return  boolean
  */
 function remove()
 {
     global $HTTP_POST_VARS;
     $items = @implode(", ", Misc::escapeInteger($HTTP_POST_VARS["items"]));
     $stmt = "DELETE FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_level\n                 WHERE\n                    rem_id IN ({$items})";
     $res = $GLOBALS["db_api"]->dbh->query($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return false;
     } else {
         Reminder::removeAllAssociations($HTTP_POST_VARS["items"]);
         $stmt = "SELECT\n                        rma_id\n                     FROM\n                        " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_action\n                     WHERE\n                        rma_rem_id IN ({$items})";
         $actions = $GLOBALS["db_api"]->dbh->getCol($stmt);
         if (count($actions) > 0) {
             Reminder_Action::remove($actions);
         }
         return true;
     }
 }
예제 #2
0
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/reminder_actions.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$rem_id = @$_POST['rem_id'] ? $_POST['rem_id'] : $_GET['rem_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_Action::insert();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the action was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new action.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new action.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    $res = Reminder_Action::update();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the action was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the action.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this action.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    @Reminder_Action::remove($_POST['items']);
}
if (@$_GET['cat'] == 'edit') {
    $tpl->assign('info', Reminder_Action::getDetails($_GET['id']));
} elseif (@$_GET['cat'] == 'change_rank') {
    Reminder_Action::changeRank($_GET['rem_id'], $_GET['id'], $_GET['rank']);
}
$tpl->assign('rem_id', $rem_id);
$tpl->assign('rem_title', Reminder::getTitle($rem_id));
$tpl->assign('action_types', Reminder_Action::getActionTypeList());
$tpl->assign('list', Reminder_Action::getAdminList($rem_id));
$tpl->assign('user_options', User::getActiveAssocList(Reminder::getProjectID($rem_id), User::getRoleID('Customer')));
$tpl->displayTemplate();
예제 #3
0
 /**
  * Method used to remove reminders by using the administrative
  * interface of the system.
  *
  * @return  boolean
  */
 public static function remove()
 {
     $items = $_POST['items'];
     $itemlist = DB_Helper::buildList($items);
     $stmt = "DELETE FROM\n                    {{%reminder_level}}\n                 WHERE\n                    rem_id IN ({$itemlist})";
     try {
         DB_Helper::getInstance()->query($stmt, $items);
     } catch (DbException $e) {
         return false;
     }
     self::removeAllAssociations($items);
     $stmt = "SELECT\n                    rma_id\n                 FROM\n                    {{%reminder_action}}\n                 WHERE\n                    rma_rem_id IN ({$itemlist})";
     $actions = DB_Helper::getInstance()->getColumn($stmt, $items);
     if (count($actions) > 0) {
         Reminder_Action::remove($actions);
     }
     return true;
 }
예제 #4
0
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "reminder_actions");
$rem_id = @$HTTP_POST_VARS['rem_id'] ? $HTTP_POST_VARS['rem_id'] : $HTTP_GET_VARS['rem_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_Action::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", Reminder_Action::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        @Reminder_Action::remove($HTTP_POST_VARS['items']);
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $tpl->assign("info", Reminder_Action::getDetails($HTTP_GET_VARS["id"]));
    } elseif (@$HTTP_GET_VARS["cat"] == "change_rank") {
        Reminder_Action::changeRank($HTTP_GET_VARS['rem_id'], $HTTP_GET_VARS['id'], $HTTP_GET_VARS['rank']);
    }
    $tpl->assign("rem_id", $rem_id);
    $tpl->assign("rem_title", Reminder::getTitle($rem_id));
    $tpl->assign("action_types", Reminder_Action::getActionTypeList());
    $tpl->assign("list", Reminder_Action::getAdminList($rem_id));
    $tpl->assign("user_options", User::getActiveAssocList(Reminder::getProjectID($rem_id), User::getRoleID('Customer')));
} else {
    $tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();