Example #1
0
 public function actionQuickVideo()
 {
     $this->validateToken();
     $this->validatePermission('smartslider_edit');
     $sliderId = N2Request::getInt('sliderid');
     $this->validateVariable($sliderId > 0, 'Slider');
     $slidesModel = new N2SmartsliderSlidesModel();
     $video = json_decode(base64_decode(N2Request::getVar('video')), true);
     $this->validateVariable($video, 'Video');
     $newSlideId = $slidesModel->createQuickVideo($video, $sliderId);
     $slide = $slidesModel->get($newSlideId);
     $this->validateDatabase($slide);
     $sliderObj = new N2SmartSlider($slide['slider'], array());
     $slideObj = new N2SmartSliderSlide($sliderObj, $slide);
     $slideObj->initGenerator();
     $slideObj->fillSample();
     $this->addView('slidebox', array('slider' => $sliderObj, 'slide' => $slideObj));
     ob_start();
     $this->render();
     $box = ob_get_clean();
     N2Message::success(n2_('Slide created.'));
     $this->response->respond($box);
 }