/**
  * @param string $xml_source  - xml as string or full filename to xml-file
  * @param string $mode
  * @return bool
  */
 public function load($xml_source, $mode = 'string')
 {
     if ($mode == 'string') {
         $xml_obj = simplexml_load_string($xml_source);
     } elseif ($mode == 'file') {
         $xml_obj = simplexml_load_file($xml_source);
     }
     if ($xml_obj) {
         $xmlname = $xml_obj->getName();
         if ($xmlname == 'template_layouts') {
             $load = new ALayoutManager();
             $load->loadXML(array('xml' => $xml_source));
         } elseif ($xmlname == 'datasets') {
             $load = new ADataset();
             $load->loadXML(array('xml' => $xml_source));
         } elseif ($xmlname == 'forms') {
             $load = new AFormManager();
             $load->loadXML(array('xml' => $xml_source));
         } else {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
Пример #2
0
 public function onControllerPagesDesignBlocks_InitData()
 {
     $method_name = func_get_arg(0);
     if ($method_name == 'insert') {
         $lm = new ALayoutManager();
         $this->baseObject->loadLanguage('banner_manager/banner_manager');
         $this->baseObject->loadLanguage('design/blocks');
         $block = $lm->getBlockByTxtId('banner');
         $block_id = $block['block_id'];
         $this->baseObject->data['tabs'][1000] = array('href' => $this->html->getSecureURL('extension/banner_manager/insert_block', '&block_id=' . $block_id), 'text' => $this->language->get('text_banner_block'), 'active' => false);
     }
     if ($method_name == 'edit') {
         $lm = new ALayoutManager();
         $blocks = $lm->getAllBlocks();
         foreach ($blocks as $block) {
             if ($block['custom_block_id'] == (int) $this->request->get['custom_block_id']) {
                 $block_txt_id = $block['block_txt_id'];
                 break;
             }
         }
         if ($block_txt_id == 'banner_block') {
             header('Location: ' . $this->html->getSecureURL('extension/banner_manager/edit_block', '&custom_block_id=' . (int) $this->request->get['custom_block_id']));
             exit;
         }
     }
 }
Пример #3
0
 public function deleteManufacturer($manufacturer_id)
 {
     $this->db->query("DELETE FROM " . $this->db->table("manufacturers") . " WHERE manufacturer_id = '" . (int) $manufacturer_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("manufacturers_to_stores") . " WHERE manufacturer_id = '" . (int) $manufacturer_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("url_aliases") . " WHERE query = 'manufacturer_id=" . (int) $manufacturer_id . "'");
     $lm = new ALayoutManager();
     $lm->deletePageLayout('pages/product/manufacturer', 'manufacturer_id', (int) $manufacturer_id);
     $this->cache->delete('manufacturer');
 }
 public function onControllerPagesExtensionBannerManager_UpdateData()
 {
     if ($this->baseObject_method == 'insert_block') {
         $lm = new ALayoutManager();
         $block = $lm->getBlockByTxtId('custom_form_block');
         $block_id = $block['block_id'];
         $this->baseObject->data['tabs'][1001] = array('href' => $this->html->getSecureURL('tool/forms_manager/insert_block', '&block_id=' . $block_id), 'text' => $this->language->get('custom_forms_block'), 'active' => false);
         $this->baseObject->view->assign('tabs', $this->baseObject->data['tabs']);
     }
     if ($this->baseObject_method == 'edit') {
         $lm = new ALayoutManager();
         $blocks = $lm->getAllBlocks();
         foreach ($blocks as $block) {
             if ($block['custom_block_id'] == (int) $this->request->get['custom_block_id']) {
                 $block_txt_id = $block['block_txt_id'];
                 break;
             }
         }
         if ($block_txt_id == 'custom_form_block') {
             header('Location: ' . $this->html->getSecureURL('tool/forms_manager/edit_block', '&custom_block_id=' . (int) $this->request->get['custom_block_id']));
             exit;
         }
     }
 }
Пример #5
0
<?php

if (!defined('DIR_CORE')) {
    header('Location: static_pages/');
}
$registry = Registry::getInstance();
//Current extension text id from extension maanger
$extension_txt_id = $name;
$language_list = $this->model_localisation_language->getLanguages();
$lm = new ALayoutManager();
// block with button
$block_data = array('block_txt_id' => 'default_pp_express_button', 'controller' => 'blocks/default_pp_express_button', 'templates' => array(array('parent_block_txt_id' => 'header_bottom', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'header', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'column_left', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'column_right', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'content_top', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'content_bottom', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'footer_top', 'template' => 'blocks/default_pp_express_button.tpl'), array('parent_block_txt_id' => 'footer', 'template' => 'blocks/default_pp_express_button.tpl')));
$lm->saveBlock($block_data);
// paypal banner block
$block_data = array('block_txt_id' => 'default_pp_express_bml_button', 'controller' => 'blocks/default_pp_express_button', 'templates' => array(array('parent_block_txt_id' => 'column_left', 'template' => 'blocks/default_pp_express_bml_button_lr.tpl'), array('parent_block_txt_id' => 'column_right', 'template' => 'blocks/default_pp_express_bml_button_lr.tpl'), array('parent_block_txt_id' => 'footer_top', 'template' => 'blocks/default_pp_express_bml_button_fb.tpl'), array('parent_block_txt_id' => 'footer', 'template' => 'blocks/default_pp_express_bml_button_fb.tpl'), array('parent_block_txt_id' => 'header_bottom', 'template' => 'blocks/default_pp_express_bml_button_fb.tpl')));
$lm->saveBlock($block_data);
$rm = new AResourceManager();
$rm->setType('image');
$result = copy(DIR_EXT . 'default_pp_express/image/secure_paypal_icon.jpg', DIR_RESOURCE . 'image/secure_paypal_icon.jpg');
$resource = array('language_id' => $this->config->get('storefront_language_id'), 'name' => array(), 'title' => array(), 'description' => array(), 'resource_path' => 'secure_paypal_icon.jpg', 'resource_code' => '');
foreach ($language_list as $lang) {
    $resource['name'][$lang['language_id']] = 'secure_paypal_icon.jpg';
    $resource['title'][$lang['language_id']] = 'default_pp_express_default_storefront_icon';
    $resource['description'][$lang['language_id']] = 'PayPal Express Checkout Default Storefront Icon';
}
$resource_id = $rm->addResource($resource);
if ($resource_id) {
    // get hexpath of resource (RL moved given file from rl-image-directory in own dir tree)
    $resource_info = $rm->getResource($resource_id, $this->config->get('admin_language_id'));
    // write it path in settings (array from parent method "install" of extension manager)
    $settings['default_pp_express_payment_storefront_icon'] = 'image/' . $resource_info['resource_path'];
Пример #6
0
 private function _init_tabs()
 {
     $blocks = array();
     $lm = new ALayoutManager();
     $default_block_type = '';
     foreach (array('html_block', 'listing_block') as $txt_id) {
         $block = $lm->getBlockByTxtId($txt_id);
         if ($block['block_id']) {
             $blocks[$block['block_id']] = $this->language->get('text_' . $txt_id);
         }
         if ($txt_id == 'html_block') {
             $default_block_type = $block['block_id'];
         }
     }
     $this->data['block_id'] = !(int) $this->request->get['block_id'] ? $default_block_type : $this->request->get['block_id'];
     $i = 0;
     $tabs = array();
     foreach ($blocks as $block_id => $block_text) {
         $tabs[] = array('name' => $block_id, 'text' => $block_text, 'href' => $this->html->getSecureURL('design/blocks/insert', '&block_id=' . $block_id), 'active' => $block_id == $this->data['block_id'] ? true : false, 'sort_order' => $i);
         $i++;
     }
     $obj = $this->dispatch('responses/common/tabs', array('design/blocks', array('tabs' => $tabs)));
     $this->data['tabs'] = $obj->dispatchGetOutput();
 }
 /**
  * @param int $content_id
  */
 public function deleteContent($content_id)
 {
     $lm = new ALayoutManager();
     $lm->deletePageLayout('pages/content/content', 'content_id', (int) $content_id);
     $this->db->query("DELETE FROM " . $this->db->table("contents") . " WHERE content_id = '" . (int) $content_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("content_descriptions") . " WHERE content_id = '" . (int) $content_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("contents_to_stores") . " WHERE content_id = '" . (int) $content_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("url_aliases") . " WHERE `query` = 'content_id=" . (int) $content_id . "'");
     $this->cache->delete('contents');
 }
Пример #8
0
 /**
  * @param int $category_id
  */
 public function deleteCategory($category_id)
 {
     $this->db->query("DELETE FROM " . $this->db->table("categories") . " WHERE category_id = '" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("category_descriptions") . " WHERE category_id = '" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("categories_to_stores") . " WHERE category_id = '" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("url_aliases") . " WHERE query = 'category_id=" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("products_to_categories") . " WHERE category_id = '" . (int) $category_id . "'");
     //delete resources
     $rm = new AResourceManager();
     $resources = $rm->getResourcesList(array('object_name' => 'categories', 'object_id' => (int) $category_id));
     foreach ($resources as $r) {
         $rm->unmapResource('products', $category_id, $r['resource_id']);
         //if resource became orphan - delete it
         if (!$rm->isMapped($r['resource_id'])) {
             $rm->deleteResource($r['resource_id']);
         }
     }
     //remove layout
     $lm = new ALayoutManager();
     $lm->deletePageLayout('pages/product/category', 'path', $category_id);
     //delete children categories
     $query = $this->db->query("SELECT category_id\n\t\t\t\t\t\t\t\t\tFROM " . $this->db->table("categories") . "\n\t\t\t\t\t\t\t\t\tWHERE parent_id = '" . (int) $category_id . "'");
     foreach ($query->rows as $result) {
         $this->deleteCategory($result['category_id']);
     }
     $this->cache->remove('category');
 }
Пример #9
0
 public function save_layout()
 {
     $page_controller = 'pages/content/content';
     $page_key_param = 'content_id';
     $content_id = $this->_get_content_id($this->request->get_or_post('content_id'));
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->acm = new AContentManager();
     if (!has_value($content_id)) {
         $this->redirect($this->html->getSecureURL('design/content'));
     }
     if ($this->request->is_POST()) {
         // need to know unique page existing
         $post_data = $this->request->post;
         $tmpl_id = $post_data['tmpl_id'];
         $layout = new ALayoutManager();
         $pages = $layout->getPages($page_controller, $page_key_param, $content_id);
         if (count($pages)) {
             $page_id = $pages[0]['page_id'];
             $layout_id = $pages[0]['layout_id'];
         } else {
             // create new page record
             $page_info = array('controller' => $page_controller, 'key_param' => $page_key_param, 'key_value' => $content_id);
             $default_language_id = $this->language->getDefaultLanguageID();
             $content_info = $this->acm->getContent($content_id, $default_language_id);
             if ($content_info) {
                 if ($content_info['title']) {
                     $page_info['page_descriptions'][$default_language_id]['name'] = $content_info['title'];
                 } else {
                     $page_info['page_descriptions'][$default_language_id]['name'] = 'Unnamed content page';
                 }
             }
             $page_id = $layout->savePage($page_info);
             $layout_id = '';
             // need to generate layout name
             $post_data['layout_name'] = 'Content: ' . $content_info['title'];
         }
         //create new instance with specific template/page/layout data
         $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
         if (has_value($post_data['layout_change'])) {
             //update layout request. Clone source layout
             $layout->clonePageLayout($post_data['layout_change'], $layout_id, $post_data['layout_name']);
             $this->session->data['success'] = $this->language->get('text_success_layout');
         } else {
             //save new layout
             $layout_data = $layout->prepareInput($post_data);
             if ($layout_data) {
                 $layout->savePageLayout($layout_data);
                 $this->session->data['success'] = $this->language->get('text_success_layout');
             }
         }
         $this->redirect($this->html->getSecureURL('design/content/edit_layout', '&content_id=' . $content_id));
     }
     $this->redirect($this->html->getSecureURL('design/content/'));
 }
Пример #10
0
 /**
  * @param int $category_id
  */
 public function deleteCategory($category_id)
 {
     $this->db->query("DELETE FROM " . $this->db->table("categories") . " WHERE category_id = '" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("category_descriptions") . " WHERE category_id = '" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("categories_to_stores") . " WHERE category_id = '" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("url_aliases") . " WHERE query = 'category_id=" . (int) $category_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("products_to_categories") . " WHERE category_id = '" . (int) $category_id . "'");
     //delete children categories
     $query = $this->db->query("SELECT category_id FROM " . $this->db->table("categories") . " WHERE parent_id = '" . (int) $category_id . "'");
     $lm = new ALayoutManager();
     foreach ($query->rows as $result) {
         $this->deleteCategory($result['category_id']);
         $lm->deletePageLayout('pages/product/category', 'path', $result['category_id']);
     }
     $lm->deletePageLayout('pages/product/category', 'path', $category_id);
     $this->cache->delete('category');
 }
Пример #11
0
 public function save()
 {
     if ($this->request->server['REQUEST_METHOD'] != 'POST') {
         $this->redirect($this->html->getSecureURL('catalog/manufacturer_layout'));
     }
     $page_controller = 'pages/product/manufacturer';
     $page_key_param = 'manufacturer_id';
     $manufacturer_id = (int) $this->request->post['manufacturer_id'];
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/manufacturer');
     if (!has_value($manufacturer_id)) {
         $this->session->data['error'] = $this->language->get('error_product_not_found');
         $this->redirect($this->html->getSecureURL('catalog/manufacturer/update'));
     }
     $tmpl_id = $this->config->get('config_storefront_template');
     $post_data = $this->request->post;
     // need to know unique page existing
     $layout = new ALayoutManager();
     $pages = $layout->getPages($page_controller, $page_key_param, $manufacturer_id);
     if (count($pages)) {
         $page_id = $pages[0]['page_id'];
         $layout_id = $pages[0]['layout_id'];
     } else {
         $page_info = array('controller' => $page_controller, 'key_param' => $page_key_param, 'key_value' => $manufacturer_id);
         $languages = $this->language->getAvailableLanguages();
         $this->loadModel('catalog/manufacturer');
         $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($manufacturer_id);
         if ($manufacturer_info) {
             foreach ($languages as $l) {
                 $page_info['page_descriptions'][$l['language_id']] = $manufacturer_info;
             }
         }
         $page_id = $layout->savePage($page_info);
         $layout_id = '';
         // need to generate layout name
         $post_data['layout_name'] = 'Manufacturer: ' . $manufacturer_info['name'];
     }
     //create new instance with specific template/page/layout data
     $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
     if (has_value($post_data['layout_change'])) {
         //update layout request. Clone source layout
         $layout->clonePageLayout($post_data['layout_change'], $layout_id, $post_data['layout_name']);
     } else {
         //save new layout
         $post_data['controller'] = $page_controller;
         $layout->savePageLayout($post_data);
     }
     $this->session->data['success'] = $this->language->get('text_success_layout');
     $this->redirect($this->html->getSecureURL('catalog/manufacturer_layout', '&manufacturer_id=' . $manufacturer_id));
 }
 public function removeCoreTemplate($template_txt_id)
 {
     if (!$template_txt_id || $template_txt_id == 'default') {
         return false;
     }
     // delete template layouts safely
     try {
         $layout = new ALayoutManager($template_txt_id);
         $layout->deleteTemplateLayouts();
     } catch (AException $e) {
     }
     $this->_remove_dir(DIR_STOREFRONT . 'view/' . $template_txt_id);
     if ($this->error) {
         return false;
     }
     return true;
 }
Пример #13
0
 /**
  * @param int $manufacturer_id
  */
 public function deleteManufacturer($manufacturer_id)
 {
     $this->db->query("DELETE FROM " . $this->db->table("manufacturers") . " WHERE manufacturer_id = '" . (int) $manufacturer_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("manufacturers_to_stores") . " WHERE manufacturer_id = '" . (int) $manufacturer_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("url_aliases") . " WHERE query = 'manufacturer_id=" . (int) $manufacturer_id . "'");
     $lm = new ALayoutManager();
     $lm->deletePageLayout('pages/product/manufacturer', 'manufacturer_id', (int) $manufacturer_id);
     //delete resources
     $rm = new AResourceManager();
     $resources = $rm->getResourcesList(array('object_name' => 'manufacturers', 'object_id' => (int) $manufacturer_id));
     foreach ($resources as $r) {
         $rm->unmapResource('manufacturers', $manufacturer_id, $r['resource_id']);
         //if resource became orphan - delete it
         if (!$rm->isMapped($r['resource_id'])) {
             $rm->deleteResource($r['resource_id']);
         }
     }
     $this->cache->remove('manufacturer');
 }
 public function delete_block()
 {
     $this->loadLanguage('developer_tools/developer_tools');
     $block_id = (int) $this->request->get['block_id'];
     if ($block_id) {
         $layout = new ALayoutManager();
         //check is block in some layout
         $bl = $layout->getBlocksLayouts($block_id);
         if ($bl) {
             $this->session->data['warning'] = $this->language->get('developer_tools_error_delete');
         } else {
             $layout->deleteBlock('', $block_id);
             $this->session->data['success'] = $this->language->get('developer_tools_text_success_deleted');
         }
     }
     $this->redirect($this->html->getSecureURL('design/blocks'));
 }
 public function delete_block()
 {
     $block_id = (int) $this->request->get['block_id'];
     if ($block_id) {
         $layout = new ALayoutManager();
         if (!$layout->deleteBlock('', $block_id)) {
             $this->session->data['warning'] = $this->language->get('error_delete');
         } else {
             $this->session->data['success'] = $this->language->get('text_success_deleted');
         }
     }
     $this->redirect($this->html->getSecureURL('design/blocks'));
 }
Пример #16
0
 public function onControllerResponsesCommonTabs_InitData()
 {
     if ($this->baseObject->parent_controller == 'design/blocks') {
         $that = $this->baseObject;
         $lm = new ALayoutManager();
         $that->loadLanguage('forms_manager/forms_manager');
         $that->loadLanguage('design/blocks');
         $block = $lm->getBlockByTxtId('custom_form_block');
         $block_id = $block['block_id'];
         $that->data['tabs'][] = array('name' => $block_id, 'text' => $that->language->get('custom_forms_block'), 'href' => $that->html->getSecureURL('tool/forms_manager/insert_block', '&block_id=' . $block_id), 'active' => $block_id == $this->request->get['block_id'] ? true : false, 'sort_order' => 4);
     }
 }
Пример #17
0
 private function _getBlockForm()
 {
     if (isset($this->session->data['warning'])) {
         $this->data['error_warning'] = $this->session->data['warning'];
         $this->session->data['warning'] = '';
     } else {
         $this->data['error_warning'] = '';
     }
     $this->load->library('json');
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $locale = $this->session->data['language'];
     if (!file_exists(DIR_ROOT . '/' . RDIR_TEMPLATE . 'javascript/jqgrid/js/i18n/grid.locale-' . $locale . '.js')) {
         $locale = 'en';
     }
     $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/i18n/grid.locale-' . $locale . '.js');
     $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/jquery.jqGrid.min.js');
     $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/plugins/jquery.grid.fluid.js');
     $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/jquery.ba-bbq.min.js');
     $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/grid.history.js');
     $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/blocks'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->data['cancel'] = $this->html->getSecureURL('design/blocks');
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     // need to get data of custom listing
     $listing_data = array();
     if ($custom_block_id) {
         $lm = new ALayoutManager();
         $block_info = $lm->getBlockDescriptions($custom_block_id);
         $language_id = $this->session->data['content_language_id'];
         if (!isset($block_info[$language_id])) {
             $language_id = key($block_info);
         }
         foreach ($block_info[$language_id] as $k => $v) {
             $this->data[$k] = $v;
         }
         $content = $block_info[$this->session->data['content_language_id']]['content'];
         if ($content) {
             $content = unserialize($content);
         } else {
             $content = current($block_info);
             $content = unserialize($content['content']);
         }
         $this->data['banner_group_name'] = $content['banner_group_name'];
         $lm = new AListingManager($this->request->get['custom_block_id']);
         $list = $lm->getCustomList();
         if ($list) {
             foreach ($list as $row) {
                 $listing_data[$row['id']] = array('status' => true, 'sort_order' => $row['sort_order']);
             }
         }
     }
     if (!$custom_block_id) {
         $this->data['action'] = $this->html->getSecureURL('extension/banner_manager/insert_block');
         $this->data['form_title'] = $this->language->get('text_create_block');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         $this->data['action'] = $this->html->getSecureURL('extension/banner_manager/edit_block', '&custom_block_id=' . $custom_block_id);
         $this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->data['name'];
         $this->data['update'] = $this->html->getSecureURL('listing_grid/blocks_grid/update_field', '&custom_block_id=' . $custom_block_id);
         $form = new AForm('HS');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['form_title'], 'separator' => ' :: '));
     $form->setForm(array('form_name' => 'BannerBlockFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'BannerBlockFrm', 'action' => $this->data['action']));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     if ($custom_block_id) {
         $this->data['form']['fields']['block_status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_status', 'value' => $this->data['status'], 'style' => 'btn_switch'));
         $this->data['form']['text']['block_status'] = $this->html->convertLinks($this->language->get('entry_block_status'));
         $this->data['form']['fields']['block_status_note'] = '';
         $this->data['form']['text']['block_status_note'] = $this->html->convertLinks($this->language->get('entry_block_status_note'));
     }
     $this->data['form']['fields']['block_name'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'block_id', 'value' => $this->data['block_id']));
     $this->data['form']['fields']['block_name'] .= $form->getFieldHtml(array('type' => 'input', 'name' => 'block_name', 'value' => $this->data['name'], 'required' => true));
     $this->data['form']['text']['block_name'] = $this->language->get('entry_block_name');
     $this->data['form']['fields']['block_title'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'block_title', 'required' => true, 'value' => $this->data['title']));
     $this->data['form']['text']['block_title'] = $this->language->get('entry_block_title');
     // list of templates for block
     $tmpl_ids = $this->extensions->getInstalled('template');
     $tmpl_ids[] = 'default';
     $tmpl_ids[] = 'default_html5';
     $this->data['block_wrappers'] = array();
     foreach ($tmpl_ids as $tmpl_id) {
         // for tpls of block that stores in db
         $layout_manager = new ALayoutManager($tmpl_id);
         $block = $layout_manager->getBlockByTxtId('banner_block');
         $block_templates = (array) $layout_manager->getBlockTemplates($block['block_id']);
         foreach ($block_templates as $item) {
             if ($item['template']) {
                 $this->data['block_wrappers'][$item['template']] = $item['template'];
             }
         }
         //Automatic block template selection mode based on parent is limited to 1 template per location
         //To extend, allow custom block's template to be selected to suppress automatic selection
         //for tpls that stores in main.php (other extensions templates)
         $ext_tpls = $this->extensions->getExtensionTemplates();
         foreach ($ext_tpls as $section) {
             foreach ($section as $s => $tpls) {
                 if ($s != 'storefront') {
                     continue;
                 }
                 foreach ($tpls as $tpl) {
                     if (isset($this->data['block_wrappers'][$tpl]) || strpos($tpl, 'blocks/banner_block/') === false) {
                         continue;
                     }
                     $this->data['block_wrappers'][$tpl] = $tpl;
                 }
             }
         }
         $tpls = glob(DIR_STOREFRONT . 'view/*/template/blocks/banner_block/*.tpl');
         foreach ($tpls as $tpl) {
             $pos = strpos($tpl, 'blocks/banner_block/');
             $tpl = substr($tpl, $pos);
             if (!isset($this->data['block_wrappers'][$tpl])) {
                 $this->data['block_wrappers'][$tpl] = $tpl;
             }
         }
     }
     ksort($this->data['block_wrappers']);
     array_unshift($this->data['block_wrappers'], $this->language->get('text_automatic'));
     if ($this->data['block_wrapper'] && !isset($this->data['block_wrappers'][$this->data['block_wrapper']])) {
         $this->data['block_wrappers'] = array_merge(array($this->data['block_wrapper'] => $this->data['block_wrapper']), $this->data['block_wrappers']);
     }
     $this->data['form']['fields']['block_wrapper'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'block_wrapper', 'options' => $this->data['block_wrappers'], 'value' => $this->data['block_wrapper'], 'help_url' => $this->gen_help_url('block_wrapper')));
     $this->data['form']['text']['block_wrapper'] = $this->language->get('entry_block_wrapper');
     $this->data['form']['fields']['block_framed'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_framed', 'value' => $this->data['block_framed'], 'style' => 'btn_switch', 'help_url' => $this->gen_help_url('block_framed')));
     $this->data['form']['text']['block_framed'] = $this->language->get('entry_block_framed');
     $this->data['form']['fields']['block_description'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'block_description', 'value' => $this->data['description'], 'attr' => ' style="height: 50px;"'));
     $this->data['form']['text']['block_description'] = $this->language->get('entry_block_description');
     // groups of banners
     $this->loadModel('extension/banner_manager');
     $result = $this->model_extension_banner_manager->getBannerGroups();
     $groups = array('0' => $this->language->get('text_select'));
     if ($result) {
         foreach ($result as $row) {
             $groups[$row['banner_group_name']] = $row['banner_group_name'];
         }
     }
     $this->data['form']['fields']['banner_group_name'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'banner_group_name', 'options' => $groups, 'value' => $this->data['banner_group_name'], 'style' => 'no-save'));
     $this->data['form']['text']['banner_group_name'] = $this->language->get('entry_banner_group_name');
     //single banners
     $this->data['form']['fields']['listed_banners'] = $form->getFieldHtml(array('id' => 'popup', 'type' => 'multivalue', 'name' => 'popup', 'title' => $this->language->get('text_select_from_list'), 'selected' => $listing_data ? AJson::encode($listing_data) : "{}", 'content_url' => $this->html->getSecureUrl('listing_grid/banner_manager/getlisting', '&custom_block_id=' . $custom_block_id), 'return_to' => '', 'no_save' => $custom_block_id ? false : true, 'text' => array('selected' => $this->language->get('text_selected'), 'edit' => $this->language->get('text_save_edit'), 'apply' => $this->language->get('text_apply'), 'save' => $this->language->get('button_save'), 'reset' => $this->language->get('button_reset'))));
     $this->data['form']['text']['listed_banners'] = $this->language->get('entry_banners_selected');
     $this->view->batchAssign($this->language->getASet());
     $this->view->batchAssign($this->data);
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->assign('language_code', $this->session->data['language']);
     $this->view->assign('help_url', $this->gen_help_url('banner_edit'));
     $this->view->assign('rl', $this->html->getSecureURL('common/resource_library', '&object_name=banners&type=image&mode=url'));
     $this->processTemplate('pages/extension/banner_manager_block_form.tpl');
 }
 private function _getListingForm()
 {
     if (isset($this->session->data['warning'])) {
         $this->data['error_warning'] = $this->session->data['warning'];
         $this->session->data['warning'] = '';
     } else {
         $this->data['error_warning'] = '';
     }
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $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/blocks'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->data['cancel'] = $this->html->getSecureURL('design/blocks');
     if (!isset($this->request->get['custom_block_id'])) {
         $this->data['action'] = $this->html->getSecureURL('design/blocks/insert');
         $this->data['heading_title'] = $this->language->get('text_create');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         $this->data['action'] = $this->html->getSecureURL('design/blocks/edit', '&custom_block_id=' . $this->request->get['custom_block_id']);
         $this->data['heading_title'] = $this->language->get('text_edit') . ' ' . $this->data['name'];
         $this->data['update'] = $this->html->getSecureURL('listing_grid/blocks_grid/update_field', '&custom_block_id=' . $this->request->get['custom_block_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' => 'BlockFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'BlockFrm', 'attr' => 'data-confirm-exit="true"', 'action' => $this->data['action']));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     if (isset($this->request->get['custom_block_id'])) {
         $this->data['form']['fields']['block_status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_status', 'value' => $this->data['status'], 'style' => 'btn_switch status_switch'));
         $this->data['form']['text']['block_status'] = $this->html->convertLinks($this->language->get('entry_block_status'));
         $this->data['form']['fields']['block_status_note'] = '';
         $this->data['form']['text']['block_status_note'] = $this->html->convertLinks($this->language->get('entry_block_status_note'));
     }
     $lm = new ALayoutManager();
     foreach ($this->data['custom_block_types'] as $txt_id) {
         $block = $lm->getBlockByTxtId($txt_id);
         if ($block['block_id']) {
             $blocks[$block['block_id']] = $this->language->get('text_' . $txt_id);
             if ($txt_id == 'listing_block') {
                 $default_block_type = $block['block_id'];
             }
         }
     }
     if (isset($this->request->get['custom_block_id'])) {
         // need to khow what type of listing is that
         $this->data['content'] = unserialize($this->data['content']);
         $this->data['autoload'] = 'load_subform({\'listing_datasource\': \'' . $this->data['content']['listing_datasource'] . '\'});';
     }
     $this->data['form']['fields']['block_name'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'block_id', 'value' => $default_block_type));
     $this->data['form']['fields']['block_name'] .= $form->getFieldHtml(array('type' => 'input', 'name' => 'block_name', 'value' => $this->data['name'], 'multilingual' => true, 'required' => true));
     $this->data['form']['text']['block_name'] = $this->language->get('entry_block_name');
     $this->data['form']['fields']['block_title'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'block_title', 'required' => true, 'multilingual' => true, 'value' => $this->data['title']));
     $this->data['form']['text']['block_title'] = $this->language->get('entry_block_title');
     // list of templates for block
     $tmpl_ids = $this->extensions->getInstalled('template');
     $tmpl_ids[] = 'default';
     $this->data['block_wrappers'] = array();
     foreach ($tmpl_ids as $tmpl_id) {
         // for tpls of block that stores in db
         $layout_manager = new ALayoutManager($tmpl_id);
         $block = $layout_manager->getBlockByTxtId('listing_block');
         $block_templates = (array) $layout_manager->getBlockTemplates($block['block_id']);
         foreach ($block_templates as $item) {
             if ($item['template']) {
                 $this->data['block_wrappers'][$item['template']] = $item['template'];
             }
         }
     }
     //Automatic block template selection mode based on parent is limited to 1 template per location
     //To extend, allow custom block's template to be selected to suppress automatic selection
     //for tpls that stores in main.php (other extensions templates)
     $ext_tpls = $this->extensions->getExtensionTemplates();
     foreach ($ext_tpls as $section) {
         foreach ($section as $s => $tpls) {
             if ($s != 'storefront') {
                 continue;
             }
             foreach ($tpls as $tpl) {
                 if (isset($this->data['block_wrappers'][$tpl]) || strpos($tpl, 'blocks/listing_block/') === false) {
                     continue;
                 }
                 $this->data['block_wrappers'][$tpl] = $tpl;
             }
         }
     }
     $tpls = glob(DIR_STOREFRONT . 'view/*/template/blocks/listing_block/*.tpl');
     foreach ($tpls as $tpl) {
         $pos = strpos($tpl, 'blocks/listing_block/');
         $tpl = substr($tpl, $pos);
         if (!isset($this->data['block_wrappers'][$tpl])) {
             $this->data['block_wrappers'][$tpl] = $tpl;
         }
     }
     ksort($this->data['block_wrappers']);
     array_unshift($this->data['block_wrappers'], $this->language->get('text_automatic'));
     $this->data['form']['fields']['block_wrapper'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'block_wrapper', 'options' => $this->data['block_wrappers'], 'value' => $this->data['block_wrapper']));
     $this->data['form']['text']['block_wrapper'] = $this->language->get('entry_block_wrapper');
     $this->data['form']['fields']['block_framed'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_framed', 'value' => $this->data['block_framed'], 'style' => 'btn_switch'));
     $this->data['form']['text']['block_framed'] = $this->language->get('entry_block_framed');
     $this->data['form']['fields']['block_description'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'block_description', 'value' => $this->data['description'], 'attr' => ' style="height: 50px;"', 'multilingual' => true));
     $this->data['form']['text']['block_description'] = $this->language->get('entry_block_description');
     $listing_manager = new AListingManager((int) $this->request->get['custom_block_id']);
     $listing_datasources = array('' => array('text' => 'text_select_listing'));
     $listing_datasources = array_merge($listing_datasources, $listing_manager->getListingDataSources());
     foreach ($listing_datasources as $k => $v) {
         $listing_datasources[$k] = $this->language->get($v['text']);
     }
     $default_listing_datasource = $this->data['content']['listing_datasource'];
     $this->data['form']['fields']['listing_datasource'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'listing_datasource', 'options' => $listing_datasources, 'value' => $default_listing_datasource, 'style' => 'no-save'));
     $this->data['form']['text']['listing_datasource'] = $this->language->get('entry_listing_datasource');
     if (!isset($this->data['subform_url'])) {
         $this->data['subform_url'] = $this->html->getSecureURL('listing_grid/blocks_grid/getsubform', $this->request->get['custom_block_id'] ? '&custom_block_id=' . $this->request->get['custom_block_id'] : '');
     }
     $this->view->batchAssign($this->language->getASet());
     $this->view->batchAssign($this->data);
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->assign('language_code', $this->session->data['language']);
     $this->view->assign('help_url', $this->gen_help_url('block_edit'));
     $this->view->assign('rl', $this->html->getSecureURL('common/resource_library', '&object_name=custom_block&type=image&mode=url'));
     $this->processTemplate('pages/design/blocks_form_listing.tpl');
 }
 public function removeCoreTemplate($template_txt_id)
 {
     if (!$template_txt_id || $template_txt_id == 'default') {
         return false;
     }
     // delete template layouts
     $layout = new ALayoutManager($template_txt_id);
     $layout->deleteTemplateLayouts();
     $this->_remove_dir(DIR_STOREFRONT . 'view/' . $template_txt_id);
     if ($this->error) {
         return false;
     }
     /*	$this->loadModel('setting/setting');
     
     		$store_id = 0;
     		if ($this->request->get['store_id']){
     			$store_id = $this->request->get['store_id'];
     		} else{
     			$store_id = $this->config->get('config_store_id');
     		}
     
     		if ($this->request->get['tmpl_id']){
     			$this->model_setting_setting->editSetting('appearance',
     					array ('config_storefront_template' => $this->request->get['tmpl_id']),
     					$store_id
     			);
     			$this->session->data['success'] = $this->language->get('text_remove_success');
     		} else{
     			$this->session->data['warning'] = $this->language->get('text_remove_error');
     		}*/
     return true;
 }
