[+] Project : default theme added
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
@@ -21,7 +21,7 @@
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
@@ -84,17 +84,17 @@ class HomeSlide extends ObjectModel
|
||||
));
|
||||
}
|
||||
|
||||
public function __construct($id_slide = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
public function __construct($id_slide = NULL, $id_lang = NULL, $id_shop = NULL, Context $context = NULL)
|
||||
{
|
||||
parent::__construct($id_slide, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->getID();
|
||||
|
||||
$res = parent::add($autodate, $null_values);
|
||||
$res = parent::add($autodate, $nullValues);
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'homeslider` (`id_shop`, `id_slide`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.')'
|
||||
@@ -155,4 +155,4 @@ class HomeSlide extends ObjectModel
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
@@ -21,7 +21,7 @@
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
include_once('../../config/config.inc.php');
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
@@ -21,15 +21,10 @@
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @version 1.1 (2011-11-23)
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
@@ -43,7 +38,7 @@ class HomeSlider extends Module
|
||||
{
|
||||
$this->name = 'homeslider';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.1';
|
||||
$this->version = '1.0';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
$this->secure_key = Tools::encrypt($this->name);
|
||||
@@ -169,7 +164,7 @@ class HomeSlider extends Module
|
||||
<fieldset>
|
||||
<legend><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/logo.gif" alt="" /> '.$this->l('Slider configuration').'</legend>';
|
||||
/* Begin form */
|
||||
$this->_html .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">';
|
||||
$this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post">';
|
||||
/* Height field */
|
||||
$this->_html .= '
|
||||
<label>'.$this->l('Height:').'</label>
|
||||
@@ -218,7 +213,7 @@ class HomeSlider extends Module
|
||||
|
||||
/* Display notice if there are no slides yet */
|
||||
if (!$slides)
|
||||
$this->_html .= '<p style="margin-left: 40px;">'.$this->l('You did not add any slides yet.').'</p>';
|
||||
$this->_html .= '<p style="margin-left: 40px;">'.$this->l("You did not add any slides yet.").'</p>';
|
||||
else /* Display slides */
|
||||
{
|
||||
$this->_html .= '
|
||||
@@ -260,7 +255,7 @@ class HomeSlider extends Module
|
||||
$this->_html = '<script type="text/javascript">id_language = Number('.$defaultLanguage.');</script>';
|
||||
|
||||
/* Form */
|
||||
$this->_html .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="POST" enctype="multipart/form-data">';
|
||||
$this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" enctype="multipart/form-data">';
|
||||
|
||||
/* Fieldset Upload */
|
||||
$this->_html .= '
|
||||
@@ -470,10 +465,7 @@ class HomeSlider extends Module
|
||||
else if (Tools::isSubmit('changeStatus') && Tools::isSubmit('id_slide'))
|
||||
{
|
||||
$slide = new HomeSlide((int)Tools::getValue('id_slide'));
|
||||
if ($slide->active == 0)
|
||||
$slide->active = 1;
|
||||
else
|
||||
$slide->active = 0;
|
||||
$slide->active = (int)($slide->active == 0 ? 1 : 0);
|
||||
$res = $slide->update();
|
||||
$this->_html = ($res ? $this->displayConfirmation($this->l('Configuration updated')) : $this->displayErro($this->l('Configuration could not be updated')));
|
||||
}
|
||||
@@ -510,19 +502,16 @@ class HomeSlider extends Module
|
||||
if (Tools::getValue('description_'.$language['id_lang']) != '')
|
||||
$slide->description[$language['id_lang']] = pSQL(Tools::getValue('description_'.$language['id_lang']));
|
||||
/* Uploads image and sets slide */
|
||||
if (isset($_FILES['image_'.$language['id_lang']]) &&
|
||||
isset($_FILES['image_'.$language['id_lang']]['tmp_name']) &&
|
||||
!empty($_FILES['image_'.$language['id_lang']]['tmp_name']))
|
||||
if (isset($_FILES['image_'.$language['id_lang']]) && isset($_FILES['image_'.$language['id_lang']]['tmp_name']) && !empty($_FILES['image_'.$language['id_lang']]['tmp_name']))
|
||||
{
|
||||
$temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
|
||||
if ($error = checkImage($_FILES['image_'.$language['id_lang']]))
|
||||
$errors .= $error;
|
||||
else if (!$temp_name || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $temp_name))
|
||||
else if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $tmpName))
|
||||
return false;
|
||||
else if (!imageResize($temp_name, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name']).'.jpg'))
|
||||
else if (!imageResize($tmpName, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name']).'.jpg'))
|
||||
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
|
||||
if (isset($temp_name))
|
||||
unlink($temp_name);
|
||||
if (isset($tmpName))
|
||||
unlink($tmpName);
|
||||
$slide->image[$language['id_lang']] = pSQL(Tools::encrypt($_FILES['image_'.($language['id_lang'])]['name']).'.jpg');
|
||||
}
|
||||
if (Tools::getValue('image_old_'.$language['id_lang']) != '')
|
||||
@@ -579,7 +568,7 @@ class HomeSlider extends Module
|
||||
{
|
||||
if (!$this->getSlides(true))
|
||||
return;
|
||||
$this->context->controller->addJqueryUI('ui.sortable');
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js');
|
||||
$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
|
||||
$this->context->controller->addCSS($this->_path.'bx_styles.css');
|
||||
$this->context->controller->addJS($this->_path.'js/homeslider.js');
|
||||
@@ -587,9 +576,6 @@ class HomeSlider extends Module
|
||||
|
||||
public function hookBackOfficeTop()
|
||||
{
|
||||
if (Tools::getValue('controller') != 'AdminModules' && Tools::getValue('configure') != $this->name)
|
||||
return;
|
||||
|
||||
/* Style & js for fieldset 'slides configuration' */
|
||||
$html = '
|
||||
<style>
|
||||
@@ -602,7 +588,7 @@ class HomeSlider extends Module
|
||||
color:#000;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui.will.be.removed.in.1.6.js"></script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var $mySlides = $("#slides");
|
||||
@@ -640,35 +626,23 @@ class HomeSlider extends Module
|
||||
public function getSlides($active = null)
|
||||
{
|
||||
$this->context = Context::getContext();
|
||||
$id_shop = $this->context->shop->getID();
|
||||
$id_lang = $this->context->language->id;
|
||||
$idShop = $this->context->shop->getID();
|
||||
$idLang = $this->context->language->id;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT hs.`id_slide`,
|
||||
hssl.`image`,
|
||||
hss.`position`,
|
||||
hss.`active`,
|
||||
hssl.`title`,
|
||||
hssl.`url`,
|
||||
hssl.`legend`
|
||||
FROM '._DB_PREFIX_.'homeslider hs
|
||||
LEFT JOIN '._DB_PREFIX_.'homeslider_slides hss ON (hs.id_slide = hss.id_slide)
|
||||
LEFT JOIN '._DB_PREFIX_.'homeslider_slides_lang hssl ON (hssl.id_slide = hs.id_slide)
|
||||
WHERE id_shop = '.(int)$id_shop.' OR id_shop = 0
|
||||
AND hssl.id_lang = '.(int)$id_lang.
|
||||
($active ? ' AND hss.`active` = 1' : ' ').'
|
||||
GROUP BY hs.id_slide
|
||||
ORDER BY hss.position');
|
||||
SELECT hs.`id_slide` AS id_slide, hssl.`image` as image, hss.`position` AS position, hss.`active` as active, hssl.`title` as title, hssl.`url` as url, hssl.`legend` as legend
|
||||
FROM `'._DB_PREFIX_.'homeslider` hs, `'._DB_PREFIX_.'homeslider_slides` hss, `'._DB_PREFIX_.'homeslider_slides_lang` hssl
|
||||
WHERE hs.`id_shop` = '.(int)$idShop.((int)$idShop != 0 ? ' OR hs.`id_shop` = 0' : '').' AND hs.`id_slide` = hss.`id_slide` AND hss.`id_slide` = hssl.`id_slide` AND hs.`id_slide` = hssl.`id_slide`
|
||||
AND hssl.`id_lang` = '.(int)$idLang.($active ? ' AND hss.`active` = 1' : '').'
|
||||
ORDER BY hss.`position`
|
||||
');
|
||||
}
|
||||
|
||||
public function displayStatus($id_slide, $active)
|
||||
{
|
||||
$title = ((int)$active == 0 ? $this->l('Disabled') : $this->l('Enabled'));
|
||||
$img = ((int)$active == 0 ? 'disabled.gif' : 'enabled.gif');
|
||||
$html = '<a href="'.AdminController::$currentIndex.
|
||||
'&configure='.$this->name.'
|
||||
&token='.Tools::getAdminTokenLite('AdminModules').'
|
||||
&changeStatus&id_slide='.(int)$id_slide.'" title="'.$title.'"><img src="'._PS_ADMIN_IMG_.''.$img.'" alt="" /></a>';
|
||||
$html = '<a href="'.AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&changeStatus&id_slide='.(int)($id_slide).'" title="'.$title.'"><img src="'._PS_ADMIN_IMG_.''.$img.'" alt="" /></a>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
@@ -680,4 +654,4 @@ class HomeSlider extends Module
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req);
|
||||
return ($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user