Beispiel #1
0
 public function main()
 {
     //HTML cache only for non-customer
     if (!$this->customer->isLogged() && !$this->customer->isUnauthCustomer()) {
         if ($this->html_cache()) {
             return;
         }
     }
     $this->loadLanguage('blocks/menu');
     $this->loadLanguage('common/header');
     $this->data['heading_title'] = $this->language->get('heading_title', 'blocks/menu');
     $cache_key = 'storefront_menu.store_' . (int) $this->config->get('config_store_id') . '_lang_' . $this->config->get('storefront_language_id');
     $this->menu_items = $this->cache->pull($cache_key);
     if ($this->menu_items === false) {
         $menu = new AMenu_Storefront();
         $this->menu_items = $menu->getMenuItems();
         $this->menu_items = $this->_buildMenu('');
         //writes into cache result of calling _buildMenu func!
         $this->cache->push($cache_key, $this->menu_items);
     }
     $storefront_menu = $this->menu_items;
     $this->session->data['storefront_menu'] = $storefront_menu;
     $this->data['storemenu'] = $storefront_menu;
     $this->view->batchAssign($this->data);
     $this->processTemplate();
 }
Beispiel #2
0
 public function main()
 {
     $this->loadLanguage('blocks/menu');
     $this->loadLanguage('common/header');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $cache_name = 'storefront_menu';
     $this->menu_items = $this->cache->get($cache_name, $this->config->get('storefront_language_id'));
     if (!$this->menu_items) {
         $menu = new AMenu_Storefront();
         $this->menu_items = $menu->getMenuItems();
         $this->menu_items = $this->_buildMenu('');
         //writes into cache result of calling _buildMenu func!
         $this->cache->set($cache_name, $this->menu_items, $this->config->get('storefront_language_id'));
     }
     $storefront_menu = $this->menu_items;
     $this->session->data['storefront_menu'] = $storefront_menu;
     $this->data['storemenu'] = $storefront_menu;
     $this->view->batchAssign($this->data);
     $this->processTemplate();
 }
Beispiel #3
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('common/header');
     $cache_name = 'storefront_menu';
     $this->menu_items = $this->cache->get($cache_name, $this->config->get('storefront_language_id'));
     if (!$this->menu_items) {
         $menu = new AMenu_Storefront();
         $this->menu_items = $menu->getMenuItems();
         $this->menu_items = $this->_buildMenu('');
         //writes into cache result of calling _buildMenu func!
         $this->cache->set($cache_name, $this->menu_items, $this->config->get('storefront_language_id'));
     }
     $storefront_menu = $this->menu_items;
     $this->session->data['storefront_menu'] = $storefront_menu;
     $this->view->assign('storemenu', $storefront_menu);
     $this->processTemplate('common/menu.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Beispiel #4
0
 private function _getForm()
 {
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['error'] = $this->error;
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => false));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('design/menu'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->data['cancel'] = $this->html->getSecureURL('design/menu');
     $language_id = $this->language->getContentLanguageID();
     $item_id = $this->request->get['item_id'];
     $menu_item = null;
     $parent_id = array();
     $this->menu_items = $this->menu->getMenuItems();
     $this->_buildMenuTree('');
     if ($item_id) {
         unset($this->menu_tree[$item_id]);
     }
     foreach ($this->menu_tree as $item) {
         $parent_id[$item['item_id']] = $item['text'];
     }
     foreach ($this->columns as $column) {
         if (isset($this->request->post[$column])) {
             $this->data[$column] = $this->request->post[$column];
         } elseif (!empty($menu_item)) {
             $this->data[$column] = $menu_item[$column];
         } else {
             $this->data[$column] = '';
         }
     }
     if (!$item_id) {
         $this->data['action'] = $this->html->getSecureURL('design/menu/insert');
         $this->data['heading_title'] = $this->language->get('text_insert') . ' ' . $this->language->get('heading_title');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         //get menu item details
         $this->data = array_merge($this->data, $this->menu->getMenuItem($item_id));
         $this->data['action'] = $this->html->getSecureURL('design/menu/update', '&item_id=' . $item_id);
         $this->data['heading_title'] = $this->language->get('text_edit') . $this->language->get('heading_title');
         $this->data['update'] = $this->html->getSecureURL('listing_grid/menu/update_field', '&id=' . $item_id);
         $form = new AForm('HS');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['heading_title'], 'separator' => ' :: ', 'current' => true));
     $form->setForm(array('form_name' => 'menuFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'menuFrm', 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"', 'action' => $this->data['action']));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save')));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel')));
     $this->data['form']['fields']['item_id'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'item_id', 'value' => $this->data['item_id'], 'required' => true, 'attr' => $item_id ? 'disabled' : ''));
     $this->data['form']['fields']['item_text'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'item_text[' . $language_id . ']', 'value' => $this->data['item_text'][$language_id], 'required' => true, 'style' => 'large-field'));
     $this->data['form']['fields']['item_url'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'item_url', 'value' => $this->data['item_url'], 'style' => 'large-field', 'help_url' => $this->gen_help_url('item_url')));
     $this->data['form']['fields']['parent_id'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'parent_id', 'options' => array_merge(array('' => $this->language->get('text_none')), $parent_id), 'value' => $this->data['parent_id'], 'style' => 'medium-field'));
     $this->data['form']['fields']['sort_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'sort_order', 'value' => $this->data['sort_order'], 'style' => 'small-field'));
     $this->data['form']['fields']['item_icon'] = $form->getFieldHtml(array('type' => 'resource', 'name' => 'item_icon', 'resource_path' => htmlspecialchars($this->data['item_icon'], ENT_COMPAT, 'UTF-8'), 'resource_id' => $this->data['item_icon_rl_id'], 'rl_type' => 'image'));
     //adds scripts for RL work
     $resources_scripts = $this->dispatch('responses/common/resource_library/get_resources_scripts', array('object_name' => 'storefront_menu_item', 'object_id' => $this->request->get['item_id'], 'types' => array('image'), 'onload' => true, 'mode' => 'single'));
     $this->data['resources_scripts'] = $resources_scripts->dispatchGetOutput();
     $this->loadModel('catalog/category');
     $categories = $this->model_catalog_category->getCategories(0);
     $options = array('' => $this->language->get('text_select'));
     foreach ($categories as $c) {
         if (!$c['status']) {
             continue;
         }
         $options[$c['category_id']] = $c['name'];
     }
     $this->data['form']['fields']['link_category'] = $this->html->buildElement(array('type' => 'selectbox', 'name' => 'menu_categories', 'options' => $options, 'style' => 'no-save large-field'));
     $acm = new AContentManager();
     $results = $acm->getContents();
     $options = array('' => $this->language->get('text_select'));
     foreach ($results as $c) {
         if (!$c['status']) {
             continue;
         }
         $options[$c['content_id']] = $c['title'];
     }
     $this->data['form']['fields']['link_page'] = $this->html->buildElement(array('type' => 'selectbox', 'name' => 'menu_information', 'options' => $options, 'style' => 'no-save large-field'));
     $this->data['button_link'] = $this->html->buildElement(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('text_link')));
     $this->view->batchAssign($this->language->getASet());
     $this->view->batchAssign($this->data);
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->assign('help_url', $this->gen_help_url('menu_edit'));
     $this->processTemplate('pages/design/menu_form.tpl');
 }