/upload/admin/controller/common/header.php

https://bitbucket.org/mjalajel/opencart · PHP · 238 lines · 212 code · 24 blank · 2 comment · 17 complexity · 48d27685ba05b0191687cdd5a7e07b63 MD5 · raw file

  1. <?php
  2. class ControllerCommonHeader extends Controller {
  3. public function index() {
  4. $this->data['title'] = $this->document->getTitle();
  5. if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
  6. $this->data['base'] = HTTPS_SERVER;
  7. } else {
  8. $this->data['base'] = HTTP_SERVER;
  9. }
  10. $this->data['description'] = $this->document->getDescription();
  11. $this->data['keywords'] = $this->document->getKeywords();
  12. $this->data['links'] = $this->document->getLinks();
  13. $this->data['styles'] = $this->document->getStyles();
  14. $this->data['scripts'] = $this->document->getScripts();
  15. $this->data['lang'] = $this->language->get('code');
  16. $this->data['direction'] = $this->language->get('direction');
  17. $this->language->load('common/header');
  18. $this->data['heading_title'] = $this->language->get('heading_title');
  19. $this->data['text_affiliate'] = $this->language->get('text_affiliate');
  20. $this->data['text_attribute'] = $this->language->get('text_attribute');
  21. $this->data['text_attribute_group'] = $this->language->get('text_attribute_group');
  22. $this->data['text_backup'] = $this->language->get('text_backup');
  23. $this->data['text_banner'] = $this->language->get('text_banner');
  24. $this->data['text_catalog'] = $this->language->get('text_catalog');
  25. $this->data['text_category'] = $this->language->get('text_category');
  26. $this->data['text_confirm'] = $this->language->get('text_confirm');
  27. $this->data['text_contact'] = $this->language->get('text_contact');
  28. $this->data['text_country'] = $this->language->get('text_country');
  29. $this->data['text_coupon'] = $this->language->get('text_coupon');
  30. $this->data['text_currency'] = $this->language->get('text_currency');
  31. $this->data['text_customer'] = $this->language->get('text_customer');
  32. $this->data['text_customer_group'] = $this->language->get('text_customer_group');
  33. $this->data['text_customer_field'] = $this->language->get('text_customer_field');
  34. $this->data['text_customer_ban_ip'] = $this->language->get('text_customer_ban_ip');
  35. $this->data['text_custom_field'] = $this->language->get('text_custom_field');
  36. $this->data['text_sale'] = $this->language->get('text_sale');
  37. $this->data['text_design'] = $this->language->get('text_design');
  38. $this->data['text_documentation'] = $this->language->get('text_documentation');
  39. $this->data['text_download'] = $this->language->get('text_download');
  40. $this->data['text_error_log'] = $this->language->get('text_error_log');
  41. $this->data['text_extension'] = $this->language->get('text_extension');
  42. $this->data['text_feed'] = $this->language->get('text_feed');
  43. $this->data['text_filter'] = $this->language->get('text_filter');
  44. $this->data['text_front'] = $this->language->get('text_front');
  45. $this->data['text_geo_zone'] = $this->language->get('text_geo_zone');
  46. $this->data['text_dashboard'] = $this->language->get('text_dashboard');
  47. $this->data['text_help'] = $this->language->get('text_help');
  48. $this->data['text_information'] = $this->language->get('text_information');
  49. $this->data['text_installer'] = $this->language->get('text_installer');
  50. $this->data['text_language'] = $this->language->get('text_language');
  51. $this->data['text_layout'] = $this->language->get('text_layout');
  52. $this->data['text_localisation'] = $this->language->get('text_localisation');
  53. $this->data['text_location'] = $this->language->get('text_location');
  54. $this->data['text_logout'] = $this->language->get('text_logout');
  55. $this->data['text_marketing'] = $this->language->get('text_marketing');
  56. $this->data['text_modification'] = $this->language->get('text_modification');
  57. $this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
  58. $this->data['text_module'] = $this->language->get('text_module');
  59. $this->data['text_option'] = $this->language->get('text_option');
  60. $this->data['text_order'] = $this->language->get('text_order');
  61. $this->data['text_order_status'] = $this->language->get('text_order_status');
  62. $this->data['text_opencart'] = $this->language->get('text_opencart');
  63. $this->data['text_payment'] = $this->language->get('text_payment');
  64. $this->data['text_product'] = $this->language->get('text_product');
  65. $this->data['text_profile'] = $this->language->get('text_profile');
  66. $this->data['text_reports'] = $this->language->get('text_reports');
  67. $this->data['text_report_sale_order'] = $this->language->get('text_report_sale_order');
  68. $this->data['text_report_sale_tax'] = $this->language->get('text_report_sale_tax');
  69. $this->data['text_report_sale_shipping'] = $this->language->get('text_report_sale_shipping');
  70. $this->data['text_report_sale_return'] = $this->language->get('text_report_sale_return');
  71. $this->data['text_report_sale_coupon'] = $this->language->get('text_report_sale_coupon');
  72. $this->data['text_report_product_viewed'] = $this->language->get('text_report_product_viewed');
  73. $this->data['text_report_product_purchased'] = $this->language->get('text_report_product_purchased');
  74. $this->data['text_report_customer_online'] = $this->language->get('text_report_customer_online');
  75. $this->data['text_report_customer_order'] = $this->language->get('text_report_customer_order');
  76. $this->data['text_report_customer_reward'] = $this->language->get('text_report_customer_reward');
  77. $this->data['text_report_customer_credit'] = $this->language->get('text_report_customer_credit');
  78. $this->data['text_report_affiliate_commission'] = $this->language->get('text_report_affiliate_commission');
  79. $this->data['text_report_sale_return'] = $this->language->get('text_report_sale_return');
  80. $this->data['text_report_product_viewed'] = $this->language->get('text_report_product_viewed');
  81. $this->data['text_report_customer_order'] = $this->language->get('text_report_customer_order');
  82. $this->data['text_review'] = $this->language->get('text_review');
  83. $this->data['text_return'] = $this->language->get('text_return');
  84. $this->data['text_return_action'] = $this->language->get('text_return_action');
  85. $this->data['text_return_reason'] = $this->language->get('text_return_reason');
  86. $this->data['text_return_status'] = $this->language->get('text_return_status');
  87. $this->data['text_support'] = $this->language->get('text_support');
  88. $this->data['text_shipping'] = $this->language->get('text_shipping');
  89. $this->data['text_setting'] = $this->language->get('text_setting');
  90. $this->data['text_stock_status'] = $this->language->get('text_stock_status');
  91. $this->data['text_system'] = $this->language->get('text_system');
  92. $this->data['text_tax'] = $this->language->get('text_tax');
  93. $this->data['text_tax_class'] = $this->language->get('text_tax_class');
  94. $this->data['text_tax_rate'] = $this->language->get('text_tax_rate');
  95. $this->data['text_total'] = $this->language->get('text_total');
  96. $this->data['text_tracking'] = $this->language->get('text_tracking');
  97. $this->data['text_user'] = $this->language->get('text_user');
  98. $this->data['text_user_group'] = $this->language->get('text_user_group');
  99. $this->data['text_users'] = $this->language->get('text_users');
  100. $this->data['text_voucher'] = $this->language->get('text_voucher');
  101. $this->data['text_voucher_theme'] = $this->language->get('text_voucher_theme');
  102. $this->data['text_weight_class'] = $this->language->get('text_weight_class');
  103. $this->data['text_length_class'] = $this->language->get('text_length_class');
  104. $this->data['text_zone'] = $this->language->get('text_zone');
  105. if (!isset($this->request->get['token']) || !isset($this->session->data['token']) && ($this->request->get['token'] != $this->session->data['token'])) {
  106. $this->data['logged'] = false;
  107. $this->data['home'] = $this->url->link('common/dashboard', '', 'SSL');
  108. } else {
  109. $this->data['logged'] = $this->user->isLogged();
  110. $this->data['home'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL');
  111. $this->data['affiliate'] = $this->url->link('marketing/affiliate', 'token=' . $this->session->data['token'], 'SSL');
  112. $this->data['attribute'] = $this->url->link('catalog/attribute', 'token=' . $this->session->data['token'], 'SSL');
  113. $this->data['attribute_group'] = $this->url->link('catalog/attribute_group', 'token=' . $this->session->data['token'], 'SSL');
  114. $this->data['backup'] = $this->url->link('tool/backup', 'token=' . $this->session->data['token'], 'SSL');
  115. $this->data['banner'] = $this->url->link('design/banner', 'token=' . $this->session->data['token'], 'SSL');
  116. $this->data['category'] = $this->url->link('catalog/category', 'token=' . $this->session->data['token'], 'SSL');
  117. $this->data['country'] = $this->url->link('localisation/country', 'token=' . $this->session->data['token'], 'SSL');
  118. $this->data['contact'] = $this->url->link('marketing/contact', 'token=' . $this->session->data['token'], 'SSL');
  119. $this->data['coupon'] = $this->url->link('marketing/coupon', 'token=' . $this->session->data['token'], 'SSL');
  120. $this->data['currency'] = $this->url->link('localisation/currency', 'token=' . $this->session->data['token'], 'SSL');
  121. $this->data['customer'] = $this->url->link('sale/customer', 'token=' . $this->session->data['token'], 'SSL');
  122. $this->data['customer_fields'] = $this->url->link('sale/customer_field', 'token=' . $this->session->data['token'], 'SSL');
  123. $this->data['customer_group'] = $this->url->link('sale/customer_group', 'token=' . $this->session->data['token'], 'SSL');
  124. $this->data['customer_ban_ip'] = $this->url->link('sale/customer_ban_ip', 'token=' . $this->session->data['token'], 'SSL');
  125. $this->data['custom_field'] = $this->url->link('sale/custom_field', 'token=' . $this->session->data['token'], 'SSL');
  126. $this->data['download'] = $this->url->link('catalog/download', 'token=' . $this->session->data['token'], 'SSL');
  127. $this->data['error_log'] = $this->url->link('tool/error_log', 'token=' . $this->session->data['token'], 'SSL');
  128. $this->data['feed'] = $this->url->link('extension/feed', 'token=' . $this->session->data['token'], 'SSL');
  129. $this->data['filter'] = $this->url->link('catalog/filter', 'token=' . $this->session->data['token'], 'SSL');
  130. $this->data['geo_zone'] = $this->url->link('localisation/geo_zone', 'token=' . $this->session->data['token'], 'SSL');
  131. $this->data['information'] = $this->url->link('catalog/information', 'token=' . $this->session->data['token'], 'SSL');
  132. $this->data['installer'] = $this->url->link('extension/installer', 'token=' . $this->session->data['token'], 'SSL');
  133. $this->data['language'] = $this->url->link('localisation/language', 'token=' . $this->session->data['token'], 'SSL');
  134. $this->data['layout'] = $this->url->link('design/layout', 'token=' . $this->session->data['token'], 'SSL');
  135. $this->data['location'] = $this->url->link('localisation/location', 'token=' . $this->session->data['token'], 'SSL');
  136. $this->data['logout'] = $this->url->link('common/logout', 'token=' . $this->session->data['token'], 'SSL');
  137. $this->data['modification'] = $this->url->link('extension/modification', 'token=' . $this->session->data['token'], 'SSL');
  138. $this->data['manufacturer'] = $this->url->link('catalog/manufacturer', 'token=' . $this->session->data['token'], 'SSL');
  139. $this->data['marketing'] = $this->url->link('marketing/marketing', 'token=' . $this->session->data['token'], 'SSL');
  140. $this->data['module'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
  141. $this->data['option'] = $this->url->link('catalog/option', 'token=' . $this->session->data['token'], 'SSL');
  142. $this->data['order'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL');
  143. $this->data['order_status'] = $this->url->link('localisation/order_status', 'token=' . $this->session->data['token'], 'SSL');
  144. $this->data['payment'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');
  145. $this->data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'], 'SSL');
  146. $this->data['profile'] = $this->url->link('user/user/update', 'token=' . $this->session->data['token'] . '&user_id=' . $this->user->getId(), 'SSL');
  147. $this->data['report_sale_order'] = $this->url->link('report/sale_order', 'token=' . $this->session->data['token'], 'SSL');
  148. $this->data['report_sale_tax'] = $this->url->link('report/sale_tax', 'token=' . $this->session->data['token'], 'SSL');
  149. $this->data['report_sale_shipping'] = $this->url->link('report/sale_shipping', 'token=' . $this->session->data['token'], 'SSL');
  150. $this->data['report_sale_return'] = $this->url->link('report/sale_return', 'token=' . $this->session->data['token'], 'SSL');
  151. $this->data['report_sale_coupon'] = $this->url->link('report/sale_coupon', 'token=' . $this->session->data['token'], 'SSL');
  152. $this->data['report_product_viewed'] = $this->url->link('report/product_viewed', 'token=' . $this->session->data['token'], 'SSL');
  153. $this->data['report_product_purchased'] = $this->url->link('report/product_purchased', 'token=' . $this->session->data['token'], 'SSL');
  154. $this->data['report_customer_online'] = $this->url->link('report/customer_online', 'token=' . $this->session->data['token'], 'SSL');
  155. $this->data['report_customer_order'] = $this->url->link('report/customer_order', 'token=' . $this->session->data['token'], 'SSL');
  156. $this->data['report_customer_reward'] = $this->url->link('report/customer_reward', 'token=' . $this->session->data['token'], 'SSL');
  157. $this->data['report_customer_credit'] = $this->url->link('report/customer_credit', 'token=' . $this->session->data['token'], 'SSL');
  158. $this->data['report_affiliate_commission'] = $this->url->link('report/affiliate_commission', 'token=' . $this->session->data['token'], 'SSL');
  159. $this->data['review'] = $this->url->link('catalog/review', 'token=' . $this->session->data['token'], 'SSL');
  160. $this->data['return'] = $this->url->link('sale/return', 'token=' . $this->session->data['token'], 'SSL');
  161. $this->data['return_action'] = $this->url->link('localisation/return_action', 'token=' . $this->session->data['token'], 'SSL');
  162. $this->data['return_reason'] = $this->url->link('localisation/return_reason', 'token=' . $this->session->data['token'], 'SSL');
  163. $this->data['return_status'] = $this->url->link('localisation/return_status', 'token=' . $this->session->data['token'], 'SSL');
  164. $this->data['shipping'] = $this->url->link('extension/shipping', 'token=' . $this->session->data['token'], 'SSL');
  165. $this->data['setting'] = $this->url->link('setting/store', 'token=' . $this->session->data['token'], 'SSL');
  166. $this->data['store'] = HTTP_CATALOG;
  167. $this->data['stock_status'] = $this->url->link('localisation/stock_status', 'token=' . $this->session->data['token'], 'SSL');
  168. $this->data['tax_class'] = $this->url->link('localisation/tax_class', 'token=' . $this->session->data['token'], 'SSL');
  169. $this->data['tax_rate'] = $this->url->link('localisation/tax_rate', 'token=' . $this->session->data['token'], 'SSL');
  170. $this->data['total'] = $this->url->link('extension/total', 'token=' . $this->session->data['token'], 'SSL');
  171. $this->data['user'] = $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL');
  172. $this->data['user_group'] = $this->url->link('user/user_permission', 'token=' . $this->session->data['token'], 'SSL');
  173. $this->data['voucher'] = $this->url->link('sale/voucher', 'token=' . $this->session->data['token'], 'SSL');
  174. $this->data['voucher_theme'] = $this->url->link('sale/voucher_theme', 'token=' . $this->session->data['token'], 'SSL');
  175. $this->data['weight_class'] = $this->url->link('localisation/weight_class', 'token=' . $this->session->data['token'], 'SSL');
  176. $this->data['length_class'] = $this->url->link('localisation/length_class', 'token=' . $this->session->data['token'], 'SSL');
  177. $this->data['zone'] = $this->url->link('localisation/zone', 'token=' . $this->session->data['token'], 'SSL');
  178. // Get total number of customers online
  179. $this->load->model('report/online');
  180. $this->data['online'] = $this->model_report_online->getTotalCustomersOnline();
  181. // Get total number of stores online
  182. $this->load->model('setting/store');
  183. $results = $this->model_setting_store->getStores();
  184. $this->data['store_name'] = $this->config->get('config_name');
  185. $this->data['stores'] = array();
  186. $this->load->model('setting/store');
  187. $results = $this->model_setting_store->getStores();
  188. foreach ($results as $result) {
  189. $this->data['stores'][] = array(
  190. 'name' => $result['name'],
  191. 'href' => $result['url']
  192. );
  193. }
  194. }
  195. $this->load->model('user/user');
  196. $this->load->model('tool/image');
  197. $user_info = $this->model_user_user->getUser($this->user->getId());
  198. if ($user_info) {
  199. $this->data['profile_name'] = $user_info['firstname'] . ' ' . $user_info['lastname'];
  200. $this->data['profile_image'] = $user_info['image'];
  201. if (!empty($user_info) && $user_info['image'] && is_file(DIR_IMAGE . $user_info['image'])) {
  202. $this->data['profile_image'] = $this->model_tool_image->resize($user_info['image'], 25, 25);
  203. } else {
  204. $this->data['profile_image'] = $this->model_tool_image->resize('no_image.jpg', 25, 25);
  205. }
  206. } else {
  207. $this->data['profile_name'] = '';
  208. $this->data['profile_image'] = $this->model_tool_image->resize('no_image.jpg', 25, 25);
  209. }
  210. $this->template = 'common/header.tpl';
  211. $this->render();
  212. }
  213. }
  214. ?>