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,133 @@
<?php
/**
* SOTESHOP/stPriceCompare
*
* Ten plik należy do aplikacji stPriceCompare opartej na licencji (Professional License 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 stPriceCompare
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: actions.class.php 11356 2011-03-02 13:48:05Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Klasa stPriceCompareActions
*
* @package stPriceCompare
* @subpackage actions
*/
class stPriceCompareActions extends stActions
{
/**
* Akcja index
*/
public function executeIndex()
{
$priceCompares = stPriceCompare::getPriceCompares();
$this->plugins = array();
$this->pluginChecked = array();
$this->pluginCount = array();
$this->productsCount = ProductPeer::doCount(new Criteria());
foreach ($priceCompares as $pluginName => $pluginOptions)
{
if (class_exists($pluginOptions['peer_name'])) {
$this->plugins[$pluginName] = $pluginOptions;
$c = new Criteria();
$c->add(constant($pluginOptions['peer_name'].'::ACTIVE'), 1);
$this->pluginCount[$pluginName] = call_user_func($pluginOptions['peer_name']."::doCount", $c);
if ($this->pluginCount[$pluginName] == $this->productsCount)
{
$this->pluginChecked[$pluginName] = true;
} else {
$this->pluginChecked[$pluginName] = false;
}
if (empty($this->pluginCount[$pluginName]))
{
$this->pluginCount[$pluginName] = 0;
}
}
}
$this->menu_items = $this->getMenuItems();
}
/**
* Dodaje wszystkie produkty do zaznaczonych porownywarek
*/
public function executeSetForAll() {
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
//czyszczenie starych wpisow
$priceCompares = stPriceCompare::getPriceCompares();
$plugins = array();
// sprawdzanie ilości produktów
$productsCount = ProductPeer::doCount(new Criteria());
//dla wszystkich zaznaczonych plugin wykonacj dodawanie
$peerName = $this->getRequestParameter('price_compare',array());
foreach ($peerName as $peer) {
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'st'.substr($peer, 0, -4).'Backend');
$c = new Criteria();
$c->add(constant($peer.'::ACTIVE'), 1);
if (call_user_func($peer."::doCount", $c) != $productsCount)
{
call_user_func($peer."::doDeleteAll");
$query = "ALTER TABLE ".constant($peer."::TABLE_NAME")." AUTO_INCREMENT = 1;";
$connection = Propel::getConnection();
$statement = $connection->prepareStatement($query);
$statement->executeQuery();
}
$c = new Criteria();
$c->add(constant($peer.'::ACTIVE'), 1);
if (call_user_func($peer."::doCount", $c) != $productsCount)
{
$query = "INSERT INTO ".constant($peer."::TABLE_NAME")." (`created_at`, `updated_at`, `product_id`, `active`) Select NOW(), NOW(), `id`, '1' FROM ".ProductPeer::TABLE_NAME.";";
$connection = Propel::getConnection();
$statement = $connection->prepareStatement($query);
$statement->executeQuery();
$this->setFlash('stPriceCompare_setForAll_notice', $this->getContext()->getI18N()->__('Produkty zostały dodane do porównywarek.'));
}
}
$this->redirect('stPriceCompare/index');
}
/**
* Konfiguracja
*/
public function executeConfig()
{
$this->config = stConfig::getInstance($this->getContext());
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$this->config->setFromRequest('config');
$this->config->save();
$this->setFlash('notice', 'Twoje zmiany zostały zapisane');
}
$this->config->load();
$this->menu_items = $this->getMenuItems();
}
protected function getMenuItems()
{
$i18n = $this->getContext()->getI18N();
return array(
'@stPriceCompareDefault' => $i18n->__('Dodawanie produktów do porównywarek cen'),
'stPriceCompare/config' => $i18n->__('Konfiguracja'));
}
}

View File

