feat: Add YouTube video support and update admin templates

- Introduced a new YouTube tech integration in `youtube.min.js` for enhanced video playback.
- Created new admin template files for managing video settings, including `index.php` and `steasyvideo-pro.tpl`.
- Updated hook templates (`device_mode.tpl`, `forquickview.tpl`, `header.tpl`, `miniature.tpl`, `miniature_tb.tpl`, and predefined templates) to include video functionality.
- Implemented caching headers in several PHP files to improve performance.
- Ensured all new templates include proper licensing information and copyright notices.
This commit is contained in:
2025-05-23 19:27:41 +02:00
parent d485f46a7a
commit eacf500d18
83 changed files with 12143 additions and 3 deletions

View File

@@ -0,0 +1,90 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoListController.php';
class AdminStEasyVideoCategoryController extends AdminStEasyVideoListController
{
protected $contr = 'category';
public function addWhere($where = '')
{
return $where.' AND id_product=\'\' AND id_category!=0 AND id_manufacturer=0 ';
}
public function filterFormFields(&$fileds, $obj)
{
array_splice($fileds['input'], 1, 0, array(
array(
'type' => 'select',
'label' => $this->l('Select a category:'),
'required' => true,
'name' => 'id_category',
'class' => 'fixed-width-xxl',
'options' => array(
'query' => $this->getApplyCategory(),
'id' => 'id',
'name' => 'name',
'default' => array(
'value' => '',
'label' => $this->l('Please select')
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Apply to subcategories:'),
'name' => 'sub_category',
'is_bool' => true,
'default_value' => 0,
'values' => array(
array(
'id' => 'sub_category_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'sub_category_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
));
}
public function getApplyCategory()
{
$category_arr = array();
$this->getCategoryOption($category_arr, Category::getRootCategory()->id, (int)$this->context->language->id, (int)Shop::getContextShopID(), true);
return $category_arr;
}
public function getCategoryOption(&$category_arr, $id_category = 1, $id_lang = false, $id_shop = false, $recursive = true)
{
$id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id;
$category = new Category((int)$id_category, (int)$id_lang, (int)$id_shop);
if (is_null($category->id)) {
return;
}
if ($recursive) {
$children = Category::getChildren((int)$id_category, (int)$id_lang, true, (int)$id_shop);
$spacer = str_repeat('&nbsp;', $this->spacer_size * (int)$category->level_depth);
}
$shop = (object) Shop::getShop((int)$category->getShopID());
$category_arr[] = array('id' => (int)$category->id,'name' => (isset($spacer) ? $spacer : '').$category->name.' ('.$shop->name.')');
if (isset($children) && is_array($children) && count($children)) {
foreach ($children as $child) {
$this->getCategoryOption($category_arr, (int)$child['id_category'], (int)$id_lang, (int)$child['id_shop'], $recursive);
}
}
}
}

View File

@@ -0,0 +1,17 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminStEasyVideoController extends ModuleAdminController
{
public function __construct()
{
Tools::redirectAdmin($this->context->link->getAdminLink('AdminStEasyVideoList'));
}
}

View File

@@ -0,0 +1,421 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminStEasyVideoGalleryController extends ModuleAdminController
{
protected $contr = '';
public function __construct()
{
$this->bootstrap = true;
parent::__construct();
$image_types_arr = array(
array('id' => '','name' => $this->l('Use the predefined value.'),)
);
$imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes as $k => $imageType) {
if (Tools::substr($imageType['name'], -3) == '_2x') {
continue;
}
$image_types_arr[] = array('id' => $imageType['name'], 'name' => $imageType['name'].'('.$imageType['width'].'x'.$imageType['height'].')');
}
$selector_desc = $this->contr == 'QUICKVIEW' ? $this->l('In most cases, selectors in quickview should start with .modal.quickview') : ($this->contr == 'DESKTOP' ? $this->l('In most cases, selectors start with .page-product:not(.modal-open) to avoid conflict with selectors in quickview window.') : '');
$play_icon_fields = $this->module->getButtonFiledsOptions('PLAY_ICON');
unset($play_icon_fields[$this->module->_prefix_st.'PLAY_ICON_BTN_HOVER_COLOR_'.$this->contr], $play_icon_fields[$this->module->_prefix_st.'PLAY_ICON_BTN_HOVER_BG_'.$this->contr]);
$this->fields_options = array(
'general' => array(
'title' => $this->l('General Settings'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'GALLERY_DISPLAY_'.$this->contr => array(
'type' => 'radio',
'title' => $this->l('How to display vidoes'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('No'),
1 => $this->l('Buttons'),
2 => $this->l('Videos'),
3 => $this->l('Add videos to a slider'),
4 => $this->l('Add buttons to a thumbnail slider, videos show out when the buttons are clicked'),
5 => $this->l('Add videos to a slider, add buttons to a synchronized thumbnail slider'),
6 => $this->l('Videos, add buttons to a thumbnail slider.'),// panda transformer gallery image scrolling
7 => $this->l('A button on the first image, and a video icon on the first item of thumbnail slider'),
),
),
$this->module->_prefix_st.'GALLERY_VIDEO_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Video selector'),
'validation' => 'isAnything',
'desc' => $selector_desc,
),
$this->module->_prefix_st.'GALLERY_VIDEO_APPEND_'.$this->contr => [
'title' => $this->l('How to add'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => $this->module::$_appends,
],
$this->module->_prefix_st.'GALLERY_VIDEO_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('How to video player'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Display on an element (Position: absolute)'),
1 => $this->l('Normal document flow (Position: static)'),
),
],
$this->module->_prefix_st.'GALLERY_BUTTON_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Button selector'),
'validation' => 'isAnything',
'desc' => $selector_desc,
),
$this->module->_prefix_st.'GALLERY_BUTTON_APPEND_'.$this->contr => [
'title' => $this->l('How to add'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => $this->module::$_appends,
],
$this->module->_prefix_st.'GALLERY_BUTTON_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('How to display buttons'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Display on an element (Position: absolute)'),
1 => $this->l('Normal document flow (Position: static)'),
),
],
$this->module->_prefix_st.'GALLERY_BUTTON_LAYOUT_'.$this->contr => array(
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Play button layout'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Icon'),
1 => $this->l('Text'),
2 => $this->l('Icon + text horizontally'),
3 => $this->l('Icon + text vertically'),
),
),
$this->module->_prefix_st.'GALLERY_BUTTON_HIDE_'.$this->contr => array(
'title' => $this->l('Hide the play button when videos start play'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
),
$this->module->_prefix_st.'GALLERY_TYPE_'.$this->contr => array(
'type' => 'radio',
'title' => $this->l('Slider'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Use the predefined value.'),
1 => $this->l('Swiper'),
2 => $this->l('Slick slider'),
3 => $this->l('Owl carrousel 2'),
4 => $this->l('Owl carrousel 1'),
// 5 => $this->l('PrestaShop classic theme - Scrollbox'),
),
'desc' => $this->l('Select the first option if you are using one of these themes: Classic theme, Panda theme, Transformer theme and Warehouse theme.'),
),
$this->module->_prefix_st.'GALLERY_SLIDER_APPEND_'.$this->contr => [
'title' => $this->l('How to add'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => array(
0 => array(
'id' => 0,
'name' => '1',
),
1 => array(
'id' => 1,
'name' => '2',
),
2 => array(
'id' => 2,
'name' => '3',
),
100 => array(
'id' => 100,
'name' => 'End',
),
),
],
$this->module->_prefix_st.'GALLERY_SLIDER_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Gallery selector'),
'validation' => 'isAnything',
'desc' => $this->l('Leave it empty to use the predefined value.').$selector_desc,
),
$this->module->_prefix_st.'GALLERY_THUMBNAIL_TYPE_'.$this->contr => array(
'type' => 'radio',
'title' => $this->l('Thumbnail slider'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Use the predefined value.'),
1 => $this->l('Swiper'),
2 => $this->l('Slick slider'),
3 => $this->l('Owl carrousel 2'),
4 => $this->l('Owl carrousel 1'),
5 => $this->l('PrestaShop classic theme - Scrollbox'),
),
'desc' => $this->l('Select the first option if you are using one of these themes: Classic theme, Panda theme, Transformer theme and Warehouse theme.'),
),
$this->module->_prefix_st.'GALLERY_THUMBNAIL_APPEND_'.$this->contr => [
'title' => $this->l('How to add'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => array(
0 => array(
'id' => 0,
'name' => '1',
),
1 => array(
'id' => 1,
'name' => '2',
),
2 => array(
'id' => 2,
'name' => '3',
),
100 => array(
'id' => 100,
'name' => 'End',
),
),
],
$this->module->_prefix_st.'GALLERY_THUMBNAIL_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Thumbnail selector'),
'validation' => 'isAnything',
'desc' => $this->l('Leave it empty to use the predefined value.').$selector_desc,
),
$this->module->_prefix_st.'GALLERY_THUMBNAIL_ITEM_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Thumbnail item selector'),
'validation' => 'isAnything',
'desc' => $this->l('Leave it empty to use the predefined value.').$selector_desc,
),
$this->module->_prefix_st.'GALLERY_CLOSE_VIDEO_'.$this->contr => array(
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Close video'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Default'),
1 => $this->l('When a thumbnail item is clicked.'),
2 => $this->l('When a thumbnail item is on hover.'),
),
),
$this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_'.$this->contr => [
'title' => $this->l('Video template'),
'validation' => 'isAnything',
'type' => 'textarea',
'cols' => 30,
'rows' => 5,
'desc' => array(
$this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'),
$this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'),
),
],
$this->module->_prefix_st.'GALLERY_VIDEO_IMAGE_TYPE_'.$this->contr => [
'title' => $this->l('Placeholder image for videos'),
'validation' => 'isAnything',
'required' => false,
'type' => 'select',
'list' => $image_types_arr,
'identifier' => 'id',
],
$this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_'.$this->contr => [
'title' => $this->l('Button template'),
'validation' => 'isAnything',
'type' => 'textarea',
'cols' => 30,
'rows' => 5,
'desc' => array(
$this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'),
$this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'),
),
],
$this->module->_prefix_st.'GALLERY_BUTTON_IMAGE_TYPE_'.$this->contr => [
'title' => $this->l('Placeholder image for buttons'),
'validation' => 'isAnything',
'required' => false,
'type' => 'select',
'list' => $image_types_arr,
'identifier' => 'id',
],
),
'submit' => array('title' => $this->l('Save all')),
),
'player' => array(
'title' => $this->l('Player'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'GALLERY_AUTOPLAY_'.$this->contr => array(
'title' => $this->l('Autoplay'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('When videos are displayed in video palyers'),
),
$this->module->_prefix_st.'GALLERY_MUTED_'.$this->contr => array(
'title' => $this->l('Muted'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('Only muted videos can be autoplay'),
),
$this->module->_prefix_st.'GALLERY_LOOP_'.$this->contr => array(
'title' => $this->l('Loop'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
),
$this->module->_prefix_st.'GALLERY_CONTROLS_'.$this->contr => array(
'title' => $this->l('Show controls'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player_style' => array(
'title' => $this->l('Player style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'GALLERY_PLAYER_BG_'.$this->contr => [
'title' => $this->l('Color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'GALLERY_PLAYER_BG_'.$this->contr,
],
$this->module->_prefix_st.'GALLERY_VIDEO_ZINDEX_'.$this->contr => [
'title' => $this->l('Z-index'),
'validation' => 'isUnsignedId',
'required' => false,
'cast' => 'intval',
'type' => 'text',
],
),
'submit' => array('title' => $this->l('Save all')),
),
'button_style' => array(
'title' => $this->l('Play button style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'GALLERY_PLAY_BTN_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Position'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Center'),
1 => $this->l('Top left'),
2 => $this->l('Top right'),
3 => $this->l('Bottom right'),
4 => $this->l('Bottom left'),
),
],
$this->module->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_X_'.$this->contr => [
'title' => $this->l('Offset x'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
$this->module->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_Y_'.$this->contr => [
'title' => $this->l('Offset y'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
) + $this->module->getButtonFiledsOptions('GALLERY_PLAY', '_'.$this->contr) + array(
$this->module->_prefix_st.'GALLERY_PLAY_TEXT_COLOR_'.$this->contr => [
'title' => $this->l('Play" text color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'GALLERY_PLAY_TEXT_COLOR_'.$this->contr,
],
$this->module->_prefix_st.'GALLERY_PLAY_TEXT_BG_'.$this->contr => [
'title' => $this->l('Play" text background'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'GALLERY_PLAY_TEXT_BG_'.$this->contr,
],
),
'submit' => array('title' => $this->l('Save all')),
),
'close_style' => array(
'title' => $this->l('Close button style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'GALLERY_CLOSE_BTN_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Position'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Center'),
1 => $this->l('Top left'),
2 => $this->l('Top right'),
3 => $this->l('Bottom right'),
4 => $this->l('Bottom left'),
),
],
$this->module->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_X_'.$this->contr => [
'title' => $this->l('Offset x'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
$this->module->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_Y_'.$this->contr => [
'title' => $this->l('Offset y'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
) + $this->module->getButtonFiledsOptions('GALLERY_CLOSE', '_'.$this->contr),
'submit' => array('title' => $this->l('Save all')),
),
'play_icon_style' => array(
'title' => $this->l('Play icon style'),
'icon' => 'icon-cogs',
'fields' => $play_icon_fields,
'submit' => array('title' => $this->l('Save all')),
),
);
}
public function postProcess()
{
parent::postProcess();
}
public function setMedia($isNewTheme = false)
{
parent::setMedia($isNewTheme);
$this->addCss(_MODULE_DIR_.$this->module->name.'/views/css/admin.css');
$this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin.js?108');
}
}

View File

@@ -0,0 +1,576 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminStEasyVideoListController extends ModuleAdminController
{
protected $spacer_size = '5';
protected $contr = '';
public function __construct()
{
$this->bootstrap = true;
$this->table = 'st_easy_video';
$this->className = 'StEasyVideoClass';
$this->lang = false;
$this->addRowAction('edit');
$this->addRowAction('delete');
if (Shop::isFeatureActive()) {
Shop::addTableAssociation($this->table, array('type' => 'shop'));
}
parent::__construct();
$this->bulk_actions = array(
'delete' => array(
'text' => $this->trans('Delete selected', array(), 'Modules.StEasyVideo.Admin'),
'icon' => 'icon-trash',
'confirm' => $this->trans('Delete selected items?', array(), 'Modules.StEasyVideo.Admin'),
)
);
if (!file_exists(_PS_IMG_DIR_.'/steasyvideo')) {
@mkdir(_PS_IMG_DIR_.'/steasyvideo', 0775, true)
|| @chmod(_PS_IMG_DIR_.'/steasyvideo', 0775);
}
$this->fieldImageSettings = [
'name' => 'thumbnail',
'dir' => 'steasyvideo',
];
$this->fields_list = array(
'id_st_easy_video' => array(
'title' => $this->trans('ID', array(), 'Modules.StEasyVideo.Admin'),
'class' => 'fixed-width-xs'
),
'url' => array(
'title' => $this->l('Url'),
'type' => 'text',
'search' => false,
'orderby' => false,
'class' => 'fixed-width-xl',
),
'name' => array(
'title' => $this->l('Name'),
'width' => 140,
'type' => 'text',
'search' => false,
'orderby' => false,
),
'id_product' => array(
'title' => $this->l('Add to'),
'width' => 140,
'type' => 'text',
'callback' => 'displayAddTo',
'search' => false,
'orderby' => false,
'class' => 'fixed-width-xl',
),
'id_category' => array(
'title' => $this->l('Language'),
'width' => 140,
'type' => 'text',
'callback' => 'displayYuyan',
'search' => false,
'orderby' => false,
'class' => 'fixed-width-xs',
),
'autoplay' => array(
'title' => $this->trans('Autoplay', array(), 'Modules.StEasyVideo.Admin'),
'type' => 'text',
'callback' => 'displayState',
'orderby' => false,
'class' => 'fixed-width-md',
),
'muted' => array(
'title' => $this->trans('Muted', array(), 'Modules.StEasyVideo.Admin'),
'type' => 'text',
'callback' => 'displayState',
'orderby' => false,
'class' => 'fixed-width-md',
),
'loop' => array(
'title' => $this->trans('Loop', array(), 'Modules.StEasyVideo.Admin'),
'type' => 'text',
'callback' => 'displayState',
'orderby' => false,
'class' => 'fixed-width-md',
),
'active' => array(
'title' => $this->trans('Status', array(), 'Modules.StEasyVideo.Admin'),
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'class' => 'fixed-width-md',
),
);
$this->_where = $this->addWhere();
$this->_orderBy = 'id_st_easy_video';
$this->_orderWay = 'DESC';
if (Tools::isSubmit('ajax_product_list')) {
$this->getAjaxProductsList();
}
Media::addJsDefL('stsb_comfirmation_msg', $this->trans('Are you sure?', array(), 'Modules.StEasyVideo.Admin'));
}
public function postProcess()
{
if (Tools::getValue('deletethumbnail')) {
if (file_exists(_PS_IMG_DIR_.'/steasyvideo/'.(int)Tools::getValue('id_st_easy_video').'.jpg')
&& !unlink(_PS_IMG_DIR_.'/steasyvideo/'.(int)Tools::getValue('id_st_easy_video').'.jpg')) {
$this->context->controller->errors[] = $this->trans('Error while delete', array(), 'Admin.Notifications.Error');
}
Tools::redirectAdmin(self::$currentIndex.'&conf=7&' . $this->identifier . '='.(int)Tools::getValue('id_st_easy_video').'&update' . $this->table . '&token=' . $this->token);
}
return parent::postProcess();
}
public function setMedia($isNewTheme = false)
{
parent::setMedia($isNewTheme);
$this->addJqueryPlugin(array('autocomplete'));
$this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin.js?108');
}
public function displayState($value, $tr)
{
$arr = array(
'0' => $this->l('No'),
'1' => $this->l('Yes'),
'2' => $this->l('Default'),
);
return array_key_exists($value, $arr) ? $arr[$value] : '';
}
public function displayYuyan($value, $tr)
{
$res = '';
$yuyuan = StEasyVideoYuyanClass::getByVideo($tr['id_st_easy_video']);
if ($yuyuan && is_array($yuyuan)) {
$all_languages = Language::getLanguages(false);
foreach ($yuyuan as $y) {
foreach ($all_languages as $language) {
if ($y['id_lang'] == $language['id_lang']) {
$res .= $language['name'];
break;
}
}
}
} else {
$res = $this->l('All');
}
return $res;
}
public function displayAddTo($value, $tr)
{
$name = '';
if ($tr['id_category'] > 0) {
$category = new Category($tr['id_category'], Context::getContext()->language->id);
if (Validate::isLoadedObject($category)) {
$name .= $category->name;
}
} elseif ($tr['id_product'] != '') {
$products = Db::getInstance()->executeS('SELECT id_product,name from `'._DB_PREFIX_.'product_lang` WHERE id_product IN ('.trim($tr['id_product'], ',').') AND id_lang='.Context::getContext()->language->id.' AND id_shop='.Context::getContext()->shop->id);
if ($products && is_array($products)) {
foreach ($products as $key => $val) {
if ($key == 0) {
$name .= ''.$val['name'];
} else {
$name .= '<br>'.$val['name'];
}
}
}
} elseif ($tr['id_manufacturer'] > 0) {
$manufacturer = new Manufacturer($tr['id_manufacturer'], Context::getContext()->language->id);
if (Validate::isLoadedObject($manufacturer)) {
$name .= $manufacturer->name;
}
}
return $name;
}
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
return;
}
$image = _PS_IMG_DIR_ . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg';
$image_size = false;
$image_tag = '';
if (file_exists($image)) {
$image_size = filesize($image) / 1000;
$image_url = _PS_IMG_ . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg';
$image_tag = '<img src="' . Context::getContext()->link->protocol_content.Tools::getMediaServer($image_url).$image_url . '" alt="" class="imgm img-thumbnail" />';
}
Media::addJsDef(array(
'_currentIndex' => $this->context->link->getAdminLink('AdminModules'),
'_token' => Tools::getAdminTokenLite('AdminModules')
));
$this->fields_form = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Add a video'),
'icon' => 'icon-tags',
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Video url:'),
'name' => 'url',
'default_value' => '',
'class' => 'fixed-width-xxl',
'required' => true,
'desc' => array(
$this->l('Url of a .mp4 file or a youtube url or a vimeo url.'),
$this->l('You can upload mp4 files to your site via FTP, another way is using the text editor at the bottom of this page to upload videos to your site to get urls.'),
'<div id="youtube_thumbnail"></div>'
),
),
array(
'type' => 'textarea',
'label' => $this->l('For uploading videos:'),
'name' => 'for_uploading_videos',
'desc' => $this->l('You can use the video button in the text editor to upload videos to your site to get their urls.'),
'autoload_rte' => 'rte',
),
array(
'type' => 'radio',
'label' => $this->l('Display on:'),
'name' => 'location',
'is_bool' => false,
'default_value' => 0,
'values' => array(
array(
'id' => 'location_0',
'value' => 0,
'label' => $this->l('All'),
),
array(
'id' => 'location_1',
'value' => 1,
'label' => $this->l('Main gallery on the product page'),
),
array(
'id' => 'location_2',
'value' => 2,
'label' => $this->l('Product miniature on the product listing pages'),
),
array(
'id' => 'location_3',
'value' => 3,
'label' => $this->l('Product miniatures'),
),
),
'validation' => 'isUnsignedInt',
),
array(
'type' => 'text',
'label' => $this->l('Name:'),
'name' => 'name',
'size' => 64,
'desc' => $this->l('As a reminder, show on backoffice only.'),
),
array(
'type' => 'switch',
'label' => $this->l('Use youtube thumbnail if it is a youtube video.'),
'name' => 'online_thumbnail',
'is_bool' => true,
'default_value' => 1,
'values' => array(
array(
'id' => 'online_thumbnail_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'online_thumbnail_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
'thumbnail' => array(
'type' => 'file',
'label' => $this->l('Custom thumbnail:'),
'name' => 'thumbnail',
'display_image' => true,
'image' => $image_tag ? $image_tag : false,
'size' => $image_size,
'delete_url' => self::$currentIndex.'&deletethumbnail=1&' . $this->identifier . '='.(int)$obj->id.'&update' . $this->table . '&token=' . $this->token,
),
array(
'type' => 'radio',
'label' => $this->l('Autoplay:'),
'name' => 'autoplay',
'is_bool' => false,
'default_value' => 2,
'values' => array(
array(
'id' => 'autoplay_on',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'autoplay_off',
'value' => 0,
'label' => $this->l('No'),
),
array(
'id' => 'autoplay_default',
'value' => 2,
'label' => $this->l('Use default'),
),
),
'validation' => 'isUnsignedInt',
'desc' => array(
$this->l('This option is NOT a guarantee that your video will autoplay.'),
$this->l('This option would not take effect if videos are put to the end of thumbnail gallery.'),
$this->l('Check the description of this module on sunnytoo.com for more info.'),
),
),
array(
'type' => 'radio',
'label' => $this->l('Loop:'),
'name' => 'loop',
'default_value' => 2,
'values' => array(
array(
'id' => 'loop_on',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'loop_off',
'value' => 0,
'label' => $this->l('No'),
),
/*array(
'id' => 'loop_no',
'value' => 3,
'label' => $this->l('No, close player after a video ends'),
),*/
array(
'id' => 'loop_default',
'value' => 2,
'label' => $this->l('Use default'),
),
),
'validation' => 'isUnsignedInt',
),
array(
'type' => 'radio',
'label' => $this->l('Muted:'),
'name' => 'muted',
'is_bool' => true,
'default_value' => 2,
'values' => array(
array(
'id' => 'muted_on',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'muted_off',
'value' => 0,
'label' => $this->l('No'),
),
array(
'id' => 'muted_default',
'value' => 2,
'label' => $this->l('Use default'),
),
),
'validation' => 'isUnsignedInt',
),
array(
'type' => 'text',
'label' => $this->l('Aspect ratio:'),
'name' => 'ratio',
'size' => 64,
'desc' => $this->l('Generally, the video ratio should be the same as the product images. But if the vidoe ratio is different, then you can force the video to display at a specific ratio, use one of the values 16:9, 4:3, 9:16, 1:1.'),
),
array(
'type' => 'switch',
'label' => $this->l('Status:'),
'name' => 'active',
'is_bool' => true,
'default_value' => 1,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
array(
'type' => 'checkbox',
'label' => $this->l('Language:'),
'name' => 'id_lang',
'values' => array(
'query' => $this->getAllLanguages(),
'id' => 'id',
'name' => 'name',
),
'desc' => $this->l('It will show out on all languages if you don\'t select any.'),
),
array(
'type' => 'text',
'label' => $this->l('Position:'),
'name' => 'position',
'default_value' => 0,
'class' => 'fixed-width-sm'
),
),
'buttons' => array(
array(
'title' => $this->l('Save all'),
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
'type' => 'submit'
)
),
'submit' => array(
'title' => $this->l('Save and stay'),
'stay' => true
),
);
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array(
'type' => 'shop',
'label' => $this->l('Shop association:'),
'name' => 'checkBoxShopAsso',
);
}
if (method_exists($this, 'filterFormFields')) {
$this->filterFormFields($this->fields_form, $obj);
}
return parent::renderForm();
}
public function getFieldsValue($obj)
{
foreach ($this->fields_form as $fieldset) {
if (isset($fieldset['form']['input'])) {
foreach ($fieldset['form']['input'] as $input) {
if (!isset($this->fields_value[$input['name']])) {
if (isset($input['type']) && $input['type'] == 'shop') {
if ($obj->id) {
$result = Shop::getShopById((int) $obj->id, $this->identifier, $this->table);
foreach ($result as $row) {
$this->fields_value['shop'][$row['id_' . $input['type']]][] = $row['id_shop'];
}
}
} elseif (isset($input['name']) && $input['name']=='id_lang') {
$lang_obj_data= StEasyVideoClass::get_lang_obj_data($obj->id);
foreach ($this->getAllLanguages() as $language) {
if(in_array($language['id'],$lang_obj_data)){
$this->fields_value['id_lang_'.$language['id']]=$language['id'];
} elseif (count($lang_obj_data) == 1 && $lang_obj_data[0] == 0) {
$this->fields_value['id_lang_'.$language['id']]=$language['id'];
}
}
} else {
$field_value = $this->getFieldValue($obj, $input['name']);
if ($field_value === false && isset($input['default_value'])) {
$field_value = $input['default_value'];
}
$this->fields_value[$input['name']] = $field_value;
}
}
}
}
}
return $this->fields_value;
}
protected function copyFromPost(&$object, $table)
{
parent::copyFromPost($object, $table);
if ($this->contr == 'product') {
if ($ids = Tools::getValue('st_id_product')) {
$object->id_product = ','.implode(',', $ids).',';
} else {
$this->errors[] = $this->l('Please select products.');
}
$object->id_category = 0;
$object->id_manufacturer = 0;
} elseif ($this->contr == 'category') {
$object->id_product = '';
$object->id_manufacturer = 0;
if (!$object->id_category) {
$this->errors[] = $this->l('Please select a category.');
}
} elseif ($this->contr == 'manufacturer') {
$object->id_category = 0;
$object->id_product = '';
if (!$object->id_manufacturer) {
$this->errors[] = $this->l('Please select a manufacturer.');
}
} else {
$this->errors[] = $this->l('Where do you want to add the video.');
}
}
public function afterAdd($object)
{
return $this->updateAssoLang($object->id);
}
public function afterUpdate($object)
{
return $this->updateAssoLang($object->id);
}
public function updateAssoLang($id, $lang = [])
{
StEasyVideoYuyanClass::deleteByVideo($id);
$lang_arr = array();
$all_languages = Language::getLanguages(false);
foreach ($all_languages as $lang) {
if (Tools::getValue('id_lang_'.$lang['id_lang'])) {
$lang_arr[] = $lang['id_lang'];
}
}
$res = true;
if (count($lang_arr) && count($lang_arr) < count($all_languages)) {
$res = StEasyVideoYuyanClass::changeVideoYuyan($id, $lang_arr);
}else{
$res = StEasyVideoYuyanClass::changeVideoYuyan($id, [0]);
}
return $res;
}
public function getAllLanguages()
{
$lang_list = Language::getLanguages(false);
$new = [];
foreach ($lang_list as $val) {
$new[] = [
'id' => $val['id_lang'],
'name' => $val['name']
];
}
return $new;
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoListController.php';
class AdminStEasyVideoManufacturerController extends AdminStEasyVideoListController
{
protected $contr = 'manufacturer';
public function addWhere($where = '')
{
return $where.' AND id_product=\'\' AND id_category=0 AND id_manufacturer!=0 ';
}
public function filterFormFields(&$fileds, $obj)
{
array_splice($fileds['input'], 1, 0, array(
array(
'type' => 'select',
'label' => $this->l('Select a manufacture:'),
'required' => true,
'name' => 'id_manufacturer',
'class' => 'fixed-width-xxl',
'options' => array(
'query' => $this->getApplyManufacture(),
'id' => 'id',
'name' => 'name',
'default' => array(
'value' => '',
'label' => $this->l('Please select')
)
),
),
));
}
public function getApplyManufacture()
{
$manufacturer_arr = array();
$manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id);
foreach ($manufacturers as $manufacturer) {
$manufacturer_arr[] = array('id' => $manufacturer['id_manufacturer'],'name' => $manufacturer['name']);
}
return $manufacturer_arr;
}
}

View File

@@ -0,0 +1,317 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminStEasyVideoMiniatureBaseController extends ModuleAdminController
{
protected $contr = '';
public function __construct()
{
$this->bootstrap = true;
parent::__construct();
$image_types_arr = array(
array('id' => '','name' => $this->l('Use the predefined value.'),)
);
$imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes as $k => $imageType) {
if (Tools::substr($imageType['name'], -3) == '_2x') {
continue;
}
$image_types_arr[] = array('id' => $imageType['name'], 'name' => $imageType['name'].'('.$imageType['width'].'x'.$imageType['height'].')');
}
$display_options = array(
0 => $this->l('No'),
1 => $this->l('Buttons'),
2 => $this->l('Video players'),
3 => $this->l('Play on hover'),
4 => $this->l('Show buttons, play on hover'),
);
if($this->contr=='MOBILE')
unset($display_options[3], $display_options[4]);
$this->fields_options = array(
'general' => array(
'title' => $this->l('General Settings'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'MINIATURE_DISPLAY_'.$this->contr => array(
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('How to display videos'),
'validation' => 'isUnsignedInt',
'choices' => $display_options,
),
$this->module->_prefix_st.'MINIATURE_VIDEO_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Video selector'),
'validation' => 'isAnything',
'desc' => $this->l('A slector inside the miniature.'),
),
$this->module->_prefix_st.'MINIATURE_VIDEO_APPEND_'.$this->contr => [
'title' => $this->l('How to add videos'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => $this->module::$_appends,
],
$this->module->_prefix_st.'MINIATURE_VIDEO_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('How to display players'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Display on an element (Position: absolute)'),
1 => $this->l('Normal document flow (Position: static)'),
),
],
$this->module->_prefix_st.'MINIATURE_BUTTON_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Button selector'),
'validation' => 'isAnything',
'desc' => $this->l('A slector inside the miniature.'),
),
$this->module->_prefix_st.'MINIATURE_BUTTON_APPEND_'.$this->contr => [
'title' => $this->l('How to add buttons'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => $this->module::$_appends,
],
$this->module->_prefix_st.'MINIATURE_BUTTON_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('How to display buttons'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Display on an element (Position: absolute)'),
1 => $this->l('Normal document flow (Position: static)'),
),
],
$this->module->_prefix_st.'MINIATURE_BUTTON_LAYOUT_'.$this->contr => array(
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Play button layout'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Icon'),
1 => $this->l('Text'),
2 => $this->l('Icon + text horizontally'),
3 => $this->l('Icon + text vertically'),
),
),
$this->module->_prefix_st.'MINIATURE_BUTTON_HIDE_'.$this->contr => array(
'title' => $this->l('Hide the play button when videos start play'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
),
$this->module->_prefix_st.'MINIATURE_SELECTOR_'.$this->contr => array(
'type' => 'text',
'title' => $this->l('Miniature selector'),
'validation' => 'isAnything',
'desc' => $this->l('The default value .js-product-miniature works for amolst all sites'),
),
$this->module->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_'.$this->contr => [
'title' => $this->l('Video template'),
'validation' => 'isAnything',
'type' => 'textarea',
'cols' => 30,
'rows' => 5,
'desc' => array(
$this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'),
$this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'),
),
],
$this->module->_prefix_st.'MINIATURE_VIDEO_IMAGE_TYPE_'.$this->contr => [
'title' => $this->l('Placeholder image for videos'),
'validation' => 'isAnything',
'required' => false,
'type' => 'select',
'list' => $image_types_arr,
'identifier' => 'id',
],
$this->module->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_'.$this->contr => [
'title' => $this->l('Button template'),
'validation' => 'isAnything',
'type' => 'textarea',
'cols' => 30,
'rows' => 5,
'desc' => array(
$this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'),
$this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'),
),
],
$this->module->_prefix_st.'MINIATURE_BUTTON_IMAGE_TYPE_'.$this->contr => [
'title' => $this->l('Placeholder image for buttons'),
'validation' => 'isAnything',
'required' => false,
'type' => 'select',
'list' => $image_types_arr,
'identifier' => 'id',
],
$this->module->_prefix_st.'MINIATURE_VIDEO_ZINDEX_'.$this->contr => [
'title' => $this->l('Z-index:'),
'validation' => 'isUnsignedId',
'required' => false,
'cast' => 'intval',
'type' => 'text',
],
$this->module->_prefix_st.'MINIATURE_POINTER_EVENTS_NONE_'.$this->contr => array(
'title' => $this->l('Link to the product page'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('In most cases, clicking on the video goes to the product page without enabling this setting. But if that\'s not your case, then enable this setting may help.'),
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player' => array(
'title' => $this->l('Player'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'MINIATURE_AUTOPLAY_'.$this->contr => array(
'title' => $this->l('Autoplay'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('When videos are displayed in video palyers'),
),
$this->module->_prefix_st.'MINIATURE_MUTED_'.$this->contr => array(
'title' => $this->l('Muted'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('Only muted videos can be autoplay'),
),
$this->module->_prefix_st.'MINIATURE_LOOP_'.$this->contr => array(
'title' => $this->l('Loop'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
),
$this->module->_prefix_st.'MINIATURE_CONTROLS_'.$this->contr => array(
'title' => $this->l('Show controls'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player_style' => array(
'title' => $this->l('Player style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'MINIATURE_PLAYER_BG_'.$this->contr => [
'title' => $this->l('Color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'MINIATURE_PLAYER_BG_'.$this->contr,
],
),
'submit' => array('title' => $this->l('Save all')),
),
'button_style' => array(
'title' => $this->l('Play button style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'MINIATURE_PLAY_BTN_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Position'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Center'),
1 => $this->l('Top left'),
2 => $this->l('Top right'),
3 => $this->l('Bottom right'),
4 => $this->l('Bottom left'),
),
],
$this->module->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_X_'.$this->contr => [
'title' => $this->l('Offset x'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
$this->module->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_Y_'.$this->contr => [
'title' => $this->l('Offset y'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
) + $this->module->getButtonFiledsOptions('MINIATURE_PLAY', '_'.$this->contr) + array(
$this->module->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_'.$this->contr => [
'title' => $this->l('"Play" text color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_'.$this->contr,
],
$this->module->_prefix_st.'MINIATURE_PLAY_TEXT_BG_'.$this->contr => [
'title' => $this->l('"Play" text background'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'MINIATURE_PLAY_TEXT_BG_'.$this->contr,
],
),
'submit' => array('title' => $this->l('Save all')),
),
'close_style' => array(
'title' => $this->l('Close button style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'MINIATURE_CLOSE_BTN_POSITION_'.$this->contr => [
'type' => 'radio',
'cast' => 'intval',
'title' => $this->l('Position'),
'validation' => 'isUnsignedInt',
'choices' => array(
0 => $this->l('Center'),
1 => $this->l('Top left'),
2 => $this->l('Top right'),
3 => $this->l('Bottom right'),
4 => $this->l('Bottom left'),
),
],
$this->module->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_X_'.$this->contr => [
'title' => $this->l('Offset x'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
$this->module->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_Y_'.$this->contr => [
'title' => $this->l('Offset y'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
) + $this->module->getButtonFiledsOptions('MINIATURE_CLOSE', '_'.$this->contr),
'submit' => array('title' => $this->l('Save all')),
),
);
}
public function postProcess()
{
parent::postProcess();
}
public function setMedia($isNewTheme = false)
{
parent::setMedia($isNewTheme);
$this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin.js?108');
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoMiniatureBaseController.php';
class AdminStEasyVideoMiniatureController extends AdminStEasyVideoMiniatureBaseController
{
protected $contr = 'DESKTOP';
public function __construct()
{
parent::__construct();
$this->fields_options['general']['fields'] = $this->fields_options['general']['fields'] + array(
$this->module->_prefix_st.'MINIATURE_HOVER_ELEMENT' => array(
'type' => 'text',
'title' => $this->l('Play the video when this selector is on hover'),
'validation' => 'isAnything',
),
);
}
public function updateOptionStEasyVideoMiniatureVideoTemplateDesktop($val)
{
Configuration::updateValue($this->module->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_DESKTOP', $val, true);
}
public function updateOptionStEasyVideoMiniatureButtonTemplateDesktop($val)
{
Configuration::updateValue($this->module->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_DESKTOP', $val, true);
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoMiniatureBaseController.php';
class AdminStEasyVideoMiniatureMobileController extends AdminStEasyVideoMiniatureBaseController
{
protected $contr = 'MOBILE';
public function updateOptionStEasyVideoMiniatureVideoTemplateMobile($val)
{
Configuration::updateValue($this->module->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_MOBILE', $val, true);
}
public function updateOptionStEasyVideoMiniatureButtonTemplateMobile($val)
{
Configuration::updateValue($this->module->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_MOBILE', $val, true);
}
}

View File

@@ -0,0 +1,168 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoListController.php';
class AdminStEasyVideoProductController extends AdminStEasyVideoListController
{
protected $contr = 'product';
public function addWhere($where = '')
{
return $where.' AND id_product!=\'\' AND id_category=0 AND id_manufacturer=0 ';
}
public function filterFormFields(&$fileds, $obj)
{
$products_html = '';
if (($id_product = (int)Tools::getValue('id_product')) && Tools::getValue('ref') == 'product') {
$obj->id_product = (int)$id_product;
}
foreach (explode(',', trim($obj->id_product, ',')) as $id_product) {
if (!(int)$id_product) {
continue;
}
$product = new Product((int)$id_product, false, $this->context->language->id);
$products_html .= '<li>'.$product->name.'['.$product->reference.']
<a href="javascript:;" class="stsb_ac_del_product"><img src="../img/admin/delete.gif" /></a>
<input type="hidden" name="st_id_product[]" value="'.$id_product.'" /></li>';
}
array_splice($fileds['input'], 1, 0, array(
'products' => array(
'type' => 'text',
'label' => $this->l('Products:'),
'name' => 'ac_products',
'autocomplete' => false,
'required' => true,
'class' => 'fixed-width-xxl ac_products',
'desc' => $this->l('Enter product names here:').'<br/>'.$this->l('Selected products')
.': <ul class="curr_products">'.$products_html.'</ul>',
),
));
}
public function getAjaxProductsList()
{
$query = Tools::getValue('q', false);
if (!$query || $query == '' || strlen($query) < 1) {
die();
}
if ($pos = strpos($query, ' (ref:')) {
$query = substr($query, 0, $pos);
}
$excludeIds = Tools::getValue('excludeIds', false);
if ($excludeIds && $excludeIds != 'NaN') {
$excludeIds = implode(',', array_map('intval', explode(',', $excludeIds)));
} else {
$excludeIds = '';
}
// Excluding downloadable products from packs because download from pack is not supported
$forceJson = Tools::getValue('forceJson', false);
$disableCombination = Tools::getValue('disableCombination', false);
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', true);
$exclude_packs = (bool)Tools::getValue('exclude_packs', false);
$context = Context::getContext();
$sql = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute`
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)$context->language->id.Shop::addSqlRestrictionOnLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$context->language->id.')
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
($excludeVirtuals ? 'AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '').
($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : '').
' GROUP BY p.id_product';
$items = Db::getInstance()->executeS($sql);
if ($items && ($disableCombination || $excludeIds)) {
$results = [];
foreach ($items as $item) {
if (!$forceJson) {
$item['name'] = str_replace('|', '&#124;', $item['name']);
$results[] = trim($item['name']).(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : '').'|'.(int)($item['id_product']);
} else {
$results[] = array(
'id' => $item['id_product'],
'name' => $item['name'].(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : ''),
'ref' => (!empty($item['reference']) ? $item['reference'] : ''),
'image' => str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $item['id_image'], 'home'.'_'.'default')),
);
}
}
if (!$forceJson) {
echo implode("\n", $results);
} else {
echo json_encode($results);
}
} elseif ($items) {
// packs
$results = array();
foreach ($items as $item) {
// check if product have combination
if (Combination::isFeatureActive() && $item['cache_default_attribute']) {
$sql = 'SELECT pa.`id_product_attribute`, pa.`reference`, ag.`id_attribute_group`, pai.`id_image`, agl.`name` AS group_name, al.`name` AS attribute_name,
a.`id_attribute`
FROM `'._DB_PREFIX_.'product_attribute` pa
'.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` pai ON pai.`id_product_attribute` = pa.`id_product_attribute`
WHERE pa.`id_product` = '.(int)$item['id_product'].'
GROUP BY pa.`id_product_attribute`, ag.`id_attribute_group`
ORDER BY pa.`id_product_attribute`';
$combinations = Db::getInstance()->executeS($sql);
if (!empty($combinations)) {
foreach ($combinations as $k => $combination) {
$results[$combination['id_product_attribute']]['id'] = $item['id_product'];
$results[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute'];
!empty($results[$combination['id_product_attribute']]['name']) ? $results[$combination['id_product_attribute']]['name'] .= ' '.$combination['group_name'].'-'.$combination['attribute_name']
: $results[$combination['id_product_attribute']]['name'] = $item['name'].' '.$combination['group_name'].'-'.$combination['attribute_name'];
if (!empty($combination['reference'])) {
$results[$combination['id_product_attribute']]['ref'] = $combination['reference'];
} else {
$results[$combination['id_product_attribute']]['ref'] = !empty($item['reference']) ? $item['reference'] : '';
}
if (empty($results[$combination['id_product_attribute']]['image'])) {
$results[$combination['id_product_attribute']]['image'] = str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $combination['id_image'], 'home'.'_'.'default'));
}
}
} else {
$results[] = array(
'id' => $item['id_product'],
'name' => $item['name'],
'ref' => (!empty($item['reference']) ? $item['reference'] : ''),
'image' => str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $item['id_image'], 'home'.'_'.'default')),
);
}
} else {
$results[] = array(
'id' => $item['id_product'],
'name' => $item['name'],
'ref' => (!empty($item['reference']) ? $item['reference'] : ''),
'image' => str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $item['id_image'], 'home'.'_'.'default')),
);
}
}
echo json_encode(array_values($results));
} else {
echo json_encode([]);
}
die;
}
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoGalleryController.php';
class AdminStEasyVideoProductMobileSettingController extends AdminStEasyVideoGalleryController
{
protected $contr = 'MOBILE';
public function updateOptionStEasyVideoGalleryVideoTemplateMobile($val)
{
Configuration::updateValue($this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_MOBILE', $val, true);
}
public function updateOptionStEasyVideoGalleryButtonTemplateMobile($val)
{
Configuration::updateValue($this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_MOBILE', $val, true);
}
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoGalleryController.php';
class AdminStEasyVideoProductSettingController extends AdminStEasyVideoGalleryController
{
protected $contr = 'DESKTOP';
public function updateOptionStEasyVideoGalleryVideoTemplateDesktop($val)
{
Configuration::updateValue($this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_DESKTOP', $val, true);
}
public function updateOptionStEasyVideoGalleryButtonTemplateDesktop($val)
{
Configuration::updateValue($this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_DESKTOP', $val, true);
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__) . '/AdminStEasyVideoGalleryController.php';
class AdminStEasyVideoQuickViewSettingController extends AdminStEasyVideoGalleryController
{
protected $contr = 'QUICKVIEW';
public function updateOptionStEasyVideoGalleryVideoTemplateQuickView($val)
{
Configuration::updateValue($this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_QUICKVIEW', $val, true);
}
public function updateOptionStEasyVideoGalleryButtonTemplateQuickView($val)
{
Configuration::updateValue($this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_QUICKVIEW', $val, true);
}
}

View File

@@ -0,0 +1,188 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminStEasyVideoSettingController extends ModuleAdminController
{
public function __construct()
{
$this->bootstrap = true;
parent::__construct();
$this->fields_options = array(
'general' => array(
'title' => $this->l('General Settings'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'THEME_NAME' => array(
'type' => 'radio',
'title' => $this->l('Theme name:'),
'validation' => 'isGenericName',
'choices' => array(
'' => $this->l('Auto detect'),
'classic' => $this->l('PrestaShop 1.7 classic'),
'panda' => $this->l('Panda theme v2'),
'transformer' => $this->l('Transformer theme v4'),
'warehouse' => $this->l('Warehouse for 1.7'),
),
'desc' => $this->l('Select a theme to use its predefined settings.'),
),
$this->module->_prefix_st.'MAXIMUM_TRIES' => [
'title' => $this->l('Maximum times of detecting if the gallery slider is initialized on the product page.'),
'validation' => 'isUnsignedId',
'required' => false,
'cast' => 'intval',
'type' => 'text',
],
$this->module->_prefix_st.'PLAY_VIDEO_TEXT' => [
'title' => $this->l('"Play video" text'),
'size' => 6,
'type' => 'textLang',
],
$this->module->_prefix_st.'YOUTUBE_API' => array(
'title' => $this->l('Stop loading YouTube api'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('If you aren\'t going to use any youtube videos, stop loading the YouTube api for better performace.'),
),
$this->module->_prefix_st.'VIMEO_API' => array(
'title' => $this->l('Stop loading Vimeo api'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('If you aren\'t going to use any vimeo videos, stop loading the vimeo api for better performace.'),
),
$this->module->_prefix_st.'BREAKPOINT' => array(
'type' => 'text',
'title' => $this->l('Mobile device breakpoint'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'desc' => $this->l('If the gallery displays in different ways on mobile, then set the breakpoint here to use different settings on mobile.'),
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player' => array(
'title' => $this->l('Player'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'PLAYER_SKIN' => array(
'title' => $this->l('Skin'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => array(
0 => array(
'id' => 0,
'name' => 'Sublime',
),
1 => array(
'id' => 1,
'name' => 'OGZ',
),
2 => array(
'id' => 2,
'name' => 'Youtube',
),
3 => array(
'id' => 3,
'name' => 'Facebook',
),
),
),
$this->module->_prefix_st.'BG_COLOR' => array(
'title' => $this->l('Control bar background'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'BG_COLOR',
),
$this->module->_prefix_st.'BG_OPACITY' => [
'title' => $this->l('Control bar background opacity'),
'validation' => 'isFloat',
'cast' => 'floatval',
'type' => 'text',
'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'),
],
$this->module->_prefix_st.'CONTROL_COLOR' => array(
'title' => $this->l('Buttons color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'CONTROL_COLOR',
),
$this->module->_prefix_st.'CONTROL_SIZE' => [
'title' => $this->l('Buttons size'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
$this->module->_prefix_st.'PROGRESS_BAR_COLOR' => array(
'title' => $this->l('Progress bar color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'PROGRESS_BAR_COLOR',
),
$this->module->_prefix_st.'PROGRESS_BAR_OPACITY' => [
'title' => $this->l('Progress bar opacity'),
'validation' => 'isFloat',
'cast' => 'floatval',
'type' => 'text',
'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'),
],
$this->module->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR' => array(
'title' => $this->l('Progress bar highlighted color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR',
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player_play_button' => array(
'title' => $this->l('Player\'s play button'),
'icon' => 'icon-cogs',
'fields' => $this->module->getButtonFiledsOptions('PLAYER_PLAY'),
'submit' => array('title' => $this->l('Save all')),
),
'player_close_button' => array(
'title' => $this->l('Player\'s close button'),
'icon' => 'icon-cogs',
'fields' => $this->module->getButtonFiledsOptions('PLAYER_CLOSE'),
'submit' => array('title' => $this->l('Save all')),
),
'style' => array(
'title' => $this->l('Style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'CUSTOM_CSS' => [
'title' => $this->l('Custom CSS Code'),
'validation' => 'isAnything',
'type' => 'textarea',
'cols' => 30,
'rows' => 5,
],
),
'submit' => array('title' => $this->l('Save all')),
),
);
}
public function updateOptionStEasyVideoCustomCss($val)
{
Configuration::updateValue($this->module->_prefix_st.'CUSTOM_CSS', $val, true);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* 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.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,22 @@
<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class StEasyVideoAjaxModuleFrontController extends ModuleFrontController
{
public function initContent()
{
$id_product = (int)Tools::getValue('id_product');
$product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'), $this->context->shop->id);
$video_data = $this->module->getVideosByProduct($product);
ob_end_clean();
header('Content-Type: application/json');
die(json_encode($video_data));
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* 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.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* 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.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;