cleanup module installer + add category column in pages list

This commit is contained in:
Rodney Figaro 2016-08-31 10:02:22 +02:00
parent 4808607e56
commit d47983b6de
4 changed files with 21 additions and 65 deletions

View File

@ -1,12 +1,6 @@
<?php
class AdminGuide extends AdminTab
{
public function __construct()
{
parent::__construct();
}
public function display()
{
}

View File

@ -1,6 +1,6 @@
<?php
include(__DIR__.'/classes/GuideCategory.php');
include(__DIR__.'/classes/FormBuilder.php');
require_once(__DIR__.'/classes/GuideCategory.php');
require_once(__DIR__.'/classes/FormBuilder.php');
class AdminGuideCategories extends AdminTab
{
@ -166,8 +166,6 @@ class AdminGuideCategories extends AdminTab
}
}
public function displayList()
{
global $currentIndex;

View File

@ -1,12 +1,15 @@
<?php
include(__DIR__.'/classes/GuidePost.php');
include(__DIR__.'/classes/GuideCategory.php');
include(__DIR__.'/classes/FormBuilder.php');
require_once(__DIR__.'/classes/GuidePost.php');
require_once(__DIR__.'/classes/GuideCategory.php');
require_once(__DIR__.'/classes/FormBuilder.php');
class AdminGuidePosts extends AdminTab
{
public function __construct()
{
global $cookie;
$this->table = 'guide_post';
$this->identifier = 'id_guide_post';
$this->className = 'GuidePost';
@ -21,6 +24,10 @@ class AdminGuidePosts extends AdminTab
'align' => 'center',
'width' => 25
),
'name' => array(
'title' => $this->l('Category'),
'width' => 200,
),
'link_rewrite' => array(
'title' => $this->l('URL'),
'width' => 200
@ -45,7 +52,14 @@ class AdminGuidePosts extends AdminTab
'orderby' => false
)
);
$this->_select = 'position ';
$this->_select = 'a.position, gcl.name, a.id_guide_category ';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'guide_category` gc
ON gc.`id_guide_category` = a.`id_guide_category`
LEFT JOIN `'._DB_PREFIX_.'guide_category_lang` gcl
ON (gcl.`id_guide_category` = gc.`id_guide_category` AND gcl.`id_lang` = '.(int)($cookie->id_lang).')';
$this->_orderBy = 'position';
$this->_orderWay = 'ASC';
$this->identifiersDnd['id_guide_post'] = 'id_guide_post';

View File

@ -6,7 +6,6 @@ class PurchaseGuide extends Module
{
const MODULE_NAME = 'purchaseguide';
public function __construct() {
$this->name = self::MODULE_NAME;
$this->tab = 'front_office_features';
@ -24,7 +23,6 @@ class PurchaseGuide extends Module
if(!parent::install()
|| !$this->installTabs()
|| !$this->createTables()
//|| !$this->addInHtAccess()
) {
$this->uninstall();
return FALSE;
@ -38,7 +36,6 @@ class PurchaseGuide extends Module
{
$this->uninstallTabs();
$this->dropTables();
//$this->removeFromHtAccess();
return parent::uninstall();
}
@ -143,53 +140,6 @@ class PurchaseGuide extends Module
');
}
private function getHtAccessRewriteRules()
{
return "\nRewriteRule ^guide/([0-9]+)-([a-zA-Z0-9-]*) /modules/".self::MODULE_NAME."/page.php?id_guide_post=$1 [QSA,L]";
}
private function addInHtAccess()
{
$_htFile = dirname(__FILE__).'/../../.htaccess';
$value = Configuration::get('PS_HTACCESS_SPECIFIC');
$value .= $this->getHtAccessRewriteRules();
Configuration::updateValue('PS_HTACCESS_SPECIFIC', $value, true);
if (Tools::generateHtaccess($_htFile,
Configuration::get('PS_REWRITING_SETTINGS'),
Configuration::get('PS_HTACCESS_CACHE_CONTROL'),
Configuration::get('PS_HTACCESS_SPECIFIC'),
Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS'))) {
return true;
}
$this->_errors[] = $this->l('Cannot write into file:').' <b>'.$_htFile.'</b><br />'.$this->l('Please check write permissions.');
return false;
}
private function removeFromHtAccess()
{
$_htFile = dirname(__FILE__).'/../../.htaccess';
$value = Configuration::get('PS_HTACCESS_SPECIFIC');
$value = str_replace('', $this->getHtAccessRewriteRules(), $value);
Configuration::updateValue('PS_HTACCESS_SPECIFIC', $value, true);
if (Tools::generateHtaccess($_htFile,
Configuration::get('PS_REWRITING_SETTINGS'),
Configuration::get('PS_HTACCESS_CACHE_CONTROL'),
Configuration::get('PS_HTACCESS_SPECIFIC'),
Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS'))) {
return true;
}
$this->_errors[] = $this->l('Cannot write into file:').' <b>'.$_htFile.'</b><br />'.$this->l('Please check write permissions.');
return false;
}
private function createTables()
{
$queries[] = '