Пример #20
0
<?php

/*------------------------------------------------------------------------------
  $Id$

  AbanteCart, Ideal OpenSource Ecommerce Solution
  http://www.AbanteCart.com

  Copyright © 2011-2014 Belavier Commerce LLC

  This source file is subject to Open Software License (OSL 3.0)
  Lincence details is bundled with this package in the file LICENSE.txt.
  It is also available at this URL:
  <http://www.opensource.org/licenses/OSL-3.0>

 UPGRADE NOTE:
   Do not edit or add to this file if you wish to upgrade AbanteCart to newer
   versions in the future. If you wish to customize AbanteCart for your
   needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (!defined('DIR_CORE')) {
    header('Location: static_pages/');
}
$block_info['block_txt_id'] = 'default_google_talk';
$block_info['controller'] = 'default_google_talk/default_google_talk';
$block_info['templates'] = array(array('parent_block_txt_id' => 'header', 'template' => 'default_google_talk/default_google_talk_tblock.tpl'), array('parent_block_txt_id' => 'header_bottom', 'template' => 'default_google_talk/default_google_talk_cblock.tpl'), array('parent_block_txt_id' => 'content_top', 'template' => 'default_google_talk/default_google_talk_cblock.tpl'), array('parent_block_txt_id' => 'content_bottom', 'template' => 'default_google_talk/default_google_talk_cblock.tpl'), array('parent_block_txt_id' => 'footer', 'template' => 'default_google_talk/default_google_talk_tblock.tpl'), array('parent_block_txt_id' => 'footer_top', 'template' => 'default_google_talk/default_google_talk_cblock.tpl'), array('parent_block_txt_id' => 'column_left', 'template' => 'default_google_talk/default_google_talk_sblock.tpl'), array('parent_block_txt_id' => 'column_right', 'template' => 'default_google_talk/default_google_talk_sblock.tpl'));
$block_info['descriptions'] = array(array('language_name' => 'english', 'name' => 'Google Talk Chat'), array('language_name' => 'espanol', 'name' => 'Google Talk Chat'));
$layout = new ALayoutManager();
$layout->saveBlock($block_info);
 public function getCustomListingSubForm()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->load->library('json');
     $lm = new ALayoutManager();
     $form_name = has_value($this->request->get['form_name']) ? $this->request->get['form_name'] : 'BlockFrm';
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     $listing_datasource = $this->request->post_or_get('listing_datasource');
     // need to get data of custom listing
     if ($custom_block_id) {
         $content = $lm->getBlockDescriptions($custom_block_id);
         $content = $content[$this->language->getContentLanguageID()]['content'];
         $content = unserialize($content);
         if ($content['listing_datasource'] == $listing_datasource) {
             $lm = new AListingManager($custom_block_id);
             $list = $lm->getCustomList();
             $options_list = array();
             if ($list) {
                 foreach ($list as $row) {
                     $options_list[(int) $row['id']] = array();
                 }
                 $ids = array_keys($options_list);
                 switch ($listing_datasource) {
                     case 'custom_products':
                         $this->loadModel('catalog/product');
                         $filter = array('subsql_filter' => 'p.product_id in (' . implode(',', $ids) . ')');
                         $results = $this->model_catalog_product->getProducts($filter);
                         $id_name = 'product_id';
                         $rl_object_name = 'products';
                         break;
                     case 'custom_categories':
                         $this->loadModel('catalog/category');
                         $filter = array('subsql_filter' => 'c.category_id in (' . implode(',', $ids) . ')');
                         $results = $this->model_catalog_category->getCategoriesData($filter);
                         $id_name = 'category_id';
                         $rl_object_name = 'categories';
                         break;
                     case 'custom_manufacturers':
                         $this->loadModel('catalog/manufacturer');
                         $filter = array('subsql_filter' => 'm.manufacturer_id in (' . implode(',', $ids) . ')');
                         $results = $this->model_catalog_manufacturer->getManufacturers($filter);
                         $id_name = 'manufacturer_id';
                         $rl_object_name = 'manufacturers';
                         break;
                 }
                 $rm = new AResourceManager();
                 $rm->setType('image');
                 foreach ($results as $item) {
                     $id = $item[$id_name];
                     if (in_array($id, $ids)) {
                         $thumbnail = $rm->getMainThumb($rl_object_name, $id, (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), false);
                         $icon = $thumbnail['thumb_html'] ? $thumbnail['thumb_html'] : '<i class="fa fa-code fa-4x"></i>&nbsp;';
                         $options_list[$id] = array('image' => $icon, 'id' => $id, 'name' => $item['name'], 'meta' => $item['model'], 'sort_order' => (int) $item['sort_order']);
                     }
                 }
             }
         }
     }
     switch ($listing_datasource) {
         case 'custom_products':
             $ajax_url = $this->html->getSecureURL('r/product/product/products');
             break;
         case 'custom_categories':
             $ajax_url = $this->html->getSecureURL('r/listing_grid/category/categories');
             break;
         case 'custom_manufacturers':
             $ajax_url = $this->html->getSecureURL('r/listing_grid/manufacturer/manufacturers');
             break;
     }
     $form = new AForm('ST');
     $form->setForm(array('form_name' => $form_name));
     $multivalue_html = $form->getFieldHtml(array('type' => 'multiselectbox', 'name' => 'selected[]', 'value' => $ids, 'options' => $options_list, 'style' => 'chosen', 'ajax_url' => $ajax_url, 'placeholder' => $this->language->get('text_select_from_lookup')));
     $this->view->assign('multivalue_html', $multivalue_html);
     $this->view->assign('form_name', $form_name);
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->processTemplate('responses/design/block_custom_listing_subform.tpl');
 }
Пример #22
0
 public function save()
 {
     if ($this->request->is_GET()) {
         $this->redirect($this->html->getSecureURL('catalog/product_layout'));
     }
     $page_controller = 'pages/product/product';
     $page_key_param = 'product_id';
     $product_id = $this->request->post['product_id'];
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/product');
     if (!has_value($product_id)) {
         unset($this->session->data['success']);
         $this->session->data['warning'] = $this->language->get('error_product_not_found');
         $this->redirect($this->html->getSecureURL('catalog/product/update'));
     }
     // need to know if unique page existing
     $post_data = $this->request->post;
     $tmpl_id = $post_data['tmpl_id'];
     $layout = new ALayoutManager();
     $pages = $layout->getPages($page_controller, $page_key_param, $product_id);
     if (count($pages)) {
         $page_id = $pages[0]['page_id'];
         $layout_id = $pages[0]['layout_id'];
     } else {
         $page_info = array('controller' => $page_controller, 'key_param' => $page_key_param, 'key_value' => $product_id);
         $this->loadModel('catalog/product');
         $product_info = $this->model_catalog_product->getProductDescriptions($product_id);
         if ($product_info) {
             foreach ($product_info as $language_id => $description) {
                 if (!(int) $language_id) {
                     continue;
                 }
                 $page_info['page_descriptions'][$language_id] = $description;
             }
         }
         $page_id = $layout->savePage($page_info);
         $layout_id = '';
         // need to generate layout name
         $default_language_id = $this->language->getDefaultLanguageID();
         $post_data['layout_name'] = 'Product: ' . $product_info[$default_language_id]['name'];
     }
     //create new instance with specific template/page/layout data
     $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
     if (has_value($post_data['layout_change'])) {
         //update layout request. Clone source layout
         $layout->clonePageLayout($post_data['layout_change'], $layout_id, $post_data['layout_name']);
         $this->session->data['success'] = $this->language->get('text_success_layout');
     } else {
         //save new layout
         $layout_data = $layout->prepareInput($post_data);
         if ($layout_data) {
             $layout->savePageLayout($layout_data);
             $this->session->data['success'] = $this->language->get('text_success_layout');
         }
     }
     $this->redirect($this->html->getSecureURL('catalog/product_layout', '&product_id=' . $product_id));
 }
Пример #23
0
 public function block_info()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('design/blocks');
     //load specific template/page/layout
     $template = $this->request->get['template'];
     $page_id = $this->request->get['page_id'];
     $layout_id = $this->request->get['layout_id'];
     $lm = new ALayoutManager($template, $page_id, $layout_id);
     //acccept 2 type of ids. Number based and custom [block]_[custom_block]
     $custom_block_id = $this->request->get['block_id'];
     if (preg_match("/(\\d+)_(\\d+)/", $custom_block_id, $match)) {
         //take last postion of id for custom block
         $block_id = $match[1];
         $custom_block_id = $match[2];
     } else {
         //error
         $this->load->library('json');
         $this->response->addJSONHeader();
         $this->response->setOutput(AJson::encode(array('error' => 'Incorrect Block ID')));
         return null;
     }
     $info = $lm->getBlockInfo((int) $block_id);
     //expect only 1 block details per layout
     $this->data = array_merge($info[0], $this->data);
     //get specific description
     if ($custom_block_id > 0) {
         $descr = $lm->getBlockDescriptions((int) $custom_block_id);
         $language_id = $this->language->getContentLanguageID();
         $this->data['block_id'] = $block_id;
         $this->data['custom_block_id'] = $custom_block_id;
         $this->data['title'] = $descr[$language_id]['title'];
         $this->data['description'] = $descr[$language_id]['description'];
         //detect edit URL and build button
         if ($this->data['block_txt_id'] == 'html_block' || $this->data['block_txt_id'] == 'listing_block') {
             $edit_url = $this->html->getSecureURL('design/blocks/edit', '&custom_block_id=' . $custom_block_id);
         } else {
             if ($this->data['block_txt_id'] == 'banner_block') {
                 $edit_url = $this->html->getSecureURL('extension/banner_manager/edit_block', '&custom_block_id=' . $custom_block_id);
             } else {
                 //just list all
                 $edit_url = $this->html->getSecureURL('design/blocks');
             }
         }
         $this->data['block_edit_brn'] = $this->html->buildButton(array('type' => 'button', 'name' => 'btn_edit', 'id' => 'btn_edit', 'text' => $this->language->get('text_edit'), 'href' => $edit_url, 'target' => '_new', 'style' => 'button1'));
         $this->data['allow_edit'] = 'true';
     } else {
         //get details from language for static blocks from storefront
         $alang = new ALanguage($this->registry, $language_id, 0);
         $alang->load($this->data['controller'], 'silent');
         $this->data['title'] = $alang->get('heading_title');
         $this->data['title'] = $this->data['title'] == 'heading_title' ? $this->data['block_txt_id'] : $this->data['title'];
         $this->data['description'] = $this->language->get('text_controller') . ": " . $this->data['controller'];
         $this->data['description'] .= "<br/>" . $this->language->get('text_templates') . ": ";
         $this->data['description'] .= "<br/>" . str_replace(',', '<br/>', $this->data['templates']);
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->load->library('json');
     $this->response->addJSONHeader();
     $this->response->setOutput(AJson::encode($this->data));
 }
Пример #24
0
 /**
  * @param int $product_id
  * @return bool
  */
 public function deleteProduct($product_id)
 {
     if (!(int) $product_id) {
         return false;
     }
     $rm = new AResourceManager();
     $this->db->query("DELETE FROM " . $this->db->table("products") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("product_descriptions") . " WHERE product_id = '" . (int) $product_id . "'");
     $resources = $rm->getResourcesList(array('object_name' => 'products', 'object_id' => (int) $product_id));
     foreach ($resources as $r) {
         $rm->unmapResource('products', $product_id, $r['resource_id']);
         //if resource become orphan - delete it
         if (!$rm->isMapped($r['resource_id'])) {
             $rm->deleteResource($r['resource_id']);
         }
     }
     //delete product's downloads
     $this->load->model('catalog/download');
     $downloads = $this->model_catalog_download->getProductDownloadsDetails($product_id, array('subsql_filter' => 'AND d.shared<>1'));
     foreach ($downloads as $d) {
         $this->model_catalog_download->deleteDownload($d['download_id']);
     }
     $this->db->query("DELETE FROM " . $this->db->table("product_options") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("product_option_descriptions") . " WHERE product_id = '" . (int) $product_id . "'");
     $sql = "SELECT product_option_value_id FROM " . $this->db->table("product_option_values") . " WHERE product_id = '" . (int) $product_id . "'";
     $result = $this->db->query($sql);
     foreach ($result->rows as $row) {
         $pd_opt_val_id = $row['product_option_value_id'];
         $resources = $rm->getResourcesList(array('object_name' => 'product_option_value', 'object_id' => (int) $pd_opt_val_id));
         foreach ($resources as $r) {
             $rm->unmapResource('product_option_value', $pd_opt_val_id, $r['resource_id']);
         }
     }
     $this->db->query("DELETE FROM " . $this->db->table("product_option_values") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("product_option_value_descriptions") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("product_discounts") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("products_related") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("products_to_downloads") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("products_to_categories") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("reviews") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("products_to_stores") . " WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("url_aliases") . " WHERE query = 'product_id=" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . $this->db->table("product_tags") . " WHERE product_id='" . (int) $product_id . "'");
     $lm = new ALayoutManager();
     $lm->deletePageLayout('pages/product/product', 'product_id', (int) $product_id);
     $this->cache->remove('product');
     return true;
 }
Пример #25
0
 private function _getBlockForm()
 {
     if (isset($this->session->data['warning'])) {
         $this->data['error_warning'] = $this->session->data['warning'];
         $this->session->data['warning'] = '';
     } else {
         $this->data['error_warning'] = '';
     }
     $this->load->library('json');
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $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/blocks'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->data['cancel'] = $this->html->getSecureURL('design/blocks');
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     // need to get data of custom listing
     $listing_data = array();
     if ($custom_block_id) {
         $lm = new ALayoutManager();
         $block_info = $lm->getBlockDescriptions($custom_block_id);
         $language_id = $this->language->getContentLanguageID();
         if (!isset($block_info[$language_id])) {
             $language_id = key($block_info);
         }
         foreach ($block_info[$language_id] as $k => $v) {
             $this->data[$k] = $v;
         }
         $content = $block_info[$this->language->getContentLanguageID()]['content'];
         if ($content) {
             $content = unserialize($content);
         } else {
             $content = current($block_info);
             $content = unserialize($content['content']);
         }
         $this->data['form_id'] = $content['form_id'];
         $lm = new AListingManager($this->request->get['custom_block_id']);
         $list = $lm->getCustomList();
         if ($list) {
             foreach ($list as $row) {
                 $listing_data[$row['id']] = array('status' => true, 'sort_order' => $row['sort_order']);
             }
         }
     }
     if (!$custom_block_id) {
         $this->data['action'] = $this->html->getSecureURL('tool/forms_manager/insert_block');
         $this->data['form_title'] = $this->language->get('text_create_block');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         $this->data['action'] = $this->html->getSecureURL('tool/forms_manager/edit_block', '&custom_block_id=' . $custom_block_id);
         $this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->data['name'];
         $this->data['update'] = $this->html->getSecureURL('listing_grid/blocks_grid/update_field', '&custom_block_id=' . $custom_block_id);
         $form = new AForm('HS');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['form_title'], 'separator' => ' :: ', 'current' => true));
     $form->setForm(array('form_name' => 'CustomFormBlockFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'CustomFormBlockFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"'));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     if ($custom_block_id) {
         $this->data['form']['fields']['block_status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_status', 'value' => $this->data['status'], 'style' => 'btn_switch'));
         $this->data['entry_block_status_note'] = $this->html->convertLinks($this->language->get('entry_block_status_note'));
         $this->data['form']['fields']['block_status_note'] = '';
         $this->data['entry_block_status_note'] = $this->html->convertLinks($this->language->get('entry_block_status_note'));
     }
     $this->data['form']['fields']['block_name'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'block_id', 'value' => $this->data['block_id']));
     $this->data['form']['fields']['block_name'] .= $form->getFieldHtml(array('type' => 'input', 'name' => 'block_name', 'value' => $this->data['name'], 'required' => true));
     $this->data['form']['text']['block_name'] = $this->language->get('entry_block_name');
     $this->data['form']['fields']['block_title'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'block_title', 'required' => true, 'value' => $this->data['title']));
     $this->data['form']['text']['block_title'] = $this->language->get('entry_block_title');
     // list of templates for block
     $tmpl_ids = $this->extensions->getInstalled('template');
     array_unshift($tmpl_ids, (string) $this->session->data['layout_params']['tmpl_id']);
     $this->data['block_wrappers'] = array();
     foreach ($tmpl_ids as $tmpl_id) {
         $layout_manager = new ALayoutManager($tmpl_id);
         $block = $layout_manager->getBlockByTxtId('custom_form_block');
         $block_templates = (array) $layout_manager->getBlockTemplates($block['block_id']);
         foreach ($block_templates as $item) {
             $this->data['block_wrappers'][$item['template']] = $item['template'];
         }
     }
     array_unshift($this->data['block_wrappers'], 'Default');
     $this->data['form']['fields']['block_wrapper'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'block_wrapper', 'options' => $this->data['block_wrappers'], 'value' => $this->data['block_wrapper'], 'help_url' => $this->gen_help_url('block_wrapper')));
     $this->data['form']['text']['block_wrapper'] = $this->language->get('entry_block_wrapper');
     $this->data['form']['fields']['block_framed'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_framed', 'value' => $this->data['block_framed'], 'style' => 'btn_switch', 'help_url' => $this->gen_help_url('block_framed')));
     $this->data['form']['text']['block_framed'] = $this->language->get('entry_block_framed');
     $this->data['form']['fields']['block_description'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'block_description', 'value' => $this->data['description'], 'attr' => ' style="height: 50px;"'));
     $this->data['form']['text']['block_description'] = $this->language->get('entry_block_description');
     $result = $this->model_tool_forms_manager->getForms(array('filter' => array('status' => 1)));
     $forms = array();
     if ($result) {
         foreach ($result as $row) {
             $forms[$row['form_id']] = $row['form_name'];
         }
     }
     $this->data['form']['fields']['form'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'form_id', 'options' => $forms, 'value' => $this->data['form_id'], 'style' => 'no-save', 'attr' => 'multiple="multiple"'));
     $this->data['form']['text']['form'] = $this->language->get('text_form');
     $this->data['note'] = sprintf($this->language->get('note_edit_layout'), $this->html->getSecureURL('design/layout'), $this->html->getSecureURL('tool/forms_manager'));
     $this->view->batchAssign($this->language->getASet());
     $this->view->batchAssign($this->data);
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->assign('language_code', $this->session->data['language']);
     $this->view->assign('help_url', $this->gen_help_url('form_block_edit'));
     $this->processTemplate('pages/tool/forms_manager_block_form.tpl');
 }
