コード例 #1
2
ファイル: ResetAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     $tags = Tag::model()->findAll();
     if ($tags) {
         foreach ($tags as $tag) {
             $post = Post::model()->findAll("FIND_IN_SET(:tag, tags)", array(':tag' => $tag->tag_name));
             $image = Image::model()->findAll("FIND_IN_SET(:tag, tags)", array(':tag' => $tag->tag_name));
             $soft = Soft::model()->findAll("FIND_IN_SET(:tag, seo_keywords)", array(':tag' => $tag->tag_name));
             $video = Video::model()->findAll("FIND_IN_SET(:tag, seo_keywords)", array(':tag' => $tag->tag_name));
             if (!$post && !$image && !$soft && !$video) {
                 $tag->delete();
             } else {
                 $tag->data_count = count($post) + count($image) + count($soft);
                 $tag->save();
             }
         }
     }
     $tagdatas = TagData::model()->findAll();
     if ($tagdatas) {
         foreach ($tagdatas as $value) {
             $modelType = ModelType::model()->findByPk($value->type);
             $model = $modelType->model;
             $data = $model::model()->findByPk($value->content_id);
             if (!$data) {
                 $value->delete();
             }
         }
     }
     $this->controller->message('success', Yii::t('admin', 'Reset Tags Success'), $this->controller->createUrl('index'));
 }
コード例 #2
1
 public function index($page = 1)
 {
     $itemPerPage = 5;
     $videos = Video::getVideos(5, $page);
     /**/
     return View::make("pages.vote")->with('videos', $videos)->with('page', $page);
 }
コード例 #3
1
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $banners = Banner::where('active', 'Y')->orderBy('id', 'desc')->get();
     $news = News::orderBy('date', 'desc')->take(5)->get();
     $videos = Video::orderBy('id', 'desc')->take(5)->get();
     return view('home', compact('banners', 'news', 'videos'));
 }
コード例 #4
0
 public function __construct(Video $video)
 {
     $this->video = $video;
     $this->details = $this->getVideoDetails();
     $this->user = DAOFactory::getUserDAO()->findById($video->getUserId());
     $this->videoTO = new VideoTO($this->video, $this->user);
 }
コード例 #5
0
function add_youtube_video()
{
    global $config;
    require_once $config["path_to_default_site_module"] . "/models/db.php";
    require_once $config["path_to_default_site_module"] . "/models/video.php";
    $ch = curl_init("https://gdata.youtube.com/feeds/api/videos/-/preachcaster?alt=json");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $json_string_data = curl_exec($ch);
    curl_close($ch);
    $video_data = json_decode($json_string_data, true);
    $db_conn = new db($config["db_connection"]);
    $db_resource = $db_conn->get_resource();
    $video = new Video($db_resource);
    foreach ($video_data["feed"]["entry"] as $single_video) {
        //parse out ID
        $tmp_array = explode("/", $single_video["id"]['$t']);
        $video_id = $tmp_array[count($tmp_array) - 1];
        //rxBS1E0KZQU
        //CQzUsTFqtW0
        $video_params = array("video_id" => $video_id, "author" => $single_video["author"][0]["name"]['$t'], "title" => $single_video["title"]['$t'], "description" => $single_video["content"]['$t'], "date_recorded" => isset($single_video['yt$recorded']) ? $single_video['yt$recorded']['$t'] : null, "location" => isset($single_video['yt$location']) ? $single_video['yt$location']['$t'] : null, "url" => isset($single_video['media$group']['media$player']) ? $single_video['media$group']['media$player'][0]["url"] : null, "duration" => isset($single_video['media$group']['yt$duration']) ? $single_video['media$group']['yt$duration']["seconds"] : null, "comment_url" => isset($single_video['gd$comments']) && isset($single_video['gd$comments']['gd$feedLink']) ? $single_video['gd$comments']['gd$feedLink']["href"] : null, "thumbnails" => isset($single_video['media$group']) && isset($single_video['media$group']['media$thumbnail']) ? $single_video['media$group']['media$thumbnail'] : null);
        $video->add_video($video_params, "YouTube");
    }
    die("here");
}
コード例 #6
0
 /**
  * Récupère les différentes propriétés afin de les afficher
  * @return true si le tableau n'est pas vide
  */
 function afficherListeVideos()
 {
     //requete sql
     if ($this->numpara) {
         $result = mysql_query("SELECT numvideo,legende,numparavideo,ordre FROM if_para_video WHERE numpara='{$this->numpara}' ORDER BY ordre");
         while ($row = mysql_fetch_row($result)) {
             $uneVideo = new Video();
             $uneVideo->numvideo = $row[0];
             $uneVideo->legendeVideo = $row[1];
             $uneVideo->numparavideo = $row[2];
             $uneVideo->numparavideo = $row[2];
             $uneVideo->infosVideo();
             $this->videos[] = $uneVideo;
         }
     } else {
         $result = mysql_query("SELECT numvideo FROM if_video ORDER BY nom_video");
         while ($row = mysql_fetch_row($result)) {
             $uneVideo = new Video();
             $uneVideo->numvideo = $row[0];
             $uneVideo->infosVideo();
             $this->videos[] = $uneVideo;
         }
     }
     if (count($this->videos) >= 1) {
         return true;
     }
 }
