column_left.php (24458B)
1 <?php 2 class ControllerCommonColumnLeft extends Controller { 3 public function index() { 4 if (isset($this->request->get['user_token']) && isset($this->session->data['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) { 5 $this->load->language('common/column_left'); 6 7 // Create a 3 level menu array 8 // Level 2 can not have children 9 10 // Menu 11 $data['menus'][] = array( 12 'id' => 'menu-dashboard', 13 'icon' => 'fa-dashboard', 14 'name' => $this->language->get('text_dashboard'), 15 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true), 16 'children' => array() 17 ); 18 19 // Catalog 20 $catalog = array(); 21 22 if ($this->user->hasPermission('access', 'catalog/category')) { 23 $catalog[] = array( 24 'name' => $this->language->get('text_category'), 25 'href' => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'], true), 26 'children' => array() 27 ); 28 } 29 30 if ($this->user->hasPermission('access', 'catalog/product')) { 31 $catalog[] = array( 32 'name' => $this->language->get('text_product'), 33 'href' => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'], true), 34 'children' => array() 35 ); 36 } 37 38 if ($this->user->hasPermission('access', 'catalog/recurring')) { 39 $catalog[] = array( 40 'name' => $this->language->get('text_recurring'), 41 'href' => $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'], true), 42 'children' => array() 43 ); 44 } 45 46 if ($this->user->hasPermission('access', 'catalog/filter')) { 47 $catalog[] = array( 48 'name' => $this->language->get('text_filter'), 49 'href' => $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'], true), 50 'children' => array() 51 ); 52 } 53 54 // Attributes 55 $attribute = array(); 56 57 if ($this->user->hasPermission('access', 'catalog/attribute')) { 58 $attribute[] = array( 59 'name' => $this->language->get('text_attribute'), 60 'href' => $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'], true), 61 'children' => array() 62 ); 63 } 64 65 if ($this->user->hasPermission('access', 'catalog/attribute_group')) { 66 $attribute[] = array( 67 'name' => $this->language->get('text_attribute_group'), 68 'href' => $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'], true), 69 'children' => array() 70 ); 71 } 72 73 if ($attribute) { 74 $catalog[] = array( 75 'name' => $this->language->get('text_attribute'), 76 'href' => '', 77 'children' => $attribute 78 ); 79 } 80 81 if ($this->user->hasPermission('access', 'catalog/option')) { 82 $catalog[] = array( 83 'name' => $this->language->get('text_option'), 84 'href' => $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'], true), 85 'children' => array() 86 ); 87 } 88 89 if ($this->user->hasPermission('access', 'catalog/manufacturer')) { 90 $catalog[] = array( 91 'name' => $this->language->get('text_manufacturer'), 92 'href' => $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'], true), 93 'children' => array() 94 ); 95 } 96 97 if ($this->user->hasPermission('access', 'catalog/download')) { 98 $catalog[] = array( 99 'name' => $this->language->get('text_download'), 100 'href' => $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'], true), 101 'children' => array() 102 ); 103 } 104 105 if ($this->user->hasPermission('access', 'catalog/review')) { 106 $catalog[] = array( 107 'name' => $this->language->get('text_review'), 108 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'], true), 109 'children' => array() 110 ); 111 } 112 113 if ($this->user->hasPermission('access', 'catalog/information')) { 114 $catalog[] = array( 115 'name' => $this->language->get('text_information'), 116 'href' => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'], true), 117 'children' => array() 118 ); 119 } 120 121 if ($catalog) { 122 $data['menus'][] = array( 123 'id' => 'menu-catalog', 124 'icon' => 'fa-tags', 125 'name' => $this->language->get('text_catalog'), 126 'href' => '', 127 'children' => $catalog 128 ); 129 } 130 131 // Extension 132 $marketplace = array(); 133 134 if ($this->user->hasPermission('access', 'marketplace/marketplace')) { 135 $marketplace[] = array( 136 'name' => $this->language->get('text_marketplace'), 137 'href' => $this->url->link('marketplace/marketplace', 'user_token=' . $this->session->data['user_token'], true), 138 'children' => array() 139 ); 140 } 141 142 if ($this->user->hasPermission('access', 'marketplace/installer')) { 143 $marketplace[] = array( 144 'name' => $this->language->get('text_installer'), 145 'href' => $this->url->link('marketplace/installer', 'user_token=' . $this->session->data['user_token'], true), 146 'children' => array() 147 ); 148 } 149 150 if ($this->user->hasPermission('access', 'marketplace/extension')) { 151 $marketplace[] = array( 152 'name' => $this->language->get('text_extension'), 153 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true), 154 'children' => array() 155 ); 156 } 157 158 if ($this->user->hasPermission('access', 'marketplace/modification')) { 159 $marketplace[] = array( 160 'name' => $this->language->get('text_modification'), 161 'href' => $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'], true), 162 'children' => array() 163 ); 164 } 165 166 if ($this->user->hasPermission('access', 'marketplace/event')) { 167 $marketplace[] = array( 168 'name' => $this->language->get('text_event'), 169 'href' => $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'], true), 170 'children' => array() 171 ); 172 } 173 174 if ($marketplace) { 175 $data['menus'][] = array( 176 'id' => 'menu-extension', 177 'icon' => 'fa-puzzle-piece', 178 'name' => $this->language->get('text_extension'), 179 'href' => '', 180 'children' => $marketplace 181 ); 182 } 183 184 // Design 185 $design = array(); 186 187 if ($this->user->hasPermission('access', 'design/layout')) { 188 $design[] = array( 189 'name' => $this->language->get('text_layout'), 190 'href' => $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true), 191 'children' => array() 192 ); 193 } 194 195 if ($this->user->hasPermission('access', 'design/theme')) { 196 $design[] = array( 197 'name' => $this->language->get('text_theme'), 198 'href' => $this->url->link('design/theme', 'user_token=' . $this->session->data['user_token'], true), 199 'children' => array() 200 ); 201 } 202 203 if ($this->user->hasPermission('access', 'design/translation')) { 204 $design[] = array( 205 'name' => $this->language->get('text_language_editor'), 206 'href' => $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'], true), 207 'children' => array() 208 ); 209 } 210 211 if ($this->user->hasPermission('access', 'design/banner')) { 212 $design[] = array( 213 'name' => $this->language->get('text_banner'), 214 'href' => $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'], true), 215 'children' => array() 216 ); 217 } 218 219 if ($this->user->hasPermission('access', 'design/seo_url')) { 220 $design[] = array( 221 'name' => $this->language->get('text_seo_url'), 222 'href' => $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'], true), 223 'children' => array() 224 ); 225 } 226 227 if ($design) { 228 $data['menus'][] = array( 229 'id' => 'menu-design', 230 'icon' => 'fa-television', 231 'name' => $this->language->get('text_design'), 232 'href' => '', 233 'children' => $design 234 ); 235 } 236 237 // Sales 238 $sale = array(); 239 240 if ($this->user->hasPermission('access', 'sale/order')) { 241 $sale[] = array( 242 'name' => $this->language->get('text_order'), 243 'href' => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'], true), 244 'children' => array() 245 ); 246 } 247 248 if ($this->user->hasPermission('access', 'sale/recurring')) { 249 $sale[] = array( 250 'name' => $this->language->get('text_recurring'), 251 'href' => $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'], true), 252 'children' => array() 253 ); 254 } 255 256 if ($this->user->hasPermission('access', 'sale/return')) { 257 $sale[] = array( 258 'name' => $this->language->get('text_return'), 259 'href' => $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'], true), 260 'children' => array() 261 ); 262 } 263 264 // Voucher 265 $voucher = array(); 266 267 if ($this->user->hasPermission('access', 'sale/voucher')) { 268 $voucher[] = array( 269 'name' => $this->language->get('text_voucher'), 270 'href' => $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'], true), 271 'children' => array() 272 ); 273 } 274 275 if ($this->user->hasPermission('access', 'sale/voucher_theme')) { 276 $voucher[] = array( 277 'name' => $this->language->get('text_voucher_theme'), 278 'href' => $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'], true), 279 'children' => array() 280 ); 281 } 282 283 if ($voucher) { 284 $sale[] = array( 285 'name' => $this->language->get('text_voucher'), 286 'href' => '', 287 'children' => $voucher 288 ); 289 } 290 291 if ($sale) { 292 $data['menus'][] = array( 293 'id' => 'menu-sale', 294 'icon' => 'fa-shopping-cart', 295 'name' => $this->language->get('text_sale'), 296 'href' => '', 297 'children' => $sale 298 ); 299 } 300 301 // Customer 302 $customer = array(); 303 304 if ($this->user->hasPermission('access', 'customer/customer')) { 305 $customer[] = array( 306 'name' => $this->language->get('text_customer'), 307 'href' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'], true), 308 'children' => array() 309 ); 310 } 311 312 if ($this->user->hasPermission('access', 'customer/customer_group')) { 313 $customer[] = array( 314 'name' => $this->language->get('text_customer_group'), 315 'href' => $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'], true), 316 'children' => array() 317 ); 318 } 319 320 if ($this->user->hasPermission('access', 'customer/customer_approval')) { 321 $customer[] = array( 322 'name' => $this->language->get('text_customer_approval'), 323 'href' => $this->url->link('customer/customer_approval', 'user_token=' . $this->session->data['user_token'], true), 324 'children' => array() 325 ); 326 } 327 328 if ($this->user->hasPermission('access', 'customer/custom_field')) { 329 $customer[] = array( 330 'name' => $this->language->get('text_custom_field'), 331 'href' => $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'], true), 332 'children' => array() 333 ); 334 } 335 336 if ($customer) { 337 $data['menus'][] = array( 338 'id' => 'menu-customer', 339 'icon' => 'fa-user', 340 'name' => $this->language->get('text_customer'), 341 'href' => '', 342 'children' => $customer 343 ); 344 } 345 346 // Marketing 347 $marketing = array(); 348 349 if ($this->user->hasPermission('access', 'marketing/marketing')) { 350 $marketing[] = array( 351 'name' => $this->language->get('text_marketing'), 352 'href' => $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'], true), 353 'children' => array() 354 ); 355 } 356 357 if ($this->user->hasPermission('access', 'marketing/coupon')) { 358 $marketing[] = array( 359 'name' => $this->language->get('text_coupon'), 360 'href' => $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'], true), 361 'children' => array() 362 ); 363 } 364 365 if ($this->user->hasPermission('access', 'marketing/contact')) { 366 $marketing[] = array( 367 'name' => $this->language->get('text_contact'), 368 'href' => $this->url->link('marketing/contact', 'user_token=' . $this->session->data['user_token'], true), 369 'children' => array() 370 ); 371 } 372 373 if ($marketing) { 374 $data['menus'][] = array( 375 'id' => 'menu-marketing', 376 'icon' => 'fa-share-alt', 377 'name' => $this->language->get('text_marketing'), 378 'href' => '', 379 'children' => $marketing 380 ); 381 } 382 383 // System 384 $system = array(); 385 386 if ($this->user->hasPermission('access', 'setting/setting')) { 387 $system[] = array( 388 'name' => $this->language->get('text_setting'), 389 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true), 390 'children' => array() 391 ); 392 } 393 394 // Users 395 $user = array(); 396 397 if ($this->user->hasPermission('access', 'user/user')) { 398 $user[] = array( 399 'name' => $this->language->get('text_users'), 400 'href' => $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'], true), 401 'children' => array() 402 ); 403 } 404 405 if ($this->user->hasPermission('access', 'user/user_permission')) { 406 $user[] = array( 407 'name' => $this->language->get('text_user_group'), 408 'href' => $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'], true), 409 'children' => array() 410 ); 411 } 412 413 if ($this->user->hasPermission('access', 'user/api')) { 414 $user[] = array( 415 'name' => $this->language->get('text_api'), 416 'href' => $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'], true), 417 'children' => array() 418 ); 419 } 420 421 if ($user) { 422 $system[] = array( 423 'name' => $this->language->get('text_users'), 424 'href' => '', 425 'children' => $user 426 ); 427 } 428 429 // Localisation 430 $localisation = array(); 431 432 if ($this->user->hasPermission('access', 'localisation/location')) { 433 $localisation[] = array( 434 'name' => $this->language->get('text_location'), 435 'href' => $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'], true), 436 'children' => array() 437 ); 438 } 439 440 if ($this->user->hasPermission('access', 'localisation/language')) { 441 $localisation[] = array( 442 'name' => $this->language->get('text_language'), 443 'href' => $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'], true), 444 'children' => array() 445 ); 446 } 447 448 if ($this->user->hasPermission('access', 'localisation/currency')) { 449 $localisation[] = array( 450 'name' => $this->language->get('text_currency'), 451 'href' => $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'], true), 452 'children' => array() 453 ); 454 } 455 456 if ($this->user->hasPermission('access', 'localisation/stock_status')) { 457 $localisation[] = array( 458 'name' => $this->language->get('text_stock_status'), 459 'href' => $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'], true), 460 'children' => array() 461 ); 462 } 463 464 if ($this->user->hasPermission('access', 'localisation/order_status')) { 465 $localisation[] = array( 466 'name' => $this->language->get('text_order_status'), 467 'href' => $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'], true), 468 'children' => array() 469 ); 470 } 471 472 // Returns 473 $return = array(); 474 475 if ($this->user->hasPermission('access', 'localisation/return_status')) { 476 $return[] = array( 477 'name' => $this->language->get('text_return_status'), 478 'href' => $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'], true), 479 'children' => array() 480 ); 481 } 482 483 if ($this->user->hasPermission('access', 'localisation/return_action')) { 484 $return[] = array( 485 'name' => $this->language->get('text_return_action'), 486 'href' => $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'], true), 487 'children' => array() 488 ); 489 } 490 491 if ($this->user->hasPermission('access', 'localisation/return_reason')) { 492 $return[] = array( 493 'name' => $this->language->get('text_return_reason'), 494 'href' => $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'], true), 495 'children' => array() 496 ); 497 } 498 499 if ($return) { 500 $localisation[] = array( 501 'name' => $this->language->get('text_return'), 502 'href' => '', 503 'children' => $return 504 ); 505 } 506 507 if ($this->user->hasPermission('access', 'localisation/country')) { 508 $localisation[] = array( 509 'name' => $this->language->get('text_country'), 510 'href' => $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'], true), 511 'children' => array() 512 ); 513 } 514 515 if ($this->user->hasPermission('access', 'localisation/zone')) { 516 $localisation[] = array( 517 'name' => $this->language->get('text_zone'), 518 'href' => $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'], true), 519 'children' => array() 520 ); 521 } 522 523 if ($this->user->hasPermission('access', 'localisation/geo_zone')) { 524 $localisation[] = array( 525 'name' => $this->language->get('text_geo_zone'), 526 'href' => $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'], true), 527 'children' => array() 528 ); 529 } 530 531 // Tax 532 $tax = array(); 533 534 if ($this->user->hasPermission('access', 'localisation/tax_class')) { 535 $tax[] = array( 536 'name' => $this->language->get('text_tax_class'), 537 'href' => $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'], true), 538 'children' => array() 539 ); 540 } 541 542 if ($this->user->hasPermission('access', 'localisation/tax_rate')) { 543 $tax[] = array( 544 'name' => $this->language->get('text_tax_rate'), 545 'href' => $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'], true), 546 'children' => array() 547 ); 548 } 549 550 if ($tax) { 551 $localisation[] = array( 552 'name' => $this->language->get('text_tax'), 553 'href' => '', 554 'children' => $tax 555 ); 556 } 557 558 if ($this->user->hasPermission('access', 'localisation/length_class')) { 559 $localisation[] = array( 560 'name' => $this->language->get('text_length_class'), 561 'href' => $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'], true), 562 'children' => array() 563 ); 564 } 565 566 if ($this->user->hasPermission('access', 'localisation/weight_class')) { 567 $localisation[] = array( 568 'name' => $this->language->get('text_weight_class'), 569 'href' => $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'], true), 570 'children' => array() 571 ); 572 } 573 574 if ($localisation) { 575 $system[] = array( 576 'name' => $this->language->get('text_localisation'), 577 'href' => '', 578 'children' => $localisation 579 ); 580 } 581 582 // Tools 583 $maintenance = array(); 584 585 if ($this->user->hasPermission('access', 'tool/backup')) { 586 $maintenance[] = array( 587 'name' => $this->language->get('text_backup'), 588 'href' => $this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token'], true), 589 'children' => array() 590 ); 591 } 592 593 if ($this->user->hasPermission('access', 'tool/upload')) { 594 $maintenance[] = array( 595 'name' => $this->language->get('text_upload'), 596 'href' => $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'], true), 597 'children' => array() 598 ); 599 } 600 601 if ($this->user->hasPermission('access', 'tool/log')) { 602 $maintenance[] = array( 603 'name' => $this->language->get('text_log'), 604 'href' => $this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'], true), 605 'children' => array() 606 ); 607 } 608 609 if ($maintenance) { 610 $system[] = array( 611 'id' => 'menu-maintenance', 612 'icon' => 'fa-cog', 613 'name' => $this->language->get('text_maintenance'), 614 'href' => '', 615 'children' => $maintenance 616 ); 617 } 618 619 620 if ($system) { 621 $data['menus'][] = array( 622 'id' => 'menu-system', 623 'icon' => 'fa-cog', 624 'name' => $this->language->get('text_system'), 625 'href' => '', 626 'children' => $system 627 ); 628 } 629 630 $report = array(); 631 632 if ($this->user->hasPermission('access', 'report/report')) { 633 $report[] = array( 634 'name' => $this->language->get('text_reports'), 635 'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'], true), 636 'children' => array() 637 ); 638 } 639 640 if ($this->user->hasPermission('access', 'report/online')) { 641 $report[] = array( 642 'name' => $this->language->get('text_online'), 643 'href' => $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'], true), 644 'children' => array() 645 ); 646 } 647 648 if ($this->user->hasPermission('access', 'report/statistics')) { 649 $report[] = array( 650 'name' => $this->language->get('text_statistics'), 651 'href' => $this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true), 652 'children' => array() 653 ); 654 } 655 656 $data['menus'][] = array( 657 'id' => 'menu-report', 658 'icon' => 'fa-bar-chart-o', 659 'name' => $this->language->get('text_reports'), 660 'href' => '', 661 'children' => $report 662 ); 663 664 // Stats 665 $this->load->model('sale/order'); 666 667 $order_total = $this->model_sale_order->getTotalOrders(); 668 669 $this->load->model('report/statistics'); 670 671 $complete_total = $this->model_report_statistics->getValue('order_complete'); 672 673 if ((float)$complete_total && $order_total) { 674 $data['complete_status'] = round(($complete_total / $order_total) * 100); 675 } else { 676 $data['complete_status'] = 0; 677 } 678 679 $processing_total = $this->model_report_statistics->getValue('order_processing'); 680 681 if ((float)$processing_total && $order_total) { 682 $data['processing_status'] = round(($processing_total / $order_total) * 100); 683 } else { 684 $data['processing_status'] = 0; 685 } 686 687 $other_total = $this->model_report_statistics->getValue('order_other'); 688 689 if ((float)$other_total && $order_total) { 690 $data['other_status'] = round(($other_total / $order_total) * 100); 691 } else { 692 $data['other_status'] = 0; 693 } 694 695 return $this->load->view('common/column_left', $data); 696 } 697 } 698 }