當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Reservation::cancel方法代碼示例

本文整理匯總了PHP中Reservation::cancel方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reservation::cancel方法的具體用法?PHP Reservation::cancel怎麽用?PHP Reservation::cancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Reservation的用法示例。


在下文中一共展示了Reservation::cancel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: catch

<?php

/**
 * キャンセルする場合は該當レコードをcrontabから削除する必要がある。
 */
require_once 'config.php';
require_once INSTALL_PATH . '/DBRecord.class.php';
require_once INSTALL_PATH . '/Reservation.class.php';
$program_id = false;
$reserve_id = false;
if (isset($_GET['program_id'])) {
    $program_id = $_GET['program_id'];
} else {
    if (isset($_GET['reserve_id'])) {
        $reserve_id = $_GET['reserve_id'];
    }
}
// 予約取り消し実行
try {
    // 手動取り消しのときには、その番組を自動録畫対象から外す
    if ($program_id) {
        Program::disableAutorec($program_id);
    }
    // 2つの引數のうち、falseでないものを処理するようにできているらしい
    Reservation::cancel($reserve_id, $program_id);
} catch (Exception $e) {
    echo "Error" . $e->getMessage();
    exit;
}
開發者ID:ha1t,項目名稱:epgrec,代碼行數:29,代碼來源:cancelReservation.php

示例2: delete

 public function delete()
 {
     if ($this->id == 0) {
         return;
     }
     $precs = array();
     try {
         $precs = $this->getPrograms();
     } catch (Exception $e) {
         throw $e;
     }
     // 一気にキャンセル
     foreach ($precs as $rec) {
         try {
             $reserve = new DBRecord(RESERVE_TBL, "program_id", $rec->id);
             // 自動予約されたもののみ削除
             if ($reserve->autorec) {
                 Reservation::cancel($reserve->id);
                 usleep(100);
                 // あんまり時間を空けないのもどう?
             }
         } catch (Exception $e) {
             // 無視
         }
     }
     try {
         parent::delete();
     } catch (Exception $e) {
         throw $e;
     }
 }
開發者ID:sushi-k,項目名稱:epgrec,代碼行數:31,代碼來源:Keyword.class.php

示例3: Reservation

<?php

require_once '../lib/Reservation.class.php';
$to_cancel = $_GET['id'];
$res = new Reservation();
$res->cancel($to_cancel);
header("Location: host.php");
開發者ID:HuiSF,項目名稱:FineTable-Class-Project,代碼行數:7,代碼來源:host.logic.php

示例4: storeProgram

