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 actionSearch() { $ModalSeo = new CmsvideoSettings(); $DataSeo = $ModalSeo->DownloadSettings(); foreach ($DataSeo as $Seoo) { $this->pageMetaRobots = $Seoo['settings_robots']; } $model = new CmsvideoVideo('search_model'); $model->unsetAttributes(); if (isset($_GET['search_key'])) { if (!$_GET['search_key'] == '') { $model->video_title = $_GET['search_key']; $model->video_text = $_GET['search_key']; // $dataProvider= $model->search(); } else { echo 'podano puste wartości!'; $this->redirect(array('/')); } } $this->render('search', 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(); }