本文整理汇总了PHP中Video::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::find方法的具体用法?PHP Video::find怎么用?PHP Video::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
try {
VideoModel::find($id)->delete();
$alert['msg'] = 'Video has been deleted successfully';
$alert['type'] = 'success';
} catch (\Exception $ex) {
$alert['msg'] = 'This Video has been already used';
$alert['type'] = 'danger';
}
return Redirect::route('company.video')->with('alert', $alert);
}
示例2: video
public function video($id, $param2, $param3 = 'nope')
{
$autoplay = $param3 != 'nope';
if ($autoplay) {
$request = $param3;
} else {
$request = $param2;
}
$video = Video::find($id);
$url = preg_match("#^http#isU", $video->url) ? $video->url : 'http://dreamvids.fr/' . $video->url;
$data = array();
$data['video'] = $video;
$data['url'] = $url;
$data['autoplay'] = $autoplay;
return new ViewResponse('embed/video', $data, false);
}
示例3: borrar
public static function borrar($input)
{
$respuesta = array();
$reglas = array('id' => array('integer'));
$validator = Validator::make($input, $reglas);
if ($validator->fails()) {
$respuesta['mensaje'] = $validator;
$respuesta['error'] = true;
} else {
$video = Video::find($input['id']);
$video->fecha_baja = date("Y-m-d H:i:s");
$video->estado = 'B';
$video->usuario_id_baja = Auth::user()->id;
$video->save();
$respuesta['mensaje'] = 'Video eliminado.';
$respuesta['error'] = false;
$respuesta['data'] = $video;
}
return $respuesta;
}
示例4: getVideos
public function getVideos()
{
$videos = array();
$videosIds = $this->videos_ids;
if (strpos($videosIds, ';') !== false) {
if (strpos($videosIds, ';') === 0) {
$videosIds = substr($videosIds, 1);
}
if (substr($videosIds, -1) === ';') {
$videosIds = substr($videosIds, 0, -1);
}
$videosIdsArray = explode(';', $videosIds);
foreach ($videosIdsArray as $videoId) {
$video = Video::find($videoId);
if (is_object($video)) {
$videos[] = $video;
}
}
}
return $videos;
}
示例5: newVideo
public function newVideo()
{
// Permet de trouver une nouvelle vidéo à l'utilisateur
$videos = Video::all();
foreach ($videos as $video) {
try {
$questionnaire = Video::find($video->id_video)->questionnaire()->where('id_user', '=', $_SESSION['id_user'])->firstorFail();
// Si la vidéo à un questionnaire pour l'utilisateur, on passe à une autre vidéo
} catch (\Exception $e) {
// Si elle n'a pas de vidéo, alors ce sera la prochaine vidéo à annoter
$_SESSION['id_video'] = $video->id_video;
$this->app->controllerUser->video();
$_SESSION['page'] = 4;
// On dirige la personne vers la page de remerciement pour l'inviter à annoter une nouvelle vidéo
$this->app->redirect($this->app->urlFor('remerciement'));
}
}
$_SESSION['page'] = 5;
// Si toutes les vidéo on été annoté, alors l'utilisateur est dirigé vers une page de fin d'expérience
$this->app->redirect($this->app->urlFor('fin'));
}
示例6: handleViewCount
public function handleViewCount($id)
{
// check if this key already exists in the view_media session
$blank_array = array();
if (!array_key_exists($id, Session::get('viewed_video', $blank_array))) {
try {
// increment view
$video = Video::find($id);
$video->views = $video->views + 1;
$video->save();
// Add key to the view_media session
Session::put('viewed_video.' . $id, time());
return true;
} catch (Exception $e) {
return false;
}
} else {
return false;
}
}
示例7: delete
/**
* @param $id
* @return mixed|void
*/
public function delete($id)
{
$video = $this->video->find($id);
$video->delete();
}
示例8: postNew
public static function postNew($authorId, $videoId, $commentContent, $parent)
{
$timestamp = Utils::tps();
$poster_channel = UserChannel::find(Video::find($videoId)->poster_id);
$admins_ids = $poster_channel->admins_ids;
$admins_ids = ChannelAction::filterReceiver($admins_ids, "comment");
$admin_ids_array = $poster_channel->getArrayAdminsIds($admins_ids);
foreach ($admin_ids_array as $k => $value) {
if ($value == Session::get()->id) {
unset($admin_ids_array[$k]);
break;
}
}
$recipients_ids = ';' . trim(implode(';', $admin_ids_array), ';') . ';';
$comment = Comment::create(array('id' => Comment::generateId(6), 'poster_id' => $authorId, 'video_id' => $videoId, 'comment' => $commentContent, 'likes' => 0, 'dislikes' => 0, 'timestamp' => $timestamp, 'parent' => $parent));
ChannelAction::create(array('id' => ChannelAction::generateId(6), 'channel_id' => $authorId, 'recipients_ids' => $recipients_ids, 'type' => 'comment', 'target' => $videoId, 'complementary_id' => $comment->id, 'timestamp' => $timestamp));
return $comment;
}
示例9: showFriendlyMatches
private function showFriendlyMatches() {
$csrf = $_SESSION['csrf'];
$opponents = Model::indexBy($this->season->getTeams(), 'teamid');
$postCsrf = HTMLResponse::fromPOST('friendlycsrf', '');
if ($postCsrf == $csrf && $this->team->isManager()) {
$url = HTMLResponse::fromPOST('friendlyurl');
$opponentsId = HTMLResponse::fromPOST('friendlyopponentsid');
$publishDate = HTMLResponse::fromPOST('friendlydate');
$publishTime = HTMLResponse::fromPOST('friendlytime');
if (!strlen($publishDate)) $publishDate = date('Y-m-d');
if (!strlen($publishTime)) $publishTime = date('H').':00';
$possibleOpponents = Model::pluck($this->season->getTeams(), 'teamid');
$regex = '/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/';
$timeRegex = "'^[0-9]{2}:[0-9]{2}$'";
$dateRegex = "'^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$'";
$removeId = HTMLResponse::fromPOST('removeid');
if ($removeId) {
/** @var Video $video */
if ($video = Video::findOne('seasonid = ? and type = ? and videoid = ? and teamid = ?',
[$this->season->seasonid, 3, $removeId, $this->team->teamid])) {
$video->delete();
HTMLResponse::exitWithRoute(HTMLResponse::getRoute());
}
}
if (!strlen($opponentsId) || !strlen($publishTime) || !strlen($publishDate) || !strlen($url)) {
$this->design->addJavaScript("
$(function() { alert(\"No has rellenado todos los datos\"); })
", false);
} else {
if ($opponentsId != $this->team->teamid && in_array($opponentsId, $possibleOpponents)) {
if (!preg_match($regex, $url)) {
$this->design->addJavaScript("
$(function() { alert(\"El enlace que has puesto no es un enlace de YouTube válido\"); })
", false);
} else {
if (!preg_match($timeRegex, $publishTime)) {
$this->design->addJavaScript("
$(function() { alert(\"La hora que has puesto tiene un formato inválido (ha de ser 08:06)\"); })
", false);
} else {
if (!preg_match($dateRegex, $publishDate)) {
$this->design->addJavaScript("
$(function() { alert(\"La fecha que has puesto tiene un formato inválido (ha de ser 2099-12-31)\"); })
", false);
} else {
$video = Video::create();
$video->dateline = time();
$video->publishdate = $publishDate;
$video->publishtime = $publishTime;
$video->link = $url;
$video->opponentid = $opponentsId * 1;
$video->teamid = $this->team->teamid;
$video->type = 3;
$video->seasonid = $this->season->seasonid;
$video->save();
HTMLResponse::exitWithRoute(HTMLResponse::getRoute());
}
}
}
}
}
}
$videos = Video::find('seasonid = ? and teamid = ? and type = ? order by publishdate asc, publishtime asc',
[$this->season->seasonid, $this->team->teamid, 3]);
if ($videos || $this->team->isManager()) {
?>
<h2>Combates amistosos</h2>
<? if ($this->team->isManager()) { ?>
<form action="<?=HTMLResponse::getRoute()?>" method="post">
<? } ?>
<table>
<thead>
<tr>
<td>Fecha</td>
<td>Hora</td>
<td>Oponentes</td>
<td>Vídeo</td>
</tr>
</thead>
<? foreach($videos as $video) {
if (!$this->team->isManager() &&
($video->publishdate > date('Y-m-d') ||
($video->publishdate == date('Y-m-d') && $video->publishtime > date('H:i')))) {
continue;
}
?>
<tr>
<td><?= $video->publishdate ?></td>
<td><?= $video->publishtime ?></td>
<td>
<a href="/<?=$this->season->getLink()?>/equipos/<?=$opponents[$video->opponentid]->getLink()?>/">
//.........这里部分代码省略.........
示例10:
if ($action->type == 'comment' && Utils::relative_time($action->timestamp)) {
?>
<div>
<p>
<a href="<?php
echo WEBROOT . 'channel/' . $action->channel_id;
?>
"><?php
echo UserChannel::getNameById($action->channel_id);
?>
</a>
a commenté votre vidéo <a href="<?php
echo WEBROOT . 'watch/' . $action->target;
?>
"><?php
echo Video::find($action->target)->title;
?>
:</a>
<p>"<?php
echo Comment::getByChannelAction($action)->comment;
?>
"</p>
</p>
<p><?php
echo Utils::relative_time($action->timestamp);
?>
</p>
<br><br>
</div>
<?php
示例11: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$video = Video::find($id);
// Detach and delete any unused tags
foreach ($video->tags as $tag) {
$this->detachTagFromVideo($video, $tag->id);
if (!$this->isTagContainedInAnyVideos($tag->name)) {
$tag->delete();
}
}
$this->deleteVideoImages($video);
Video::destroy($id);
return Redirect::to('admin/videos')->with(array('note' => 'Successfully Deleted Video', 'note_type' => 'success'));
}
示例12: foreach
//back to index.php
if (!$user->exists()) {
Redirect::to('../index.php');
} else {
if (!$user->isLoggedIn() || !$user->hasPermission('admin')) {
Redirect::to('../index.php');
} else {
foreach ($_GET as $key => $value) {
if ($value == "") {
Redirect::to('../index.php');
}
}
if (Input::exists('get')) {
$video_entry = new Video();
$video_entry_id = $video_entry->safe_string(Input::get('id'));
$video_entry->find($video_entry_id);
if (!$video_entry->exists()) {
Redirect::to('../index.php');
} else {
$video_entry_title = $video_entry->data()->video_title;
try {
$video_entry->delete(['id', '=', Input::get('id')]);
Session::flash('delete', 'Video for entry "' . $video_entry_title . '" has been deleted from the database.');
Redirect::to('../index.php');
} catch (Exception $e) {
die($e->getMessage());
}
}
} else {
Redirect::to('../index.php');
}
示例13: video
public function video($id, $request)
{
$video = Video::exists($id) ? Video::find($id) : false;
if (!$request->acceptsJson()) {
return new RedirectResponse(WEBROOT . 'watch/' . $id);
}
if (is_object($video)) {
$comments = $video->getComments();
$commentsData = array();
foreach ($comments as $comment) {
$commentsData[] = array('id' => $comment->id, 'author' => UserChannel::find($comment->poster_id)->name, 'video_id' => $comment->video_id, 'comment' => $comment->comment, 'relativeTime' => Utils::relative_time($comment->timestamp), 'timestamp' => $comment->timestamp, 'likes' => $comment->likes, 'dislikes' => $comment->dislikes);
}
return new JsonResponse($commentsData);
}
return new Response(500);
}
示例14:
<div class="thumbnail bg-loader" data-background-load-in-view data-background="http://lorempicsum.com/up/350/200/6"></div>
<p><?php
echo $phrase;
?>
</p>
</a>
<i><?php
echo Utils::relative_time($action->timestamp);
?>
</i>
</div>
<?php
} else {
if ($action->type == 'comment' && Video::exists($action->target)) {
$comment = Comment::getByChannelAction($action);
$video = Utils::secureActiveRecordModel(Video::find($action->target));
?>
<div class="card<?php
echo $supp_class;
?>
comment">
<a href="<?php
echo WEBROOT . 'watch/' . $action->target;
?>
">
<p><b><?php
echo Utils::secure($channel_action->name);
?>
</b> a commenté votre vidéo "<b><?php
echo $video->title;
?>
示例15: supprimervideoAction
public function supprimervideoAction()
{
if (isset($_GET['id'])) {
$video = new Video();
$selectlavideo = $video->selectOne($_GET['id']);
$videoname = $selectlavideo['nomVideo'];
exec('rm ' . APPLICATION_PATH . '/../public/videoNao/' . $videoname . '.mp4', $outputmp4, $returnmp4);
exec('rm ' . APPLICATION_PATH . '/../public/videoNao/miniature/' . $videoname . '.jpeg', $outputjpeg, $returnjpeg);
$lavideo = $video->find($_GET['id'])->current();
$lavideo->delete();
$this->_redirect('photovideo/video');
}
}