Skip to content

Commit

Permalink
Added indexes to article modules
Browse files Browse the repository at this point in the history
  • Loading branch information
optimlab committed Jun 15, 2020
1 parent 7d0f1ea commit 76975ac
Show file tree
Hide file tree
Showing 23 changed files with 259 additions and 222 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
Expand All @@ -11,7 +11,7 @@ class ControllerExtensionModuleBestSellerInformation extends Controller {
private $error = array();

public function index() {
$data['version'] = 'v' . '3.0.1.0';
$data['version'] = 'v' . '3.0.1.1';

$this->load->language('extension/module/bestseller_information');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
* @link http://optimlab.com
*/
class ControllerExtensionModuleBestSellerInformation extends Controller {
public function index($setting) {
static $module = 0;

$this->load->language('extension/module/bestseller_information');

$this->load->model('catalog/information');
Expand Down Expand Up @@ -53,10 +55,12 @@ public function index($setting) {
$data['heading_title'] = html_entity_decode($setting['title'][$this->config->get('config_language_id')]);
}

$data['author'] = $setting['author'];
$data['date'] = $setting['date'];
$data['review'] = $setting['review'];
$data['author'] = $setting['author'];
$data['rating'] = $setting['rating'];
$data['review'] = $setting['review'];

$data['module'] = $module++;

return $this->load->view('extension/module/bestseller_information', $data);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.0
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
* @link http://optimlab.com
*/
class ControllerExtensionModuleFeaturedInformation extends Controller {
class ControllerExtensionModuleBestSellerInformation extends Controller {
private $error = array();

public function index() {
$data['version'] = 'v' . '3.0.1.0';
$data['version'] = 'v' . '3.0.1.1';

$this->load->language('extension/module/featured_information');
$this->load->language('extension/module/bestseller_information');

$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/module');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
if (!isset($this->request->get['module_id'])) {
$this->model_setting_module->addModule('featured_information', $this->request->post);
$this->model_setting_module->addModule('bestseller_information', $this->request->post);
} else {
$this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
}

$this->cache->delete('information');

$this->session->data['success'] = $this->language->get('text_success');

$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
Expand Down Expand Up @@ -70,19 +72,19 @@ public function index() {
if (!isset($this->request->get['module_id'])) {
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('extension/module/featured_information', 'user_token=' . $this->session->data['user_token'], true)
'href' => $this->url->link('extension/module/bestseller_information', 'user_token=' . $this->session->data['user_token'], true)
);
} else {
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('extension/module/featured_information', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
'href' => $this->url->link('extension/module/bestseller_information', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
);
}

if (!isset($this->request->get['module_id'])) {
$data['action'] = $this->url->link('extension/module/featured_information', 'user_token=' . $this->session->data['user_token'], true);
$data['action'] = $this->url->link('extension/module/bestseller_information', 'user_token=' . $this->session->data['user_token'], true);
} else {
$data['action'] = $this->url->link('extension/module/featured_information', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
$data['action'] = $this->url->link('extension/module/bestseller_information', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
}

$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
Expand All @@ -91,8 +93,6 @@ public function index() {
$module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
}

$data['user_token'] = $this->session->data['user_token'];

if (isset($this->request->post['name'])) {
$data['name'] = $this->request->post['name'];
} elseif (!empty($module_info)) {
Expand All @@ -113,27 +113,37 @@ public function index() {
$data['title'] = array();
}

$this->load->model('catalog/information');

$data['informations'] = array();
// Category
$this->load->model('catalog/category');

if (!empty($this->request->post['information'])) {
$informations = $this->request->post['information'];
} elseif (!empty($module_info['information'])) {
$informations = $module_info['information'];
if (isset($this->request->post['category_id'])) {
$data['category_id'] = $this->request->post['category_id'];
} elseif (!empty($module_info)) {
$data['category_id'] = $module_info['category_id'];
} else {
$informations = array();
$data['category_id'] = 0;
}

foreach ($informations as $information_id) {
$information_info = $this->model_catalog_information->getInformation($information_id);
if (isset($this->request->post['category'])) {
$data['category'] = $this->request->post['category'];
} elseif (!empty($module_info)) {
$category_info = $this->model_catalog_category->getCategory($module_info['category_id']);

if ($information_info) {
$data['informations'][] = array(
'information_id' => $information_info['information_id'],
'title' => $information_info['title']
);
if ($category_info) {
$data['category'] = ($category_info['path']) ? $category_info['path'] . ' &gt; ' . $category_info['name'] : $category_info['name'];
} else {
$data['category'] = '';
}
} else {
$data['category'] = '';
}

if (isset($this->request->post['sort'])) {
$data['sort'] = $this->request->post['sort'];
} elseif (!empty($module_info)) {
$data['sort'] = $module_info['sort'];
} else {
$data['sort'] = 'i.viewed';
}

if (isset($this->request->post['limit'])) {
Expand Down Expand Up @@ -200,15 +210,17 @@ public function index() {
$data['status'] = '';
}

$data['user_token'] = $this->session->data['user_token'];

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');

$this->response->setOutput($this->load->view('extension/module/featured_information', $data));
$this->response->setOutput($this->load->view('extension/module/bestseller_information', $data));
}

protected function validate() {
if (!$this->user->hasPermission('modify', 'extension/module/featured_information')) {
if (!$this->user->hasPermission('modify', 'extension/module/bestseller_information')) {
$this->error['warning'] = $this->language->get('error_permission');
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
* @link http://optimlab.com
*/
// Heading
$_['heading_title'] = 'OptimBlog : Best Articles';

// Text
$_['text_extension'] = 'Extensions';
$_['text_success'] = 'Success: You have modified Best Articles module!';
$_['text_edit'] = 'Edit Best Articles Module';
$_['text_viewed'] = 'Viewed';
$_['text_rating'] = 'Rating';

// Entry
$_['entry_name'] = 'Module Name';
$_['entry_title'] = 'Header';
$_['entry_category'] = 'Сategory';
$_['entry_sort'] = 'Sort';
$_['entry_limit'] = 'Limit';
$_['entry_image'] = 'Image (W x H) and Resize Type';
$_['entry_width'] = 'Width';
$_['entry_height'] = 'Height';
$_['entry_author'] = 'Author';
$_['entry_date'] = 'Date';
$_['entry_review'] = 'Reviews';
$_['entry_rating'] = 'Rating';
$_['entry_status'] = 'Status';

// Help
$_['help_title'] = 'Can Use HTML';
$_['help_category'] = '(Autocomplete)';

// Error
$_['error_permission'] = 'Warning: You do not have permission to modify Best Articles module!';
$_['error_name'] = 'Module Name must be between 3 and 64 characters!';
$_['error_width'] = 'Width required!';
$_['error_height'] = 'Height required!';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* @package OptimBlog
* @version 3.0.1.1
* @author Dmitriy Khokhlov <admin@optimlab.com>
* @copyright Copyright (c) 2018, Dmitriy Khokhlov. (http://optimlab.com/)
* @license https://opensource.org/licenses/GPL-3.0
* @link http://optimlab.com
*/
// Heading
$_['heading_title'] = 'OptimBlog : Лучшие статьи';

// Text
$_['text_extension'] = 'Расширения';
$_['text_success'] = 'Настройки успешно изменены!';
$_['text_edit'] = 'Настройки модуля';
$_['text_viewed'] = 'Просмотры';
$_['text_rating'] = 'Рейтинг';

// Entry
$_['entry_name'] = 'Название модуля';
$_['entry_title'] = 'Заголовок';
$_['entry_category'] = 'Категория';
$_['entry_sort'] = 'Сортировка';
$_['entry_limit'] = 'Лимит';
$_['entry_image'] = 'Изображение (Ширина x Высота)';
$_['entry_width'] = 'Ширина';
$_['entry_height'] = 'Высота';
$_['entry_author'] = 'Автор';
$_['entry_date'] = 'Дата';
$_['entry_review'] = 'Отзывы';
$_['entry_rating'] = 'Рейтинг';
$_['entry_status'] = 'Статус';

// Help
$_['help_title'] = 'Можно использовать HTML';
$_['help_category'] = '(Автозаполнение)';

// Error
$_['error_permission'] = 'У Вас нет прав для управления данным модулем!';
$_['error_name'] = 'Название модуля должно содержать от 3 до 64 символов!';
$_['error_width'] = 'Введите ширину изображения!';
$_['error_height'] = 'Введите высоту изображения!';

Loading

0 comments on commit 76975ac

Please sign in to comment.