Пример #26
0
<?php

/*------------------------------------------------------------------------------
  $Id$

  AbanteCart, Ideal OpenSource Ecommerce Solution
  http://www.AbanteCart.com

  Copyright © 2011-2014 Belavier Commerce LLC

  This source file is subject to Open Software License (OSL 3.0)
  Lincence details is bundled with this package in the file LICENSE.txt.
  It is also available at this URL:
  <http://www.opensource.org/licenses/OSL-3.0>

 UPGRADE NOTE:
   Do not edit or add to this file if you wish to upgrade AbanteCart to newer
   versions in the future. If you wish to customize AbanteCart for your
   needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (!defined('DIR_CORE')) {
    header('Location: static_pages/');
}
$layout = new ALayoutManager();
$layout->deleteBlock('default_google_talk');
 public function validate_block()
 {
     $responce = array();
     $this->loadLanguage('design/blocks');
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $block_id = $this->request->get['block_id'];
     $parent_block_id = $this->request->get['parent_block_id'];
     if (has_value($block_id) && has_value($parent_block_id)) {
         $lm = new ALayoutManager();
         $template = $lm->getBlockTemplate($block_id, $parent_block_id);
         if ($template) {
             $responce['allowed'] = 'true';
             $responce['template'] = $template;
         } else {
             $responce['allowed'] = 'false';
             $responce['message'] = $this->language->get('error_block_not_available');
         }
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->load->library('json');
     $this->response->setOutput(AJson::encode($responce));
 }
Пример #28
0
 /**
  * @param int $product_id
  */
 public function deleteProduct($product_id)
 {
     $this->db->query("DELETE FROM " . DB_PREFIX . "products WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_descriptions WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_options WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_descriptions WHERE product_id = '" . (int) $product_id . "'");
     $sql = "SELECT product_option_value_id FROM " . DB_PREFIX . "product_option_values WHERE product_id = '" . (int) $product_id . "'";
     $result = $this->db->query($sql);
     $rm = new AResourceManager();
     foreach ($result->rows as $row) {
         $pd_opt_val_id = $row['product_option_value_id'];
         $resources = $rm->getResourcesList(array('object_name' => 'product_option_value', 'object_id' => (int) $pd_opt_val_id));
         foreach ($resources as $r) {
             $rm->unmapResource('product_option_value', $pd_opt_val_id, $r['resource_id']);
         }
     }
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_values WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value_descriptions WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_discounts WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "products_related WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "products_to_downloads WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "products_to_categories WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "reviews WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "products_to_stores WHERE product_id = '" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "url_aliases WHERE query = 'product_id=" . (int) $product_id . "'");
     $this->db->query("DELETE FROM " . DB_PREFIX . "product_tags WHERE product_id='" . (int) $product_id . "'");
     $lm = new ALayoutManager();
     $lm->deletePageLayout('pages/product/product', 'product_id', (int) $product_id);
     $this->cache->delete('product');
 }