コード例 #7
0
 /**
  * Returns the raw HTML to embed the video
  *
  * @return string
  */
 public function getEmbedCode()
 {
     if ($this->embedTemplate === null) {
         return '';
     }
     return str_replace(array('$video_id', '$height', '$width'), array($this->videoId, $this->video->getHeight(), $this->video->getWidth()), $this->embedTemplate);
 }
コード例 #8
0
ファイル: CreateAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     $model = new Video();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         //封面、文件
         $model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
         $model->video_file = isset($_POST['video_file']) ? $_POST['video_file'] : '';
         //标签   (前5个标签有效)
         $tags = trim($_POST['Video']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     //判断有无栏目
     $article_cat = Catalog::model()->find('type=:type', array(':type' => $this->controller->_type));
     if (!$article_cat) {
         $this->controller->message('error', Yii::t('admin', 'No Catalog'), $this->controller->createUrl('index'));
     }
     $this->controller->render('create', array('model' => $model));
 }
コード例 #9
0
 public static function fillVideo(Video $video)
 {
     $videoType = DAOFactory::getVideoTypeDAO()->findById($video->getType());
     $videoTypeName = $videoType->getName() . 'Filler';
     $filler = new $videoTypeName($video);
     $video = $filler->getVideoTO();
     $video->setType($videoType->getName());
     return $video;
 }
コード例 #10
0
ファイル: Video.php プロジェクト: hristodinev/site
 public static function remove(Video $video)
 {
     if (!Session::get('is_admin')) {
         if ($video->user_id !== Auth::user()->id_member) {
             return false;
         }
     }
     $video->delete();
     return true;
 }
コード例 #11
0
 public function actionVideo()
 {
     $model = new Video('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Video'])) {
         $model->attributes = $_GET['Video'];
     }
     $this->render('video', compact('model'));
 }
コード例 #12
0
 /**
  * @param array $result
  * @return ArrayObject
  */
 private function buildArrayVideo($result)
 {
     $arrayVideo = new ArrayObject();
     foreach ($result as $row) {
         $video = new Video($row['title'], $row['link'], $row['date']);
         $video->setId($row['id']);
         $arrayVideo->append($video);
     }
     return $arrayVideo;
 }
コード例 #13
0
function save_item_action($data)
{
    global $fpdo;
    debug($data, 'posted data');
    $oVideo = new Video($data['path']);
    $video_id = $oVideo->get_videoID();
    $data['path'] = $video_id;
    debug($data['path'], 'posted path');
    $oItem = new Item($fpdo);
    $id = $oItem->add($data);
    debug($id, 'id');
}
コード例 #14
0
function smarty_cms_function_Video($params, &$smarty)
{
    $vid = new Video();
    if (isset($params['url'])) {
        $vid->setVideoUrl($params['url']);
    }
    if (isset($params['width'])) {
        $vid->setWidth((int) $params['width']);
    }
    if (isset($params['height'])) {
        $vid->setHeight((int) $params['height']);
    }
    return $vid->getHtml();
}
コード例 #15
0
ファイル: composition.php プロジェクト: ojoven/amadeus
 public function getRandomCompositionConsideringRelevance()
 {
     $composerModel = new Composer();
     $videoModel = new Video();
     $lessonCompositionModel = new LessonComposition();
     $lessonComposerModel = new LessonComposer();
     $composition['composition'] = $this->getRandomComposition();
     $composerId = $composition['composition']['composer_id'];
     $compositionId = $composition['composition']['id'];
     $composition['videos'] = $videoModel->getVideosComposition($compositionId);
     $composition['composer'] = $composerModel->getComposer($composerId);
     $composition['lessons']['composer'] = $lessonComposerModel->getLessonsComposer($composerId);
     $composition['lessons']['composition'] = $lessonCompositionModel->getLessonsComposition($compositionId);
     return $composition;
 }
