Ejemplo n.º 1
0
 public function actionBrowseVideoImage()
 {
     $uploadtype = isset($_REQUEST['imgvid']) ? $_REQUEST['imgvid'] : "";
     if ($uploadtype != "") {
         $page = isset($_REQUEST['pageid']) ? $_REQUEST['pageid'] : 1;
         $targetdiv = $_REQUEST['targetdiv'];
         $limit = 1;
         $uptypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadtype', 'lookup_name' => $uploadtype));
         $criteria = new CDbCriteria();
         $criteria->condition = " explore_finao = 1 and uploadtype = " . $uptypeid->lookup_id;
         $criteria->order = "updateddate desc";
         $uploadImages = Uploaddetails::model()->findAll($criteria);
         $upPageNav = FinaoController::getpagedetails($uploadImages, 1, $page, 1);
         //$criteria->limit = $upPageNav["limittxt"];
         //$lim = FinaoController::getpagecount(count($uploadImages),$limit,$page);
         //print_r($upPageNav);exit;
         $criteria->limit = $upPageNav['limittxt'];
         $criteria->offset = $upPageNav['offset'];
         $uploadImages = Uploaddetails::model()->findAll($criteria);
         $videoembedurl = "";
         $caption = "";
         $userimg = "";
         if (isset($uploadImages) && $uploadImages != "" && count($uploadImages) >= 1) {
             foreach ($uploadImages as $vidup) {
                 if ($uploadtype == 'Video') {
                     if ($vidup->videoid != "" && $vidup->videostatus == 'ready') {
                         $videoembedurl = FinaoController::getviddlembedCode($vidup->videoid);
                     } elseif ($vidup->video_embedurl != "") {
                         $videoembedurl = $vidup->video_embedurl;
                     }
                 } elseif ($uploadtype == 'Image') {
                     $filename = $vidup->uploadfile_path . "/" . $vidup->uploadfile_name;
                     if (file_exists(Yii::app()->basePath . "/../" . $filename)) {
                         $videoembedurl = Yii::app()->baseUrl . $filename;
                     }
                 }
                 $caption = $vidup->caption;
                 $userimg = User::model()->findByPk($vidup->uploadedby);
             }
         }
         $this->renderPartial('_browserImagVideo', array('videoembedurl' => $videoembedurl, 'uploadtype' => $uploadtype, 'upPageNav' => $upPageNav, 'caption' => $caption, 'targetdiv' => $targetdiv, 'userinfo' => $userimg));
     }
 }