Exemple #1
0
 public function actionCreate()
 {
     $video = new Video();
     $video->loadDefaultValues();
     $video->videoId = '146751001';
     $video->mobileLink = "https://player.vimeo.com/external/146751001.mobile.mp4?s=0b43d0d45d443d1850e290c950ab621e977d5cb2&profile_id=116";
     $video->sdLink = "https://player.vimeo.com/external/146751001.sd.mp4?s=ae3d3e9818788730b24d5aafa31fd10d6cee87b0&profile_id=112";
     $video->hlsLink = "https://player.vimeo.com/external/146751001.m3u8?p=high,standard,mobile&s=5100ac376ddb43addfe9e185b93075eb83ffd519";
     $video->embed = "<iframe src=\"https://player.vimeo.com/video/146751001?title=0&byline=0&portrait=0&badge=0&autopause=0&player_id=0\" width=\"854\" height=\"480\" frameborder=\"0\" title=\"EVAW LoRes\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
     $video->duration = 221;
     $video->poster = "https://i.vimeocdn.com/video/545226406_640x360.jpg?r=pad";
     $video->size = 10;
     $video->created_by = 7;
     $video->updated_by = 7;
     $video->save();
     $cb = new CodeBankCampaign();
     $cb->loadDefaultValues();
     $cb->name = 'Violence Against Women';
     $cb->modelClass = 'Video';
     $cb->objectId = $video->id;
     $cb->codeBank_code = 'EVAW';
     $cb->created_by = 7;
     $cb->updated_by = 7;
     $cb->save();
     echo "Done\n";
 }
 public static function getData()
 {
     $videoModel = new Video();
     $videoData = $videoModel->find()->limit(6)->all();
     $videoHot = array($videoData[0], $videoData[1]);
     $videoHotChild = array($videoData[2], $videoData[3], $videoData[4], $videoData[5]);
     return array('videoHot' => $videoHot, 'videoHotChild' => $videoHotChild);
 }
 public function actionView($id)
 {
     $model = Video::findOne($id);
     $course = $model->course;
     $author = $course->author;
     return $this->render('view', ['model' => $model, 'course' => $course, 'author' => $author, 'chapters' => Course::getVideoList($course->id)]);
 }
