Example #1
0
 public function hookDisplayTop()
 {
     $theme = $this->getParams()->get('theme', 'default');
     $this->context->controller->addCSS($this->_path . 'themes/' . $theme . '/assets/styles.css');
     $tpl = 'themes/default/default.tpl';
     if (file_exists(dirname(__FILE__) . "/themes/" . $theme . '/default.tpl')) {
         $tpl = 'themes/' . $theme . '/default.tpl';
     }
     $menu_config = array();
     foreach ($this->_configs as $key => $config) {
         $menu_config[$key] = $this->getParams()->get($key, $config);
     }
     $obj = new Btmegamenu();
     $menu_tree = $obj->getFrontTree();
     $this->smarty->assign('leobootstrapmenu_menu_tree', $menu_tree);
     $this->smarty->assign('leobootstrapmenu', $menu_config);
     return $this->display(__FILE__, $tpl);
 }
Example #2
0
 public function checkVersion($version)
 {
     $versions = array('3.0.0');
     if ($version && $version == $versions[count($versions) - 1]) {
         return;
     }
     foreach ($versions as $ver) {
         if (!$version || $version && $version < $ver) {
             if ($this->checktable()) {
                 $checkcolumn = Db::getInstance()->executeS("\n        \t\t\t\tSELECT * FROM INFORMATION_SCHEMA.COLUMNS\n        \t\t\t\t\tWHERE TABLE_SCHEMA = '" . _DB_NAME_ . "'\n        \t\t\t\t\t\tAND TABLE_NAME='" . _DB_PREFIX_ . "btmegamenu_lang'\n        \t\t\t\t\t\tAND COLUMN_NAME ='url'\n    \t\t\t\t");
                 if (count($checkcolumn) < 1) {
                     Db::getInstance()->execute('
 						ALTER TABLE `' . _DB_PREFIX_ . 'btmegamenu_lang` 
 							ADD `url` varchar(255) DEFAULT NULL');
                     $menus = Db::getInstance()->executeS('SELECT `id_btmegamenu`,`id_parent`,`url` FROM `' . _DB_PREFIX_ . 'btmegamenu`');
                     if ($menus) {
                         foreach ($menus as $menu) {
                             if ($menu['id_parent'] != 0) {
                                 $megamenu = new Btmegamenu((int) $menu['id_btmegamenu']);
                                 foreach ($megamenu->url as &$url) {
                                     $url = $menu['url'] ? $menu['url'] : '';
                                     # validate module
                                     $validate_module = $url;
                                     unset($validate_module);
                                 }
                                 $megamenu->update();
                             }
                         }
                     }
                     Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'btmegamenu` DROP `url`');
                     Configuration::updateValue('LEO_MEGAMENU_VERSION', $ver);
                 }
             }
         }
     }
 }
Example #3
0
 public function deleteSelection($menus)
 {
     $return = 1;
     foreach ($menus as $id_btmegamenu) {
         $objMenu = new Btmegamenu($id_btmegamenu);
         $return &= $objMenu->delete();
     }
     return $return;
 }