本文整理汇总了PHP中Video::switchOnById方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::switchOnById方法的具体用法?PHP Video::switchOnById怎么用?PHP Video::switchOnById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::switchOnById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
if (isset($date_on) && $date_on == date("Y-m-d")) {
Mysql::getInstance()->delete('video_on_tasks', array('video_id' => $video_id));
}
if (isset($date_on) && $date_on != date("Y-m-d")) {
//var_dump($date_on, $_GET['id']); exit;
$video_on_task = Mysql::getInstance()->from('video_on_tasks')->where(array('video_id' => $video_id))->get()->first();
$data = array('video_id' => $video_id, 'date_on' => $date_on);
if (empty($video_on_task)) {
Mysql::getInstance()->insert('video_on_tasks', $data);
} else {
Mysql::getInstance()->update('video_on_tasks', $data, array('video_id' => $video_id));
}
} else {
if ($_GET['accessed'] == 1) {
Video::switchOnById($video_id);
} else {
Video::switchOffById($video_id);
}
}
header("Location: add_video.php?letter=" . @$_GET['letter'] . "&search=" . @urldecode($_GET['search']) . "&page=" . @$_GET['page']);
exit;
}
if (@$_GET['del']) {
Admin::checkAccess(AdminAccess::ACCESS_DELETE);
Video::log(intval(@$_GET['id']), _('video deleted'));
Mysql::getInstance()->delete('video', array('id' => intval(@$_GET['id'])));
header("Location: add_video.php?letter=" . @$_GET['letter'] . "&search=" . @$_GET['search'] . "&page=" . @$_GET['page']);
exit;
}
if (count(@$_POST) > 0) {
示例2: foreach
<?php
include "./common.php";
$today_tasks = Mysql::getInstance()->from('video_on_tasks')->where(array('date_on<=' => 'CURDATE()'))->get()->all();
foreach ($today_tasks as $task) {
try {
Video::switchOnById($task['video_id']);
Mysql::getInstance()->delete('video_on_tasks', array('id' => $task['id']));
} catch (Exception $e) {
echo $e->getTraceAsString();
}
}