コード例 #16
0
ファイル: SpecialAddVideo.php プロジェクト: Tjorriemorrie/app
 /**
  * Actually inserts the Video into the DB if validation passes
  *
  * @param $data Array
  * @return bool
  */
 public function submit(array $data)
 {
     list($url, $provider) = $this->getUrlAndProvider($data['Video']);
     $this->video->addVideo($url, $provider, false, $data['Watch']);
     $this->getOutput()->redirect($this->video->getTitle()->getFullURL());
     return true;
 }
コード例 #17
0
 public function actionDisplay()
 {
     $id = Request::getVar('id', null);
     $alias = Request::getVar('alias', null);
     $model = Video::getInstance();
     if ($id == null or $id == "") {
         if ($alias != null and $alias != "") {
             $obj_item = $model->getItemByAlias($alias);
         } else {
             header("Location: /");
         }
     } else {
         $obj_item = $model->getItem($id);
     }
     $items = $model->getItems($obj_item['catID'], true, 4);
     $items2 = $model->getItems($obj_item['catID'], false, 9);
     $obj_category = $model->getCategory($obj_item['catID']);
     $data['item'] = $obj_item;
     $data['items'] = $items;
     $data['items2'] = $items2;
     $data['category'] = $obj_category;
     $page_title = $obj_item['title'];
     $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title;
     $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title;
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_keyword);
     setSysConfig("seopage.description", $page_description);
     Request::setVar('alias', $obj_category['alias']);
     $this->render('default', $data);
 }
コード例 #18
0
 /**
  * 登録
  *
  * @return CakeResponse
  */
 public function add()
 {
     if ($this->request->isPost()) {
         if (!($status = $this->NetCommonsWorkflow->parseStatus())) {
             $this->throwBadRequest();
             return;
         }
         // 保存dataの準備
         $data = $this->__readySaveData($this->data);
         // 登録データ作成
         $video = $this->Video->create();
         $data = Hash::merge($video, $data, array($this->Video->alias => array('status' => $status, 'block_id' => $this->viewVars['blockId'], 'language_id' => $this->viewVars['languageId'])), array($this->Comment->alias => array('block_key' => $this->viewVars['blockKey'])));
         if (Video::isFfmpegEnable()) {
             // 登録
             $this->Video->addSaveVideo($data, $this->viewVars['roomId']);
         } else {
             // 登録 動画を自動変換しない
             $this->Video->addNoConvertSaveVideo($data);
         }
         // 正常時
         if ($this->handleValidationError($this->Video->validationErrors)) {
             if (!$this->request->is('ajax')) {
                 // 一覧へ
                 $this->redirect('/videos/videos/index/' . $this->viewVars['frameId']);
             }
         }
     }
     $results = $this->__init();
     $this->set($results);
 }
コード例 #19
0
 public function actionVideo()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 25;
     $model = Video::model()->is_publish()->findAll($criteria);
     $this->setRss($model, 'video', 'Video', 'Rss Feed Video', $this->createUrl('video'));
 }
コード例 #20
0
 public function detail($id)
 {
     $video = Video::getVideo($id);
     $previous = Video::getPreviousVideo($id);
     $next = Video::getNextVideo($id);
     return View::make('pages.video.detail')->with('video', $video)->with('previous', $previous ? $previous->id : null)->with('next', $next ? $next->id : null);
 }
