AbstractControllerAdmin.php
2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace Nextend\SmartSlider3\Application\Admin;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Controller\Admin\AbstractAdminController;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Model\ModelSlidersXRef;
use Nextend\SmartSlider3\SmartSlider3Info;
abstract class AbstractControllerAdmin extends AbstractAdminController {
use TraitAdminUrl;
public function initialize() {
parent::initialize();
Js::addFirstCode('window.ss2lang = {};');
require_once dirname(__FILE__) . '/JavaScriptTranslation.php';
}
public function loadSliderManager() {
$groupID = Request::$REQUEST->getInt('sliderid', 0);
$storage = StorageSectionManager::getStorage('smartslider');
$options = array(
'userEmail' => Platform::getUserEmail(),
'skipNewsletter' => intval($storage->get('free', 'subscribeOnImport')) || intval($storage->get('free', 'dismissNewsletterSampleSliders')),
'exportAllUrl' => $this->getUrlDashboardExportAll($groupID),
'ajaxUrl' => $this->getAjaxUrlSlidesCreate(),
'previewUrl' => $this->getUrlPreviewIndex(0),
'importUrl' => $this->getUrlImport($groupID)
);
Js::addInline("new _N2.ManageSliders('" . $groupID . "', " . json_encode($options) . ", " . json_encode(SmartSlider3Info::shouldSkipLicenseModal()) . ");");
}
public function redirectToSliders() {
$this->redirect($this->getUrlDashboard());
}
/**
* @param int $sliderID
*
* @return bool
*/
protected function getGroupData($sliderID) {
$groupID = Request::$REQUEST->getInt('groupID');
$xref = new ModelSlidersXRef($this);
$groups = $xref->getGroups($sliderID, 'published');
$currentGroup = false;
foreach ($groups as $group) {
if ($group['group_id'] == $groupID) {
$currentGroup = $group;
break;
}
}
if ($currentGroup === false) {
$currentGroup = $groups[0];
}
return $currentGroup;
}
}