public function install() { $sql = array(); $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'belvg_staticblocks` ( `id_belvg_staticblocks` int(10) unsigned NOT NULL auto_increment, `status` int(10) NOT NULL default "1", `block_identifier` varchar(255) NOT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id_belvg_staticblocks`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; $sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'belvg_staticblocks` ADD UNIQUE `block_identifier` ( `block_identifier` )'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'belvg_staticblocks_shop` ( `id_belvg_staticblocks` int(10) unsigned NOT NULL auto_increment, `id_shop` int(10) unsigned NOT NULL, PRIMARY KEY (`id_belvg_staticblocks`, `id_shop`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'belvg_staticblocks_lang` ( `id_belvg_staticblocks` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL, `title` varchar(255) NOT NULL, `content` text, PRIMARY KEY (`id_belvg_staticblocks`,`id_lang`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; /* theme data [begin] */ $sql[] = "INSERT INTO `" . _DB_PREFIX_ . "belvg_staticblocks` \n\t\t(`id_belvg_staticblocks`, `status`, `block_identifier`, `date_add`, `date_upd`)\n\t\tVALUES \n\t\t(3, 1, 'p1', '2015-02-13 14:33:14', '2015-02-25 14:25:09'),\n\t\t(4, 1, 'p2', '2015-02-13 14:34:22', '2015-02-25 15:05:43'),\n\t\t(5, 1, 'p3', '2015-02-13 14:46:58', '2015-02-24 13:40:32'),\n\t\t(6, 1, 'p4', '2015-02-13 14:47:29', '2015-02-25 14:48:40'),\n\t\t(7, 1, 'ib1', '2015-02-16 08:44:16', '2015-02-17 15:30:14'),\n\t\t(8, 1, 'ib2', '2015-02-16 08:44:35', '2015-02-17 15:16:03'),\n\t\t(9, 1, 'ib3', '2015-02-16 08:44:59', '2015-02-17 15:34:19'),\n\t\t(10, 1, 'ib4', '2015-02-16 08:45:19', '2015-02-17 08:10:22'),\n\t\t(11, 1, 'sb1', '2015-02-16 08:58:38', '2015-02-26 10:45:14'),\n\t\t(12, 1, 'sb2', '2015-02-16 08:58:58', '2015-02-26 10:46:02'),\n\t\t(13, 1, 'sb3', '2015-02-16 08:59:16', '2015-02-26 11:08:31'),\n\t\t(15, 1, 'foo1', '2015-02-20 10:57:15', '2015-02-20 15:53:43'),\n\t\t(17, 1, 'foo2', '2015-02-20 15:15:22', '2015-02-20 15:54:09'),\n\t\t(18, 1, 'foo3', '2015-02-20 15:22:41', '2015-02-25 10:53:44'),\n\t\t(19, 1, 'discount', '2015-02-20 15:42:55', '2015-02-20 15:49:14'),\n\t\t(20, 1, 'promo1', '2015-02-23 13:58:40', '2015-02-24 15:03:34'),\n\t\t(21, 1, 'promo2', '2015-02-23 14:24:40', '2015-02-24 14:30:51'),\n\t\t(22, 1, 'promo3', '2015-02-23 14:42:18', '2015-02-24 11:28:59'),\n\t\t(23, 1, 'poptour-title', '2015-02-23 15:31:46', '2015-02-25 12:53:14'),\n\t\t(24, 1, 'promo-title', '2015-02-24 14:34:05', '2015-02-24 15:04:03')"; $languages = Language::getLanguages(); foreach ($languages as $language) { $sql[] = "INSERT INTO `" . _DB_PREFIX_ . "belvg_staticblocks_lang` \n\t\t\t(`id_belvg_staticblocks`, `id_lang`, `title`, `content`)\n\t\t\tVALUES\n\t\t\t(3, '" . (int) $language['id_lang'] . "', 'Popular Tours', '<div class=\"popular_tours\">\r\n<div class=\"pop_new_label_wrapper\">\r\n<div class=\"pop_new_label\">NEW!</div>\r\n</div>\r\n<div class=\"pop_label\"><span class=\"pop_label_bold\">11 </span><span class=\"pop_label_thin\">days</span></div>\r\n<div class=\"pop_descr\">Norway Fjords Tour</div>\r\n<div class=\"pop_center_name_wrapper\">\r\n<div class=\"pop_center_name\">Norway</div>\r\n<div class=\"pop_center_name_below\">FjordsTours every Friday</div>\r\n</div>\r\n<div class=\"pop_image_wrapper\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/norway3.jpg\" alt=\"\" width=\"832\" height=\"238\" /></div>\r\n<div class=\"popular_text\">\r\n<div class=\"poptour_price_block\">\r\n<div class=\"poptour_price\">\$1200 - \$1800</div>\r\n<span style=\"padding-left: 15px;\"><strong>8-12</strong> nights flight from Vilnius</span>\r\n<div class=\"pop_rating\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/rating.jpg\" alt=\"\" width=\"66\" height=\"18\" /> <button class=\"btn btn-default\" type=\"button\">Shop now !</button></div>\r\n</div>\r\n</div>\r\n</div>'),\n\t\t\t(4, '" . (int) $language['id_lang'] . "', 'Popular Tours', '<div class=\"popular_tours\">\r\n<div class=\"pop_new_label_wrapper\">\r\n<div class=\"pop_new_label\">NEW!</div>\r\n</div>\r\n<div class=\"pop_label\"><span class=\"pop_label_bold\">14 </span><span class=\"pop_label_thin\">days</span></div>\r\n<div class=\"pop_descr\">America tours</div>\r\n<div class=\"pop_center_name_wrapper\">\r\n<div class=\"pop_center_name\">America</div>\r\n<div class=\"pop_center_name_below\">Grand Canyon Tour every week</div>\r\n</div>\r\n<div class=\"pop_image_wrapper\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/canyon1.jpg\" alt=\"\" width=\"832\" height=\"238\" /></div>\r\n<div class=\"popular_text\">\r\n<div class=\"poptour_price_block\">\r\n<div class=\"poptour_price\">\$3500 - \$4200</div>\r\n<span style=\"padding-left: 15px;\"><strong>8-12</strong> nights flight from Vilnius</span>\r\n<div class=\"pop_rating\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/rating.jpg\" alt=\"\" width=\"66\" height=\"18\" /><button class=\"btn btn-default\" type=\"button\">Shop now !</button></div>\r\n</div>\r\n</div>\r\n</div>'),\n\t\t\t(5, '" . (int) $language['id_lang'] . "', 'Popular Tours', '<div class=\"popular_tours\">\r\n<div class=\"pop_new_label_wrapper\">\r\n<div class=\"pop_new_label\">NEW!</div>\r\n</div>\r\n<div class=\"pop_label\"><span class=\"pop_label_bold\">8 </span><span class=\"pop_label_thin\">days</span></div>\r\n<div class=\"pop_descr\">Egypt holidays</div>\r\n<div class=\"pop_center_name_wrapper\">\r\n<div class=\"pop_center_name\">Egypt</div>\r\n<div class=\"pop_center_name_below\">Hot tour to Egypt every Friday</div>\r\n</div>\r\n<div class=\"pop_image_wrapper\"><a href=\"module-presta.com\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/popegypt.jpg\" alt=\"\" width=\"832\" height=\"238\" /></a></div>\r\n<div class=\"popular_text\">\r\n<div class=\"poptour_price_block\">\r\n<div class=\"poptour_price\">\$600 - \$1200</div>\r\n<span style=\"padding-left: 15px;\"><strong>8-12</strong> nights flight from Vilnius</span>\r\n<div class=\"pop_rating\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/rating.jpg\" alt=\"\" width=\"66\" height=\"18\" /> <button class=\"btn btn-default\" type=\"button\">Shop now !</button></div>\r\n</div>\r\n</div>\r\n</div>'),\n\t\t\t(6, '" . (int) $language['id_lang'] . "', 'Popular Tours', '<div class=\"popular_tours\">\r\n<div class=\"pop_new_label_wrapper\">\r\n<div class=\"pop_new_label\">NEW!</div>\r\n</div>\r\n<div class=\"pop_label\"><span class=\"pop_label_bold\">8 </span><span class=\"pop_label_thin\">days</span></div>\r\n<div class=\"pop_descr\">wild Russia tour</div>\r\n<div class=\"pop_center_name_wrapper\">\r\n<div class=\"pop_center_name\">Russia</div>\r\n<div class=\"pop_center_name_below\">Find the wild Russia Nature</div>\r\n</div>\r\n<div class=\"pop_image_wrapper\"><a href=\"module-presta.com\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/bear2.jpg\" alt=\"\" width=\"832\" height=\"238\" /></a></div>\r\n<div class=\"popular_text\">\r\n<div class=\"poptour_price_block\">\r\n<div class=\"poptour_price\">\$600 - \$1200</div>\r\n<span style=\"padding-left: 15px;\"><strong>8-12</strong> nights flight from Vilnius</span>\r\n<div class=\"pop_rating\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/rating.jpg\" alt=\"\"\\ width=\"66\" height=\"18\" /> <button class=\"btn btn-default\" type=\"button\">Shop now !</button></div>\r\n</div>\r\n</div>\r\n</div>'),\n\t\t\t(7, '" . (int) $language['id_lang'] . "', 'Info Banner', '<div class=\"ib\"><span class=\"icon-file-photo-o\"> </span> <span class=\"ib_title\">VISA SUPPORT</span> in 3 days</div>'),\n\t\t\t(8, '" . (int) $language['id_lang'] . "', 'Info Banner', '<div class=\"ib\"><span class=\"icon-plane\"> </span><span class=\"ib_title\"> CHEAP FLIGHTS</span> early booking</div>'),\n\t\t\t(9, '" . (int) $language['id_lang'] . "', 'Info Banner', '<div class=\"ib\"><span class=\"icon-discount\"> </span><span class=\"ib_title\"> 20% OFF</span> on all Europe</div>'),\n\t\t\t(10, '" . (int) $language['id_lang'] . "', 'Info Banner', '<div class=\"ib\"><span class=\"icon-phone1\"> </span><span class=\"ib_title\"> Need help?</span> +1 800 123 1234</div>'),\n\t\t\t(11, '" . (int) $language['id_lang'] . "', 'Slider Banners', '<div class=\"sb\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/family2_1.jpg\" alt=\"\" width=\"367\" height=\"202\" />\r\n<div class=\"sb-title\">Family Tours</div>\r\n<div class=\"sb-mini-text\">Spain, Turkey, Italy Avia Tours</div>\r\n<div class=\"sb-shopnow\"><a href=\"#\">Shop Now</a></div>\r\n</div>'),\n\t\t\t(12, '" . (int) $language['id_lang'] . "', 'Slider Banners', '<div class=\"sb\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/worktravel1.jpg\" alt=\"\" width=\"367\" height=\"202\" />\r\n<div class=\"sb-title\">Work&Travel</div>\r\n<div class=\"sb-mini-text\">Travel, Work and Earn Money</div>\r\n<div class=\"sb-shopnow\"><a href=\"#\">Shop Now</a></div>\r\n</div>'),\n\t\t\t(13, '" . (int) $language['id_lang'] . "', 'Slider Banners', '<div class=\"sb-r\"><img src=\"http://belvg.net/helen/prestashop_themes/theme6/prestashop/img/cms/honemoon.jpg\" alt=\"\" width=\"367\" height=\"202\" />\r\n<div class=\"sb-title\">Honeymoon</div>\r\n<div class=\"sb-mini-text\">Mexico, Philippines + Ceremony</div>\r\n<div class=\"sb-shopnow\"><a href=\"#\">Shop Now</a></div>\r\n</div>'),\n\t\t\t(15, '" . (int) $language['id_lang'] . "', 'Footer Banner', '<div class=\"foo_banner wow bounceIn\">\r\n<div class=\"icosearch\"> </div>\r\n<div class=\"foo-text\">Search Tours<span class=\"foo-mini\">Lorem ipsum dolor sit amen</span></div>\r\n</div>'),\n\t\t\t(17, '" . (int) $language['id_lang'] . "', 'Footer Banner', '<div class=\"foo_banner wow bounceIn\">\r\n<div class=\"icovisa\"> </div>\r\n<div class=\"foo-text\">Easy Visa<span class=\"foo-mini\">Lorem ipsum dolor sit amen</span></div>\r\n</div>'),\n\t\t\t(18, '" . (int) $language['id_lang'] . "', 'Footer Banner', '<div class=\"foo_banner lastfoo wow bounceIn\">\r\n<div class=\"icocall\"> </div>\r\n<div class=\"foo-text\">Call Us Now<span class=\"foo-mini\">Free call: 8 (095) 1234-5678</span></div>\r\n</div>'),\n\t\t\t(19, '" . (int) $language['id_lang'] . "', 'Discount Banner', '<div class=\"discount-banner\"><strong>5%</strong> discount for regular clients!<a href=\"#\">Discover</a></div>'),\n\t\t\t(20, '" . (int) $language['id_lang'] . "', 'Promo Banner', '<div class=\"promo_banner\">\r\n<h2>Shop Now</h2>\r\n<div class=\"promo-hr\"> </div>\r\n<div class=\"promo_banner_descr\">The Best Theme</div>\r\n<div class=\"promo_banner_descr\">For Travel Agency</div>\r\n</div>'),\n\t\t\t(21, '" . (int) $language['id_lang'] . "', 'Promo Banner', '<div class=\"promo_banner\">\r\n<h2>Responsive</h2>\r\n<div class=\"promo-hr\"> </div>\r\n<div class=\"promo_banner_descr\">The Best Theme</div>\r\n<div class=\"promo_banner_descr\">Fits any screen</div>\r\n</div>'),\n\t\t\t(22, '" . (int) $language['id_lang'] . "', 'Promo Banner', '<div class=\"promo_banner\">\r\n<h2>Traveler</h2>\r\n<div class=\"promo-hr\"> </div>\r\n<div class=\"promo_banner_descr\">The Best Theme</div>\r\n<div class=\"promo_banner_descr\">For Travel Agency</div>\r\n</div>'),\n\t\t\t(23, '" . (int) $language['id_lang'] . "', 'Poptour tours Title', '<div class=\"poptour-title\">Special Offers</div>'),\n\t\t\t(24, '" . (int) $language['id_lang'] . "', 'Promo Banner Title', '<div class=\"promo-top-title\">Best Offer!</div>')"; } /* theme data [end] */ foreach ($sql as $_sql) { Db::getInstance()->Execute($_sql); } $new_tab = new Tab(); $new_tab->class_name = 'AdminStaticBlocks'; $new_tab->id_parent = Tab::getCurrentParentId(); $new_tab->module = $this->name; $languages = Language::getLanguages(); foreach ($languages as $language) { $new_tab->name[$language['id_lang']] = 'Belvg Static Blocks'; } $new_tab->add(); return parent::install(); }
/** * Assign smarty variables for the header */ public function initHeader() { header('Cache-Control: no-store, no-cache'); // Multishop $is_multishop = Shop::isFeatureActive(); // Quick access $quick_access = QuickAccess::getQuickAccesses($this->context->language->id); foreach ($quick_access as $index => $quick) { if ($quick['link'] == '../' && Shop::getContext() == Shop::CONTEXT_SHOP) { $url = $this->context->shop->getBaseURL(); if (!$url) { unset($quick_access[$index]); continue; } $quick_access[$index]['link'] = $url; } else { preg_match('/controller=(.+)(&.+)?$/', $quick['link'], $admin_tab); if (isset($admin_tab[1])) { if (strpos($admin_tab[1], '&')) { $admin_tab[1] = substr($admin_tab[1], 0, strpos($admin_tab[1], '&')); } $token = Tools::getAdminToken($admin_tab[1] . (int) Tab::getIdFromClassName($admin_tab[1]) . (int) $this->context->employee->id); $quick_access[$index]['target'] = $admin_tab[1]; $quick_access[$index]['link'] .= '&token=' . $token; } } } //$link = preg_replace('/&token=[a-z0-9]{32}/', '', basename($_SERVER['REQUEST_URI'])); //$currentPage = 'index.php?controller='.$this->context->controller->controller_name."&".$this->display.$this->table; // Tab list $tabs = Tab::getTabs($this->context->language->id, 0); $current_id = Tab::getCurrentParentId(); foreach ($tabs as $index => $tab) { if (!Tab::checkTabRights($tab['id_tab']) || $tab['class_name'] == 'AdminStock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0 || $tab['class_name'] == 'AdminCarrierWizard') { unset($tabs[$index]); continue; } $img_cache_url = 'themes/' . $this->context->employee->bo_theme . '/img/t/' . $tab['class_name'] . '.png'; $img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_ . $img_cache_url); // retrocompatibility : change png to gif if icon not exists if (!$img_exists_cache) { $img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_ . str_replace('.png', '.gif', $img_cache_url)); } if ($img_exists_cache) { $path_img = $img = $img_exists_cache; } else { $path_img = _PS_IMG_DIR_ . 't/' . $tab['class_name'] . '.png'; // Relative link will always work, whatever the base uri set in the admin $img = '../img/t/' . $tab['class_name'] . '.png'; } if (trim($tab['module']) != '') { $path_img = _PS_MODULE_DIR_ . $tab['module'] . '/' . $tab['class_name'] . '.png'; // Relative link will always work, whatever the base uri set in the admin $img = '../modules/' . $tab['module'] . '/' . $tab['class_name'] . '.png'; } // retrocompatibility if (!file_exists($path_img)) { $img = str_replace('png', 'gif', $img); } // tab[class_name] does not contains the "Controller" suffix $tabs[$index]['current'] = $tab['class_name'] . 'Controller' == get_class($this) || $current_id == $tab['id_tab']; $tabs[$index]['img'] = $img; $tabs[$index]['href'] = $this->context->link->getAdminLink($tab['class_name']); $sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']); foreach ($sub_tabs as $index2 => $sub_tab) { //check if module is enable and if (isset($sub_tab['module']) && !empty($sub_tab['module'])) { $module = Module::getInstanceByName($sub_tab['module']); if (is_object($module) && !$module->isEnabledForShopContext()) { unset($sub_tabs[$index2]); continue; } } if (Tab::checkTabRights($sub_tab['id_tab']) === true && (bool) $sub_tab['active'] && $sub_tab['class_name'] != 'AdminCarrierWizard') { $sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']); $sub_tabs[$index2]['current'] = $sub_tab['class_name'] . 'Controller' == get_class($this) || $sub_tab['class_name'] == Tools::getValue('controller'); } elseif ($sub_tab['class_name'] == 'AdminCarrierWizard' && $sub_tab['class_name'] . 'Controller' == get_class($this)) { foreach ($sub_tabs as $i => $tab) { if ($tab['class_name'] == 'AdminCarriers') { break; } } $sub_tabs[$i]['current'] = true; unset($sub_tabs[$index2]); } else { unset($sub_tabs[$index2]); } } $tabs[$index]['sub_tabs'] = $sub_tabs; } if (Validate::isLoadedObject($this->context->employee)) { $accesses = Profile::getProfileAccesses($this->context->employee->id_profile, 'class_name'); /* Hooks are volontary out the initialize array (need those variables already assigned) */ $bo_color = empty($this->context->employee->bo_color) ? '#FFFFFF' : $this->context->employee->bo_color; $this->context->smarty->assign(array('autorefresh_notifications' => Configuration::get('PS_ADMINREFRESH_NOTIFICATION'), 'help_box' => Configuration::get('PS_HELPBOX'), 'round_mode' => Configuration::get('PS_PRICE_ROUND_MODE'), 'brightness' => Tools::getBrightness($bo_color) < 128 ? 'white' : '#383838', 'bo_width' => (int) $this->context->employee->bo_width, 'bo_color' => isset($this->context->employee->bo_color) ? Tools::htmlentitiesUTF8($this->context->employee->bo_color) : null, 'show_new_orders' => Configuration::get('PS_SHOW_NEW_ORDERS') && isset($accesses['AdminOrders']) && $accesses['AdminOrders']['view'], 'show_new_customers' => Configuration::get('PS_SHOW_NEW_CUSTOMERS') && isset($accesses['AdminCustomers']) && $accesses['AdminCustomers']['view'], 'show_new_messages' => Configuration::get('PS_SHOW_NEW_MESSAGES') && isset($accesses['AdminCustomerThreads']) && $accesses['AdminCustomerThreads']['view'], 'employee' => $this->context->employee, 'search_type' => Tools::getValue('bo_search_type'), 'bo_query' => Tools::safeOutput(Tools::stripslashes(Tools::getValue('bo_query'))), 'quick_access' => $quick_access, 'multi_shop' => Shop::isFeatureActive(), 'shop_list' => Helper::renderShopList(), 'shop' => $this->context->shop, 'shop_group' => new ShopGroup((int) Shop::getContextShopGroupID()), 'current_parent_id' => (int) Tab::getCurrentParentId(), 'tabs' => $tabs, 'is_multishop' => $is_multishop, 'multishop_context' => $this->multishop_context, 'default_tab_link' => $this->context->link->getAdminLink(Tab::getClassNameById((int) Context::getContext()->employee->default_tab)), 'collapse_menu' => isset($this->context->cookie->collapse_menu) ? (int) $this->context->cookie->collapse_menu : 0)); } else { $this->context->smarty->assign('default_tab_link', $this->context->link->getAdminLink('AdminDashboard')); } // Shop::initialize() in config.php may empty $this->context->shop->virtual_uri so using a new shop instance for getBaseUrl() $this->context->shop = new Shop((int) $this->context->shop->id); $this->context->smarty->assign(array('img_dir' => _PS_IMG_, 'iso' => $this->context->language->iso_code, 'class_name' => $this->className, 'iso_user' => $this->context->language->iso_code, 'country_iso_code' => $this->context->country->iso_code, 'version' => _PS_VERSION_, 'lang_iso' => $this->context->language->iso_code, 'full_language_code' => $this->context->language->language_code, 'link' => $this->context->link, 'shop_name' => Configuration::get('PS_SHOP_NAME'), 'base_url' => $this->context->shop->getBaseURL(), 'tab' => isset($tab) ? $tab : null, 'current_parent_id' => (int) Tab::getCurrentParentId(), 'tabs' => $tabs, 'install_dir_exists' => file_exists(_PS_ADMIN_DIR_ . '/../install'), 'pic_dir' => _THEME_PROD_PIC_DIR_, 'controller_name' => htmlentities(Tools::getValue('controller')), 'currentIndex' => self::$currentIndex, 'bootstrap' => $this->bootstrap, 'default_language' => (int) Configuration::get('PS_LANG_DEFAULT'), 'display_addons_connection' => Tab::checkTabRights(Tab::getIdFromClassName('AdminModulesController')))); $module = Module::getInstanceByName('themeconfigurator'); $lang = ''; if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1) { $lang = Language::getIsoById($this->context->employee->id_lang) . '/'; } if (is_object($module) && $module->active && (int) Configuration::get('PS_TC_ACTIVE') == 1 && $this->context->shop->getBaseURL()) { $this->context->smarty->assign('base_url_tc', $this->context->shop->getBaseUrl() . (Configuration::get('PS_REWRITING_SETTINGS') ? '' : 'index.php') . $lang . '?live_configurator_token=' . $module->getLiveConfiguratorToken() . '&id_employee=' . (int) $this->context->employee->id . '&id_shop=' . (int) $this->context->shop->id . (Configuration::get('PS_TC_THEME') != '' ? '&theme=' . Configuration::get('PS_TC_THEME') : '') . (Configuration::get('PS_TC_FONT') != '' ? '&theme_font=' . Configuration::get('PS_TC_FONT') : '')); } }
</b> <img src="../img/admin/nav-logout.gif" alt="<?php echo translate('logout'); ?> " /> </a> </div> <br style="clear:both;" /> <?php echo Module::hookExec('backOfficeTop'); ?> <ul id="menu" style="margin-top:20px"> <?php global $cookie; /* Get current tab informations */ $id_parent_tab_current = intval(Tab::getCurrentParentId()); $tabs = Tab::getTabs(intval($cookie->id_lang), 0); foreach ($tabs as $t) { if ($t['class_name'] == $tab) { $id_parent = $t['id_tab']; } if (checkTabRights($t['id_tab']) === true) { $img = '../img/t/' . $t['class_name'] . '.gif'; if (trim($t['module']) != '') { $img = _MODULE_DIR_ . $t['module'] . '/' . $t['class_name'] . '.gif'; } echo ' <li' . (($t['class_name'] == $tab or $id_parent_tab_current == $t['id_tab']) ? ' class="active"' : '') . '> <a href="index.php?tab=' . $t['class_name'] . '&token=' . Tools::getAdminToken($t['class_name'] . intval($t['id_tab']) . intval($cookie->id_employee)) . '"><img src="' . $img . '" alt="" style="width:16px;height:16px" /> ' . $t['name'] . '</a> </li>'; }
if (strpos($adminTab[1], '&')) { $adminTab[1] = substr($adminTab[1], 0, strpos($adminTab[1], '&')); } $quick['link'] .= '&token=' . Tools::getAdminToken($adminTab[1] . (int) Tab::getIdFromClassName($adminTab[1]) . (int) $cookie->id_employee); } echo '<option value="' . $quick['link'] . ($quick['new_window'] ? '_blank' : '') . '">> ' . $quick['name'] . '</option>'; } echo ' </select> </div> <div class="flatclear"> </div> ' . Module::hookExec('backOfficeTop') . ' <ul id="menu">'; if (empty($tab)) { echo '<div class="mainsubtablist" style="display:none"></div>'; } $id_parent_tab_current = (int) Tab::getCurrentParentId(); $tabs = Tab::getTabs((int) $cookie->id_lang, 0); $echoLis = ''; $mainsubtablist = ''; foreach ($tabs as $t) { if (checkTabRights($t['id_tab']) === true) { $img = (Tools::file_exists_cache(($path_name = _PS_ADMIN_DIR_ . '/themes/' . $employee->bo_theme . '/img/t/') . $t['class_name'] . '.gif') ? 'themes/' . $employee->bo_theme . '/img/' : _PS_IMG_ . '/') . 't/' . $t['class_name'] . '.gif'; if (trim($t['module']) != '') { $img = _MODULE_DIR_ . $t['module'] . '/' . $t['class_name'] . '.gif'; } $current = ($t['class_name'] == $tab or $id_parent_tab_current == $t['id_tab']); echo '<li class="submenu_size ' . ($current ? 'active' : '') . '" id="maintab' . $t['id_tab'] . '"> <a href="index.php?tab=' . $t['class_name'] . '&token=' . Tools::getAdminToken($t['class_name'] . (int) $t['id_tab'] . (int) $cookie->id_employee) . '"> <img src="' . $img . '" alt="" /> ' . $t['name'] . ' </a> </li>';
/** * Assign smarty variables for the header */ public function initHeader() { // Multishop $is_multishop = Shop::isFeatureActive(); // Quick access $quick_access = QuickAccess::getQuickAccesses($this->context->language->id); foreach ($quick_access as $index => $quick) { if ($quick['link'] == '../' && Shop::getContext() == Shop::CONTEXT_SHOP) { $url = $this->context->shop->getBaseURL(); if (!$url) { unset($quick_access[$index]); continue; } $quick_access[$index]['link'] = $url; } else { preg_match('/controller=(.+)(&.+)?$/', $quick['link'], $admin_tab); if (isset($admin_tab[1])) { if (strpos($admin_tab[1], '&')) { $admin_tab[1] = substr($admin_tab[1], 0, strpos($admin_tab[1], '&')); } $token = Tools::getAdminToken($admin_tab[1] . (int) Tab::getIdFromClassName($admin_tab[1]) . (int) $this->context->employee->id); $quick_access[$index]['link'] .= '&token=' . $token; } } } // Tab list $tabs = Tab::getTabs($this->context->language->id, 0); $current_id = Tab::getCurrentParentId(); foreach ($tabs as $index => $tab) { if (!checkTabRights($tab['id_tab']) || $tab['class_name'] == 'AdminStock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0 || $tab['class_name'] == 'AdminCarrierWizard') { unset($tabs[$index]); continue; } $img_cache_url = 'themes/' . $this->context->employee->bo_theme . '/img/t/' . $tab['class_name'] . '.png'; $img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_ . $img_cache_url); // retrocompatibility : change png to gif if icon not exists if (!$img_exists_cache) { $img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_ . str_replace('.png', '.gif', $img_cache_url)); } if ($img_exists_cache) { $path_img = $img = $img_exists_cache; } else { $path_img = _PS_IMG_DIR_ . 't/' . $tab['class_name'] . '.png'; // Relative link will always work, whatever the base uri set in the admin $img = '../img/t/' . $tab['class_name'] . '.png'; } if (trim($tab['module']) != '') { $path_img = _PS_MODULE_DIR_ . $tab['module'] . '/' . $tab['class_name'] . '.png'; // Relative link will always work, whatever the base uri set in the admin $img = '../modules/' . $tab['module'] . '/' . $tab['class_name'] . '.png'; } // retrocompatibility if (!file_exists($path_img)) { $img = str_replace('png', 'gif', $img); } // tab[class_name] does not contains the "Controller" suffix $tabs[$index]['current'] = $tab['class_name'] . 'Controller' == get_class($this) || $current_id == $tab['id_tab']; $tabs[$index]['img'] = $img; $tabs[$index]['href'] = $this->context->link->getAdminLink($tab['class_name']); $sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']); foreach ($sub_tabs as $index2 => $sub_tab) { // class_name is the name of the class controller if (Tab::checkTabRights($sub_tab['id_tab']) === true && (bool) $sub_tab['active'] && $sub_tab['class_name'] != 'AdminCarrierWizard') { $sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']); $sub_tabs[$index2]['current'] = $sub_tab['class_name'] . 'Controller' == get_class($this); } else { unset($sub_tabs[$index2]); } } $tabs[$index]['sub_tabs'] = $sub_tabs; } if (Validate::isLoadedObject($this->context->employee)) { $accesses = Profile::getProfileAccesses($this->context->employee->id_profile, 'class_name'); /* Hooks are volontary out the initialize array (need those variables already assigned) */ $bo_color = empty($this->context->employee->bo_color) ? '#FFFFFF' : $this->context->employee->bo_color; $this->context->smarty->assign(array('autorefresh_notifications' => Configuration::get('PS_ADMINREFRESH_NOTIFICATION'), 'help_box' => Configuration::get('PS_HELPBOX'), 'round_mode' => Configuration::get('PS_PRICE_ROUND_MODE'), 'brightness' => Tools::getBrightness($bo_color) < 128 ? 'white' : '#383838', 'bo_width' => (int) $this->context->employee->bo_width, 'bo_color' => isset($this->context->employee->bo_color) ? Tools::htmlentitiesUTF8($this->context->employee->bo_color) : null, 'show_new_orders' => Configuration::get('PS_SHOW_NEW_ORDERS') && $accesses['AdminOrders']['view'], 'show_new_customers' => Configuration::get('PS_SHOW_NEW_CUSTOMERS') && $accesses['AdminCustomers']['view'], 'show_new_messages' => Configuration::get('PS_SHOW_NEW_MESSAGES') && $accesses['AdminCustomerThreads']['view'], 'first_name' => Tools::substr($this->context->employee->firstname, 0, 1), 'last_name' => Tools::safeOutput($this->context->employee->lastname), 'employee' => $this->context->employee, 'search_type' => Tools::getValue('bo_search_type'), 'bo_query' => Tools::safeOutput(Tools::stripslashes(Tools::getValue('bo_query'))), 'quick_access' => $quick_access, 'multi_shop' => Shop::isFeatureActive(), 'shop_list' => Helper::renderShopList(), 'shop' => $this->context->shop, 'shop_group' => new ShopGroup((int) Shop::getContextShopGroupID()), 'current_parent_id' => (int) Tab::getCurrentParentId(), 'tabs' => $tabs, 'is_multishop' => $is_multishop, 'multishop_context' => $this->multishop_context, 'default_tab_link' => $this->context->link->getAdminLink(Tab::getClassNameById((int) Context::getContext()->employee->default_tab)), 'employee_avatar' => ImageManager::thumbnail($this->context->employee->getImage(), 'employee' . '_' . (int) $this->context->employee->id . '.' . $this->imageType, 150, $this->imageType, true, true), 'collapse_menu' => isset($this->context->cookie->collapse_menu) ? (int) $this->context->cookie->collapse_menu : 0)); } else { $this->context->smarty->assign('default_tab_link', $this->context->link->getAdminLink('AdminDashboard')); } $this->context->smarty->assign(array('img_dir' => _PS_IMG_, 'iso' => $this->context->language->iso_code, 'class_name' => $this->className, 'iso_user' => $this->context->language->iso_code, 'country_iso_code' => $this->context->country->iso_code, 'version' => _PS_VERSION_, 'lang_iso' => $this->context->language->iso_code, 'link' => $this->context->link, 'shop_name' => Configuration::get('PS_SHOP_NAME'), 'base_url' => $this->context->shop->getBaseURL(), 'tab' => isset($tab) ? $tab : null, 'current_parent_id' => (int) Tab::getCurrentParentId(), 'tabs' => $tabs, 'install_dir_exists' => file_exists(_PS_ADMIN_DIR_ . '/../install'), 'pic_dir' => _THEME_PROD_PIC_DIR_, 'controller_name' => htmlentities(Tools::getValue('controller')), 'currentIndex' => self::$currentIndex, 'bootstrap' => $this->bootstrap, 'default_language' => (int) Configuration::get('PS_LANG_DEFAULT'))); }
private function getTabs($parentId = 0, $level = 0) { $tabs = Tab::getTabs($this->context->language->id, $parentId); $current_id = Tab::getCurrentParentId($this->controller_name ? $this->controller_name : ''); foreach ($tabs as $index => $tab) { if (!Tab::checkTabRights($tab['id_tab']) || $tab['class_name'] == 'AdminStock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0 || $tab['class_name'] == 'AdminCarrierWizard') { unset($tabs[$index]); continue; } $img_cache_url = 'themes/' . $this->context->employee->bo_theme . '/img/t/' . $tab['class_name'] . '.png'; $img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_ . $img_cache_url); // retrocompatibility : change png to gif if icon not exists if (!$img_exists_cache) { $img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_ . str_replace('.png', '.gif', $img_cache_url)); } if ($img_exists_cache) { $path_img = $img = $img_exists_cache; } else { $path_img = _PS_IMG_DIR_ . 't/' . $tab['class_name'] . '.png'; // Relative link will always work, whatever the base uri set in the admin $img = '../img/t/' . $tab['class_name'] . '.png'; } if (trim($tab['module']) != '') { $path_img = _PS_MODULE_DIR_ . $tab['module'] . '/' . $tab['class_name'] . '.png'; // Relative link will always work, whatever the base uri set in the admin $img = '../modules/' . $tab['module'] . '/' . $tab['class_name'] . '.png'; } // retrocompatibility if (!file_exists($path_img)) { $img = str_replace('png', 'gif', $img); } // tab[class_name] does not contains the "Controller" suffix if ($tab['class_name'] . 'Controller' == get_class($this) || $current_id == $tab['id_tab'] || $tab['class_name'] == $this->controller_name) { $tabs[$index]['current'] = true; $tabs[$index]['current_level'] = $level; } else { $tabs[$index]['current'] = false; } $tabs[$index]['img'] = $img; $tabs[$index]['href'] = $this->context->link->getAdminLink($tab['class_name']); $tabs[$index]['sub_tabs'] = array_values($this->getTabs($tab['id_tab'], $level + 1)); if (isset($tabs[$index]['sub_tabs'][0])) { $tabs[$index]['href'] = $tabs[$index]['sub_tabs'][0]['href']; } elseif (0 == $tabs[$index]['id_parent'] && '' == $tabs[$index]['icon']) { unset($tabs[$index]); } if (array_key_exists($index, $tabs) && array_key_exists('sub_tabs', $tabs[$index])) { foreach ($tabs[$index]['sub_tabs'] as $sub_tab) { if ((int) $sub_tab['current'] == true) { $tabs[$index]['current'] = true; $tabs[$index]['current_level'] = $sub_tab['current_level']; } } } } return $tabs; }