Exemplo n.º 1
0
 /**
  * Edit action for the current object.
  *
  * @access public
  *
  * @return void
  */
 public function editAction()
 {
     $pageID = $this->_getParam('pageID');
     $videoID = $this->_getParam('videoID');
     $blockID = $this->_getParam('blockID');
     $baseDir = $this->view->baseUrl();
     $videoObject = new VideoObject();
     $returnUrl = "/video/index/list/";
     $imageSrc = "";
     $ocjVideo = $videoObject->populate($videoID, $this->getCurrentEditLanguage());
     if ($this->_request->isPost()) {
         //var_dump($this->_request->getPost());
         //exit;
         $formData = $this->_request->getPost();
         if ($formData['VI_Poster'] == "") {
             $imageSrc = $this->view->baseUrl() . "/icons/image_non_ disponible.jpg";
         } else {
             $imageSrc = $data[$this->_imageSrc];
         }
     } else {
         if ($ocjVideo['VI_Poster'] == "") {
             $imageSrc = $this->view->baseUrl() . "/icons/image_non_ disponible.jpg";
         } else {
             $imageSrc = Zend_Registry::get("www_root") . "/data/files/videos/" . $ocjVideo['VI_Poster'];
         }
     }
     $form = new FormVideo(array('baseDir' => $baseDir, 'cancelUrl' => "{$baseDir}{$returnUrl}", 'VI_ID' => $videoID, 'VI_Poster' => $ocjVideo['VI_Poster'], 'VI_MP4' => $ocjVideo['VI_MP4'], 'VI_WEBM' => $ocjVideo['VI_WEBM'], 'VI_OGG' => $ocjVideo['VI_OGG'], 'VI_Description' => $ocjVideo['VI_Description'], 'VI_Name' => $ocjVideo['VI_Name'], 'V_Alias' => $ocjVideo['V_Alias'], 'V_Width' => $ocjVideo['V_Width'], 'V_Height' => $ocjVideo['V_Height'], 'V_Autoplay' => $ocjVideo['V_Autoplay'], 'isNewPoster' => 0, 'isNewMP4' => 0, 'isNewWEBM' => 0, 'isNewOGG' => 0, 'imageSrc' => $imageSrc, 'lang' => Zend_Registry::get('languageSuffix')));
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             if ($form->getValue('VI_MP4') != '') {
                 $srcVI_MP4O = $form->getValue('VI_MP4');
                 $mp4 = $this->getVideoName($srcVI_MP4O);
                 $formData['VI_MP4'] = $mp4;
             }
             if ($form->getValue('VI_WEBM') != '') {
                 $srcVI_WEBM = $form->getValue('VI_WEBM');
                 $webm = $this->getVideoName($srcVI_WEBM);
                 $formData['VI_WEBM'] = $webm;
             }
             if ($form->getValue('VI_OGG') != '') {
                 $srcVI_OGG = $form->getValue('VI_OGG');
                 $ogg = $this->getVideoName($srcVI_OGG);
                 $formData['VI_OGG'] = $ogg;
             }
             $videoObject->save($videoID, $formData, $this->_currentEditLanguage);
             $this->mediaListVideoMaker();
             $config = Zend_Registry::get('config')->toArray();
             //var_dump($form);
             $config = Zend_Registry::get('config')->toArray();
             if ($form->getValue('VI_Poster') != '') {
                 $srcVI_PosterO = "../../{$this->_config->document_root}/data/images/tmp/" . $form->getValue('VI_Poster');
                 $srcVI_PosterL = "../../{$this->_config->document_root}/data/files/videos/" . $form->getValue('VI_Poster');
                 copy($srcVI_PosterO, $srcVI_PosterL);
                 //echo $srcVI_PosterO . " | " . $srcVI_PosterL . "<br />";
             }
             if ($form->getValue('VI_MP4') != '') {
                 $srcVI_MP4O = $form->getValue('VI_MP4');
                 /* $srcVI_MP4O = $this->getRelativePathVideo($srcVI_MP4O);
                    $mp4 = $this->getVideoName($srcVI_MP4O);
                    $srcVI_MP4L = "../../{$this->_config->document_root}/data/images/videos/" . $videoID . "/" . Zend_Registry::get('languageSuffix') . "/" . $mp4;
                    copy($srcVI_MP4O, $srcVI_MP4L);*/
                 //echo $srcVI_MP4O . " | " . $srcVI_MP4L . "<br />";
             }
             if ($form->getValue('VI_WEBM')) {
                 $srcVI_WEBMO = $form->getValue('VI_WEBM');
                 /* $srcVI_WEBMO = $this->getRelativePathVideo($srcVI_WEBMO);
                    $webm = $this->getVideoName($srcVI_WEBMO);
                    $srcVI_WEBML = "../../{$this->_config->document_root}/data/images/videos/" . $videoID . "/" . Zend_Registry::get('languageSuffix') . "/" . $webm;
                    copy($srcVI_WEBMO, $srcVI_WEBML);*/
                 //echo $srcVI_WEBMO . " | " . $srcVI_WEBML . "<br />";
             }
             if ($form->getValue('VI_OGG')) {
                 $srcVI_OGGO = $form->getValue('VI_OGG');
                 /*$srcVI_OGGO = $this->getRelativePathVideo($srcVI_OGGO);
                   $ogg = $this->getVideoName($srcVI_OGGO);
                   $srcVI_OGGL = "../../{$this->_config->document_root}/data/images/videos/" . $videoID . "/" . Zend_Registry::get('languageSuffix') . "/" . $ogg;
                   copy($srcVI_OGGO, $srcVI_OGGL); */
                 //echo $srcVI_OGGO . " | " . $srcVI_OGGL . "<br />";
             }
             if (isset($formData['submitSaveClose'])) {
                 $this->_redirect($returnUrl);
             } else {
                 $this->_redirect('video/index/edit/videoID/' . $videoID . "/lang/" . Zend_Registry::get('languageSuffix') . "/return/list/");
             }
         } else {
             $form->populate($formData);
         }
     } else {
         // var_dump($ocjVideo);
         $form->populate($ocjVideo);
     }
 }