Exemple #4
0
 public function getAllItems($lastId = 0, $searchTag = "", $userId = false, $limit = false)
 {
     $query = Video::find()->from(["v" => Video::tableName()])->joinWith(['items i'])->andWhere('i.deleted = 0')->orderBy('id DESC');
     // Определяем за какой период будем показывать
     if (!empty($limit)) {
         $query = $query->limit((int) $limit);
     } else {
         $query = $query->limit(100);
     }
     if ($lastId != 0) {
         $query = $query->andWhere('i.id < :id', [':id' => $lastId]);
     }
     if (!empty($userId)) {
         $query = $query->andWhere('i.user_id = :userId', [':userId' => $userId]);
     }
     if (!empty($searchTag)) {
         if (is_array($searchTag)) {
             $tagsId = $searchTag;
         } else {
             $tags = Tags::find()->where(['name' => $searchTag])->all();
             $tagsId = [];
             foreach ($tags as $tag) {
                 $tagsId[] = (int) $tag->id;
             }
         }
         if (count($tagsId) > 0) {
             $query = $query->andWhere('(SELECT COUNT(*) as tagCount FROM `' . TagEntity::tableName() . '` te WHERE te.entity = "' . TagEntity::ENTITY_ITEM . '" AND te.entity_id = i.id  AND te.tag_id IN (' . join(',', $tagsId) . ')) > 0');
         }
     }
     return $query->all();
 }
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $nodes = Video::find()->where(['status' => 10])->limit(2)->all();
     return $this->render('VideoRightWidget', ['nodes' => $nodes]);
 }
 /**
  * Finds the ReviewCategory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $slug
  * @return ReviewCategory the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($slug)
 {
     if (($model = Video::findOne(['slug' => $slug])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 protected function findModel($id)
 {
     if (($model = Video::find()->where(['and', 'id=' . $id])->One()) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('你所查找的网页不存在');
     }
 }
Exemple #8
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Video::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'views' => $this->views, 'course' => $this->course, 'class' => $this->class, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'thumb', $this->thumb])->andFilterWhere(['like', 'keyword', $this->keyword])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'author', $this->author]);
     return $dataProvider;
 }
Exemple #9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Video::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'size' => $this->size, 'duration' => $this->duration, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'confirmed' => $this->confirmed]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'embed', $this->embed])->andFilterWhere(['like', 'poster', $this->poster])->andFilterWhere(['like', 'videoId', $this->videoId])->andFilterWhere(['like', 'mobileLink', $this->mobileLink])->andFilterWhere(['like', 'sdLink', $this->sdLink])->andFilterWhere(['like', 'hlsLink', $this->hlsLink]);
     return $dataProvider;
 }
Exemple #10
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Video::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'user_id' => $this->user_id, 'status' => $this->status, 'course_id' => $this->course_id]);
     $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'video_url', $this->video_url]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Video::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'status' => $this->status, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'meta_title', $this->meta_title])->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords])->andFilterWhere(['like', 'meta_description', $this->meta_description]);
     return $dataProvider;
 }
Exemple #12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = VideoModel::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'video_source_id' => $this->video_source_id, 'date_added' => $this->date_added, 'date_created' => $this->date_created, 'added_by_id' => $this->added_by_id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'thumbnail', $this->thumbnail]);
     return $dataProvider;
 }
 public function actionIndex()
 {
     $type = Yii::$app->request->get('type');
     $class = Yii::$app->request->get('class');
     $course = Yii::$app->request->get('course');
     $key = Yii::$app->request->get('key');
     $sort = Yii::$app->request->get('sort');
     //条件
     $where[] = 'and';
     $where[] = 'status>' . Status::STATUS_INACTIVE;
     if (!is_null($class)) {
         $where[] = ['class' => $class];
     }
     if (!is_null($course)) {
         $where[] = ['course' => $course];
     }
     if (!is_null($key)) {
         $where[] = ['like', 'title', $key];
     }
     //排序
     $sort = ['created_at' => SORT_DESC];
     if ($sort == 'star') {
         $sort = ['star' => SORT_DESC];
     }
     //课程类型
     if ($type == 0) {
         $query = Video::find()->where($where);
         //查询4条推荐信息
         $where[1] = 'status=' . Status::STATUS_REC;
         $infoRec = Video::find()->where($where)->limit(4)->all();
     } else {
         $where[] = ['type' => $type];
         $query = Resource::find()->where($where);
         //查询4条推荐信息
         $where[1] = 'status=' . Status::STATUS_REC;
         $infoRec = Resource::find()->where($where)->limit(4)->all();
     }
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => $sort], 'pagination' => ['pageSize' => 15]]);
     return $this->render('index', ['models' => $dataProvider->getModels(), 'pagination' => $dataProvider->pagination, 'type' => $type, 'class' => $class, 'course' => $course, 'key' => $key, 'infoRec' => $infoRec]);
 }
 public function actionIndex()
 {
     //轮播图
     $slider = Slider::find()->where(['place' => 0])->orderBy(['ord' => SORT_ASC])->all();
     //微课
     $weike = \common\models\Video::find()->where(['and', ['status' => \common\models\Status::STATUS_REC]])->limit(6)->all();
     //教案
     $jiaoan = \common\models\Resource::find()->where(['and', ['type' => 0], ['status' => \common\models\Status::STATUS_REC]])->limit(3)->all();
     //课件
     $kejian = \common\models\Resource::find()->where(['and', ['type' => 1], ['status' => \common\models\Status::STATUS_REC]])->limit(3)->all();
     //试题
     $shiti = \common\models\Resource::find()->where(['and', ['type' => 2], ['status' => \common\models\Status::STATUS_REC]])->limit(3)->all();
     //新闻公告
     $news = \common\models\News::find()->where(['and', 'status>' . \common\models\Status::STATUS_INACTIVE])->orderBy(['id' => SORT_DESC])->limit(3)->all();
     //推荐下载
     $recdown = \common\models\Resource::find()->where(['and', ['status' => \common\models\Status::STATUS_REC]])->orderBy(['id' => SORT_DESC])->limit(4)->all();
     //最新评价
     $pinglun = \common\models\Pinglun::find()->where(['and', 'status>' . \common\models\Status::STATUS_INACTIVE])->orderBy(['id' => SORT_DESC])->limit(6)->all();
     //学霸必备
     $xueba = \common\models\Resource::find()->where(['and', 'status>' . \common\models\Status::STATUS_REC])->orderBy(['rand()' => SORT_DESC])->limit(10)->all();
     //友情链接
     $friendLink = \common\models\Friendlink::find()->where(['isshow' => \common\models\YesNo::YES])->orderBy(['ord' => SORT_ASC])->all();
     return $this->render('index', ['slider' => $slider, 'weike' => $weike, 'jiaoan' => $jiaoan, 'kejian' => $kejian, 'shiti' => $shiti, 'news' => $news, 'recdown' => $recdown, 'pinglun' => $pinglun, 'xueba' => $xueba, 'friendlink' => $friendLink]);
 }
Exemple #15
0
 public function rightRandomVideo()
 {
     $video = Video::getRandomVideo();
     return $this->render('rightWidget/rightRandomVideo', ['video' => $video]);
 }
Exemple #16
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVideos()
 {
     return $this->hasMany(Video::className(), ['author_id' => 'id']);
 }
Exemple #17
0
<?php

use yii\helpers\Html;
use frontend\assets\ShopAsset;
use frontend\assets\AppAsset;
use common\models\Video;
AppAsset::register($this);
ShopAsset::register($this);
$modelYoutube = Video::getLastVideo(4);
$this->beginPage();
?>
<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
<head>
    <link rel="icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <meta charset="<?php 
echo Yii::$app->charset;
?>
"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php 
echo Html::csrfMetaTags();
?>
    <title><?php 
echo Html::encode($this->title);
?>
</title>
 public function actionMyVideo()
 {
     $where[] = 'and';
     $where[] = ['created_by' => Yii::$app->user->id];
     $query = \common\models\Video::find()->where($where);
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['defaultPageSize' => 6], 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]]]);
     return $this->render('my-video', ['models' => $dataProvider->getModels(), 'pagination' => $dataProvider->pagination]);
 }
Exemple #19
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVideo()
 {
     return $this->hasOne(Video::className(), ['id' => 'video_id']);
 }
 public function actionGetVideoByTime()
 {
     $time = Yii::$app->request->post('time');
     //vd($time);
     if ($time == 0) {
         $model = Video::find()->orderBy('created_at DESC')->all();
     } else {
         $model = Video::find()->orderBy('created_at ASC')->all();
     }
     //vd($model);
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     return $this->renderAjax('get-video-by-categoria-id', ['model' => $model]);
 }
Exemple #21
0
 public function actionConfirmed()
 {
     $codeBankCampaign = new CodeBankCampaign();
     $codeBankCampaign->loadDefaultValues();
     $video = new Video();
     $video->loadDefaultValues();
     $request = Yii::$app->request;
     if ($request->isPost) {
         $lib = new Vimeo(Yii::$app->params['vimeoClientId'], Yii::$app->params['vimeoSecret'], Yii::$app->params['vimeoAccessToken']);
         if ($codeBankCampaign->load($request->post()) && $video->load($request->post())) {
             $response = $lib->request('/me/videos/' . $video->videoId, [], 'GET');
             $video->duration = $response['body']['duration'];
             $video->embed = $response['body']['embed']['html'];
             $video->poster = $response['body']['pictures']['sizes'][3]['link'];
             $files = $response['body']['files'];
             foreach ($files as $key => $value) {
                 switch ($value['quality']) {
                     case 'mobile':
                         $video->mobileLink = $value['link'];
                         break;
                     case 'sd':
                         $video->sdLink = $value['link'];
                         break;
                     case 'hls':
                         $video->hlsLink = $value['link'];
                         break;
                 }
             }
             if (isset($codeBankCampaign->codeBank_code)) {
                 $video->confirmed = 1;
             }
             $video->save();
             $codeBankCampaign->objectId = $video->id;
             $codeBankCampaign->save();
             //                $view = $this->getView();
             //                $view->title = 'Step 3: Editing Video Information for Hyrizy Code ' . Html::tag('label',$codeBankCampaign->codeBank_code,['class'=>'label label-primary']);
             //                return $this->render('update',['model'=>$video]);
             return $this->redirect(['/campaign/view', 'id' => $codeBankCampaign->id]);
         }
     }
 }
Exemple #22
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVideos()
 {
     return $this->hasMany(Video::className(), ['video_source_id' => 'id']);
 }
Exemple #23
0
 /**
  * @return Video
  */
 public static function getRandomVideo($exclude = [])
 {
     $find = Video::find()->orderBy(new Expression('rand()'));
     if (!empty($exclude)) {
         $find = $find->andWhere(['not in', 'entity_id', $exclude]);
     }
     return $find->one();
 }
