first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
/**
* SOTESHOP/appCategoryHorizontalPlugin
*
* Ten plik należy do aplikacji stCategoryTreePlugin opartej na licencji (Open License SOTE) Otwarta Licencja SOTE.
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package appCategoryHorizontalPlugin
* @subpackage configs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
* @version $Id: config.php 10617 2011-01-28 13:04:18Z bartek $
* @author Bartosz Alejski <bartosz.alejski@sote.pl>
*/
if (SF_APP == 'frontend')
{
stPluginHelper::addEnableModule('appCategoryHorizontalFrontend', 'frontend');
$dispatcher->connect('smarty.slot.append', array('appCategoryHorizontalListener', 'append'));
$dispatcher->connect('stActions.preExecute', array('appCategoryHorizontalListener', 'preExecute'));
}
elseif (SF_APP == 'backend')
{
stPluginHelper::addEnableModule('appCategoryHorizontalBackend', 'backend');
stPluginHelper::addRouting('appCategoryHorizontalPlugin', '/categoryHorizontal/*', 'appCategoryHorizontalBackend', 'config', 'backend');
$dispatcher->connect('autoStProductActions.postSave', array('appCategoryHorizontalListener', 'clearCache'));
$dispatcher->connect('autoStProductActions.preDelete', array('appCategoryHorizontalListener', 'clearCache'));
$dispatcher->connect('Category.postSave', array('appCategoryHorizontalListener', 'clearCache'));
$dispatcher->connect('stCategoryTreeActions.preExecuteRemoveCategory', array('appCategoryHorizontalListener', 'clearCache'));
}
?>

View File

@@ -0,0 +1,27 @@
<?php
class appCategoryHorizontalListener
{
public static function append(sfEvent $event, $components)
{
if ($event['slot'] == 'container_head_bottom')
{
$components[] = $event->getSubject()->createComponent('appCategoryHorizontalFrontend', 'tree', array('initialize' => true));
}
return $components;
}
public static function preExecute(sfEvent $event)
{
if ($event->getSubject()->hasRequestParameter('horizontal'))
{
stProducer::clearSelectedProducerId();
}
}
public static function clearCache(sfEvent $event=null)
{
stPartialCache::clear('appCategoryHorizontalFrontend', '_tree', array('app' => 'frontend'));
}
}
?>

View File

@@ -0,0 +1,43 @@
<?php
/**
* SOTESHOP/appCategoryHorizontalPlugin
*
*
* @package appCategoryHorizontalPlugin
*/
class appCategoryHorizontalBackendActions extends sfActions
{
public function executeConfig()
{
$this->config = stConfig::getInstance($this->getContext(), 'appCategoryHorizontalBackend');
$c = new Criteria();
$c->add(CategoryPeer::PARENT_ID, NULL);
$categories = CategoryPeer::doSelect($c);
if($categories)
{
foreach ($categories as $category)
{
$select[$category->getId()] = $category->getOptName();
}
}
else
{
$select = 0;
}
$this->select = $select;
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$this->config->setFromRequest('categoryHorizontal');
$this->config->save(true);
appCategoryHorizontalListener::clearCache();
$fc = new stFunctionCache('stCategoryTree');
$fc->removeAll();
stFastCacheManager::clearCache();
$this->setFlash('notice', 'Twoje zmiany zostały zapisane');
}
}
}

View File

