</h3> <div id="lofform"> <?php global $lofPosition; $divLangName = ''; foreach ($lofPosition as $id_position) { $blocks = LofBlock::getBlocks($id_position, $cookie->id_lang); if ($blocks) { foreach ($blocks as $key => $b) { $divLangName .= 'title' . $b['id_loffc_block'] . '¤'; } } } $divLangName = rtrim($divLangName, '¤'); foreach ($lofPosition as $id_position) { $blocks = LofBlock::getBlocks($id_position, $cookie->id_lang); ?> <fieldset class="loffieldset" id="lofposition-<?php echo $id_position; ?> "> <legend><img src="../img/admin/contact.gif" /><?php echo $this->l('Position') . ' ' . $id_position; ?> </legend> <?php if (count($blocks) < LOF_MODULE_ADVANCE_CUSTOM_LIMIT_BLOCK) { ?> <a onclick="return false;" class="lofaddnew-block-item lofaddnew-block-<?php echo $id_position; ?>
}); </script> <script src="<?php echo __PS_BASE_URI__; ?> js/admin.js" type="text/javascript"></script> </head> <body> <div id="container"> <div id="content"> <?php $errors = array(); $defaultLanguage = new Language((int) $module->_defaultFormLanguage); $id_shop = Tools::getValue('id_shop', (int) Context::getContext()->shop->id); if (isset($_GET['addBlock'])) { $blocks = LofBlock::getBlocks(Tools::getValue('id_position'), $cookie->id_lang, $id_shop); $nb = count($blocks); if ($nb >= LOF_MODULE_ADVFOOTER_LIMIT_BLOCK) { $errors[] = $module->l('Block number was limited'); } $totalWidth = 0; if ($blocks) { foreach ($blocks as $bl) { $totalWidth += $bl['width']; } } if (Tools::isSubmit('submitAddBlock') && $nb < LOF_MODULE_ADVFOOTER_LIMIT_BLOCK) { $titles = array(); foreach ($module->_languages as $language) { $titles[$language['id_lang']] = Tools::getValue('title_' . $language['id_lang']); }
/** * Proccess module by hook * $pparams: param of module * $pos: position call */ function processHook($pparams = array(), $pos = "footer") { global $smarty, $cookie, $lofPosition; //load param $params = $this->_params; $module_theme = $params->get('theme', 'default'); $module_class = $params->get('class', 'customfooter'); if (!$lofPosition) { return ''; } $positions = array(); $widths = array(); foreach ($lofPosition as $key => $p) { $blocks = LofBlock::getBlocks($p, $cookie->id_lang); if ($blocks) { $nbw = 0; $tw = 0; $arrblocks = array(); foreach ($blocks as &$b) { $items = LofBlock::getItems($b['id_loffc_block'], $cookie->id_lang); if ($items) { foreach ($items as &$i) { if ($i['type'] == 'link') { $i['link_item'] = htmlentities($this->getLinkItem($i['link_content'], $i['linktype'])); } elseif ($i['type'] == 'module') { $i['module'] = $this->getModuleAssign($i['module_name'], $i['hook_name']); } } if ($b['width'] > 0) { $nbw += 1; } $tw += $b['width']; $b['items'] = $items; $arrblocks[] = $b; } } if ($arrblocks) { $widths[$key]['nbw'] = $nbw; $widths[$key]['tw'] = $tw; $positions[$key] = $arrblocks; } } } $posis = $this->calWidth($positions, $widths); //echo "<pre>".print_r($posis,1); die; $smarty->assign(array('lofpositions' => $posis, 'module_theme' => $module_theme, 'pos' => $pos, 'module_class' => $module_class)); return $this->display(__FILE__, 'tmpl/' . $module_theme . '/default.tpl'); }
<?php define('_PS_ADMIN_DIR_', getcwd()); include_once _PS_ADMIN_DIR_ . '/../../config/config.inc.php'; include dirname(__FILE__) . '/classes/LofBlock.php'; global $cookie; include dirname(__FILE__) . '/blockadvfooter.php'; $module = new blockadvfooter(); if (isset($_POST['lofajax']) && $_POST['task'] == 'gethook') { $module_name = Tools::getValue('module_name'); $hook_name = Tools::getValue('hook_name'); $content = $module->getParamHooks($module_name, $hook_name); die($content); } if (isset($_GET['lofajax']) && $_GET['task'] == 'positionItem' && Tools::getValue('action') == 'dnd') { $blocks = LofBlock::getBlocks(false, $cookie->id_lang); if ($blocks) { foreach ($blocks as $b) { if (Tools::getValue('loftable-' . $b['id_loffc_block'])) { $table = Tools::getValue('loftable-' . $b['id_loffc_block']); } } } if (isset($table)) { $pos = 0; foreach ($table as $key => $row) { $ids = explode('_', $row); Db::getInstance()->Execute(' UPDATE `' . _DB_PREFIX_ . 'loffc_block_item` SET `position` = ' . (int) $pos . ' WHERE `id_loffc_block_item` = ' . (int) $ids[2] . ' AND `id_loffc_block` = ' . (int) $ids[1]);
/** * Proccess module by hook * $pparams: param of module * $pos: position call */ function processHook($pparams = array(), $pos = "footer") { $cookie = $this->context->cookie; //if (!$this->isCached('blockadvfooter.tpl', $this->getCacheId(null))){ global $smarty, $cookie, $lofPosition; //load param $params = $this->_params; $module_theme = $params->get('theme', 'default'); $module_class = $params->get('class', 'customfooter'); if (!$lofPosition) { return ''; } $positions = array(); $widths = array(); foreach ($lofPosition as $key => $p) { $blocks = LofBlock::getBlocks($p, $cookie->id_lang); if ($blocks) { $nbw = 0; $tw = 0; $arrblocks = array(); foreach ($blocks as &$b) { if ($b['is_link']) { $b['link_item'] = htmlentities($this->getLinkItem($b['link_content'], $b['linktype'])); if (isset($_GET['category_rewrite']) && $_GET['category_rewrite'] == $b['link_content']) { $b['link_item'] = '#'; } else { if (isset($_GET['cms_rewrite']) && $b['linktype'] == "cms") { $oCMS = new CMS($b['link_content'], $cookie->id_lang); if ($oCMS->link_rewrite == $_GET['cms_rewrite']) { $b['link_item'] = '#'; } } } } $items = LofBlock::getItems($b['id_loffc_block'], $cookie->id_lang); if ($items) { foreach ($items as &$i) { if ($i['type'] == 'link') { //var_dump($_GET);exit(); $i['link_item'] = htmlentities($this->getLinkItem($i['link_content'], $i['linktype'])); if (isset($_GET['category_rewrite']) && $_GET['category_rewrite'] == $i['link_content']) { $i['link_item'] = '#'; } else { if (isset($_GET['cms_rewrite']) && $i['linktype'] == "cms") { $oCMS = new CMS($i['link_content'], $cookie->id_lang); if ($oCMS->link_rewrite == $_GET['cms_rewrite']) { $i['link_item'] = '#'; } } else { if (isset($_GET['controller']) && $_GET['controller'] == $i['link_content']) { $i['link_item'] = '#'; } } } } elseif ($i['type'] == 'module') { $i['module'] = $this->getModuleAssign($i['module_name'], $i['hook_name']); } } if ($b['width'] > 0) { $nbw += 1; } $tw += $b['width']; $b['items'] = $items; $arrblocks[] = $b; } } if ($arrblocks) { $widths[$key]['nbw'] = $nbw; $widths[$key]['tw'] = $tw; $positions[$key] = $arrblocks; } } } $posis = $this->calWidth($positions, $widths); //var_dump($posis);exit(); $smarty->assign(array('lofpositions' => $posis, 'module_theme' => $module_theme, 'pos' => $pos, 'module_class' => $module_class)); //} return $this->display(__FILE__, 'blockadvfooter.tpl', $this->getCacheId(null)); }