diff options
author | Jesús <heckyel@hyperbola.info> | 2019-08-18 21:14:58 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-08-18 21:14:58 -0500 |
commit | 2eed7b082f83630301e51f57ca8394de228a8605 (patch) | |
tree | 1d19962d22d30f99317d9276e4bae7744fc93fc2 /public/admin/controller/event | |
download | librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.lz librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.xz librecart-2eed7b082f83630301e51f57ca8394de228a8605.zip |
first commit
Diffstat (limited to 'public/admin/controller/event')
-rw-r--r-- | public/admin/controller/event/language.php | 26 | ||||
-rw-r--r-- | public/admin/controller/event/statistics.php | 16 | ||||
-rw-r--r-- | public/admin/controller/event/theme.php | 15 |
3 files changed, 57 insertions, 0 deletions
diff --git a/public/admin/controller/event/language.php b/public/admin/controller/event/language.php new file mode 100644 index 0000000..5049b7d --- /dev/null +++ b/public/admin/controller/event/language.php @@ -0,0 +1,26 @@ +<?php +class ControllerEventLanguage extends Controller { + public function index(&$route, &$args) { + foreach ($this->language->all() as $key => $value) { + if (!isset($args[$key])) { + $args[$key] = $value; + } + } + } + + // 1. Before controller load store all current loaded language data + public function before(&$route, &$output) { + $this->language->set('backup', $this->language->all()); + } + + // 2. After contoller load restore old language data + public function after(&$route, &$args, &$output) { + $data = $this->language->get('backup'); + + if (is_array($data)) { + foreach ($data as $key => $value) { + $this->language->set($key, $value); + } + } + } +}
\ No newline at end of file diff --git a/public/admin/controller/event/statistics.php b/public/admin/controller/event/statistics.php new file mode 100644 index 0000000..46e55e2 --- /dev/null +++ b/public/admin/controller/event/statistics.php @@ -0,0 +1,16 @@ +<?php +class ControllerEventStatistics extends Controller { + // model/catalog/review/removeReview/after + public function removeReview(&$route, &$args, &$output) { + $this->load->model('setting/statistics'); + + $this->model_report_statistics->addValue('review', 1); + } + + // model/sale/return/removeReturn/after + public function removeReturn(&$route, &$args, &$output) { + $this->load->model('setting/statistics'); + + $this->model_report_statistics->addValue('return', 1); + } +}
\ No newline at end of file diff --git a/public/admin/controller/event/theme.php b/public/admin/controller/event/theme.php new file mode 100644 index 0000000..3148f13 --- /dev/null +++ b/public/admin/controller/event/theme.php @@ -0,0 +1,15 @@ +<?php +class ControllerEventTheme extends Controller { + public function index(&$route, &$args) { + // This is only here for compatibility with old templates + if (substr($route, -3) == 'tpl') { + $view = substr($route, 0, -3); + } + + if (is_file(DIR_TEMPLATE . $route . '.twig')) { + $this->config->set('template_engine', 'twig'); + } elseif (is_file(DIR_TEMPLATE . $route . '.tpl')) { + $this->config->set('template_engine', 'template'); + } + } +} |