function storeProgram($type, $xmlfile)
{
    global $BS_CHANNEL_MAP, $GR_CHANNEL_MAP, $CS_CHANNEL_MAP;
    // チャンネルマップファイルの準備
    $map = array();
    if ($type == "BS") {
        $map = $BS_CHANNEL_MAP;
    } else {
        if ($type == "GR") {
            $map = $GR_CHANNEL_MAP;
        } else {
            if ($type == "CS") {
                $map = $CS_CHANNEL_MAP;
            }
        }
    }
    // XML parse
    $xml = @simplexml_load_file($xmlfile);
    if ($xml === false) {
        return;
        // XMLが読み取れないなら何もしない
    }
    // channel抽出
    foreach ($xml->channel as $ch) {
        $disc = $ch['id'];
        try {
            // チャンネルデータを探す
            $num = DBRecord::countRecords(CHANNEL_TBL, "WHERE channel_disc = '" . $disc . "'");
            if ($num == 0) {
                // チャンネルデータがないなら新規作成
                $rec = new DBRecord(CHANNEL_TBL);
                $rec->type = $type;
                $rec->channel = $map["{$disc}"];
                $rec->channel_disc = $disc;
                $rec->name = $ch->{'display-name'};
            } else {
                // 存在した場合も、とりあえずチャンネル名は更新する
                $rec = new DBRecord(CHANNEL_TBL, "channel_disc", $disc);
                $rec->name = $ch->{'display-name'};
            }
        } catch (Exception $e) {
            // 無視
        }
    }
    // channel 終了
    // programme 取得
    foreach ($xml->programme as $program) {
        $channel_disc = $program['channel'];
        $channel = $map["{$channel_disc}"];
        $starttime = str_replace(" +0900", '', $program['start']);
        $endtime = str_replace(" +0900", '', $program['stop']);
        $title = $program->title;
        $desc = $program->desc;
        $cat_ja = "";
        $cat_en = "";
        foreach ($program->category as $cat) {
            if ($cat['lang'] == "ja_JP") {
                $cat_ja = $cat;
            }
            if ($cat['lang'] == "en") {
                $cat_en = $cat;
            }
        }
        $program_disc = md5($channel_disc . $starttime . $endtime);
        // printf( "%s %s %s %s %s %s %s \n", $program_disc, $channel, $starttime, $endtime, $title, $desc, $cat_ja );
        try {
            // カテゴリを処理する
            $category_disc = md5($cat_ja . $cat_en);
            $num = DBRecord::countRecords(CATEGORY_TBL, "WHERE category_disc = '" . $category_disc . "'");
            $cat_rec = null;
            if ($num == 0) {
                // 新規カテゴリの追加
                $cat_rec = new DBRecord(CATEGORY_TBL);
                $cat_rec->name_jp = $cat_ja;
                $cat_rec->name_en = $cat_en;
                $cat_rec->category_disc = $category_disc;
            } else {
                $cat_rec = new DBRecord(CATEGORY_TBL, "category_disc", $category_disc);
            }
            //
            $channel_rec = new DBRecord(CHANNEL_TBL, "channel_disc", $channel_disc);
            $num = DBRecord::countRecords(PROGRAM_TBL, "WHERE program_disc = '" . $program_disc . "'");
            if ($num == 0) {
                // 新規番組
                // 重複チェック 同時間帯にある番組
                $options = "WHERE channel_disc = '" . $channel_disc . "' " . "AND starttime < '" . $endtime . "' AND endtime > '" . $starttime . "'";
                $battings = DBRecord::countRecords(PROGRAM_TBL, $options);
                if ($battings > 0) {
                    // 重複発生=おそらく放映時間の変更
                    $records = DBRecord::createRecords(PROGRAM_TBL, $options);
                    foreach ($records as $rec) {
                        // 自動録畫予約された番組は放映時間変更と同時にいったん削除する
                        try {
                            $reserve = new DBRecord(RESERVE_TBL, "program_id", $rec->id);
                            if ($reserve->autorec) {
                                Reservation::cancel($reserve->id);
                            }
                        } catch (Exception $e) {
                            //無視
                        }
//.........這裏部分代碼省略.........
開發者ID:sushi-k,項目名稱:epgrec,代碼行數:101,代碼來源:storeProgram.php

示例5: catch

    echo "<br>Testing find review:<br>";
    print_r("If found review:" . $review->find($review_id) . "<br>");
    print_r($review->get_review_info());
    echo "<br>";
    echo $review->get_review_info_json();
    echo "<br>";
} catch (Exception $e) {
    $success = false;
    $message = $e->getMessage();
    echo "Find review Error: " . $message . "<br>";
}
echo ($success == true ? "SUCCESS" : "FAILURE") . "<br>";
try {
    echo "<br>Testing for canceling a review : <br> review_id: {$review_id}<br>";
    echo "Result: " . $review->cancel($review_id) . "<br>";
} catch (Exception $e) {
    $success = false;
    $message = $e->getMessage();
    echo "Cancel review Error: " . $message . "<br>";
}
echo ($success == true ? "SUCCESS" : "FAILURE") . "<br>";
try {
    echo "<br>Testing for canceling a reservation : <br> reservation_id: {$rsv_id}<br>";
    echo "Result: " . $rsv->cancel($rsv_id) . "<br>";
    $success = true;
} catch (Exception $e) {
    $success = false;
    $message = $e->getMessage();
    echo "Cancel reservation Error: " . $message . "<br>";
}
echo ($success == true ? "SUCCESS" : "FAILURE") . "<br>";
開發者ID:HuiSF,項目名稱:FineTable-Class-Project,代碼行數:31,代碼來源:test-rsv-and-review.php


注:本文中的Reservation::cancel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。