Пример #29
0
 private function _getBlockForm()
 {
     if (isset($this->session->data['warning'])) {
         $this->data['error_warning'] = $this->session->data['warning'];
         $this->session->data['warning'] = '';
     } else {
         $this->data['error_warning'] = '';
     }
     $this->load->library('json');
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $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/blocks'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->data['cancel'] = $this->html->getSecureURL('design/blocks');
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     // need to get data of custom listing
     $options_list = array();
     if ($custom_block_id) {
         $lm = new ALayoutManager();
         $block_info = $lm->getBlockDescriptions($custom_block_id);
         $language_id = $this->session->data['content_language_id'];
         if (!isset($block_info[$language_id])) {
             $language_id = key($block_info);
         }
         foreach ($block_info[$language_id] as $k => $v) {
             $this->data[$k] = $v;
         }
         $content = $block_info[$this->language->getContentLanguageID()]['content'];
         if ($content) {
             $content = unserialize($content);
         } else {
             $content = current($block_info);
             $content = unserialize($content['content']);
         }
         $this->data['banner_group_name'] = $content['banner_group_name'];
         $lm = new AListingManager($this->request->get['custom_block_id']);
         $list = $lm->getCustomList();
         $options_list = array();
         if ($list) {
             foreach ($list as $row) {
                 $options_list[(int) $row['id']] = array();
             }
             $ids = array_keys($options_list);
             $assigned_banners = $this->model_extension_banner_manager->getBanners(array('subsql_filter' => 'b.banner_id IN (' . implode(', ', $ids) . ')'));
             $rm = new AResourceManager();
             $rm->setType('image');
             foreach ($assigned_banners as $banner) {
                 $id = $banner['banner_id'];
                 if (in_array($id, $ids)) {
                     $thumbnail = $rm->getMainThumb('banners', $banner['banner_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), false);
                     $icon = $thumbnail['thumb_html'] ? $thumbnail['thumb_html'] : '<i class="fa fa-code fa-4x"></i>&nbsp;';
                     $options_list[$id] = array('image' => $icon, 'id' => $id, 'name' => $banner['name'], 'sort_order' => (int) $banner['sort_order']);
                 }
             }
         }
     }
     if (!$custom_block_id) {
         $this->data['action'] = $this->html->getSecureURL('extension/banner_manager/insert_block');
         $this->data['form_title'] = $this->language->get('text_create_block');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         $this->data['action'] = $this->html->getSecureURL('extension/banner_manager/edit_block', '&custom_block_id=' . $custom_block_id);
         $this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->data['name'];
         $this->data['update'] = $this->html->getSecureURL('listing_grid/blocks_grid/update_field', '&custom_block_id=' . $custom_block_id);
         $form = new AForm('HS');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['form_title'], 'separator' => ' :: ', 'current' => true));
     $form->setForm(array('form_name' => 'BannerBlockFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'BannerBlockFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"'));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     if ($custom_block_id) {
         $this->data['form']['fields']['block_status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_status', 'value' => $this->data['status'], 'style' => 'btn_switch'));
         $this->data['form']['text']['block_status'] = $this->html->convertLinks($this->language->get('entry_block_status'));
         $this->data['form']['fields']['block_status_note'] = '';
         $this->data['form']['text']['block_status_note'] = $this->html->convertLinks($this->language->get('entry_block_status_note'));
     }
     $this->data['form']['fields']['block_name'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'block_id', 'value' => $this->data['block_id']));
     $this->data['form']['fields']['block_name'] .= $form->getFieldHtml(array('type' => 'input', 'name' => 'block_name', 'value' => $this->data['name'], 'required' => true));
     $this->data['form']['text']['block_name'] = $this->language->get('entry_block_name');
     $this->data['form']['fields']['block_title'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'block_title', 'required' => true, 'value' => $this->data['title']));
     $this->data['form']['text']['block_title'] = $this->language->get('entry_block_title');
     // list of templates for block
     $tmpl_ids = $this->extensions->getInstalled('template');
     $tmpl_ids[] = 'default';
     $this->data['block_wrappers'] = array();
     foreach ($tmpl_ids as $tmpl_id) {
         // for tpls of block that stores in db
         $layout_manager = new ALayoutManager($tmpl_id);
         $block = $layout_manager->getBlockByTxtId('banner_block');
         $block_templates = (array) $layout_manager->getBlockTemplates($block['block_id']);
         foreach ($block_templates as $item) {
             if ($item['template']) {
                 $this->data['block_wrappers'][$item['template']] = $item['template'];
             }
         }
         //Automatic block template selection mode based on parent is limited to 1 template per location
         //To extend, allow custom block's template to be selected to suppress automatic selection
         //for tpls that stores in main.php (other extensions templates)
         $ext_tpls = $this->extensions->getExtensionTemplates();
         foreach ($ext_tpls as $section) {
             foreach ($section as $s => $tpls) {
                 if ($s != 'storefront') {
                     continue;
                 }
                 foreach ($tpls as $tpl) {
                     if (isset($this->data['block_wrappers'][$tpl]) || strpos($tpl, 'blocks/banner_block/') === false) {
                         continue;
                     }
                     $this->data['block_wrappers'][$tpl] = $tpl;
                 }
             }
         }
         $tpls = glob(DIR_STOREFRONT . 'view/*/template/blocks/banner_block/*.tpl');
         foreach ($tpls as $tpl) {
             $pos = strpos($tpl, 'blocks/banner_block/');
             $tpl = substr($tpl, $pos);
             if (!isset($this->data['block_wrappers'][$tpl])) {
                 $this->data['block_wrappers'][$tpl] = $tpl;
             }
         }
     }
     ksort($this->data['block_wrappers']);
     array_unshift($this->data['block_wrappers'], $this->language->get('text_automatic'));
     if ($this->data['block_wrapper'] && !isset($this->data['block_wrappers'][$this->data['block_wrapper']])) {
         $this->data['block_wrappers'] = array_merge(array($this->data['block_wrapper'] => $this->data['block_wrapper']), $this->data['block_wrappers']);
     }
     $this->data['form']['fields']['block_wrapper'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'block_wrapper', 'options' => $this->data['block_wrappers'], 'value' => $this->data['block_wrapper'], 'help_url' => $this->gen_help_url('block_wrapper')));
     $this->data['form']['text']['block_wrapper'] = $this->language->get('entry_block_wrapper');
     $this->data['form']['fields']['block_framed'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_framed', 'value' => $this->data['block_framed'], 'style' => 'btn_switch', 'help_url' => $this->gen_help_url('block_framed')));
     $this->data['form']['text']['block_framed'] = $this->language->get('entry_block_framed');
     $this->data['form']['fields']['block_description'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'block_description', 'value' => $this->data['description'], 'attr' => ' style="height: 50px;"'));
     $this->data['form']['text']['block_description'] = $this->language->get('entry_block_description');
     // groups of banners
     $this->loadModel('extension/banner_manager');
     $result = $this->model_extension_banner_manager->getBannerGroups();
     $groups = array('0' => $this->language->get('text_select'));
     if ($result) {
         foreach ($result as $row) {
             $groups[$row['banner_group_name']] = $row['banner_group_name'];
         }
     }
     $this->data['form']['fields']['banner_group_name'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'banner_group_name', 'options' => $groups, 'value' => $this->data['banner_group_name'], 'style' => 'no-save'));
     $this->data['form']['text']['banner_group_name'] = $this->language->get('entry_banner_group_name');
     $this->data['form']['text']['listed_banners'] = $this->language->get('entry_banners_selected');
     //load only prior saved products
     $this->data['banners'] = array();
     $this->data['form']['fields']['listed_banners'] = $form->getFieldHtml(array('type' => 'multiselectbox', 'name' => 'block_banners[]', 'value' => $ids, 'options' => $options_list, 'style' => 'no-save chosen', 'ajax_url' => $this->html->getSecureURL('listing_grid/banner_manager/banners'), 'placeholder' => $this->language->get('text_select_from_lookup')));
     $this->view->batchAssign($this->language->getASet());
     $this->view->batchAssign($this->data);
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->assign('language_code', $this->session->data['language']);
     $this->view->assign('help_url', $this->gen_help_url('banner_edit'));
     $this->view->assign('rl', $this->html->getSecureURL('common/resource_library', '&object_name=banners&type=image&mode=url'));
     $this->processTemplate('pages/extension/banner_manager_block_form.tpl');
 }