コード例 #21
0
ファイル: BatchAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             foreach ((array) $ids as $id) {
                 $videoModel = Video::model()->findByPk($id);
                 if ($videoModel) {
                     Uploader::deleteFile(ROOT_PATH . $videoModel->cover_image);
                 }
             }
             Video::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Video::model()->updateAll(['status' => 'Y'], $criteria);
             break;
         case 'hidden':
             //隐藏
             Video::model()->updateAll(['status' => 'N'], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
コード例 #22
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         Video::create(array('title' => $faker->sentence($nbwords = 5), 'slug' => $faker->slug, 'content' => $faker->text, 'excerpt' => $faker->sentence, 'image' => $faker->imageUrl($width = 640, $height = 480), 'file' => 'uploads/videos/1.mp4', 'video_category_id' => $faker->numberBetween(1, 8)));
     }
 }
コード例 #23
0
ファイル: admin.php プロジェクト: jtiala/xqdvd
/**
 * Views list of videos
 * 
 * @param type $url
 * @param type $adminHash
 * @param type $dvd
 */
function viewVideoList($url, $adminHash, $dvd = 0)
{
    $dbh = new Database();
    $sth = $dbh->prepare("SELECT id FROM " . DB_PREFIX . "videos WHERE dvd = ? ORDER BY id DESC");
    $sth->execute(array($dvd));
    $videoCount = 0;
    while ($id = $sth->fetchColumn()) {
        $videoCount++;
        $video = new Video();
        $video->load($id);
        include '../views/admin/singleVideo.php';
    }
    if ($videoCount == 0) {
        include '../views/admin/noVideos.php';
    }
}
コード例 #24
0
ファイル: html5video.php プロジェクト: 01J/bealtine
 function __construct($id, $title = '', $offset = 0)
 {
     parent::__construct($id, $title, $offset);
     if (in_array(pathinfo($id, PATHINFO_EXTENSION), array('oga', 'mp3', 'm4a', 'webma', 'wav'))) {
         $this->type = 'a';
     }
 }
コード例 #25
0
ファイル: IndexAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     //SEO
     $this->controller->_seoTitle = $this->controller->_setting['seo_title'];
     $this->controller->_seoKeywords = $this->controller->_setting['seo_keywords'];
     $this->controller->_seoDescription = $this->controller->_setting['seo_description'];
     //头部banner
     $index_top_banner = Ad::model()->getAdOne(4);
     //中部banner
     $index_mid_banner = Ad::model()->getAdOne(3);
     //底部banner
     $index_bottom_banner = Ad::model()->getAdOne(5);
     //最新资讯
     $news_new = Post::model()->getList(array('limit' => 20));
     //热门资讯
     $news_hot = Post::model()->getList(array('order' => 't.view_count DESC, t.id DESC', 'limit' => 20));
     //最新图集
     $image_new = Image::model()->getList(array('limit' => 10));
     //热门图集
     $image_hot = Image::model()->getList(array('limit' => 10, 'order' => 'view_count DESC, t.id DESC'));
     //最新软件
     $soft_new = Soft::model()->getList(array('limit' => 20));
     //热门软件
     $soft_hot = Soft::model()->getList(array('limit' => 10, 'order' => 'down_count DESC, t.id DESC'));
     //最新视频
     $video_new = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY id DESC Limit 20", array(':status' => 'Y'));
     //热门视频
     $video_hot = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY view_count DESC, video_score DESC, id DESC Limit 20", array(':status' => 'Y'));
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->controller->render('index', array('index_top_banner' => $index_top_banner, 'index_mid_banner' => $index_mid_banner, 'index_bottom_banner' => $index_bottom_banner, 'link_logos' => $link_logos, 'link_texts' => $link_texts, 'news_new' => $news_new, 'news_hot' => $news_hot, 'image_new' => $image_new, 'image_hot' => $image_hot, 'soft_new' => $soft_new, 'soft_hot' => $soft_hot, 'video_new' => $video_new, 'video_hot' => $video_hot));
 }
コード例 #26
0
ファイル: news_controller.php プロジェクト: boulama/DreamVids
 public function index($request)
 {
     $data = array();
     $data['currentPageTitle'] = 'Nouveautés';
     $data['vids'] = Video::getLastVideos(50);
     return new ViewResponse('news/news', $data);
 }
