Advertisement
Guest User

Install() method of FaqModule Class

a guest
Apr 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. public function install()
  2.     {
  3.         if (Module::isInstalled('blocktopmenu'))
  4.         {
  5.             require_once $_SERVER['DOCUMENT_ROOT'] . '/modules/blocktopmenu/menutoplinks.class.php';
  6.             $languages = $this->context->controller->getLanguages();
  7.             $shops = Shop::getContextListShopID();
  8.  
  9.             foreach ($shops as $shop_id)
  10.             {
  11.                 $links_label = array();
  12.                 $labels = array();
  13.  
  14.                 foreach ($languages as $key => $val)
  15.                 {
  16.                     $links_label[$val['id_lang']] = Context::getContext()->link->getModuleLink('my_module', 'my_controller', array(), null, $val['id_lang'], $shop_id);
  17.                     $labels[$val['id_lang']] = 'My Link Name';
  18.                 }
  19.  
  20.                 $sql = 'SELECT * FROM '._DB_PREFIX_.'linksmenutop';
  21.                 if ($results = Db::getInstance()->ExecuteS($sql)) {
  22.                     $lastlink = array_pop($results);
  23.                 } else {
  24.                     return false;
  25.                 }
  26.  
  27.                 if (!MenuTopLinks::add($links_label, $labels, 0, (int) $shop_id) ) {
  28.                     return false;
  29.                 }
  30.  
  31.                 $this->linkname = ',LNK' . $lastlink['id_linksmenutop'];
  32.                 $modBlocktopmenuItems = Configuration::getValue['MOD_BLOCKTOPMENU_ITEMS'];
  33.                 $modBlocktopmenuItems = $modBlocktopmenuItems . $this->linkname;
  34.  
  35.                 Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', $this->linkname, false, (int)$shop_group_id, (int)$shop_id);
  36.             }
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement