shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

dashboard.php (2982B)


      1 <?php
      2 class ControllerCommonDashboard extends Controller {
      3 	public function index() {
      4 		$this->load->language('common/dashboard');
      5 
      6 		$this->document->setTitle($this->language->get('heading_title'));
      7 
      8 		$data['user_token'] = $this->session->data['user_token'];
      9 		
     10 		$data['breadcrumbs'] = array();
     11 
     12 		$data['breadcrumbs'][] = array(
     13 			'text' => $this->language->get('text_home'),
     14 			'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
     15 		);
     16 
     17 		$data['breadcrumbs'][] = array(
     18 			'text' => $this->language->get('heading_title'),
     19 			'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
     20 		);
     21 		
     22 		// Check install directory exists
     23 		if (is_dir(DIR_APPLICATION . 'install')) {
     24 			$data['error_install'] = $this->language->get('error_install');
     25 		} else {
     26 			$data['error_install'] = '';
     27 		}
     28 		
     29 		// Dashboard Extensions
     30 		$dashboards = array();
     31 
     32 		$this->load->model('setting/extension');
     33 
     34 		// Get a list of installed modules
     35 		$extensions = $this->model_setting_extension->getInstalled('dashboard');
     36 		
     37 		// Add all the modules which have multiple settings for each module
     38 		foreach ($extensions as $code) {
     39 			if ($this->config->get('dashboard_' . $code . '_status') && $this->user->hasPermission('access', 'extension/dashboard/' . $code)) {
     40 				$output = $this->load->controller('extension/dashboard/' . $code . '/dashboard');
     41 				
     42 				if ($output) {
     43 					$dashboards[] = array(
     44 						'code'       => $code,
     45 						'width'      => $this->config->get('dashboard_' . $code . '_width'),
     46 						'sort_order' => $this->config->get('dashboard_' . $code . '_sort_order'),
     47 						'output'     => $output
     48 					);
     49 				}
     50 			}
     51 		}
     52 
     53 		$sort_order = array();
     54 
     55 		foreach ($dashboards as $key => $value) {
     56 			$sort_order[$key] = $value['sort_order'];
     57 		}
     58 
     59 		array_multisort($sort_order, SORT_ASC, $dashboards);
     60 		
     61 		// Split the array so the columns width is not more than 12 on each row.
     62 		$width = 0;
     63 		$column = array();
     64 		$data['rows'] = array();
     65 		
     66 		foreach ($dashboards as $dashboard) {
     67 			$column[] = $dashboard;
     68 			
     69 			$width = ($width + $dashboard['width']);
     70 			
     71 			if ($width >= 12) {
     72 				$data['rows'][] = $column;
     73 				
     74 				$width = 0;
     75 				$column = array();
     76 			}
     77 		}
     78 
     79 		if (DIR_STORAGE == DIR_SYSTEM . 'storage/') {
     80 			$data['security'] = $this->load->controller('common/security');
     81 		} else {
     82 			$data['security'] = '';
     83 		}
     84 		
     85 		$data['header'] = $this->load->controller('common/header');
     86 		$data['column_left'] = $this->load->controller('common/column_left');
     87 		$data['footer'] = $this->load->controller('common/footer');
     88 
     89 		// Run currency update
     90 		if ($this->config->get('config_currency_auto')) {
     91 			$this->load->model('localisation/currency');
     92 
     93 			$this->model_localisation_currency->refresh();
     94 		}
     95 
     96 		$this->response->setOutput($this->load->view('common/dashboard', $data));
     97 	}
     98 }