|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Dashboard admin controller |
|
5
|
|
|
* |
|
6
|
|
|
* @author Alexey Krupskiy <[email protected]> |
|
7
|
|
|
* @link http://inji.ru/ |
|
8
|
|
|
* @copyright 2015 Alexey Krupskiy |
|
9
|
|
|
* @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
|
10
|
|
|
*/ |
|
11
|
|
|
class DashboardController extends adminController { |
|
12
|
|
|
|
|
13
|
|
|
public function indexAction() { |
|
14
|
|
|
$sections = $this->module->getSnippets('adminDashboardWidget'); |
|
15
|
|
|
$this->view->setTitle('Панель управления'); |
|
16
|
|
|
$this->view->page(['data' => compact('sections')]); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function siteConfigAction() { |
|
|
|
|
|
|
20
|
|
|
if (isset($_POST['site_name'])) { |
|
21
|
|
|
$config = \App::$primary->config; |
|
22
|
|
|
$config['site']['name'] = $_POST['site_name']; |
|
23
|
|
|
$config['site']['company_name'] = $_POST['company_name']; |
|
24
|
|
|
$config['site']['email'] = $_POST['site_email']; |
|
25
|
|
|
$config['site']['keywords'] = $_POST['site_keywords']; |
|
26
|
|
|
$config['site']['description'] = $_POST['site_description']; |
|
27
|
|
|
$config['site']['domain'] = $_POST['site_domain']; |
|
28
|
|
|
if (isset($_POST['metatags'])) { |
|
29
|
|
|
$config['site']['metatags'] = $_POST['metatags']; |
|
30
|
|
|
} |
|
31
|
|
|
if (!empty($_FILES['site_logo']['tmp_name'])) { |
|
32
|
|
|
$fileId = $this->Files->upload($_FILES['site_logo'], array('file_code' => 'site_logo')); |
|
33
|
|
|
$config['site']['site_logo'] = Files\File::get($fileId)->path; |
|
34
|
|
|
} |
|
35
|
|
|
Config::save('app', $config); |
|
36
|
|
|
Tools::redirect('/admin/dashboard/siteConfig', 'Изменения сохранены', 'success'); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
$this->view->setTitle('Общие настройки сайта'); |
|
40
|
|
|
$this->view->page(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function phpInfoAction() { |
|
44
|
|
|
$this->view->page(); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: