本文整理汇总了PHP中Video::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::getById方法的具体用法?PHP Video::getById怎么用?PHP Video::getById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::getById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
/**
* Delete a Country
*/
public function deleteAction()
{
$Video = Video::getById($this->getRequest()->getParam('id'));
if ($Video) {
if ($this->getRequest()->isPost()) {
$Video->delete();
$this->Member->log('Video: ' . $Video->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
My_Plugin_Libs::setSplash('Video: <b>' . $Video->name . '</b> đã được xóa khỏi hệ thống.');
$this->_redirect($this->_helper->url('index', 'video', 'admin'));
}
$this->view->Video = $Video;
}
}
示例2: get_selected_cat_genres
function get_selected_cat_genres(){
$cat_genre_id = array();
if (!empty($_GET['id'])){
$video = Video::getById((int) $_GET['id']);
$cat_genre_id[1] = $video['cat_genre_id_1'] ? $video['cat_genre_id_1'] : 0;
$cat_genre_id[2] = $video['cat_genre_id_2'] ? $video['cat_genre_id_2'] : 0;
$cat_genre_id[3] = $video['cat_genre_id_3'] ? $video['cat_genre_id_3'] : 0;
$cat_genre_id[4] = $video['cat_genre_id_4'] ? $video['cat_genre_id_4'] : 0;
$k=0;
for ($i = 1; $i <= 4; $i++){
if ($cat_genre_id[$i] > 0){
$k ++;
}
}
$str = "var sel_cat_genre_id_1 = ".$cat_genre_id[1]."\n";
$str .= "var sel_cat_genre_id_2 = ".$cat_genre_id[2]."\n";
$str .= "var sel_cat_genre_id_3 = ".$cat_genre_id[3]."\n";
$str .= "var sel_cat_genre_id_4 = ".$cat_genre_id[4]."\n";
$str .= "var total_cat_genres = ".$k."\n";
}else{
$str = "var sel_cat_genre_id_1\n";
$str .= "var sel_cat_genre_id_2\n";
$str .= "var sel_cat_genre_id_3\n";
$str .= "var sel_cat_genre_id_4\n";
}
return $str;
}
示例3: parse_param
function parse_param($action, $param)
{
if ($action == 'play') {
$sub_param = substr($param, 0, 3);
if ($sub_param == 'rtp') {
$channel = Mysql::getInstance()->from('itv')->where(array('cmd' => $param))->get()->first();
$name = '[' . _('Channel') . '] ' . $channel['name'];
} else {
if ($sub_param == 'aut') {
preg_match("/(\\d+)\\.[a-z]*\$/", $param, $tmp_arr);
$media_id = $tmp_arr[1];
$video = Video::getById($media_id);
$name = '[' . _('Video') . '] ' . $video['name'];
} else {
$name = '';
}
}
} else {
if ($param == '""') {
$name = '';
} else {
$name = $param;
}
}
return $name;
}
示例4: setClaimGlobal
/**
* Main claim method.
*
* @param string $media_type
*/
protected function setClaimGlobal($media_type)
{
$id = intval($_REQUEST['id']);
$type = $_REQUEST['real_type'];
$this->db->insert('media_claims_log', array('media_type' => $media_type, 'media_id' => $id, 'type' => $type, 'uid' => $this->stb->id, 'added' => 'NOW()'));
$total_media_claims = $this->db->from('media_claims')->where(array('media_type' => $media_type, 'media_id' => $id))->get()->first();
$sound_counter = 0;
$video_counter = 0;
$no_epg_counter = 0;
$wrong_epg_counter = 0;
if ($type == 'video') {
$video_counter++;
} else {
if ($type == 'sound') {
$sound_counter++;
} else {
if ($type == 'no_epg') {
$no_epg_counter++;
} else {
if ($type == 'wrong_epg') {
$wrong_epg_counter++;
}
}
}
}
if (!empty($total_media_claims)) {
$this->db->update('media_claims', array('sound_counter' => $total_media_claims['sound_counter'] + $sound_counter, 'video_counter' => $total_media_claims['video_counter'] + $video_counter, 'no_epg' => $total_media_claims['no_epg'] + $no_epg_counter, 'wrong_epg' => $total_media_claims['wrong_epg'] + $wrong_epg_counter), array('media_type' => $media_type, 'media_id' => $id));
} else {
$this->db->insert('media_claims', array('sound_counter' => $sound_counter, 'video_counter' => $video_counter, 'no_epg' => $no_epg_counter, 'wrong_epg' => $wrong_epg_counter, 'media_type' => $media_type, 'media_id' => $id));
}
$total_daily_claims = $this->db->from('daily_media_claims')->where(array('date' => 'CURDATE()'))->get()->first();
$media_name = 'undefined';
if ($media_type == 'itv') {
$media = Itv::getById($id);
if (!empty($media['name'])) {
$media_name = $media['name'];
}
} elseif ($media_type == 'vclub') {
$media = Video::getById($id);
if (!empty($media['name'])) {
$media_name = $media['name'];
}
} elseif ($media_type == 'karaoke') {
$media = Karaoke::getById($id);
if (!empty($media['name'])) {
$media_name = $media['name'];
}
}
if (Config::exist('administrator_email')) {
$message = sprintf(_("New claim on %s - %s (%s, id: %s). From %s"), $media_type, $type, $media_name, $id, $this->stb->mac);
mail(Config::get('administrator_email'), 'New claim on ' . $media_type . ' - ' . $type, $message, "Content-type: text/html; charset=UTF-8\r\n");
}
if (!empty($total_daily_claims)) {
return $this->db->update('daily_media_claims', array($media_type . '_sound' => $total_daily_claims[$media_type . '_sound'] + $sound_counter, $media_type . '_video' => $total_daily_claims[$media_type . '_video'] + $video_counter, 'no_epg' => $total_daily_claims['no_epg'] + $no_epg_counter, 'wrong_epg' => $total_daily_claims['wrong_epg'] + $wrong_epg_counter), array('date' => 'CURDATE()'))->result();
} else {
return $this->db->insert('daily_media_claims', array($media_type . '_sound' => $sound_counter, $media_type . '_video' => $video_counter, 'no_epg' => $no_epg_counter, 'wrong_epg' => $wrong_epg_counter, 'date' => 'CURDATE()'))->insert_id();
}
}
示例5: get_media_length_by_id
function get_media_length_by_id($id)
{
$video = Video::getById($id);
return $video['time'];
}
示例6: getUrlByVideoId
public function getUrlByVideoId($video_id, $series = 0, $forced_storage = "")
{
$video = Video::getById($video_id);
if (empty($video)) {
throw new Exception("Video not found");
}
if (!empty($video['rtsp_url'])) {
return $video['rtsp_url'];
}
$link = $this->getLinkByVideoId($video_id, $series, $forced_storage);
if (empty($link['cmd'])) {
throw new Exception("Obtaining url failed");
}
if (!empty($link['storage_id'])) {
$storage = Master::getStorageById($link['storage_id']);
if (!empty($storage)) {
$cache = Cache::getInstance();
$cache->set($this->stb->id . '_playback', array('type' => 'video', 'id' => $link['id'], 'storage' => $storage['storage_name']), 0, 10);
}
} else {
$cache = Cache::getInstance();
$cache->del($this->stb->id . '_playback');
}
return $link['cmd'];
}
示例7: check_video_status
private function check_video_status($id)
{
$video = \Video::getById($id);
if (!empty($video['rtsp_url'])) {
return 2;
}
return $video['status'];
}
示例8: parse_param
function parse_param($action, $param, $type){
if($action == 'play'){
switch ($type){
case 1: // TV
$channel = Mysql::getInstance()
->from('itv')
->where(array(
'cmd' => $param,
'status' => 1
))
->get()->first();
if (!empty($channel)){
$ch_name = $channel['name'];
}else{
$ch_name = htmlspecialchars($param);
}
$name = '['._('Channel').'] '.$ch_name;
break;
case 2: // Video Club
if (!preg_match("/(\d+)\.[a-z0-9]*$/", $param, $tmp_arr)){
$name = $param;
break;
}
$media_id = $tmp_arr[1];
$video = Video::getById($media_id);
if (!empty($video)){
$video_name = $video['name'];
}else{
$video_name = htmlspecialchars($param);
}
$name = '['._('Video').'] '.$video_name;
break;
case 3: // Karaoke
preg_match("/(\d+)\.[a-z]*$/", $param, $tmp_arr);
$karaoke_id = $tmp_arr[1];
$karaoke = Karaoke::getById($karaoke_id);
if (!empty($karaoke)){
$karaoke_name = $karaoke['name'];
}else{
$karaoke_name = htmlspecialchars($param);
}
$name = '['._('Karaoke').'] '.$karaoke_name;
break;
case 4: // Audio Club
preg_match("/(\d+).mp3$/", $param, $tmp_arr);
$audio_id = $tmp_arr[1];
$audio = Mysql::getInstance()->from('audio')->where(array('id' => $audio_id))->get()->first();
if (!empty($audio)){
$audio_name = $audio['name'];
}else{
$audio_name = htmlspecialchars($param);
}
$name = '['._('Audio').'] '.$audio_name;
break;
case 5: // Radio
$radio = Mysql::getInstance()->from('radio')->where(array('cmd' => $param, 'status' => 1))->get()->first();
if (empty($radio)){
$ch_name = $radio['name'];
}else{
$ch_name = htmlspecialchars($param);
}
$name = '['._('Radio').'] '.$ch_name;
break;
case 6: // My Records
preg_match("/\/(\d+).mpg/", $param, $tmp_arr);
$my_record_id = $tmp_arr[1];
$record = Mysql::getInstance()
->select('t_start, itv.name')
->from('users_rec')
->join('itv', 'users_rec.ch_id', 'itv.id', 'INNER')
->where(array(
'users_rec.id' => $my_record_id
))
->get()
->first();
if (!empty($record)){
//.........这里部分代码省略.........
示例9: transliterate
$genre_id_3 = @$_POST['genre_id_3'] ? @$_POST['genre_id_3'] : 0;
$genre_id_4 = @$_POST['genre_id_4'] ? @$_POST['genre_id_4'] : 0;
$cat_genre_id_1 = @$_POST['cat_genre_id_1'] ? @$_POST['cat_genre_id_1'] : 0;
$cat_genre_id_2 = @$_POST['cat_genre_id_2'] ? @$_POST['cat_genre_id_2'] : 0;
$cat_genre_id_3 = @$_POST['cat_genre_id_3'] ? @$_POST['cat_genre_id_3'] : 0;
$cat_genre_id_4 = @$_POST['cat_genre_id_4'] ? @$_POST['cat_genre_id_4'] : 0;
$category_id = @$_POST['category_id'] ? @intval($_POST['category_id']) : 0;
$protocol = $_POST['protocol'];
if ($protocol == 'custom') {
$rtsp_url = @trim($_POST['rtsp_url']);
} else {
$rtsp_url = '';
}
$status = $rtsp_url ? 1 : 0;
if (!empty($_GET['id'])) {
$video = Video::getById($_GET['id']);
}
if (@$_GET['save']) {
$trans_name = transliterate(@urldecode($_POST['name']));
if ($hd) {
$trans_name .= '_HD';
}
$sql = "select * from video where path='" . $trans_name . "'";
$rs = $db->executeQuery($sql);
$rows = @$rs->getRowCount();
if ($rows > 0) {
$error = _('Error: The folder with that name already exists');
}
if (@$_GET['name'] && !$error) {
$master = new VideoMaster();
try {
示例10: get_video_name
function get_video_name($id)
{
$video = Video::getById($id);
return $video['name'];
}
示例11: get_video_name
function get_video_name()
{
$id = intval($_GET['id']);
$video = Video::getById($id);
return $video['name'];
}
示例12: get_data
function get_data()
{
$get = @$_GET['get'];
$data = @$_POST['data'];
$arr = array();
if ($data) {
switch ($get) {
case 'del_tv_logo':
if (!Admin::isEditAllowed('add_itv')) {
header($_SERVER["SERVER_PROTOCOL"] . ' 405 Method Not Allowed');
echo _('Action "edit" denied for page "add_itv"');
exit;
}
return Itv::delLogoById(intval($_GET['id']));
case 'vclub_info':
$media_id = intval($data);
$video = Video::getById($media_id);
$path = $video['path'];
$rtsp_url = $video['rtsp_url'];
if (!empty($rtsp_url)) {
$result['data'] = array();
return $result;
}
$master = new VideoMaster();
$good_storages = $master->getAllGoodStoragesForMediaFromNet($media_id, true);
foreach ($good_storages as $name => $data) {
$arr[] = array('storage_name' => $name, 'path' => $path, 'series' => count($data['series']), 'files' => $data['files'], 'for_moderator' => $data['for_moderator']);
}
$result['data'] = $arr;
return $result;
break;
case 'startmd5sum':
$resp = array();
if (Admin::isPageActionAllowed('add_video')) {
$master = new VideoMaster();
try {
$master->startMD5Sum($data['storage_name'], $data['media_name']);
} catch (Exception $exception) {
$resp['error'] = $exception->getMessage();
}
return $resp;
} else {
$resp['error'] = 'У Вас нет прав на это действие';
return $resp;
}
break;
case 'karaoke_info':
$media_id = intval($data);
$master = new KaraokeMaster();
$good_storages = $master->getAllGoodStoragesForMediaFromNet($media_id, true);
if (count($good_storages) > 0) {
set_karaoke_status($media_id, 1);
} else {
set_karaoke_status($media_id, 0);
}
foreach ($good_storages as $name => $data) {
$arr[] = array('storage_name' => $name, 'file' => $media_id . '.mpg');
}
$result['data'] = $arr;
return $result;
break;
case 'chk_name':
return $result['data'] = Mysql::getInstance()->count()->from('video')->where(array('name' => $data))->get()->counter();
break;
case 'org_name_chk':
return $result['data'] = Mysql::getInstance()->count()->from('permitted_video')->where(array('o_name' => $data['o_name'], 'year' => $data['year']))->get()->counter();
break;
case 'get_cat_genres':
$category_alias = Mysql::getInstance()->from('media_category')->where(array('id' => $data))->get()->first('category_alias');
$genres = Mysql::getInstance()->from('cat_genre')->where(array('category_alias' => $category_alias))->orderby('title')->get()->all();
$genres = array_map(function ($genre) {
return array('id' => $genre['id'], 'title' => _($genre['title']));
}, $genres);
return array('data' => $genres);
break;
}
}
}
示例13: get_status
function get_status($id)
{
$video = Video::getById($id);
return $video['status'];
}
示例14: getUrlByVideoId
public function getUrlByVideoId($video_id, $series = 0, $forced_storage = "")
{
$video = Video::getById($video_id);
if (empty($video)) {
throw new Exception("Video not found");
}
if (!empty($video['rtsp_url'])) {
return $video['rtsp_url'];
}
$link = $this->getLinkByVideoId($video_id, $series, $forced_storage);
if (empty($link['cmd'])) {
throw new Exception("Obtaining url failed");
}
return $link['cmd'];
}
示例15: get_sended_video
function get_sended_video()
{
$video = Video::getById(intval($_GET['id']));
return $video['name'];
}