예제 #1
0
 public function actionExport()
 {
     if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
         N2Loader::import('libraries.export', 'smartslider');
         $export = new N2SmartSliderExport($this->sliderId);
         $export->create();
     }
 }
예제 #2
0
 public function actionExportAll()
 {
     N2Loader::import('libraries.export', 'smartslider');
     $slidersModel = new N2SmartsliderSlidersModel();
     $sliders = $slidersModel->getAll();
     foreach ($sliders as $slider) {
         $export = new N2SmartSliderExport($slider['id']);
         $export->create(true);
     }
     $folder = N2Platform::getPublicDir();
     $folder .= '/export/';
     $zip = new N2ZipFile();
     foreach (N2Filesystem::files($folder) as $file) {
         $zip->addFile(file_get_contents($folder . $file), $file);
     }
     ob_end_clean();
     header('Content-disposition: attachment; filename=sliders_unzip_to_import.zip');
     header('Content-type: application/zip');
     echo $zip->file();
     n2_exit(true);
 }