[*] MO: Blockadvertising is now installed only on leftColumn
[*] MO: Editorial module now install default text for each language git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10027 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -27,20 +27,20 @@
|
|||||||
|
|
||||||
if (!defined('_PS_VERSION_'))
|
if (!defined('_PS_VERSION_'))
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
class BlockAdvertising extends Module
|
class BlockAdvertising extends Module
|
||||||
{
|
{
|
||||||
public $adv_link;
|
public $adv_link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adv_title contains string for title and alt attributes
|
* adv_title contains string for title and alt attributes
|
||||||
*
|
*
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
public $adv_title;
|
public $adv_title;
|
||||||
/**
|
/**
|
||||||
* adv_img contains url to the image to display.
|
* adv_img contains url to the image to display.
|
||||||
*
|
*
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
public $adv_img;
|
public $adv_img;
|
||||||
@@ -87,14 +87,14 @@ class BlockAdvertising extends Module
|
|||||||
Configuration::updateValue('BLOCKADVERT_LINK', 'http://www.prestashop.com');
|
Configuration::updateValue('BLOCKADVERT_LINK', 'http://www.prestashop.com');
|
||||||
if (!parent::install())
|
if (!parent::install())
|
||||||
return false;
|
return false;
|
||||||
if (!$this->registerHook('leftColumn') OR !$this->registerHook('rightColumn'))
|
if (!$this->registerHook('leftColumn'))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _deleteCurrentImg delete current image, (so this will use default image)
|
* _deleteCurrentImg delete current image, (so this will use default image)
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function _deleteCurrentImg()
|
private function _deleteCurrentImg()
|
||||||
@@ -114,7 +114,7 @@ class BlockAdvertising extends Module
|
|||||||
{
|
{
|
||||||
$errors = '';
|
$errors = '';
|
||||||
if (Tools::isSubmit('submitDeleteImgConf'))
|
if (Tools::isSubmit('submitDeleteImgConf'))
|
||||||
$this->_deleteCurrentImg();
|
$this->_deleteCurrentImg();
|
||||||
|
|
||||||
if (Tools::isSubmit('submitAdvConf'))
|
if (Tools::isSubmit('submitAdvConf'))
|
||||||
{
|
{
|
||||||
@@ -160,12 +160,12 @@ class BlockAdvertising extends Module
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getContent used to display admin module form
|
* getContent used to display admin module form
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->postProcess();
|
$this->postProcess();
|
||||||
$output = '';
|
$output = '';
|
||||||
$output .= '
|
$output .= '
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -41,14 +41,14 @@ class BlockTags extends Module
|
|||||||
$this->need_instance = 0;
|
$this->need_instance = 0;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->displayName = $this->l('Tags block');
|
$this->displayName = $this->l('Tags block');
|
||||||
$this->description = $this->l('Adds a block containing a tag cloud.');
|
$this->description = $this->l('Adds a block containing a tag cloud.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function install()
|
function install()
|
||||||
{
|
{
|
||||||
if (parent::install() == false
|
if (parent::install() == false
|
||||||
OR $this->registerHook('leftColumn') == false
|
OR $this->registerHook('leftColumn') == false
|
||||||
OR $this->registerHook('header') == false
|
OR $this->registerHook('header') == false
|
||||||
OR Configuration::updateValue('BLOCKTAGS_NBR', 10) == false)
|
OR Configuration::updateValue('BLOCKTAGS_NBR', 10) == false)
|
||||||
@@ -107,7 +107,7 @@ class BlockTags extends Module
|
|||||||
foreach ($tags AS &$tag)
|
foreach ($tags AS &$tag)
|
||||||
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
|
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
|
||||||
$this->context->smarty->assign('tags', $tags);
|
$this->context->smarty->assign('tags', $tags);
|
||||||
|
|
||||||
return $this->display(__FILE__, 'blocktags.tpl');
|
return $this->display(__FILE__, 'blocktags.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ class BlockTags extends Module
|
|||||||
{
|
{
|
||||||
return $this->hookLeftColumn($params);
|
return $this->hookLeftColumn($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hookHeader($params)
|
function hookHeader($params)
|
||||||
{
|
{
|
||||||
$this->context->controller->addCSS(($this->_path).'blocktags.css', 'all');
|
$this->context->controller->addCSS(($this->_path).'blocktags.css', 'all');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -37,7 +37,7 @@ class Editorial extends Module
|
|||||||
$this->version = '1.6';
|
$this->version = '1.6';
|
||||||
$this->author = 'PrestaShop';
|
$this->author = 'PrestaShop';
|
||||||
$this->need_instance = 0;
|
$this->need_instance = 0;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->displayName = $this->l('Home text editor');
|
$this->displayName = $this->l('Home text editor');
|
||||||
@@ -52,7 +52,7 @@ class Editorial extends Module
|
|||||||
{
|
{
|
||||||
if (!parent::install() OR !$this->registerHook('home') OR !$this->registerHook('header'))
|
if (!parent::install() OR !$this->registerHook('home') OR !$this->registerHook('header'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Db::getInstance()->execute('
|
if (!Db::getInstance()->execute('
|
||||||
CREATE TABLE `'._DB_PREFIX_.'editorial` (
|
CREATE TABLE `'._DB_PREFIX_.'editorial` (
|
||||||
`id_editorial` int(10) unsigned NOT NULL auto_increment,
|
`id_editorial` int(10) unsigned NOT NULL auto_increment,
|
||||||
@@ -60,7 +60,7 @@ class Editorial extends Module
|
|||||||
PRIMARY KEY (`id_editorial`))
|
PRIMARY KEY (`id_editorial`))
|
||||||
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'))
|
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Db::getInstance()->execute('
|
if (!Db::getInstance()->execute('
|
||||||
CREATE TABLE `'._DB_PREFIX_.'editorial_lang` (
|
CREATE TABLE `'._DB_PREFIX_.'editorial_lang` (
|
||||||
`id_editorial` int(10) unsigned NOT NULL,
|
`id_editorial` int(10) unsigned NOT NULL,
|
||||||
@@ -72,24 +72,27 @@ class Editorial extends Module
|
|||||||
PRIMARY KEY (`id_editorial`, `id_lang`))
|
PRIMARY KEY (`id_editorial`, `id_lang`))
|
||||||
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'))
|
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Db::getInstance()->execute('
|
if (!Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'editorial`(`id_editorial`, `body_home_logo_link`)
|
INSERT INTO `'._DB_PREFIX_.'editorial`(`body_home_logo_link`)
|
||||||
VALUES(1, "http://www.prestashop.com")'))
|
VALUES("http://www.prestashop.com")'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Db::getInstance()->execute('
|
$id_editorial = Db::getInstance()->Insert_ID();
|
||||||
INSERT INTO `'._DB_PREFIX_.'editorial_lang`(`id_editorial`, `id_lang`, `body_title`, `body_subheading`, `body_paragraph`, `body_logo_subheading`)
|
$result = true;
|
||||||
VALUES(1, 1, "Lorem ipsum dolor sit amet", "Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>", "Excepteur sint prestashop cupidatat non proident")'))
|
foreach (Language::getLanguages() as $lang)
|
||||||
return false;
|
$result &= Db::getInstance()->autoExecute(_DB_PREFIX_.'editorial_lang', array(
|
||||||
|
'id_editorial' => $id_editorial,
|
||||||
if (!Db::getInstance()->execute('
|
'id_lang' => $lang['id_lang'],
|
||||||
INSERT INTO `'._DB_PREFIX_.'editorial_lang`(`id_editorial`, `id_lang`, `body_title`, `body_subheading`, `body_paragraph`, `body_logo_subheading`)
|
'body_title' => 'Lorem ipsum dolor sit amet',
|
||||||
VALUES(1, 2, "Lorem ipsum dolor sit amet", "Excepteur sint occaecat cupidatat non proident", "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>", "Lorem ipsum presta shop amet")'))
|
'body_subheading' => 'Excepteur sint occaecat cupidatat non proident',
|
||||||
return false;
|
'body_paragraph' => '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>',
|
||||||
return true;
|
'body_logo_subheading' => 'Lorem ipsum presta shop amet',
|
||||||
|
), 'INSERT');
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
{
|
{
|
||||||
if (!parent::uninstall())
|
if (!parent::uninstall())
|
||||||
@@ -114,7 +117,7 @@ class Editorial extends Module
|
|||||||
|
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
|
|
||||||
/* display the module name */
|
/* display the module name */
|
||||||
$this->_html = '<h2>'.$this->displayName.'</h2>';
|
$this->_html = '<h2>'.$this->displayName.'</h2>';
|
||||||
$errors = '';
|
$errors = '';
|
||||||
@@ -138,7 +141,7 @@ class Editorial extends Module
|
|||||||
{
|
{
|
||||||
// Forbidden key
|
// Forbidden key
|
||||||
$forbidden = array('submitUpdate');
|
$forbidden = array('submitUpdate');
|
||||||
|
|
||||||
$editorial = new EditorialClass(1);
|
$editorial = new EditorialClass(1);
|
||||||
$editorial->copyFromPost();
|
$editorial->copyFromPost();
|
||||||
$editorial->update();
|
$editorial->update();
|
||||||
@@ -170,7 +173,7 @@ class Editorial extends Module
|
|||||||
|
|
||||||
/* display the editorial's form */
|
/* display the editorial's form */
|
||||||
$this->_displayForm();
|
$this->_displayForm();
|
||||||
|
|
||||||
return $this->_html;
|
return $this->_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +190,7 @@ class Editorial extends Module
|
|||||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
||||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var iso = \''.$isoTinyMCE.'\' ;
|
var iso = \''.$isoTinyMCE.'\' ;
|
||||||
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
|
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
|
||||||
var ad = \''.$ad.'\' ;
|
var ad = \''.$ad.'\' ;
|
||||||
@@ -201,7 +204,7 @@ class Editorial extends Module
|
|||||||
<legend><img src="'.$this->_path.'logo.gif" alt="" title="" /> '.$this->displayName.'</legend>
|
<legend><img src="'.$this->_path.'logo.gif" alt="" title="" /> '.$this->displayName.'</legend>
|
||||||
<label>'.$this->l('Main title').'</label>
|
<label>'.$this->l('Main title').'</label>
|
||||||
<div class="margin-form">';
|
<div class="margin-form">';
|
||||||
|
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
{
|
{
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
@@ -210,14 +213,14 @@ class Editorial extends Module
|
|||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title', true);
|
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title', true);
|
||||||
|
|
||||||
|
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
<p class="clear">'.$this->l('Appears along top of homepage').'</p>
|
<p class="clear">'.$this->l('Appears along top of homepage').'</p>
|
||||||
</div>
|
</div>
|
||||||
<label>'.$this->l('Subheading').'</label>
|
<label>'.$this->l('Subheading').'</label>
|
||||||
<div class="margin-form">';
|
<div class="margin-form">';
|
||||||
|
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
{
|
{
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
@@ -226,7 +229,7 @@ class Editorial extends Module
|
|||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'subheading', true);
|
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'subheading', true);
|
||||||
|
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -240,9 +243,9 @@ class Editorial extends Module
|
|||||||
<textarea class="rte" cols="70" rows="30" id="body_paragraph_'.$language['id_lang'].'" name="body_paragraph_'.$language['id_lang'].'">'.(isset($editorial->body_paragraph[$language['id_lang']]) ? $editorial->body_paragraph[$language['id_lang']] : '').'</textarea>
|
<textarea class="rte" cols="70" rows="30" id="body_paragraph_'.$language['id_lang'].'" name="body_paragraph_'.$language['id_lang'].'">'.(isset($editorial->body_paragraph[$language['id_lang']]) ? $editorial->body_paragraph[$language['id_lang']] : '').'</textarea>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'cpara', true);
|
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'cpara', true);
|
||||||
|
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
<p class="clear">'.$this->l('Text of your choice; for example, explain your mission, highlight a new product, or describe a recent event.').'</p>
|
<p class="clear">'.$this->l('Text of your choice; for example, explain your mission, highlight a new product, or describe a recent event.').'</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -255,10 +258,10 @@ class Editorial extends Module
|
|||||||
<a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&deleteImage" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
<a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&deleteImage" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete').'" /> '.$this->l('Delete').'</a>
|
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete').'" /> '.$this->l('Delete').'</a>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
$this->_html .= '<input type="file" name="body_homepage_logo" />
|
$this->_html .= '<input type="file" name="body_homepage_logo" />
|
||||||
<p style="clear: both">'.$this->l('Will appear next to the Introductory Text above').'</p>
|
<p style="clear: both">'.$this->l('Will appear next to the Introductory Text above').'</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<label>'.$this->l('Homepage logo link').'</label>
|
<label>'.$this->l('Homepage logo link').'</label>
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
@@ -267,7 +270,7 @@ class Editorial extends Module
|
|||||||
</div>
|
</div>
|
||||||
<label>'.$this->l('Homepage logo subheading').'</label>
|
<label>'.$this->l('Homepage logo subheading').'</label>
|
||||||
<div class="margin-form">';
|
<div class="margin-form">';
|
||||||
|
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
{
|
{
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
@@ -275,9 +278,9 @@ class Editorial extends Module
|
|||||||
<input type="text" name="body_logo_subheading_'.$language['id_lang'].'" id="logo_subheading_'.$language['id_lang'].'" size="64" value="'.(isset($editorial->body_logo_subheading[$language['id_lang']]) ? $editorial->body_logo_subheading[$language['id_lang']] : '').'" />
|
<input type="text" name="body_logo_subheading_'.$language['id_lang'].'" id="logo_subheading_'.$language['id_lang'].'" size="64" value="'.(isset($editorial->body_logo_subheading[$language['id_lang']]) ? $editorial->body_logo_subheading[$language['id_lang']] : '').'" />
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'logo_subheading', true);
|
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'logo_subheading', true);
|
||||||
|
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -289,7 +292,7 @@ class Editorial extends Module
|
|||||||
|
|
||||||
public function hookHome($params)
|
public function hookHome($params)
|
||||||
{
|
{
|
||||||
|
|
||||||
$editorial = new EditorialClass(1, $this->context->language->id);
|
$editorial = new EditorialClass(1, $this->context->language->id);
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'editorial' => $editorial,
|
'editorial' => $editorial,
|
||||||
@@ -302,7 +305,7 @@ class Editorial extends Module
|
|||||||
));
|
));
|
||||||
return $this->display(__FILE__, 'editorial.tpl');
|
return $this->display(__FILE__, 'editorial.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hookHeader()
|
public function hookHeader()
|
||||||
{
|
{
|
||||||
$this->context->controller->addCSS(($this->_path).'editorial.css', 'all');
|
$this->context->controller->addCSS(($this->_path).'editorial.css', 'all');
|
||||||
|
|||||||
Reference in New Issue
Block a user