Exemple #1
0
/**
 * 
 * @param type $id
 * @param type $name
 * @param type $value
 * @param type $class
 * @param type $rows
 */
function wysiwyg($id, $name, $value = '', $class = "form-control", $rows = 20)
{
    init_wysiwyg();
    $ed = '<textarea id="' . $id . '" name="' . $name . '" rows="' . $rows . '" class="' . $class . '">';
    $ed .= $value;
    $ed .= '</textarea>';
    $ed .= '<script>docReady(function() { CKEDITOR.replace(\'' . $id . '\', { ' . "\n" . '});});</script>';
    return $ed;
}
Exemple #2
0
 public function index()
 {
     $this->load->language('module/html');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('extension/module');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (!isset($this->request->get['module_id'])) {
             $this->model_extension_module->addModule('html', $this->request->post);
         } else {
             $this->model_extension_module->editModule($this->request->get['module_id'], $this->request->post);
         }
         $this->session->data['success'] = $this->language->get('text_success');
         $this->response->redirect(fixajaxurl($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL')));
     }
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_edit'] = $this->language->get('text_edit');
     $data['text_enabled'] = $this->language->get('text_enabled');
     $data['text_disabled'] = $this->language->get('text_disabled');
     $data['entry_name'] = $this->language->get('entry_name');
     $data['entry_title'] = $this->language->get('entry_title');
     $data['entry_description'] = $this->language->get('entry_description');
     $data['entry_status'] = $this->language->get('entry_status');
     $data['button_save'] = $this->language->get('button_save');
     $data['button_cancel'] = $this->language->get('button_cancel');
     if (isset($this->error['warning'])) {
         $data['error_warning'] = $this->error['warning'];
     } else {
         $data['error_warning'] = '';
     }
     if (isset($this->error['name'])) {
         $data['error_name'] = $this->error['name'];
     } else {
         $data['error_name'] = '';
     }
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_module'), 'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
     if (!isset($this->request->get['module_id'])) {
         $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('module/html', 'token=' . $this->session->data['token'], 'SSL'));
     } else {
         $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('module/html', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL'));
     }
     if (!isset($this->request->get['module_id'])) {
         $data['action'] = $this->url->link('module/html', 'token=' . $this->session->data['token'], 'SSL');
     } else {
         $data['action'] = $this->url->link('module/html', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL');
     }
     $data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
     if (isset($this->request->get['module_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $module_info = $this->model_extension_module->getModule($this->request->get['module_id']);
     }
     if (isset($this->request->post['name'])) {
         $data['name'] = $this->request->post['name'];
     } elseif (!empty($module_info)) {
         $data['name'] = $module_info['name'];
     } else {
         $data['name'] = '';
     }
     if (isset($this->request->post['title'])) {
         $data['title'] = $this->request->post['name'];
     } elseif (!empty($module_info)) {
         $data['title'] = $module_info['title'];
     } else {
         $data['title'] = '';
     }
     if (isset($this->request->post['module_description'])) {
         $data['module_description'] = $this->request->post['module_description'];
     } elseif (!empty($module_info)) {
         $data['module_description'] = $module_info['module_description'];
     } else {
         $data['module_description'] = '';
     }
     if (isset($this->request->post['status'])) {
         $data['status'] = $this->request->post['status'];
     } elseif (!empty($module_info)) {
         $data['status'] = $module_info['status'];
     } else {
         $data['status'] = '';
     }
     init_wysiwyg();
     $this->data = $data;
     $this->template = 'module/html.phtml';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
     //$this->response->setOutput($this->load->view('module/html.tpl', $data));
 }
Exemple #3
0
 protected function getForm()
 {
     //    $this->language->load('cms/page');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_enabled'] = $this->language->get('text_enabled');
     $this->data['text_disabled'] = $this->language->get('text_disabled');
     $this->data['entry_name'] = $this->language->get('entry_name');
     $this->data['entry_seo_url'] = $this->language->get('entry_seo_url');
     $this->data['entry_status'] = $this->language->get('entry_status');
     $this->data['entry_layout'] = $this->language->get('entry_layout');
     $this->data['entry_parent'] = $this->language->get('entry_parent');
     $this->data['entry_comments'] = $this->language->get('entry_comments');
     $this->data['entry_meta_title'] = $this->language->get('entry_meta_title');
     $this->data['entry_meta_keywords'] = $this->language->get('entry_meta_keywords');
     $this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
     $this->data['tab_general'] = $this->language->get('tab_general');
     $this->data['tab_meta'] = $this->language->get('tab_meta');
     $this->data['tab_permission'] = $this->language->get('tab_permission');
     $this->data['tab_revision'] = $this->language->get('tab_revision');
     $this->data['button_save'] = $this->language->get('button_save');
     $this->data['button_cancel'] = $this->language->get('button_cancel');
     $this->data['site_url'] = $this->config->get('config_catalog');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->error['name'])) {
         $this->data['error_name'] = $this->error['name'];
     } else {
         $this->data['error_name'] = '';
     }
     if (isset($this->error['content'])) {
         $this->data['error_content'] = $this->error['content'];
     } else {
         $this->data['error_content'] = '';
     }
     if (isset($this->error['slug'])) {
         $this->data['error_slug'] = $this->error['slug'];
     } else {
         $this->data['error_slug'] = '';
     }
     $url = '';
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link($this->_namespace, 'token=' . $this->session->data['token'] . $url, 'SSL'), 'separator' => ' :: ');
     if (!isset($this->request->get['ams_page_id'])) {
         $this->data['action'] = $this->url->link($this->_namespace . '/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
         $this->data['doslug'] = true;
         $this->data['autosave'] = fixajaxurl($this->url->link($this->_namespace . '/autosave', 'token=' . $this->session->data['token'] . '&_autosave_=1&ams_page_id=0', 'SSL'));
         $this->data['history'] = fixajaxurl($this->url->link($this->_namespace . '/get_revisions', 'token=' . $this->session->data['token'] . '&page=1&ams_page_id=0', 'SSL'));
     } else {
         $this->data['action'] = $this->url->link($this->_namespace . '/update', 'token=' . $this->session->data['token'] . '&ams_page_id=' . $this->request->get['ams_page_id'] . $url, 'SSL');
         $this->data['doslug'] = false;
         $this->data['autosave'] = fixajaxurl($this->url->link($this->_namespace . '/autosave', 'token=' . $this->session->data['token'] . '&_autosave_=1&ams_page_id=' . $this->request->get['ams_page_id'], 'SSL'));
         $this->data['history'] = fixajaxurl($this->url->link($this->_namespace . '/get_revisions', 'token=' . $this->session->data['token'] . '&page=1&ams_page_id=' . $this->request->get['ams_page_id'], 'SSL'));
     }
     $this->data['cancel'] = $this->url->link($this->_namespace, 'token=' . $this->session->data['token'] . $url, 'SSL');
     $this->data['namespace'] = $this->_namespace;
     $this->load->model($this->_namespace);
     $this->load->model('tool/seo');
     $_model = 'model_' . str_replace('/', '_', $this->_namespace);
     $this->_pageModel = \Core\Core::$registry->get($_model);
     if (isset($this->request->get['ams_page_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         if (isset($this->request->get['revision_id'])) {
             $page_info = $this->_pageModel->loadPageRevision($this->request->get['revision_id']);
         } else {
             $page_info = $this->_pageModel->loadPageObject($this->request->get['ams_page_id'])->toArray();
         }
         $page_info['slug'] = $this->model_tool_seo->getUrl('ams_page_id=' . $page_info['id']);
         $this->_pageInfo = $page_info;
     } elseif (!isset($this->request->get['ams_page_id']) && isset($this->request->get['revision_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $page_info = $this->_pageModel->loadPageRevision($this->request->get['revision_id']);
         $this->request->post = $page_info;
     }
     if (isset($this->request->post['name'])) {
         $this->data['name'] = $this->request->post['name'];
     } elseif (!empty($page_info)) {
         $this->data['name'] = $page_info['name'];
     } else {
         $this->data['name'] = '';
     }
     if (isset($this->request->post['slug'])) {
         $this->data['slug'] = $this->request->post['slug'];
     } elseif (!empty($page_info)) {
         $this->data['slug'] = $page_info['slug'];
     } else {
         $this->data['slug'] = '';
     }
     if (isset($this->request->post['parent_id'])) {
         $this->data['parent_id'] = $this->request->post['parent_id'];
     } elseif (!empty($page_info)) {
         $this->data['parent_id'] = $page_info['parent_id'];
     } else {
         $this->data['parent_id'] = 0;
     }
     if (isset($this->request->post['status'])) {
         $this->data['status'] = $this->request->post['parent_id'];
     } elseif (!empty($page_info)) {
         $this->data['status'] = $page_info['status'];
     } else {
         $this->data['status'] = 1;
     }
     if (isset($this->request->post['comments'])) {
         $this->data['comments'] = $this->request->post['comments'];
     } elseif (!empty($page_info)) {
         $this->data['comments'] = $page_info['comments'];
     } else {
         $this->data['comments'] = 1;
     }
     if (isset($this->request->post['meta_title'])) {
         $this->data['meta_title'] = $this->request->post['meta_title'];
     } elseif (!empty($page_info)) {
         $this->data['meta_title'] = $page_info['meta_title'];
     } else {
         $this->data['meta_title'] = '';
     }
     if (isset($this->request->post['meta_og_description'])) {
         $this->data['meta_og_description'] = $this->request->post['meta_og_description'];
     } elseif (!empty($page_info)) {
         $this->data['meta_og_description'] = $page_info['meta_og_description'];
     } else {
         $this->data['meta_og_description'] = '';
     }
     if (isset($this->request->post['meta_og_title'])) {
         $this->data['meta_og_title'] = $this->request->post['meta_og_title'];
     } elseif (!empty($page_info)) {
         $this->data['meta_og_title'] = $page_info['meta_og_title'];
     } else {
         $this->data['meta_og_title'] = '';
     }
     if (isset($this->request->post['meta_og_image'])) {
         $this->data['meta_og_image'] = $this->request->post['meta_og_title'];
     } elseif (!empty($page_info)) {
         $this->data['meta_og_image'] = $page_info['meta_og_image'];
     } else {
         $this->data['meta_og_image'] = '';
     }
     $image_model = $this->load->model('tool/image');
     if ($this->data['meta_og_image']) {
         $src_og_image = $image_model->resizeExact($this->data['meta_og_image'], 100, 100);
     } else {
         $src_og_image = $image_model->resizeExact('no_image.jpg', 100, 100);
     }
     $this->data['src_og_image'] = $src_og_image;
     $this->data['placeholder'] = $image_model->resizeExact('no_image.jpg', 100, 100);
     //  $this->data['meta_og_image'] = $meta_og_image;
     if (isset($this->request->post['meta_keywords'])) {
         $this->data['meta_keywords'] = $this->request->post['meta_keywords'];
     } elseif (!empty($page_info)) {
         $this->data['meta_keywords'] = $page_info['meta_keywords'];
     } else {
         $this->data['meta_keywords'] = '';
     }
     if (isset($this->request->post['meta_description'])) {
         $this->data['meta_description'] = $this->request->post['status'];
     } elseif (!empty($page_info)) {
         $this->data['meta_description'] = $page_info['meta_description'];
     } else {
         $this->data['meta_description'] = '';
     }
     if (isset($this->request->post['layout_id'])) {
         $this->data['layout_id'] = $this->request->post['layout_id'];
     } elseif (!empty($page_info)) {
         $this->data['layout_id'] = $page_info['layout_id'];
     } else {
         $this->data['layout_id'] = $this->config->get('config_layout_id');
     }
     $this->load->model('design/layout');
     $this->data['layouts'] = $this->model_design_layout->getLayouts();
     //User Groups
     $this->load->model('sale/customer_group');
     $this->data['customer_groups'] = $this->model_sale_customer_group->getCustomerGroups(array('sort' => 'cg.sort_order'));
     $this->load->model('setting/rights');
     if (isset($this->request->post['allowed_groups'])) {
         $allowed_groups = $this->request->post['allowed_groups'];
     } elseif (isset($this->request->get['ams_page_id'])) {
         $allowed_groups = $this->model_setting_rights->getAllowedGroups($this->request->get['ams_page_id'], 'ams_page');
         //1 is information type
     } else {
         $allowed_groups[] = -1;
     }
     $this->data['allowed_groups'] = $allowed_groups;
     if (isset($this->request->post['denied_groups'])) {
         $denied_groups = $this->request->post['denied_groups'];
     } elseif (isset($this->request->get['ams_page_id'])) {
         $denied_groups = $this->model_setting_rights->getDeniedGroups($this->request->get['ams_page_id'], 'ams_page');
         //1 is information type
     } else {
         $denied_groups = array();
     }
     $this->data['denied_groups'] = $denied_groups;
     $this->data['parents'] = $this->getPageTree();
     $this->data['ams_commentable'] = $this->_enableComments;
     //$_enableComments
     $this->data['ams_parents'] = $this->_enableParents;
     //$_enableParents
     $tabs = array('general' => array(), 'general_details' => array(), 'meta' => array());
     $this->data['tabs'] = $this->_pageModel->getFormFields($tabs);
     //Autosave::
     $this->data['autosave_enabled'] = $this->config->get('config_autosave_status');
     $this->data['autosave_time'] = $this->config->get('config_autosave_time') && (int) $this->config->get('config_autosave_time') > 30 ? (int) $this->config->get('config_autosave_time') : 120;
     // $this->document->addScript('view/plugins/ckeditor/ckeditor.js');
     init_wysiwyg();
     $this->template = 'cms/page_form.phtml';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }