first commit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user