ControllerSettings.php
2.52 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
namespace Nextend\SmartSlider3\Application\Admin\Settings;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\Framework\Settings;
use Nextend\SmartSlider3\Application\Admin\AbstractControllerAdmin;
use Nextend\SmartSlider3\Application\Model\ModelGenerator;
use Nextend\SmartSlider3\Application\Model\ModelSliders;
class ControllerSettings extends AbstractControllerAdmin {
public function actionDefault() {
if ($this->validatePermission('smartslider_config')) {
$view = new ViewSettingsGeneral($this);
$view->display();
}
}
public function actionFramework() {
if ($this->canDo('smartslider_config')) {
$data = Request::$POST->getVar('global');
if (is_array($data)) {
if ($this->validateToken()) {
Settings::setAll($data);
$this->invalidateSliderCache();
Notification::success(n2_('Saved and slider cache invalidated.'));
}
$this->redirect($this->getUrlSettingsFramework());
}
$view = new ViewSettingsFramework($this);
$view->display();
}
}
public function actionFonts() {
if ($this->canDo('smartslider_config')) {
$view = new ViewSettingsFonts($this);
$view->display();
}
}
public function actionItemDefaults() {
if ($this->validatePermission('smartslider_config')) {
$view = new ViewSettingsItemDefaults($this);
$view->display();
}
}
public function actionGeneratorConfigure() {
if ($this->validatePermission('smartslider_config')) {
$view = new ViewGeneratorConfigure($this);
$generatorModel = new ModelGenerator($this);
$group = Request::$REQUEST->getVar('group');
$generatorGroup = $generatorModel->getGeneratorGroup($group);
$configuration = $generatorGroup->getConfiguration();
$view->setGeneratorGroup($generatorGroup);
$view->setConfiguration($configuration);
$view->display();
}
}
public function actionClearCache() {
if ($this->validatePermission('smartslider_config')) {
$view = new ViewSettingsClearCache($this);
$view->display();
}
}
private function invalidateSliderCache() {
$slidersModel = new ModelSliders($this);
$slidersModel->invalidateCache();
}
}