当前位置: 首页>>代码示例>>PHP>>正文


PHP Check::delete方法代码示例

本文整理汇总了PHP中Check::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::delete方法的具体用法?PHP Check::delete怎么用?PHP Check::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Check的用法示例。


在下文中一共展示了Check::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

fAuthorization::requireLoggedIn();
fRequest::overrideAction();
$breadcrumbs[] = array('name' => 'Checks', 'url' => Check::makeUrl('list'), 'active' => false);
$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete'));
$sort = fCRUD::getSortColumn(array('name', 'target', 'warn', 'error', 'status', 'timestamp', 'count'));
$sort_dir = fCRUD::getSortDirection('asc');
$check_id = fRequest::get('check_id', 'integer');
$check_list_url = Check::makeURL('list');
// --------------------------------- //
if ('delete' == $action) {
    try {
        $obj = new Check($check_id);
        $delete_text = 'Are you sure you want to delete the check : <strong>' . $obj->getName() . '</strong>?';
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $obj->delete();
            // Do our own Subscription and CheckResult cleanup instead of using ORM
            $subscriptions = Subscription::findAll($check_id);
            foreach ($subscriptions as $subscription) {
                $subscription->delete();
            }
            $check_results = CheckResult::findAll($check_id);
            foreach ($check_results as $check_result) {
                $check_result->delete();
            }
            fMessaging::create('success', fURL::get(), 'The check ' . $obj->getName() . ' was successfully deleted');
            fURL::redirect($check_list_url);
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', fURL::get(), 'The check requested, ' . fHTML::encode($date) . ', could not be found');
        fURL::redirect($check_list_url);
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:31,代码来源:check.php

示例2: deleteCheck

function deleteCheck()
{
    global $tool, $form;
    if (is_numeric($_GET[checkid])) {
        $check = new Check($_GET[checkid]);
    } else {
        $form->warning("Invalid Check id");
        return;
    }
    // Confimration part
    if (isset($_POST['deleteYes'])) {
        if ($check->delete()) {
            echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['PHP_SELF'] . "?action=list_checks&delete=success\">";
        } else {
            $form->warning("Could not  delete domain. " . $check->get_error());
            return false;
        }
    } else {
        if (isset($_POST['deleteNo'])) {
            echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['PHP_SELF'] . "?action=showCheck&checkid=" . $_GET[checkid] . "\">";
        } else {
            $form->prompt("Are you sure you want to delete this Check (" . $check->get_name() . " on " . $check->get_hostname() . ")?");
        }
    }
}
开发者ID:precurse,项目名称:netharbour,代码行数:25,代码来源:monitor.php

示例3: dirname

include dirname(__FILE__) . '/inc/init.php';
fAuthorization::requireLoggedIn();
fRequest::overrideAction();
$breadcrumbs[] = array('name' => 'Checks', 'url' => Check::makeUrl('list'), 'active' => false);
$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete'));
$sort = fCRUD::getSortColumn(array('name', 'target', 'warn', 'error', 'status', 'timestamp', 'count'));
$sort_dir = fCRUD::getSortDirection('asc');
$check_id = fRequest::get('check_id', 'integer');
$check_list_url = Check::makeURL('list');
// --------------------------------- //
if ('delete' == $action) {
    try {
        $check = new Check($check_id);
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $check->delete();
            fMessaging::create('success', $check_list_url, 'The check ' . $check->getName() . ' was successfully deleted');
            fURL::redirect($check_list_url);
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', $check_list_url, 'The check requested, ' . fHTML::encode($date) . ', could not be found');
        fURL::redirect($check_list_url);
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/delete.php';
    // --------------------------------- //
} elseif ('edit' == $action) {
    try {
        $check = new Check($check_id);
        if (fRequest::isPost()) {
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:check.php


注:本文中的Check::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。