aboutsummaryrefslogtreecommitdiffstats
path: root/public/admin/controller/common/dashboard.php
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-08-18 21:14:58 -0500
committerJesús <heckyel@hyperbola.info>2019-08-18 21:14:58 -0500
commit2eed7b082f83630301e51f57ca8394de228a8605 (patch)
tree1d19962d22d30f99317d9276e4bae7744fc93fc2 /public/admin/controller/common/dashboard.php
downloadlibrecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.lz
librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.xz
librecart-2eed7b082f83630301e51f57ca8394de228a8605.zip
first commit
Diffstat (limited to 'public/admin/controller/common/dashboard.php')
-rw-r--r--public/admin/controller/common/dashboard.php98
1 files changed, 98 insertions, 0 deletions
diff --git a/public/admin/controller/common/dashboard.php b/public/admin/controller/common/dashboard.php
new file mode 100644
index 0000000..87de219
--- /dev/null
+++ b/public/admin/controller/common/dashboard.php
@@ -0,0 +1,98 @@
+<?php
+class ControllerCommonDashboard extends Controller {
+ public function index() {
+ $this->load->language('common/dashboard');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ // Check install directory exists
+ if (is_dir(DIR_APPLICATION . 'install')) {
+ $data['error_install'] = $this->language->get('error_install');
+ } else {
+ $data['error_install'] = '';
+ }
+
+ // Dashboard Extensions
+ $dashboards = array();
+
+ $this->load->model('setting/extension');
+
+ // Get a list of installed modules
+ $extensions = $this->model_setting_extension->getInstalled('dashboard');
+
+ // Add all the modules which have multiple settings for each module
+ foreach ($extensions as $code) {
+ if ($this->config->get('dashboard_' . $code . '_status') && $this->user->hasPermission('access', 'extension/dashboard/' . $code)) {
+ $output = $this->load->controller('extension/dashboard/' . $code . '/dashboard');
+
+ if ($output) {
+ $dashboards[] = array(
+ 'code' => $code,
+ 'width' => $this->config->get('dashboard_' . $code . '_width'),
+ 'sort_order' => $this->config->get('dashboard_' . $code . '_sort_order'),
+ 'output' => $output
+ );
+ }
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($dashboards as $key => $value) {
+ $sort_order[$key] = $value['sort_order'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $dashboards);
+
+ // Split the array so the columns width is not more than 12 on each row.
+ $width = 0;
+ $column = array();
+ $data['rows'] = array();
+
+ foreach ($dashboards as $dashboard) {
+ $column[] = $dashboard;
+
+ $width = ($width + $dashboard['width']);
+
+ if ($width >= 12) {
+ $data['rows'][] = $column;
+
+ $width = 0;
+ $column = array();
+ }
+ }
+
+ if (DIR_STORAGE == DIR_SYSTEM . 'storage/') {
+ $data['security'] = $this->load->controller('common/security');
+ } else {
+ $data['security'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ // Run currency update
+ if ($this->config->get('config_currency_auto')) {
+ $this->load->model('localisation/currency');
+
+ $this->model_localisation_currency->refresh();
+ }
+
+ $this->response->setOutput($this->load->view('common/dashboard', $data));
+ }
+} \ No newline at end of file