first
This commit is contained in:
@ -0,0 +1,330 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
|
||||
use Nextend\Framework\Controller\Admin\AdminAjaxController;
|
||||
use Nextend\Framework\Data\Data;
|
||||
use Nextend\Framework\Filesystem\Filesystem;
|
||||
use Nextend\Framework\Misc\HttpClient;
|
||||
use Nextend\Framework\Model\StorageSectionManager;
|
||||
use Nextend\Framework\Notification\Notification;
|
||||
use Nextend\Framework\Platform\Platform;
|
||||
use Nextend\Framework\Request\Request;
|
||||
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
|
||||
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
|
||||
use Nextend\SmartSlider3\Application\Model\ModelSliders;
|
||||
use Nextend\SmartSlider3\BackupSlider\ImportSlider;
|
||||
use Nextend\SmartSlider3\Settings;
|
||||
use RuntimeException;
|
||||
|
||||
class ControllerAjaxSliders extends AdminAjaxController {
|
||||
|
||||
use TraitAdminUrl;
|
||||
|
||||
public function actionList() {
|
||||
$this->validateToken();
|
||||
|
||||
$parentID = Request::$REQUEST->getInt('parentID');
|
||||
$this->validateVariable($parentID >= 0, 'parentID');
|
||||
|
||||
if ($parentID > 0) {
|
||||
$orderBy = 'ordering';
|
||||
$orderByDirection = 'ASC';
|
||||
} else {
|
||||
$orderBy = Settings::get('slidersOrder2', 'ordering');
|
||||
$orderByDirection = Settings::get('slidersOrder2Direction', 'ASC');
|
||||
}
|
||||
|
||||
$slidersModel = new ModelSliders($this);
|
||||
$sliders = $slidersModel->getAll($parentID, 'published', $orderBy, $orderByDirection);
|
||||
|
||||
$data = array();
|
||||
foreach ($sliders as $slider) {
|
||||
$data[] = array(
|
||||
'id' => $slider['id'],
|
||||
'alias' => $slider['alias'],
|
||||
'title' => $slider['title'],
|
||||
'thumbnail' => $this->getSliderThumbnail($slider),
|
||||
'isGroup' => $slider['type'] == 'group',
|
||||
'childrenCount' => $slider['slides'] > 0 ? $slider['slides'] : 0
|
||||
);
|
||||
}
|
||||
|
||||
$this->response->respond($data);
|
||||
}
|
||||
|
||||
private function getSliderThumbnail($slider) {
|
||||
|
||||
$thumbnail = $slider['thumbnail'];
|
||||
if (empty($thumbnail)) {
|
||||
return '';
|
||||
} else {
|
||||
return ResourceTranslator::toUrl($thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionOrder() {
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_edit');
|
||||
|
||||
$slidersModel = new ModelSliders($this);
|
||||
$result = $slidersModel->order(Request::$REQUEST->getVar('groupID', 0), Request::$REQUEST->getVar('sliderorder'), Request::$REQUEST->getInt('isReversed', 1), Request::$REQUEST->getVar('orders', array()));
|
||||
$this->validateDatabase($result);
|
||||
|
||||
Notification::success(n2_('Slider order saved.'));
|
||||
$this->response->respond();
|
||||
}
|
||||
|
||||
public function actionTrash() {
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_delete');
|
||||
|
||||
$groupID = Request::$REQUEST->getInt('groupID', 0);
|
||||
$this->validateVariable($groupID >= 0, 'groupID');
|
||||
|
||||
$ids = array_map('intval', array_filter((array)Request::$REQUEST->getVar('sliders'), 'is_numeric'));
|
||||
|
||||
$this->validateVariable(count($ids), 'Slider');
|
||||
|
||||
$slidersModel = new ModelSliders($this);
|
||||
|
||||
$isTrash = false;
|
||||
$isUnlink = false;
|
||||
foreach ($ids as $id) {
|
||||
if ($id > 0) {
|
||||
$mode = $slidersModel->trash($id, $groupID);
|
||||
switch ($mode) {
|
||||
case 'trash':
|
||||
$isTrash = true;
|
||||
break;
|
||||
case 'unlink':
|
||||
$isUnlink = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($isTrash) {
|
||||
Notification::success(n2_('Slider(s) moved to the trash.'));
|
||||
}
|
||||
|
||||
if ($isUnlink) {
|
||||
Notification::success(n2_('Slider(s) removed from the group.'));
|
||||
}
|
||||
|
||||
$this->response->respond();
|
||||
}
|
||||
|
||||
public function actionEmptyTrash() {
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_delete');
|
||||
|
||||
$slidersModel = new ModelSliders($this);
|
||||
|
||||
$slidersInTrash = $slidersModel->getAll('*', 'trash');
|
||||
|
||||
foreach ($slidersInTrash as $slider) {
|
||||
$slidersModel->deletePermanently($slider['id']);
|
||||
}
|
||||
|
||||
Notification::success(n2_('Slider(s) deleted permanently from the trash.'));
|
||||
|
||||
$this->response->respond();
|
||||
}
|
||||
|
||||
public function actionHideReview() {
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_config');
|
||||
|
||||
StorageSectionManager::getStorage('smartslider')
|
||||
->set('free', 'review', 1);
|
||||
|
||||
$this->response->respond();
|
||||
}
|
||||
|
||||
public function actionSearch() {
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_config');
|
||||
|
||||
$slidersModel = new ModelSliders($this);
|
||||
|
||||
$keyword = Request::$REQUEST->getVar('keyword', '');
|
||||
$sliders = array();
|
||||
|
||||
$url = parse_url($keyword);
|
||||
$baseUrl = parse_url(Platform::getSiteUrl());
|
||||
|
||||
if (isset($url['host']) && $url['host'] === $baseUrl['host']) {
|
||||
$content = HttpClient::get($keyword);
|
||||
preg_match_all('/data-ssid="(?<id>[0-9]+)/', $content, $matches);
|
||||
|
||||
foreach ($matches['id'] as $sliderID) {
|
||||
if ($_slider = $slidersModel->getWithThumbnail($sliderID)) {
|
||||
array_push($sliders, $_slider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sliders = array_merge($sliders, $slidersModel->getSearchResults($keyword));
|
||||
$result = array();
|
||||
if (!empty($sliders)) {
|
||||
foreach ($sliders as $slider) {
|
||||
$result[] = array(
|
||||
'id' => $slider['id'],
|
||||
'alias' => $slider['alias'],
|
||||
'title' => $slider['title'],
|
||||
'thumbnail' => $this->getSliderThumbnail($slider),
|
||||
'isGroup' => $slider['type'] == 'group',
|
||||
'childrenCount' => $slider['slides'] > 0 ? $slider['slides'] : 0,
|
||||
'editUrl' => $this->getUrlSliderEdit($slider['id'], $slider['group_id']),
|
||||
'order' => $slider['ordering']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->response->respond($result);
|
||||
|
||||
}
|
||||
|
||||
public function actionPagination() {
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_config');
|
||||
|
||||
$slidersModel = new ModelSliders($this);
|
||||
$pageIndex = Request::$REQUEST->getInt('pageIndex', 0);
|
||||
$limit = Request::$REQUEST->getVar('limit', 20);
|
||||
$orderBy = Request::$REQUEST->getCmd('orderBy', 'ordering');
|
||||
$orderDirection = Request::$REQUEST->getCmd('orderDirection', 'ASC');
|
||||
|
||||
Settings::set('limit', $limit);
|
||||
Settings::set('slidersOrder2', $orderBy);
|
||||
Settings::set('slidersOrder2Direction', $orderDirection);
|
||||
|
||||
if ($pageIndex < 0) {
|
||||
$pageIndex = 0;
|
||||
}
|
||||
|
||||
$sliderCount = $slidersModel->getSlidersCount('published', true);
|
||||
$result = array();
|
||||
|
||||
$sliders = $slidersModel->getAll(0, 'published', $orderBy, $orderDirection, $pageIndex, $limit);
|
||||
|
||||
//if last page is empty
|
||||
if (empty($sliders) && $sliderCount) {
|
||||
$lastPageIndex = intval(ceil(($sliderCount - $limit) / $limit));
|
||||
$sliders = $slidersModel->getAll(0, 'published', $orderBy, $orderDirection, $lastPageIndex, $limit);
|
||||
$result['pageIndex'] = $lastPageIndex;
|
||||
}
|
||||
|
||||
if (!empty($sliders)) {
|
||||
foreach ($sliders as $slider) {
|
||||
$result['sliders'][] = array(
|
||||
'id' => $slider['id'],
|
||||
'alias' => $slider['alias'],
|
||||
'title' => $slider['title'],
|
||||
'thumbnail' => $this->getSliderThumbnail($slider),
|
||||
'isGroup' => $slider['type'] == 'group',
|
||||
'childrenCount' => $slider['slides'] > 0 ? $slider['slides'] : 0,
|
||||
'editUrl' => $this->getUrlSliderEdit($slider['id'], 0),
|
||||
'order' => $slider['ordering']
|
||||
);
|
||||
}
|
||||
$result['slidersPerPage'] = count($sliders);
|
||||
}
|
||||
$result['sliderCount'] = $sliderCount;
|
||||
|
||||
$this->response->respond($result);
|
||||
}
|
||||
|
||||
protected function actionImport() {
|
||||
|
||||
$this->validateToken();
|
||||
|
||||
$this->validatePermission('smartslider_edit');
|
||||
|
||||
if (empty($_FILES) && empty($_POST)) {
|
||||
Notification::error(sprintf(n2_('Your server has an upload file limit at %s, so if you have bigger export file, please use the local import file method.'), @ini_get('post_max_size')));
|
||||
$this->response->respond();
|
||||
} else if (!empty($_POST)) {
|
||||
$data = new Data(Request::$REQUEST->getVar('slider'));
|
||||
|
||||
|
||||
$restore = $data->get('restore', 0);
|
||||
|
||||
$file = '';
|
||||
|
||||
$slider = Request::$FILES->getVar('slider');
|
||||
|
||||
if ($slider['tmp_name']['import-file'] !== null) {
|
||||
|
||||
switch ($slider['error']['import-file']) {
|
||||
case UPLOAD_ERR_OK:
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
break;
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
throw new RuntimeException('Exceeded filesize limit.');
|
||||
default:
|
||||
throw new RuntimeException('Unknown errors.');
|
||||
}
|
||||
|
||||
$file = $slider['tmp_name']['import-file'];
|
||||
}
|
||||
|
||||
if (empty($file)) {
|
||||
$_file = $data->get('local-import-file');
|
||||
if (!empty($_file)) {
|
||||
$file = Platform::getPublicDirectory() . '/' . $_file;
|
||||
}
|
||||
}
|
||||
|
||||
if (Filesystem::fileexists($file)) {
|
||||
|
||||
$import = new ImportSlider($this);
|
||||
if ($restore) {
|
||||
$import->enableReplace();
|
||||
}
|
||||
|
||||
$groupID = Request::$REQUEST->getVar('groupID', 0);
|
||||
|
||||
$sliderId = $import->import($file, $groupID, $data->get('image-mode', 'clone'), 0);
|
||||
|
||||
if ($sliderId !== false) {
|
||||
Notification::success(n2_('Slider imported.'));
|
||||
|
||||
if ($data->get('delete')) {
|
||||
@unlink($file);
|
||||
}
|
||||
|
||||
$this->response->redirect($this->getUrlSliderEdit($sliderId, $groupID));
|
||||
} else {
|
||||
$extension = pathinfo($slider['name']['import-file'], PATHINFO_EXTENSION);
|
||||
if (strpos($slider['name']['import-file'], 'sliders_unzip_to_import') !== false) {
|
||||
Notification::error(sprintf(n2_('You have to unzip your %1$s file to find the importable *.ss3 files!'), $slider['name']['import-file']));
|
||||
$this->response->error();
|
||||
} else if ($extension != 'ss3') {
|
||||
Notification::error(n2_('Only *.ss3 files can be uploaded!'));
|
||||
$this->response->error();
|
||||
} else {
|
||||
Notification::error(n2_('Import error!'));
|
||||
$this->response->error();
|
||||
}
|
||||
$this->response->redirect($this->getUrlImport());
|
||||
}
|
||||
} else {
|
||||
Notification::error(n2_('The imported file is not readable!'));
|
||||
$this->response->error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
|
||||
use Nextend\Framework\Misc\Zip\Creator;
|
||||
use Nextend\Framework\Model\StorageSectionManager;
|
||||
use Nextend\Framework\PageFlow;
|
||||
use Nextend\Framework\Request\Request;
|
||||
use Nextend\SmartSlider3\Application\Admin\AbstractControllerAdmin;
|
||||
use Nextend\SmartSlider3\Application\Admin\Sliders\Pro\ViewSlidersActivate;
|
||||
use Nextend\SmartSlider3\Application\Model\ModelLicense;
|
||||
use Nextend\SmartSlider3\Application\Model\ModelSliders;
|
||||
use Nextend\SmartSlider3\BackupSlider\ExportSlider;
|
||||
use Nextend\SmartSlider3\Settings;
|
||||
|
||||
class ControllerSliders extends AbstractControllerAdmin {
|
||||
|
||||
protected function actionGettingStarted() {
|
||||
|
||||
if (!StorageSectionManager::getStorage('smartslider')
|
||||
->get('tutorial', 'GettingStarted')) {
|
||||
|
||||
$view = new ViewSlidersGettingStarted($this);
|
||||
|
||||
$view->display();
|
||||
} else {
|
||||
$this->redirectToSliders();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected function actionGettingStartedDontShow() {
|
||||
StorageSectionManager::getStorage('smartslider')
|
||||
->set('tutorial', 'GettingStarted', 1);
|
||||
|
||||
$this->redirectToSliders();
|
||||
}
|
||||
|
||||
protected function actionIndex() {
|
||||
$this->loadSliderManager();
|
||||
|
||||
$view = new ViewSlidersIndex($this);
|
||||
$view->setPaginationIndex(max(0, intval(Request::$REQUEST->getInt('pageIndex', 0)) - 1)); /*-1 needs because beautified query string*/
|
||||
|
||||
$view->display();
|
||||
}
|
||||
|
||||
protected function actionTrash() {
|
||||
|
||||
$view = new ViewSlidersTrash($this);
|
||||
|
||||
$view->display();
|
||||
}
|
||||
|
||||
protected function actionExportAll() {
|
||||
$slidersModel = new ModelSliders($this);
|
||||
$groupID = (Request::$REQUEST->getVar('inSearch', false)) ? '*' : Request::$REQUEST->getInt('currentGroupID', 0);
|
||||
$sliders = $slidersModel->getAll($groupID, 'published');
|
||||
$ids = Request::$REQUEST->getVar('sliders');
|
||||
|
||||
$files = array();
|
||||
$saveAsFile = count($ids) == 1 ? false : true;
|
||||
foreach ($sliders as $slider) {
|
||||
if (!empty($ids) && !in_array($slider['id'], $ids)) {
|
||||
continue;
|
||||
}
|
||||
$export = new ExportSlider($this, $slider['id']);
|
||||
$files[] = $export->create($saveAsFile);
|
||||
}
|
||||
|
||||
$zip = new Creator();
|
||||
foreach ($files as $file) {
|
||||
$zip->addFile(file_get_contents($file), basename($file));
|
||||
unlink($file);
|
||||
}
|
||||
PageFlow::cleanOutputBuffers();
|
||||
header('Content-disposition: attachment; filename=sliders_unzip_to_import.zip');
|
||||
header('Content-type: application/zip');
|
||||
// PHPCS - Contains binary zip data, so nothing to escape.
|
||||
echo $zip->file(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
PageFlow::exitApplication();
|
||||
|
||||
}
|
||||
|
||||
protected function actionImport() {
|
||||
if ($this->validatePermission('smartslider_edit')) {
|
||||
|
||||
$groupID = Request::$REQUEST->getVar('groupID', 0);
|
||||
|
||||
$view = new ViewSlidersImport($this);
|
||||
$view->setGroupID($groupID);
|
||||
$view->display();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
/**
|
||||
* @var $this ViewSlidersGettingStarted
|
||||
*/
|
||||
|
||||
?>
|
||||
<div class="n2_getting_started">
|
||||
<div class="n2_getting_started__heading">
|
||||
<?php n2_e('Welcome to Smart Slider 3'); ?>
|
||||
</div>
|
||||
<div class="n2_getting_started__subheading">
|
||||
<?php n2_e('To help you get started, we\'ve put together a super tutorial video that shows you the basic settings.'); ?>
|
||||
</div>
|
||||
<div class="n2_getting_started__video">
|
||||
<div class="n2_getting_started__video_placeholder"></div>
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/3PPtkRU7D74?rel=0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div>
|
||||
<div class="n2_getting_started__buttons">
|
||||
<div class="n2_getting_started__button_dont_show">
|
||||
<a href="<?php echo esc_url($this->getUrlGettingStartedDontShow()); ?>"><?php n2_e('Don\'t show again'); ?></a>
|
||||
</div>
|
||||
<div class="n2_getting_started__button_dashboard">
|
||||
<a href="<?php echo esc_url($this->getUrlDashboard()); ?>"><?php n2_e('Go to dashboard'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
|
||||
use Nextend\Framework\Asset\Js\Js;
|
||||
|
||||
|
||||
/**
|
||||
* @var ViewSlidersImport $this
|
||||
*/
|
||||
|
||||
JS::addInline('new _N2.SliderImport();');
|
||||
?>
|
||||
|
||||
<form id="n2-ss-form-slider-import" action="<?php echo esc_url($this->getAjaxUrlImport($this->getGroupID())); ?>" method="post">
|
||||
<?php
|
||||
$this->renderForm();
|
||||
?>
|
||||
</form>
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
|
||||
use Nextend\Framework\View\AbstractView;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
|
||||
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
|
||||
|
||||
class ViewSlidersGettingStarted extends AbstractView {
|
||||
|
||||
use TraitAdminUrl;
|
||||
|
||||
public function display() {
|
||||
|
||||
$this->layout = new LayoutDefault($this);
|
||||
|
||||
$this->layout->addContent($this->render('GettingStarted'));
|
||||
|
||||
$this->layout->render();
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
use Nextend\Framework\Form\Container\ContainerTable;
|
||||
use Nextend\Framework\Form\Element\Grouping;
|
||||
use Nextend\Framework\Form\Element\Message\Notice;
|
||||
use Nextend\Framework\Form\Element\OnOff;
|
||||
use Nextend\Framework\Form\Element\Select;
|
||||
use Nextend\Framework\Form\Element\Select\SelectFile;
|
||||
use Nextend\Framework\Form\Element\Token;
|
||||
use Nextend\Framework\Form\Element\Upload;
|
||||
use Nextend\Framework\Form\Form;
|
||||
use Nextend\Framework\Platform\Platform;
|
||||
use Nextend\Framework\View\AbstractView;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\BlockTopBarMain;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonBack;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonImport;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
|
||||
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
|
||||
|
||||
class ViewSlidersImport extends AbstractView {
|
||||
|
||||
use TraitAdminUrl;
|
||||
|
||||
/**
|
||||
* @var LayoutDefault
|
||||
*/
|
||||
protected $layout;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $groupID;
|
||||
|
||||
public function display() {
|
||||
|
||||
$this->layout = new LayoutDefault($this);
|
||||
|
||||
$this->layout->addBreadcrumb(n2_('Import project'), '', $this->getUrlImport());
|
||||
|
||||
$this->displayTopBar();
|
||||
|
||||
$this->displayHeader();
|
||||
|
||||
$this->layout->render();
|
||||
|
||||
}
|
||||
|
||||
protected function displayTopBar() {
|
||||
|
||||
$topBar = new BlockTopBarMain($this);
|
||||
|
||||
$buttonImport = new BlockButtonImport($this);
|
||||
$buttonImport->addClass('n2_button--inactive');
|
||||
$buttonImport->addClass('n2_slider_import');
|
||||
$topBar->addPrimaryBlock($buttonImport);
|
||||
|
||||
$buttonBack = new BlockButtonBack($this);
|
||||
$buttonBack->setUrl($this->getUrlDashboard());
|
||||
$buttonBack->addClass('n2_slider_import_back');
|
||||
$topBar->addPrimaryBlock($buttonBack);
|
||||
|
||||
$this->layout->setTopBar($topBar->toHTML());
|
||||
}
|
||||
|
||||
protected function displayHeader() {
|
||||
|
||||
$this->layout->addContent($this->render('Import'));
|
||||
}
|
||||
|
||||
|
||||
public function renderForm() {
|
||||
|
||||
$form = new Form($this, 'slider');
|
||||
|
||||
new Token($form->getFieldsetHidden());
|
||||
|
||||
$settings = new ContainerTable($form->getContainer(), 'import-slider', n2_('Import project'));
|
||||
|
||||
|
||||
$row1 = $settings->createRow('import-row-1');
|
||||
|
||||
$instructions = n2_('You can upload *.ss3 files which were exported by Smart Slider 3.') . '<br>';
|
||||
new Notice($row1, 'instructions', n2_('Instruction'), $instructions);
|
||||
|
||||
|
||||
$row2 = $settings->createRow('import-row-2');
|
||||
|
||||
new OnOff($row2, 'upload_or_local', n2_('Local import'), 0, array(
|
||||
'relatedFieldsOff' => array(
|
||||
'sliderupload-grouping'
|
||||
),
|
||||
'relatedFieldsOn' => array(
|
||||
'sliderlocal-import-grouping'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$uploadGrouping = new Grouping($row2, 'upload-grouping');
|
||||
|
||||
new Upload($uploadGrouping, 'import-file', n2_('Upload file'));
|
||||
new Notice($uploadGrouping, 'instructions', '', sprintf(n2_('Your server\'s upload filesize limitation is %s, so if your file is bigger, use the local import.'), @ini_get('post_max_size')));
|
||||
|
||||
|
||||
$localImportGrouping = new Grouping($row2, 'local-import-grouping');
|
||||
|
||||
new SelectFile($localImportGrouping, 'local-import-file', n2_('File'), '', 'ss3');
|
||||
|
||||
new Notice($localImportGrouping, 'instructions', '', sprintf(n2_('Files with %1$s.ss3%2$s extension are listed from: %3$s'), '<i>', '</i>', Platform::getPublicDirectory()));
|
||||
|
||||
new OnOff($localImportGrouping, 'delete', n2_('Delete file'), 0, array(
|
||||
'tipLabel' => n2_('Delete file'),
|
||||
'tipDescription' => n2_('Removes the selected .ss3 file from your sever after the import.'),
|
||||
));
|
||||
|
||||
|
||||
$row3 = $settings->createRow('import-row-3');
|
||||
|
||||
new OnOff($row3, 'restore', n2_('Restore slider'), 0, array(
|
||||
'tipLabel' => n2_('Restore'),
|
||||
'tipDescription' => n2_('The imported slider will have the same ID as the original export has. If you have a slider with the same ID, it will be overwritten.'),
|
||||
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1728-export-import-slider#import'
|
||||
));
|
||||
|
||||
new Select($row3, 'image-mode', n2_('Image mode'), 'clone', array(
|
||||
'options' => array(
|
||||
'clone' => n2_('Clone'),
|
||||
'update' => n2_('Old site url'),
|
||||
'original' => n2_('Original')
|
||||
),
|
||||
'tipLabel' => n2_('Image mode'),
|
||||
'tipDescription' => n2_('You can choose how the slide images are loaded.'),
|
||||
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1728-export-import-slider#image-mode'
|
||||
));
|
||||
|
||||
$form->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getGroupID() {
|
||||
return $this->groupID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $groupID
|
||||
*/
|
||||
public function setGroupID($groupID) {
|
||||
$this->groupID = $groupID;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
use Nextend\Framework\View\AbstractView;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Banner\BlockBannerActivate;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardInfo\BlockDashboardInfo;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\BlockDashboardManager;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slider\SliderManager\BlockSliderManager;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
|
||||
use Nextend\SmartSlider3\Application\Model\ModelLicense;
|
||||
|
||||
class ViewSlidersIndex extends AbstractView {
|
||||
|
||||
/**
|
||||
* @var LayoutDefault
|
||||
*/
|
||||
protected $layout;
|
||||
protected $paginationIndex = 0;
|
||||
|
||||
public function display() {
|
||||
|
||||
$this->layout = new LayoutDefault($this);
|
||||
|
||||
$dashboardInfo = new BlockDashboardInfo($this);
|
||||
$this->layout->addHeaderMenuItem($dashboardInfo->toHTML());
|
||||
|
||||
$this->displayHeader();
|
||||
|
||||
$this->displaySliderManager();
|
||||
|
||||
$dashboardManager = new BlockDashboardManager($this);
|
||||
$this->layout->addContentBlock($dashboardManager);
|
||||
|
||||
|
||||
$this->layout->render();
|
||||
}
|
||||
|
||||
public function setPaginationIndex($index) {
|
||||
$this->paginationIndex = $index;
|
||||
}
|
||||
|
||||
protected function displayHeader() {
|
||||
}
|
||||
|
||||
protected function displaySliderManager() {
|
||||
|
||||
$sliderManager = new BlockSliderManager($this);
|
||||
$sliderManager->setPaginationIndex($this->paginationIndex);
|
||||
$this->layout->addContentBlock($sliderManager);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Application\Admin\Sliders;
|
||||
|
||||
|
||||
use Nextend\Framework\View\AbstractView;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\BlockTopBarMain;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButton;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonBack;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slider\SliderTrash\BlockSliderTrash;
|
||||
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
|
||||
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
|
||||
|
||||
class ViewSlidersTrash extends AbstractView {
|
||||
|
||||
use TraitAdminUrl;
|
||||
|
||||
public function display() {
|
||||
|
||||
$this->layout = new LayoutDefault($this);
|
||||
|
||||
$this->layout->addBreadcrumb(n2_('Trash'), 'ssi_16 ssi_16--delete', $this->getUrlTrash());
|
||||
|
||||
$topBar = new BlockTopBarMain($this);
|
||||
|
||||
$buttonEmptyTrash = new BlockButton($this);
|
||||
$buttonEmptyTrash->setLabel(n2_('Empty trash'));
|
||||
$buttonEmptyTrash->setBig();
|
||||
$buttonEmptyTrash->setRed();
|
||||
$buttonEmptyTrash->addClass('n2_slider_empty_trash');
|
||||
$buttonEmptyTrash->addClass('n2_button--inactive');
|
||||
$topBar->addPrimaryBlock($buttonEmptyTrash);
|
||||
|
||||
|
||||
$buttonBack = new BlockButtonBack($this);
|
||||
$buttonBack->setUrl($this->getUrlDashboard());
|
||||
$buttonBack->addClass('n2_slider_settings_back');
|
||||
$topBar->addPrimaryBlock($buttonBack);
|
||||
|
||||
$this->layout->setTopBar($topBar->toHTML());
|
||||
|
||||
$this->displaySliderTrash();
|
||||
|
||||
$this->layout->render();
|
||||
}
|
||||
|
||||
protected function displaySliderTrash() {
|
||||
|
||||
$sliderManager = new BlockSliderTrash($this);
|
||||
$this->layout->addContentBlock($sliderManager);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user