コード例 #1
0
ファイル: Slides.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionQuickImages()
 {
     $this->validateToken();
     $this->validatePermission('smartslider_edit');
     $sliderId = N2Request::getInt('sliderid');
     $this->validateVariable($sliderId > 0, 'Slider');
     $images = json_decode(base64_decode(N2Request::getVar('images')), true);
     $this->validateVariable(count($images), 'Images');
     $sliderObj = new N2SmartSlider($sliderId, array());
     $slidesModel = new N2SmartsliderSlidesModel();
     foreach ($images as $image) {
         $newSlideId = $slidesModel->createQuickImage($image, $sliderId);
         $slide = $slidesModel->get($newSlideId);
         $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_n('Slide created.', 'Slides created.', count($images)));
     $this->response->respond($box);
 }