@@ -0,0 +1,67 @@
<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?>
<?php echo st_get_admin_head('appCategoryHorizontalPlugin', __('Poziome kategorie'), __('Konfiguracja poziomego drzewa'), NULL) ?>
<?php if ($sf_flash->has('notice')): ?>
<div class="save-ok">
<h2><?php echo __($sf_flash->get('notice'), null, 'stAdminGeneratorPlugin') ?></h2>
</div>
<?php endif; ?>
<div id="sf_admin_content_config">
<?php echo form_tag('appCategoryHorizontalBackend/config', array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form'));?>
<fieldset>
<div class="st_header"><div><h2><?php echo __('Konfiguracja wyświetlania poziomych kategorii') ?> </h2></div></div>
<div id="sf_fieldset_none_slide" class="st_fieldset-content">
<div class="form-row">
<label><?php echo __('Włącz poziome kategorie') ?>:</label>
<div class="content">
<?php echo checkbox_tag('categoryHorizontal[menu_on]',true,$config->get('menu_on')) ?>
<br class="st_clear_all">
</div>
</div>
<div class="form-row">
<label><?php echo __('Drzewo kategorii') ?>:</label>
<div class="content">
<?php if($select!=0): ?>
<?php echo select_tag('categoryHorizontal[category_id]', options_for_select($select,
array($config->get('category_id'))
)) ?>
<?php else: ?>
<?php echo __('Brak drzew kategorii'); ?>
<?php endif; ?>
<br class="st_clear_all">
</div>
</div>
<div class="form-row">
<label><?php echo __('Pokaż obrazek kategorii') ?>:</label>
<div class="content">
<?php echo checkbox_tag('categoryHorizontal[image_on]',true,$config->get('image_on')) ?>
<br class="st_clear_all">
</div>
</div>
<div class="form-row">
<label><?php echo __('Pokaż opis kategorii') ?>:</label>
<div class="content">
<?php echo checkbox_tag('categoryHorizontal[description_on]',true,$config->get('description_on')) ?>
<br class="st_clear_all">
</div>
</div>
</div>
</fieldset>
<?php echo st_get_admin_actions_head() ?>
<?php echo st_get_admin_action('save', __('Zapisz', null, 'stAdminGeneratorPlugin')) ?>
<?php echo st_get_admin_actions_foot() ?>
</form>
</div>
<br class="st_clear_all">
<?php echo st_get_admin_foot() ?>

View File

@@ -0,0 +1,66 @@
<?php
if (!class_exists('stCategoryTreeComponents', false))
{
include sfConfig::get('sf_plugins_dir').'/stCategoryTreePlugin/modules/stCategoryTree/actions/components.class.php';
}
class appCategoryHorizontalFrontendComponents extends stCategoryTreeComponents
{
public function __toString()
{
return get_class($this);
}
public function executeTree()
{
$this->smarty = new stSmarty('appCategoryHorizontalFrontend');
$config = stConfig::getInstance(sfContext::getInstance(), 'stCategory');
$this->categoryHorizontal = $config->load();
if (!isset($this->parent_id))
{
$this->parent_id = $config->get('cathor_tree');
}
$this->categories = $this->getCategoriesCached(array('parent_id' => $this->parent_id));
if ($config->get('menu_on') && !$this->categories)
{
return sfView::NONE;
}
$this->smarty->register_function('capture_category_description', array($this, 'smartyCategoryDescription'));
}
protected function checkForHidden()
{
return false;
}
public function smartyCategoryDescription($params, $smarty)
{
$c = new Criteria();
$c->addSelectColumn(CategoryPeer::OPT_DESCRIPTION);
$c->addSelectColumn(CategoryI18nPeer::DESCRIPTION);
$c->add(CategoryPeer::ID, $params['category']['id']);
$c->setLimit(1);
CategoryPeer::setHydrateMethod(array('appCategoryHorizontalFrontendComponents', 'hydrateCategoryDescription'));
$smarty->_smarty_vars['capture']['category_description'] = CategoryPeer::doSelectWithI18n($c);
CategoryPeer::setHydrateMethod(null);
}
public static function hydrateCategoryDescription(ResultSet $rs)
{
if ($rs->next())
{
$row = $rs->getRow();
return $row[1] ? $row[1] : $row[0];
}
return '';
}
}

View File

@@ -0,0 +1,4 @@
_tree:
enabled: on
view:
stylesheets: [appCategoryHorizontal.css]

View File

@@ -0,0 +1,44 @@
<?php
st_theme_use_stylesheet('appCategoryHorizontal.css');
use_helper('stCategoryImage');
use_helper('stAsset');
$smarty->assign('categories', $categories);
$smarty->assign('category_horizontal', $categoryHorizontal);
$selected = $sf_user->getParameter('selected', null, 'soteshop/stCategory');
$sf_user->setParameter('selected', null, 'soteshop/stCategory');
$smarty->assign('count', count($categories));
$smarty->display('category_tree.html');
$sf_user->setParameter('selected', $selected, 'soteshop/stCategory');
?>
<?php if (isset($initialize)): ?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($) {
$('.horizontal-category-menu a').click(function() {
var link = $(this);
window.location = link.attr('href')+'?horizontal';
return false;
});
var url = window.location.pathname;
if (url != '/') {
var current = $('.horizontal-category-menu a[href="'+url+'"]');
if (current.length) {
current.parent().addClass('selected');
current.parentsUntil('#underbaner', '.subMenu').addClass('selected');
}
}
});
//]]>
</script>
<?php endif ?>

View File