@@ -0,0 +1,103 @@
<?php
/**
* SOTESHOP/stPriceCompare
*
* Ten plik należy do aplikacji stPriceCompare opartej na licencji (Professional License 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 stPriceCompare
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: components.class.php 10 2009-08-24 09:32:18Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Klasa stPriceCompareComponents
*
* @package stPriceCompare
* @subpackage actions
*/
class stPriceCompareComponents extends sfComponents
{
/**
* Dodawanie produktu do porównywarek w stProduct
*/
public function executePriceComparesInProduct()
{
$priceCompares = stPriceCompare::getPriceCompares();
$this->plugin = array();
$this->pluginName = array();
if ($this->hasRequestParameter('product_id'))
{
$this->product_id = $this->getRequestParameter('product_id');
$this->product = ProductPeer::retrieveByPK($this->product_id);
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
foreach ($priceCompares as $pluginName => $pluginOptions)
{
if (class_exists($pluginOptions['peer_name'])) {
$c = new Criteria();
$c->add(constant($pluginOptions['peer_name']."::PRODUCT_ID"), $this->product_id);
$this->obj = call_user_func($pluginOptions['peer_name']."::doSelectOne",$c);
if ($this->getRequestParameter('priceCompare['.$pluginOptions['name'].']'))
{
if (!is_object($this->obj))
{
$class = str_replace('Peer', '', $pluginOptions['peer_name']);
$this->obj = new $class;
$this->obj->setProductId($this->product_id);
}
$this->obj->setActive($this->getRequestParameter('priceCompare['.$pluginOptions['name'].']'));
$this->obj->save();
} else {
if (is_object($this->obj)) {
$this->obj->delete();
}
}
$this->setFlash('notice', 'Twoje zmiany zostały zapisane');
}
}
}
foreach ($priceCompares as $pluginName => $pluginOptions)
{
/**
* warunek aby dodac konfiguracje wszykich pluginow poza nie posiadających tabeli w bazie.
*
* @package stPriceCompare
* @subpackage actions
*/
if (class_exists($pluginOptions['peer_name'])) {
$c = new Criteria();
$c->add(constant($pluginOptions['peer_name']."::PRODUCT_ID"), $this->product_id);
$this->plugin[$pluginOptions['name']] = call_user_func($pluginOptions['peer_name']."::doSelectOne",$c);
$this->pluginName[$pluginOptions['name']] = $pluginName;
// $module = str_replace('Plugin','Backend',$pluginName);
//
// $x = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$module.'/'.sfConfig::get('sf_app_module_config_dir_name').'/generator.yml', true);
// if (!empty($x))
// {
// require($x);
// }
//
// if ($this->getController()->componentExists($module, 'showInProduct'))
// {
// $this->plugin[$pluginOptions['name']] = array('moduleName' => $module, 'peer' => $this->plugin[$pluginOptions['name']]);
// }
}
}
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* SOTESHOP/stPriceCompare
*
* Ten plik należy do aplikacji stPriceCompare opartej na licencji (Professional License 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 stPriceCompare
* @subpackage configs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: config.php 13375 2011-06-02 08:19:22Z piotr $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Dodawanie routingow
*/
stPluginHelper::addRouting('stPriceCompare','/share_offer/:action/*','stPriceCompare',null,'backend');
stPluginHelper::addRouting('stPriceCompareDefault','/share_offer','stPriceCompare','index','backend');
/**
* Dodanie do menu stPriceComare modułu stPriceCompare i dodanie do menu porównywarek cen linków aplikacji
*/
stPriceCompare::addToMenu('stPriceCompare');
stPriceCompare::generatePriceComparesMenu();
/**
* Przeciazanie generatora produktu
*/
$dispatcher = stEventDispatcher::getInstance();
$dispatcher->connect('stAdminGenerator.generateStProduct', array('stPriceCompareListener', 'generate'));
/**
* Dodawanie komponentu
*/
stSocketView::addComponent('stProduct.priceCompareCustom.Content','stPriceCompare','priceComparesInProduct',array());

View File

@@ -0,0 +1,13 @@
price_compare_model_class: Product
custom_actions:
custom: [price_compare]
price_compare_custom:
forward_parameters: [product_id]
build_options:
related_id: forward_parameters.product_id
menu: {use: edit.menu}
description: Zarządzanie produktami w sklepie.
title: Dodawanie produktu

View File

@@ -0,0 +1,25 @@
<div class="application-menu">
<ul>
<?php if ($sf_request->getParameter('action')=="index" ): ?>
<li class="selected"><?php echo link_to(__('Dodawanie produktów'),'stPriceCompare/index')?></li>
<?php else: ?>
<li class="none"><?php echo link_to(__('Dodawanie produktów'),'stPriceCompare/index')?></li>
<?php endif; ?>
<?php if ($sf_request->getParameter('action')=="config" ): ?>
<li class="selected"><?php echo link_to(__('Konfiguracja'),'stPriceCompare/config')?></li>
<?php else: ?>
<li class="none"><?php echo link_to(__('Konfiguracja'),'stPriceCompare/config')?></li>
<?php endif; ?>
<li class="none"><?php echo link_to(__('Ceneo'),'stCeneoBackend')?></li>
<li class="none"><?php echo link_to(__('Nokaut'),'stNokautBackend')?></li>
<li class="none"><?php echo link_to(__('Okazje'),'stOkazjeBackend')?></li>
<li class="none"><?php echo link_to(__('Radar'),'stRadarBackend')?></li>
<li class="none"><?php echo link_to(__('Sklepy24'),'stSklepy24Backend')?></li>
<?php if (is_dir(sfConfig::get('sf_plugins_dir')."/appFaviPlugin")){ ?>
<li class="none"><?php echo link_to(__('Favi'),'appFaviBackend')?></li>
<?php } ?>
<li class="clear_item"></li>
</ul>
</div>
<br style="clear: left">

View File

@@ -0,0 +1,19 @@
<?php echo form_tag('stProduct/priceCompareCustom?product_id='.$sf_params->get('product_id'));?>
<?php echo st_get_admin_horizontal_look_head('style="border: 1px solid #ccc;"');?>
<?php echo stSocketView::openComponents('stPriceCompare.showInProduct.before'); ?>
<?php foreach ($plugin as $key => $value):?>
<?php if ($pluginName[$key] <> 'stSkapiecPlugin'): ?>
<?php echo st_get_admin_horizontal_element_head('style="width:250px; border: none; padding: 10px;"');?>
<div id="st_application-st_price_compare-set_active_for_price_compares-div">
<?php echo link_to(image_tag('backend/main/icons/red/'.$pluginName[$key].'.png', array('id' => 'app_stCeneoPlugin', 'style' => 'float: left; height: 35px; width: 35px;')), '@'.$pluginName[$key]);?>
<p style="margin-top: 8px; margin-left: 10px; float: left; font-size: 12px;"><?php echo $key ?></p>
<?php echo checkbox_tag('priceCompare['.$key.']', 1, ($value)?$value->getActive():false, array('style' => 'margin-top: 10px; margin-left: 10px; float: left'));?>
</div>
<?php echo st_get_admin_horizontal_element_foot();?>
<?php endif; ?>
<?php endforeach;?>
<?php echo st_get_admin_horizontal_look_foot();?>
<?php echo st_get_admin_actions_head('style="float: right"');?>
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, 'name=save');?>
<?php echo st_get_admin_actions_foot();?>
</form>

View File

@@ -0,0 +1,42 @@
<?php use_helper('I18N', 'stAdminGenerator') ?>
<?php echo st_get_admin_head('stPriceCompare', __('Dodawanie produktów'), __('Zarządzanie produktami w porównywarkach cen, konfiguracja ustawień.'), NULL) ?>
<?php include_partial('menu', array()) ?>
<div id="sf_admin_content_config" style="padding: 10px">
<?php st_include_partial('stAdminGenerator/message') ?>
<div id="sf_admin_content_config">
<?php echo form_tag('share_offer/config', array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form'));?>
<fieldset>
<div class="st_header">
<div>
<h2><?php echo __('Konfiguracja generowania plików');?></h2>
</div>
</div>
<div class="st_fieldset-content">
<div class="form-row">
<?php echo label_for('config[stock]', __('Nie eksportuj produktów ze stanem magazynowym równym 0'), array('style' => 'width: 360px'));?>
<?php if($sf_request->hasErrors()):?>
<?php echo checkbox_tag('config[stock]', true, $sf_params->get('config[stock]'));?>
<?php else:?>
<?php echo checkbox_tag('config[stock]', true, $config->get('stock'));?>
<?php endif;?>
<br class="st_clear_all" />
</div>
<div class="form-row">
<?php echo label_for('config[category_root]', __('Nie dodawaj nazw drzew kategorii w plikach'), array('style' => 'width: 360px'));?>
<?php if($sf_request->hasErrors()):?>
<?php echo checkbox_tag('config[category_root]', true, $sf_params->get('config[category_root]'));?>
<?php else:?>
<?php echo checkbox_tag('config[category_root]', true, $config->get('category_root'));?>
<?php endif;?>
<br class="st_clear_all" />
</div>
</div>
</fieldset>
<?php echo st_get_admin_actions_head('style="margin-top: 10px; float: right"');?>
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, array('name' => 'save'));?>
<?php echo st_get_admin_actions_foot();?>
</form>
</div>
</div>
<br class="st_clear_all" />
<?php echo st_get_admin_foot();?>

View File

@@ -0,0 +1,34 @@
<?php use_helper('I18N', 'stAdminGenerator') ?>
<?php echo st_get_admin_head('stPriceCompare', __('Dodawanie produktów'), __('Zarządzanie produktami w porównywarkach cen, konfiguracja ustawień.'), NULL) ?>
<?php include_partial('menu', array()) ?>
<?php st_include_partial('stAdminGenerator/message') ?>
<div id="sf_admin_content" style="padding: 10px">
<?php echo form_tag('share_offer/setForAll', array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form')) ?>
<table cellspacing="0" cellpadding="0" class="st_record_list record_list" width="100%">
<thead>
<tr>
<th style="color: rgb(0, 0, 0); text-decoration: none; padding: 6px 10px;"><?php echo __('Nazwa') ?></th>
<th style="padding: 6px 10px; border-left: none;"><?php echo __('Ilość dodanych produktów (wszystkich').': '.$productsCount.')' ?></th>
<th style="padding: 6px 10px; border-left: none;"><?php echo __('Dodaj wszystkie produkty') ?></th>
</tr>
</thead>
<?php $i = 2;?>
<?php foreach ($plugins as $key => $plugin):?>
<tr<?php if($i%2) echo ' style="background-color: rgb(249, 249, 249);"'?>>
<?php if ($plugin['name'] <> 'Skapiec'): ?>
<td style="font-size: 12px; color: rgb(0, 0, 0); text-decoration: none; padding: 6px 10px;"><?php echo $plugin['name'];?></td>
<td style="padding: 6px 10px; border-left: none;"><?php echo $pluginCount[$key];?></td>
<td style="padding: 6px 10px; border-left: none;"><?php echo checkbox_tag('price_compare['.$plugin['peer_name'].']',$plugin['peer_name'],$pluginChecked[$key]);?></td>
<?php endif; ?>
</tr>
<?php $i++;?>
<?php endforeach; ?>
</table>
<?php echo st_get_admin_actions_head('style="margin-top: 10px; float: right"') ?>
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, array('name' => 'save')) ?>
<?php echo st_get_admin_actions_foot() ?>
</form>
</div>
<br class="st_clear_all" />
<?php echo st_get_admin_foot() ?>