Пример #30
0
 public function delete()
 {
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     if (isset($this->request->get['tmpl_id'])) {
         $tmpl_id = $this->request->get['tmpl_id'];
     } else {
         $tmpl_id = null;
     }
     if (isset($this->request->get['page_id'])) {
         $page_id = $this->request->get['page_id'];
     } else {
         $page_id = null;
     }
     if (isset($this->request->get['layout_id'])) {
         $layout_id = $this->request->get['layout_id'];
     } else {
         $layout_id = null;
     }
     $success = false;
     if ($this->request->is_GET() && $this->request->get['confirmed_delete'] == 'yes') {
         $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
         //do delete this page/layout validate that it is alowed to delete
         $page = $layout->getPageData();
         if ($page['restricted']) {
             $this->session->data['warning'] = $this->language->get('text_delete_restricted');
         } else {
             if ($layout->deletePageLayoutByID($page_id, $layout_id)) {
                 $this->session->data['success'] = $this->language->get('text_delete_success');
                 $success = true;
             } else {
                 $this->session->data['warning'] = 'Error! Try again.';
             }
         }
     }
     $url = '';
     if (!$success) {
         if ($tmpl_id) {
             $url .= '&tmpl_id=' . $tmpl_id;
         }
         if ($layout_id) {
             $url .= '&layout_id=' . $layout_id;
         }
         if ($page_id) {
             $url .= '&page_id=' . $page_id;
         }
     }
     $this->redirect($this->html->getSecureURL('design/layout', $url));
 }