@@ -0,0 +1,75 @@
{if $category_horizontal.menu_on}
<div class="horizontal-category-menu">
{if $categories[0].depth > 1}
{if $categories[0].depth == 2}
<div class="part first_part test">
{/if}
{foreach item=category from=$categories name="cloop"}
{if $category.depth < 4}
{if $category.depth == 2}
<span class="category-level-1"><a href="{$category.url}">{$category.name}</a></span>
{/if}
{if $category.depth == 3}
<span class="category-level-2"><a href="{$category.url}">{$category.name}</a></span>
{/if}
{if $category.has_children}
{st_get_component module="appCategoryHorizontalFrontend" component="tree" parent_id=$category.id _is_cacheable=false}
{/if}
{/if}
{/foreach}
{if $categories[0].depth == 2}
</div>
{/if}
{else}
{foreach item=category from=$categories}
<div class="subMenu">
<a href="{$category.url}">{$category.name}</a>
{if $category.has_children}
{capture name="children"}{st_get_component module="appCategoryHorizontalFrontend" component="tree" parent_id=$category.id _is_cacheable=false}{/capture}
{if $smarty.capture.children}
{if $category_horizontal.description_on}
{capture_category_description category=$category}
{/if}
<div class="items">
{if $category_horizontal.image_on || $category_horizontal.description_on}
<div class="menu-description right {if $category_horizontal.description_on && $category.description}desc-on{/if}">
{if $category_horizontal.image_on}
<div class="image_menu">
<img src="{st_category_image_path category=$category.image image_type='large'}" alt="{$category.name}" />
</div>
{/if}
{if $smarty.capture.category_description}
<span class="category-big">
<a href="{$category.url}">{$category.name}</a>
</span>
<div class="category-description">
{$smarty.capture.category_description}
</div>
<div class="clear"></div>
{/if}
</div>
{/if}
<div class="left">
{$smarty.capture.children}
</div>
<div class="clear"></div>
</div>
{/if}
{/if}
</div>
{/foreach}
{/if}
<div class="clear"></div>
</div>
{if $categories[0].depth == 3 && $count >= 5}
</div><div class="part">
{/if}
{else}
{st_get_component module="stWebpageFrontend" component="groupWebpage" group_page="HEADER"}
{/if}

View File

@@ -0,0 +1,81 @@
{if $category_horizontal.menu_on == 1}
{php} $categories = $this->get_template_vars('categories'); {/php}
<div class="horizontal-category-menu">
{php} if ($categories[0]['depth'] > 1): {/php}
{php} if ($categories[0]['depth'] == 2): {/php}
<div class="part first_part">
{php} endif; {/php}
{php} foreach ($categories as $category): $i = $category['category_count'] {/php}
{php} if ($categories[0]['depth'] < 4): {/php}
{php} if ($categories[0]['depth'] == 2): {/php}
<span class="category-level-1"><a href="{php} echo $category['url'] {/php}">{php} echo $category['name'] {/php}</a></span>
{php} endif; {/php}
{php} if ($categories[0]['depth'] == 3): {/php}
<span class="category-level-2"><a href="{php} echo $category['url'] {/php}">{php} echo $category['name'] {/php}</a></span>
{php} endif; {/php}
{php} if ($category['has_children']): {/php}
{php} echo st_get_component('appCategoryHorizontalFrontend', "tree", array('parent_id' => $category['id'])); {/php}
{php} endif; {/php}
{php} endif; {/php}
{php} if ($category['depth'] == 2 && $i >= 5): $i == 0 {/php}
{php} $i=0; {/php}
</div><div class="part">
{php} endif; {/php}
{php} endforeach; {/php}
{php} if ($categories[0]['depth'] == 2): {/php}
</div>
{php} endif; {/php}
{php} else: {/php}
{php} foreach ($categories as $category): {/php}
<div class="subMenu">
<a href="{php} echo $category['url'] {/php}">{php} echo $category['name'] {/php}</a>
{php} if ($category['has_children']): {/php}
<div class="items">
<div class="menu-description">
{if $category_horizontal.image_on == 1}
<div class="image_menu">
{php} echo st_asset_image_tag($category['image'], 'thumb', 'category') {/php}
</div>
{/if}
{if $category_horizontal.description_on == 1}
{php} if($category['description']!=""): {/php}
<span class="category-big">
<a href="{php} echo $category['url'] {/php}">{php} echo $category['name'] {/php}</a>
</span>
<div style="padding-left:10px;">
{php} echo $category['description']; {/php}
</div>
<div class="clear"></div>
<div class="menu-space"></div>
{php} endif; {/php}
{/if}
</div>
{php} echo st_get_component('appCategoryHorizontalFrontend', "tree", array('parent_id' => $category['id'])); {/php}
</div>
{php} endif; {/php}
</div>
{php} endforeach; {/php}
{php} endif; {/php}
<div class="clear"></div>
</div>
{else}
{st_get_component module="stWebpageFrontend" component="groupWebpage" params="group_page=HEADER"}
{/if}