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')); }
public static function getSearchVideosByTags($tags_array, $order, $contain_all = false) { if ($order == "none") { $order = "timestamp desc"; } $sql_string = ""; $args = array(); $cond = array(); foreach ($tags_array as $k => $value) { $tags_array[$k] = str_replace("#", "", $value); $sql_string .= " tags LIKE ? " . ($contain_all ? "AND" : "OR"); $args[] = "%" . $tags_array[$k] . "%"; } $sql_string .= $contain_all ? " 1" : " 0"; $cond[] = $sql_string . ' AND visibility = ?'; $cond = array_merge($cond, $args); $cond[] = Config::getValue_('vid_visibility_public'); return Video::all(array('conditions' => $cond, 'order' => $order)); }
public function getPostedVideos($publicOnly = true) { $visibility = $publicOnly ? 'AND visibility = ' . Config::getValue_('vid_visibility_public') : ''; return Video::all(array('conditions' => array("poster_id = ? AND visibility != ? " . $visibility, $this->id, Config::getValue_('vid_visibility_suspended')), 'order' => 'timestamp desc')); }
require '../config.php'; require_once '../helpers/session.php'; require '../helpers/boot.php'; require '../helpers/functions.php'; require_once '../helpers/User.php'; require_once '../helpers/Article.php'; require_once '../helpers/Video.php'; require_once '../helpers/Level.php'; $session = new Session(); $user = NULL; if ($session->getLoggedin()) { $user = User::find($session->getUsername()); $level = Level::where('user_id', $user->id)->first(); $video = Video::where('level', $level->level)->get(); } else { $video = Video::all(); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Autism</title> <link href="../static/css/awe.css" rel="stylesheet"> <link href="../static/css/player.css" rel="stylesheet"> <script type="text/javascript" src="../static/js/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="../static/js/bootstrap.min.js"></script> <link href="../static/css/bootstrap.min.css" rel="stylesheet">
/** * Return all videos * POST /allvideos * @param string $language * @return Response */ public function allVideos() { $arr = array(); $language = trim(Input::get('language')); if ($language == '') { $arr['Success'] = false; $arr['Status'] = 'Parameter missing: language'; $arr['StatusCode'] = 400; } else { // $videos = Video::where('video_language', $language) // ->get(array('video_id as id')); $videos = Video::all(); if (count($videos) == 0) { $arr['Success'] = false; $arr['Status'] = 'Video not found'; $arr['StatusCode'] = 404; } else { $arr['Success'] = true; $arr['Status'] = 'OK'; $arr['StatusCode'] = 200; $arr['language'] = $language; $url = Config::get('app.channel_videos_web_view_url'); $url = str_replace('{language}', $language, $url); $arr['url'] = $url; } } return Response::json($arr); }