コード例 #1
0
 public function actionVideo($id)
 {
     if (!is_numeric($id)) {
         exit;
     }
     $this->ogtype = "yes";
     $this->videoID = $id;
     $ModalSeo = new CmsvideoSettings();
     $DataSeo = $ModalSeo->DownloadSettings();
     $ModelCategories = CmsvideoCategories::model()->findAll();
     $Model = CmsvideoVideo::model()->find('video_id=:IdVideo', array(':IdVideo' => $id));
     $criteria = new CDbCriteria(array('select' => 'video_id, video_title, video_thumb, video_views, video_alias', 'condition' => 'video_views >= 0 AND video_id != :IdVideo', 'order' => 'video_views DESC', 'params' => array(':IdVideo' => $id)));
     $total = CmsvideoVideo::model()->count();
     $pages = new CPagination($total);
     $pages->pageSize = 7;
     $pages->applyLimit($criteria);
     $VideoList = CmsvideoVideo::model()->findAll($criteria);
     $TagsId = unserialize($Model->video_tags);
     $ModelTags = array();
     if (is_array($TagsId) && !empty($TagsId)) {
         $TagsIdArr = join(',', $TagsId);
         $ModelTags = Tags::model()->findAllBySQL('SELECT tag_name FROM videocms_tags WHERE tag_id IN (' . $TagsIdArr . ')');
     }
     $session = Yii::app()->getSession();
     $video_arr = array();
     $ses_arr = array();
     if ($session['video_arr']) {
         $ses_arr = $session['video_arr'];
     }
     if (!in_array($id, $ses_arr)) {
         $video_arr = $ses_arr;
         $video_arr[] = $id;
         $Views = CmsvideoVideo::model()->find('video_id=:id', array(':id' => $id));
         if ($Views->video_views) {
             $Views->video_views = $Views->video_views + 1;
         } else {
             $Views->video_views = 1;
         }
         $Views->save();
         $session['video_arr'] = $video_arr;
     }
     foreach ($DataSeo as $Seoo) {
         $this->pageMetaRobots = $Seoo['settings_robots'];
         $this->disqus_shortname = $Seoo['disqus_shortname'];
         $this->player_autoplay = $Seoo['player_autoplay'];
         $this->player_preload = $Seoo['player_preload'];
         $this->player_loop = $Seoo['player_loop'];
         $this->player_controls = $Seoo['player_controls'];
     }
     // foreach ($Model as $Video)
     //  {
     $this->pageTitle = $Model->video_title;
     $this->pageMetaKeywords = $Model->video_keywords;
     $this->pageMetaDescription = $Model->video_description;
     $this->pageMetaOgImage = $Model->video_image;
     $this->pageAlias = $Model->video_alias;
     // $this->pageMetaDescription = $Video['video_description'];
     //}
     $this->render('video', array('ModelCategories' => $ModelCategories, 'ModelTags' => $ModelTags, 'Model' => $Model, 'VideoList' => $VideoList, 'pages' => $pages));
 }
コード例 #2
0
ファイル: videos.php プロジェクト: videocms/videocms-test
?>
                <?php 
echo $form->error($ModelVideo, 'video_1080p', array('class' => 'text-danger'));
?>
 
                <span class="glyphicon <?php 
echo $iconStat;
?>
 form-control-feedback"></span>
            </div>
            <div class="form-group <?php 
echo $fieldStat;
?>
 has-feedback">
                <?php 
$parents = CmsvideoCategories::model()->findAll('parent_id = 1');
$cm = new CommonMethods();
$data = $cm->makeDropDown($parents);
?>
                <?php 
echo $form->labelEx($ModelVideo, 'video_category');
?>
                <?php 
echo $form->dropDownList($ModelVideo, 'video_category', $data, array('class' => 'form-control'));
?>
                <?php 
echo $form->error($ModelVideo, 'video_category');
?>
            </div> 
            <div class="form-group <?php 
echo $fieldStat;
コード例 #3
0
 public function actionCategoryUpdate($id)
 {
     $this->pageTitle = 'Edit Category';
     if (!is_numeric($id)) {
         exit;
     }
     $CategoryUpdate = false;
     $ModelCategory = CmsvideoCategories::model()->findByPk($id);
     if (isset($_POST['CmsvideoCategories'])) {
         $ModelCategory->attributes = $_POST['CmsvideoCategories'];
         if ($ModelCategory->validate()) {
             $ModelCategory->save();
             $CategoryUpdate = true;
         }
         $this->redirect(array('/admin/category'));
     }
     $this->render('categoryupdate', array('ModelCategory' => $ModelCategory, 'CategoryUpdate' => $CategoryUpdate));
 }