Example #1
0
 public function addVideoItemAction()
 {
     $form = new Admin_Form_SlideshowVideoItem();
     $form->setMethod('POST')->setAction($this->view->url(array('action' => 'add-video-item')));
     $request = $this->getRequest();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $slideshow = $this->getSlideshow();
         $this->_helper->service('package')->addItem($slideshow, new \Newscoop\Package\RemoteVideo($form->url->getValue()));
         $this->_helper->redirector('edit', 'slideshow', 'admin', array('article_number' => $this->_getParam('article_number'), 'slideshow' => $slideshow->getId()));
     }
     $this->view->form = $form;
 }
 public function addVideoItemAction()
 {
     $form = new Admin_Form_SlideshowVideoItem();
     $form->setMethod('POST')->setAction($this->view->url(array('action' => 'add-video-item')));
     $slideshow = null;
     if ($this->_getParam('slideshow')) {
         $slideshow = $this->getSlideshow();
     }
     if ($this->_getParam('slideshow_name') && !$slideshow) {
         $values = array('rendition' => $this->_getParam('rendition'), 'headline' => $this->_getParam('slideshow_name'));
         $values['rendition'] = $this->_helper->service('image.rendition')->getRendition($values['rendition']);
         $slideshow = $this->_helper->service('package')->save($values);
         if ($this->_getParam('article_number', false)) {
             $slideshows = $this->_helper->service('package')->findByArticle($this->_getParam('article_number'));
             $slideshows[] = $slideshow;
             $this->_helper->service('package')->saveArticle(array('id' => $this->_getParam('article_number'), 'slideshows' => array_map(function ($slideshow) {
                 return array('id' => $slideshow->getId());
             }, $slideshows)));
         }
     }
     $request = $this->getRequest();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $this->_helper->service('package')->addItem($slideshow, new \Newscoop\Package\RemoteVideo($form->url->getValue()));
         $this->_helper->redirector('edit', 'slideshow', 'admin', array('article_number' => $this->_getParam('article_number'), 'slideshow' => $slideshow->getId()));
     }
     $this->view->form = $form;
 }