Files
redline.com.pl/modules/steasyvideo/controllers/admin/AdminStEasyVideoCategoryController.php
Jacek Pyziak eacf500d18 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.
2025-05-23 19:27:41 +02:00

91 lines
3.3 KiB
PHP

<?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);
}
}
}
}