Exemple #24
0
           	  <dt>[报考指南]</dt>
                <dd><a href="#">2015河南造价员资格证书领</a></dd>
                 <dd><a href="#">取通知造价员考试合格标准</a></dd>
                 <dt>[报考指南]</dt>
                <dd><a href="#">2015河南造价员资格证书领</a></dd>
                 <dd><a href="#">取通知造价员考试合格标准</a></dd>
            </dl>
        </div>
        
        <div class="third-right f-l">
            <div class="wlst-tit lm-tb"><span><a href="<?php 
echo Yii::$app->urlManager->createUrl(['video/index']);
?>
">更多</a></span>网络试听</div>
            <?php 
$video = \common\models\Video::find()->where(['status' => \common\models\Status::STATUS_REC])->one();
?>
            <?php 
if ($video) {
    ?>
            <div class="wlst-sp">
                <a href="<?php 
    echo Yii::$app->urlManager->createUrl(['video/show', 'id' => $video->id]);
    ?>
">
                    <img src="<?php 
    echo $video->content . "?vframe/jpg/offset/" . $video->thumb;
    ?>
" width="295" height="196" />
                </a>
            </div>
 public function actionInterview()
 {
     $userdetails = \Yii::$app->user->identity;
     $model = InterviewVideo::find()->where(['user_id' => $userdetails->id])->one();
     //echo "<pre>";print_r($model->video);die;
     if (empty($model)) {
         $model = new InterviewVideo();
     }
     $video = new Video();
     $user = Userform::find()->where(['id' => $userdetails->id])->one();
     if (empty($user)) {
         $user = new Userform();
     }
     $userprofile = UserProfile::find()->where(['user_id' => $userdetails->id])->one();
     if (empty($userprofile)) {
         $userprofile = new UserProfile();
     }
     if (isset($_POST['Video'])) {
         $video->attributes = $_POST['Video'];
         $video->media_module_id = 5;
         // id 5 is interview video type in tlb_media_module table
         $model->user_id = $userdetails->id;
         if ($video->validate()) {
             $video->save();
             $model->video_id = $video->id;
             $model->save();
         }
     }
     return $this->render('interview', ['model' => $model, 'user' => $user, 'video' => $video, 'userprofile' => $userprofile]);
 }
Exemple #26
0
 public function getWeike()
 {
     return $this->hasOne(Video::className(), ['id' => 'rid']);
 }
Exemple #27
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVideos()
 {
     return $this->hasMany(Video::className(), ['course_id' => 'id'])->orderBy(['sort_order' => SORT_ASC])->all();
 }
 public function actionViews()
 {
     $slug = Yii::$app->request->get('slug');
     $model = Video::find()->where(['slug' => $slug])->one();
     $this->meta = $model;
     return $this->render('views', ['model' => $model]);
 }
Exemple #29
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVideos()
 {
     return $this->hasMany(Video::className(), ['id' => 'video_id'])->viaTable('{{%video_caster}}', ['caster_id' => 'id']);
 }
Exemple #30
0
 public function actionRandomvideo()
 {
     $exclude = Yii::$app->request->post('exclude');
     $video = Video::getRandomVideo($exclude);
     return json_encode(['videoId' => $video->entity_id]);
 }