public function DeleteVideoImage($id) { $Data = CmsvideoVideo::model()->find('video_id=:id', array(':id' => $id)); $FileImage = $Data->video_image; $FileThumb = $Data->video_thumb; if (file_exists($FileImage)) { unlink($FileImage); } else { echo 'Error deleting Image:' . $FileImage; } if (file_exists($FileThumb)) { unlink($FileThumb); } else { echo 'Error deleting Thumbnail: ' . $FileThumb; } }
public function actionEmbed($id) { if (!is_numeric($id)) { exit; } $this->layout = 'site/embed'; $ModalSeo = new CmsvideoSettings(); $DataSeo = $ModalSeo->DownloadSettings(); // $ModelCategories = CmsvideoCategories::model()->findAll(); $Model = CmsvideoVideo::model()->find('video_id=:IdVideo', array(':IdVideo' => $id)); $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_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->pageMetaDescription = $Video['video_description']; //} $this->pageTitle = 'embed-video-site'; // $this->pageMetaKeywords = $Model->video_keywords; // $this->pageMetaDescription = $Model->video_description; // $this->pageMetaOgImage = $Model->video_thumb; // $this->pageMetaDescription = $Video['video_description']; $this->render('embed', array('Model' => $Model)); }
function actionAutocompleteVideo($term) { $criteria = new CDbCriteria(); $criteria->compare('video_title', $term, true); $ModelVideo = CmsvideoVideo::model()->findAll($criteria); foreach ($ModelVideo as $value) { // $array[] = array('value' => trim($value->video_title)); $array[] = array('idvideo' => trim($value->video_id), 'label' => trim($value->video_title), 'image' => trim($value->video_image)); } echo CJSON::encode($array); Yii::app()->end(); }