コード例 #27
0
 public function index($request)
 {
     $data = [];
     $counts = [];
     $counts['videos'] = Video::count();
     $counts['users'] = User::count();
     $counts['channels'] = UserChannel::count();
     $counts['comments'] = Comment::count();
     $counts['total_views'] = Video::sumViews();
     $counts['channel_user_ratio'] = round($counts['channels'] / $counts['users'], 2);
     $counts['videos_that_has_comments'] = Statistic::countVideosHavingComments();
     $counts['channels_having_videos'] = Video::find_by_sql('SELECT count(DISTINCT poster_id) as count from `videos`')[0]->count;
     $counts['part_of_commented_videos'] = round($counts['videos_that_has_comments'] / $counts['videos'] * 100, 2);
     $counts['part_of_channels_having_videos'] = round($counts['channels_having_videos'] / $counts['channels'] * 100, 2);
     $counts['user_1_channel'] = Statistic::countUserHavingChannels('= 1');
     $counts['user_2_channel'] = Statistic::countUserHavingChannels('= 2');
     $counts['user_3_channel'] = Statistic::countUserHavingChannels('= 3');
     $counts['user_more3_channel'] = Statistic::countUserHavingChannels('> 3');
     $counts['user_1_channel_part'] = round($counts['user_1_channel'] / $counts['users'] * 100, 2);
     $counts['user_2_channel_part'] = round($counts['user_2_channel'] / $counts['users'] * 100, 2);
     $counts['user_3_channel_part'] = round($counts['user_3_channel'] / $counts['users'] * 100, 2);
     $counts['user_more3_channel_part'] = round($counts['user_more3_channel'] / $counts['users'] * 100, 2);
     $data['counts'] = $counts;
     return new ViewResponse('admin/statistic/index', $data);
 }
コード例 #28
0
ファイル: DownloadAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     //限制下载频率
     $cookie = Yii::app()->request->getCookies();
     $id = Yii::app()->request->getParam('id');
     $cookie_key = 'DL' . $id . 'TIMES';
     if (isset($cookie[$cookie_key]) && $cookie[$cookie_key]->value) {
         throw new CHttpException(404, Yii::t('common', 'Access frequency too fast'));
     }
     $video = Video::model()->findByPk($id);
     if ($video) {
         $file = Helper::convertChineseName(ROOT_PATH . '/' . $video->video_file);
         if ($video->video_file && file_exists($file)) {
             $filename = pathinfo($file, PATHINFO_BASENAME);
             //更新下载次数
             $video->updateCounters(array('down_count' => 1), 'id=:id', array('id' => $id));
             //存储下载cookie次数
             unset($cookie[$cookie_key]);
             $down = 1;
             $cookie = new CHttpCookie($cookie_key, $down);
             $cookie->expire = time() + 20;
             //20秒之后可以再次下载
             Yii::app()->request->cookies[$cookie_key] = $cookie;
             //开始下载
             Yii::app()->request->sendFile($filename, file_get_contents($file));
             exit;
         } else {
             throw new CHttpException(404, Yii::t('common', 'Source Is Not Found'));
         }
     } else {
         throw new CHttpException(404, Yii::t('common', 'Source Is Not Found'));
     }
 }
コード例 #29
0
ファイル: Video.php プロジェクト: bashrc/gnusocial-debian
 static function saveNew(Profile $profile, $url, $options = array())
 {
     $vid = new Video();
     $vid->id = UUID::gen();
     $vid->profile_id = $profile->id;
     $vid->url = $url;
     $options['object_type'] = Video::OBJECT_TYPE;
     if (!array_key_exists('uri', $options)) {
         $options['uri'] = common_local_url('showvideo', array('id' => $vid->id));
     }
     if (!array_key_exists('rendered', $options)) {
         $options['rendered'] = sprintf("<video src=\"%s\">Sorry, your browser doesn't support the video tag.</video>", $url);
     }
     $vid->uri = $options['uri'];
     $vid->insert();
     return Notice::saveNew($profile->id, '', 'web', $options);
 }
コード例 #30
-2
 public function borrar()
 {
     //Aca se manda a la funcion borrarItem de la clase Item
     //y se queda con la respuesta para redirigir cual sea el caso
     $respuesta = Video::borrar(Input::all());
     return $respuesta;
 }