first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 251 2009-03-30 11:35:06Z marek $
|
||||
*/
|
||||
|
||||
class sfGuardAuthComponents extends autoSfGuardAuthComponents
|
||||
{
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php use_helper('I18N') ?>
|
||||
<div id="sf_admin_container" class="admin_container">
|
||||
<div class="form-errors">
|
||||
<h2><?php echo __('Nie posiadasz odpowiednich uprawnień do wykonania tej operacji', null, 'sfGuardUser'); ?></h2>
|
||||
</div>
|
||||
</div>
|
||||
62
apps/backend/modules/sfGuardAuth/templates/signinSuccess.php
Normal file
62
apps/backend/modules/sfGuardAuth/templates/signinSuccess.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php use_helper('Validation', 'I18N') ?>
|
||||
<div class="login_form">
|
||||
<form action="<?php echo url_for('@sf_guard_signin') ?>" method="post">
|
||||
<div class="logo">
|
||||
<img src="/images/backend/beta/logo.jpg" alt="" />
|
||||
</div>
|
||||
<div class="row<?php if ($sf_request->hasError('username')): ?> form-error<?php endif; ?>">
|
||||
<input type="text" name="username" id="username" placeholder="Login / e-mail" value="<?php echo $sf_request->getParameter('username') ?>" />
|
||||
<?php if ($sf_request->hasError('username')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('username') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row<?php if ($sf_request->hasError('password')): ?> form-error<?php endif; ?>">
|
||||
<input type="password" name="password" id="password" placeholder="<?php echo __('Hasło') ?>" />
|
||||
<?php if ($sf_request->hasError('password')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('password') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="remind">
|
||||
<a href="#" rel="#password_reminder"><?php echo __('Zapomniałeś hasła?', null, 'sfGuardUser') ?></a>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
<div class="submit">
|
||||
<button type="submit"><?php echo __('Zaloguj się', null, 'sfGuardUser') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="site_address"><?php echo __('odwiedź stronę sklepu', null, 'sfGuardUser').': ' ?><a href="http://<?php echo $sf_request->getHost() ?>" target="_blank"><?php echo $sf_request->getHost() ?></a></div>
|
||||
<div id="password_reminder" class="popup_window">
|
||||
<div class="close"><a id="reminder_close" href="#"><img src="/images/frontend/theme/default2/buttons/close.png" alt="" /></a></div>
|
||||
<h2><?php echo __('Przypomnij hasło', null, 'stRemindPassword') ?></h2>
|
||||
<div class="content preloader_160x24">
|
||||
<?php st_include_component('stRemindPassword', 'remind') ?>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('a[rel=#password_reminder]').overlay({
|
||||
speed: 'fast',
|
||||
close: $('#password_reminder .close a'),
|
||||
mask: {
|
||||
color: '#444',
|
||||
loadSpeed: 'fast',
|
||||
opacity: 0.5,
|
||||
top: 130
|
||||
},
|
||||
closeOnClick: true,
|
||||
onClose: function() {
|
||||
$('#password_reminder_form').css({ visibility: 'hidden' });
|
||||
},
|
||||
onBeforeLoad: function() {
|
||||
$('#password_reminder_form').css({ visibility: 'hidden' });
|
||||
$.get('<?php echo url_for("stRemindPassword/ajaxShow") ?>', {}, function(html) {
|
||||
$('#password_reminder > .content').html(html);
|
||||
$('#remind_email').val($('#username').val());
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
19
apps/backend/modules/sfGuardAuth/validate/signin.yml
Normal file
19
apps/backend/modules/sfGuardAuth/validate/signin.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
methods:
|
||||
post: [username, password]
|
||||
|
||||
names:
|
||||
username:
|
||||
required: false
|
||||
required_msg: Proszę podać nazwę użytkownika
|
||||
validators: [userValidator]
|
||||
|
||||
password:
|
||||
required: false
|
||||
required_msg: Proszę podać hasło
|
||||
|
||||
userValidator:
|
||||
class: sfGuardUserValidator
|
||||
param:
|
||||
password_field: password
|
||||
remember_field: remember
|
||||
username_error: Proszę podać poprawną nazwę użytkownika i hasło
|
||||
84
apps/backend/modules/sfGuardGroup/actions/actions.class.php
Normal file
84
apps/backend/modules/sfGuardGroup/actions/actions.class.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
class sfGuardGroupActions extends autosfGuardGroupActions
|
||||
{
|
||||
public function validateEdit()
|
||||
{
|
||||
if (!$this->getUser()->isSuperAdmin())
|
||||
{
|
||||
return $this->redirect('sfGuardAuth/secure');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function validateList()
|
||||
{
|
||||
if (!$this->getUser()->isSuperAdmin())
|
||||
{
|
||||
return $this->redirect('sfGuardAuth/secure');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addFiltersCriteria($c)
|
||||
{
|
||||
$c->add(sfGuardGroupPeer::NAME, array('admin', 'user'), Criteria::NOT_IN);
|
||||
|
||||
parent::addFiltersCriteria($c);
|
||||
}
|
||||
|
||||
protected function savesfGuardGroup($sf_guard_group)
|
||||
{
|
||||
|
||||
$sf_guard_group->setDescription($this->getRequestParameter('sf_guard_group[description]'));
|
||||
|
||||
parent::savesfGuardGroup($sf_guard_group);
|
||||
|
||||
$this->savePermissions($sf_guard_group);
|
||||
|
||||
$this->saveModulePermissions($sf_guard_group);
|
||||
}
|
||||
|
||||
protected function saveModulePermissions(sfGuardGroup $group)
|
||||
{
|
||||
$group_id = $group->getId();
|
||||
|
||||
sfGuardGroupModulePermissionPeer::doDelete($group_id);
|
||||
|
||||
$permission = new sfGuardGroupModulePermission();
|
||||
|
||||
$permission->setId($group_id);
|
||||
|
||||
$permissions = $this->getRequestParameter('module_permission');
|
||||
|
||||
$permission->setPermissions($permissions);
|
||||
|
||||
$permission->save();
|
||||
}
|
||||
|
||||
protected function savePermissions(sfGuardGroup $group)
|
||||
{
|
||||
$group_id = $group->getId();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardGroupPermissionPeer::GROUP_ID, $group_id);
|
||||
|
||||
sfGuardGroupPermissionPeer::doDelete($c);
|
||||
|
||||
$permissions = $this->getRequestParameter('permission');
|
||||
|
||||
foreach ($permissions as $id)
|
||||
{
|
||||
$permission = new sfGuardGroupPermission();
|
||||
|
||||
$permission->setGroupId($group_id);
|
||||
|
||||
$permission->setPermissionId($id);
|
||||
|
||||
$permission->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 251 2009-03-30 11:35:06Z marek $
|
||||
*/
|
||||
|
||||
class sfGuardGroupComponents extends autoSfGuardGroupComponents
|
||||
{
|
||||
|
||||
}
|
||||
?>
|
||||
52
apps/backend/modules/sfGuardGroup/config/generator.yml
Normal file
52
apps/backend/modules/sfGuardGroup/config/generator.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: sfGuardGroup
|
||||
theme: simple
|
||||
|
||||
head:
|
||||
package: stAuthUsers
|
||||
|
||||
documentation:
|
||||
pl: https://www.sote.pl/docs/administratorzy
|
||||
en: https://www.soteshop.com/docs/administrators
|
||||
|
||||
menu:
|
||||
display:
|
||||
poziom1: [users, groups, perm]
|
||||
fields:
|
||||
users: {name: Użytkownicy, action: sfGuardUser/list}
|
||||
groups: {name: Grupy, action: sfGuardGroup/list}
|
||||
perm: {name: Uprawnienia, action: sfGuardPermission/list}
|
||||
fields:
|
||||
description: {name: Nazwa}
|
||||
|
||||
create:
|
||||
title: Dodaj grupę uprawnień
|
||||
|
||||
list:
|
||||
menu:
|
||||
display: [list, group]
|
||||
fields:
|
||||
list: { name: Administratorzy, action: sfGuardUser/list }
|
||||
group: { name: Grupy uprawnień, action: sfGuardGroup/list }
|
||||
title: Grupy uprawnień
|
||||
description: Zarządzanie i konfiguracja kont administratorów panelu
|
||||
display: [=description]
|
||||
object_actions:
|
||||
_edit: -
|
||||
_delete: -
|
||||
actions:
|
||||
_create: {name: Dodaj}
|
||||
|
||||
edit:
|
||||
use_helper: [sfGuardUser/sfGuardUser]
|
||||
title: Edycja grupy
|
||||
description: Zarządzanie i konfiguracja kont administratorów panelu
|
||||
fields:
|
||||
permissions: {name: Uprawnienia, type: guard_group_permission_list, params: control_name=permission}
|
||||
app_permissions: {name: Uprawnienia modułów, type: guard_group_app_permission_list, params: control_name=module_permission}
|
||||
display: [=description, permissions, app_permissions]
|
||||
actions:
|
||||
_save: {name: Zapisz}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class sfGuardGroupBreadcrumbsBuilder extends autoSfGuardGroupBreadcrumbsBuilder
|
||||
{
|
||||
public function getEditBreadcrumbs(sfGuardGroup $sf_guard_group)
|
||||
{
|
||||
if (null === $this->editBreadcrumbs)
|
||||
{
|
||||
$this->defaultBreadcrumbs = $this->getListBreadcrumbs();
|
||||
$this->editBreadcrumbs = parent::getEditBreadcrumbs($sf_guard_group);
|
||||
}
|
||||
|
||||
return $this->editBreadcrumbs;
|
||||
}
|
||||
}
|
||||
16
apps/backend/modules/sfGuardGroup/validate/edit.yml
Normal file
16
apps/backend/modules/sfGuardGroup/validate/edit.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
methods:
|
||||
post:
|
||||
- "sf_guard_group{description}"
|
||||
|
||||
names:
|
||||
sf_guard_group{description}:
|
||||
required: yes
|
||||
required_msg: Proszę podać nazwę grupy.
|
||||
validators: nameUniqueValidator
|
||||
|
||||
nameUniqueValidator:
|
||||
class: sfPropelUniqueValidator
|
||||
param:
|
||||
class: sfGuardGroup
|
||||
column: description
|
||||
unique_error: "Podana grupa już instnieje, proszę podać inną nazwę."
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 251 2009-03-30 11:35:06Z marek $
|
||||
*/
|
||||
|
||||
class sfGuardPermissionComponents extends autoSfGuardPermissionComponents
|
||||
{
|
||||
|
||||
}
|
||||
?>
|
||||
30
apps/backend/modules/sfGuardPermission/config/generator.yml
Normal file
30
apps/backend/modules/sfGuardPermission/config/generator.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: sfGuardPermission
|
||||
theme: simple
|
||||
|
||||
head:
|
||||
package: stAuthUsers
|
||||
|
||||
list:
|
||||
title: Lista uprawnień
|
||||
display: [id, =name, description]
|
||||
object_actions:
|
||||
_edit: -
|
||||
_delete: -
|
||||
fields:
|
||||
name: {name: Nazwa uprawnienia}
|
||||
description: {name: Opis}
|
||||
actions:
|
||||
_create: {name: Dodaj nowe uprawnienia}
|
||||
edit:
|
||||
title: Edycja uprawnienia "%%name%%"
|
||||
description: Zarządzanie i konfiguracja kont administratorów panelu
|
||||
display: [name, description]
|
||||
fields:
|
||||
name: {name: Nazwa uprawnienia}
|
||||
description: {name: Opis , help: Opis wyświetlana jest dla użytkownika panelu}
|
||||
|
||||
actions:
|
||||
_save: {name: Zapisz}
|
||||
16
apps/backend/modules/sfGuardPermission/validate/edit.yml
Normal file
16
apps/backend/modules/sfGuardPermission/validate/edit.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
methods:
|
||||
post:
|
||||
- "sf_guard_permission{name}"
|
||||
|
||||
names:
|
||||
sf_guard_permission{name}:
|
||||
required: yes
|
||||
required_msg: Proszę podać nazwę uprawnienia.
|
||||
validators: nameUniqueValidator
|
||||
|
||||
nameUniqueValidator:
|
||||
class: sfPropelUniqueValidator
|
||||
param:
|
||||
class: sfGuardPermission
|
||||
column: name
|
||||
unique_error: Uprawnienie już istnieje, proszę podać inną nazwę.
|
||||
245
apps/backend/modules/sfGuardUser/actions/actions.class.php
Normal file
245
apps/backend/modules/sfGuardUser/actions/actions.class.php
Normal file
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: actions.class.php 251 2009-03-30 11:35:06Z marek $
|
||||
*/
|
||||
class sfGuardUserActions extends autosfGuardUserActions
|
||||
{
|
||||
|
||||
protected function addFiltersCriteria($c)
|
||||
{
|
||||
parent::addFiltersCriteria($c);
|
||||
|
||||
$group = sfGuardGroupPeer::retrieveByName('admin');
|
||||
|
||||
$c->addJoin(sfGuardUserPeer::ID, sfGuardUserGroupPeer::USER_ID);
|
||||
$c->add(sfGuardUserGroupPeer::GROUP_ID, $group->getId());
|
||||
}
|
||||
|
||||
public function executeDelete()
|
||||
{
|
||||
if (!$this->getUser()->isSuperAdmin())
|
||||
{
|
||||
$this->setFlash('warning', 'Nie posiadasz uprawnień do wykonywania tej operacji');
|
||||
|
||||
return $this->redirect('sfGuardUser/list?page='.$this->getRequestParameter('page', 1));
|
||||
}
|
||||
|
||||
if ($this->getRequestParameter('sf_guard_user[selected]['.$this->getUser()->getGuardUserId().']') !== null)
|
||||
{
|
||||
$this->setFlash('warning', 'Nie możesz usunąć własnego konta');
|
||||
|
||||
return $this->redirect('sfGuardUser/list?page='.$this->getRequestParameter('page', 1));
|
||||
}
|
||||
|
||||
return parent::executeDelete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Przeciążenie zapisu - automatyczne nadawanie grupy
|
||||
*
|
||||
* @param sfGuardUser $sf_guard_user Użytkownik
|
||||
*/
|
||||
protected function savesfGuardUser($sf_guard_user)
|
||||
{
|
||||
if (!$this->getUser()->isSuperAdmin())
|
||||
{
|
||||
$sf_guard_user->setIsSuperAdmin(false);
|
||||
}
|
||||
|
||||
parent::savesfGuardUser($sf_guard_user);
|
||||
|
||||
if ($this->getUser()->isSuperAdmin())
|
||||
{
|
||||
$this->saveGroups($sf_guard_user);
|
||||
|
||||
$this->savePermissions($sf_guard_user);
|
||||
|
||||
$this->saveModulePermissions($sf_guard_user);
|
||||
}
|
||||
|
||||
$this->saveUpdateCredentials();
|
||||
}
|
||||
|
||||
public function validateList()
|
||||
{
|
||||
if (!$this->getUser()->isSuperAdmin())
|
||||
{
|
||||
return $this->redirect('sfGuardAuth/secure');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function validateEdit()
|
||||
{
|
||||
if (!$this->getUser()->isSuperAdmin() && $this->getUser()->getGuardUserId() != $this->getRequest()->getParameter('id'))
|
||||
{
|
||||
return $this->redirect('sfGuardAuth/secure');
|
||||
}
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
if (!$this->getRequest()->getParameter('id'))
|
||||
{
|
||||
$error_exists = false;
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
|
||||
if (!$this->getRequestParameter('sf_guard_user[password]'))
|
||||
{
|
||||
$this->getRequest()->setError('sf_guard_user{password}', $i18n->__('Proszę podać hasło.'));
|
||||
$error_exists = true;
|
||||
}
|
||||
|
||||
if (!$this->getRequestParameter('sf_guard_user[password_bis]'))
|
||||
{
|
||||
$this->getRequest()->setError('sf_guard_user{password_bis}', $i18n->__('Proszę podać hasło.'));
|
||||
$error_exists = true;
|
||||
}
|
||||
|
||||
return !$error_exists;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function saveModulePermissions(sfGuardUser $user)
|
||||
{
|
||||
$user_id = $user->getId();
|
||||
|
||||
sfGuardUserModulePermissionPeer::doDelete($user_id);
|
||||
|
||||
$permission = new sfGuardUserModulePermission();
|
||||
|
||||
$permission->setId($user_id);
|
||||
|
||||
$permissions = $this->getRequestParameter('module_permission');
|
||||
|
||||
$permission->setPermissions($permissions);
|
||||
|
||||
$permission->save();
|
||||
}
|
||||
|
||||
protected function saveGroups(sfGuardUser $user)
|
||||
{
|
||||
$user_id = $user->getId();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardUserGroupPeer::USER_ID, $user_id);
|
||||
|
||||
sfGuardUserGroupPeer::doDelete($c);
|
||||
|
||||
$groups = $this->getRequestParameter('group');
|
||||
|
||||
foreach ($groups as $id)
|
||||
{
|
||||
$group = new sfGuardUserGroup();
|
||||
|
||||
$group->setUserId($user_id);
|
||||
|
||||
$group->setGroupId($id);
|
||||
|
||||
$group->save();
|
||||
}
|
||||
|
||||
$user->addGroupByName('admin');
|
||||
}
|
||||
|
||||
protected function savePermissions(sfGuardUser $user)
|
||||
{
|
||||
$user_id = $user->getId();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardUserPermissionPeer::USER_ID, $user_id);
|
||||
|
||||
sfGuardUserPermissionPeer::doDelete($c);
|
||||
|
||||
$permissions = $this->getRequestParameter('permission');
|
||||
|
||||
foreach ($permissions as $id)
|
||||
{
|
||||
$permission = new sfGuardUserPermission();
|
||||
|
||||
$permission->setUserId($user_id);
|
||||
|
||||
$permission->setPermissionId($id);
|
||||
|
||||
$permission->save();
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveUpdateCredentials()
|
||||
{
|
||||
$config = stConfig::getInstance('stAuth');
|
||||
|
||||
$permission = sfGuardPermissionPeer::retrieveByName('update');
|
||||
|
||||
$group_ids = array();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(sfGuardGroupPeer::ID);
|
||||
|
||||
$c->addJoin(sfGuardGroupPeer::ID, sfGuardGroupPermissionPeer::GROUP_ID);
|
||||
|
||||
$c->add(sfGuardGroupPermissionPeer::PERMISSION_ID, $permission->getId());
|
||||
|
||||
$rs = sfGuardGroupPermissionPeer::doSelectRs($c);
|
||||
|
||||
while($rs->next())
|
||||
{
|
||||
$group_ids[] = $rs->getInt(1);
|
||||
}
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addJoin(sfGuardUserPeer::ID, sfGuardUserPermissionPeer::USER_ID, Criteria::LEFT_JOIN);
|
||||
|
||||
if ($group_ids)
|
||||
{
|
||||
$c->addJoin(sfGuardUserPeer::ID, sfGuardUserGroupPeer::USER_ID, Criteria::LEFT_JOIN);
|
||||
}
|
||||
|
||||
$criterion = $c->getNewCriterion(sfGuardUserPeer::IS_SUPER_ADMIN, true);
|
||||
|
||||
$criterion->addOr($c->getNewCriterion(sfGuardUserPermissionPeer::PERMISSION_ID, $permission->getId()));
|
||||
|
||||
if ($group_ids)
|
||||
{
|
||||
$criterion->addOr($c->getNewCriterion(sfGuardUserGroupPeer::GROUP_ID, $group_ids, Criteria::IN));
|
||||
}
|
||||
|
||||
$c->add($criterion);
|
||||
|
||||
$c->addGroupByColumn(sfGuardUserPeer::ID);
|
||||
|
||||
$users = sfGuardUserPeer::doSelect($c);
|
||||
|
||||
$credentials = array();
|
||||
|
||||
foreach ($users as $user)
|
||||
{
|
||||
$credentials[] = array('username' => $user->getUsername(), 'salt' => $user->getSalt(), 'password' => $user->getPassword());
|
||||
}
|
||||
|
||||
$config->set('users', $credentials);
|
||||
|
||||
$config->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 251 2009-03-30 11:35:06Z marek $
|
||||
*/
|
||||
|
||||
class sfGuardUserComponents extends autoSfGuardUserComponents
|
||||
{
|
||||
}
|
||||
27
apps/backend/modules/sfGuardUser/config/config.php
Normal file
27
apps/backend/modules/sfGuardUser/config/config.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: config.php 251 2009-03-30 11:35:06Z marek $
|
||||
* @author Marcin Olejniczak <marcin.olejniczak@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Włączanie modułów
|
||||
*/
|
||||
stPluginHelper::addEnableModule('sfGuardUser', 'frontend');
|
||||
stPluginHelper::addEnableModule('sfGuardUser', 'backend');
|
||||
|
||||
if (SF_APP == 'backend')
|
||||
{
|
||||
$dispatcher->connect('stActions.preValidate', array('stAuthUsersListener', 'checkCredentials'));
|
||||
}
|
||||
59
apps/backend/modules/sfGuardUser/config/generator.yml
Normal file
59
apps/backend/modules/sfGuardUser/config/generator.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: sfGuardUser
|
||||
theme: simple
|
||||
head:
|
||||
package: stAuthUsers
|
||||
|
||||
documentation:
|
||||
pl: https://www.sote.pl/docs/administratorzy
|
||||
en: https://www.soteshop.com/docs/administrators
|
||||
|
||||
applications: [stUser]
|
||||
fields:
|
||||
username: {name: Login}
|
||||
is_active: {name: Aktywny}
|
||||
last_login: {name: Ostatnio logowany}
|
||||
is_super_admin: {name: Super admin}
|
||||
|
||||
create:
|
||||
title: Dodaj administratora
|
||||
|
||||
list:
|
||||
menu:
|
||||
display: [list, group]
|
||||
fields:
|
||||
list: { name: Administratorzy, action: sfGuardUser/list }
|
||||
group: { name: Grupy uprawnień, action: sfGuardGroup/list }
|
||||
title: Administratorzy
|
||||
description: Zarządzanie i konfiguracja kont administratorów
|
||||
display: [=username, last_login, is_super_admin]
|
||||
filters: [username]
|
||||
object_actions:
|
||||
_edit: -
|
||||
_delete: -
|
||||
fields:
|
||||
actions:
|
||||
_create: {name: Dodaj}
|
||||
|
||||
edit:
|
||||
menu: {use: list.menu}
|
||||
use_helper: [sfGuardUser]
|
||||
title: Edycja administratora
|
||||
description: Zarządzanie i konfiguracja kont administratorów panelu
|
||||
fields:
|
||||
groups: {name: Grupy uprawnień, type: guard_group_list, params: control_name=group}
|
||||
permissions: {name: Uprawnienia, type: guard_permission_list, params: control_name=permission}
|
||||
app_permissions: {name: Uprawnienia modułów, type: guard_app_permission_list, params: control_name=module_permission}
|
||||
last_login: {name: Ostatnio logowany, type: plain}
|
||||
password_bis: {name: "Ponów hasło"}
|
||||
password: {name: Hasło}
|
||||
is_super_admin: {name: Super admin}
|
||||
is_active: {name: Aktywny}
|
||||
|
||||
display:
|
||||
"NONE": [last_login, _is_active, _is_super_admin, username, _password, _password_bis, groups, permissions, app_permissions]
|
||||
actions:
|
||||
_list: {name: Lista}
|
||||
_save: {name: Zapisz}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
function object_guard_permission_list(sfGuardUser $user, $method, $options)
|
||||
{
|
||||
$sf_user = sfContext::getInstance()->getUser();
|
||||
|
||||
$culture = $sf_user->getCulture();
|
||||
|
||||
$fc = new stFunctionCache('stGuardUser');
|
||||
|
||||
$select_options = $fc->cacheCall('_permission_select_options', array($culture));
|
||||
|
||||
$selected = array();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(sfGuardUserPermissionPeer::PERMISSION_ID);
|
||||
|
||||
$c->add(sfGuardUserPermissionPeer::USER_ID, $user->getId());
|
||||
|
||||
$rs = sfGuardUserPermissionPeer::doSelectRs($c);
|
||||
|
||||
while ($rs->next())
|
||||
{
|
||||
$row = $rs->getRow();
|
||||
|
||||
$selected[] = $row[0];
|
||||
}
|
||||
|
||||
$disabled = !$sf_user->isSuperAdmin() || $user->getIsSuperAdmin();
|
||||
|
||||
return select_tag($options['control_name'], options_for_select($select_options, $selected), array('multiple' => true, 'size' => 7, 'style' => 'min-width: 180px', 'disabled' => $disabled));
|
||||
}
|
||||
|
||||
function object_guard_group_permission_list(sfGuardGroup $group, $method, $options)
|
||||
{
|
||||
$sf_user = sfContext::getInstance()->getUser();
|
||||
|
||||
$culture = $sf_user->getCulture();
|
||||
|
||||
$fc = new stFunctionCache('stGuardUser');
|
||||
|
||||
$select_options = $fc->cacheCall('_permission_select_options', array($culture));
|
||||
|
||||
$selected = array();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(sfGuardGroupPermissionPeer::PERMISSION_ID);
|
||||
|
||||
$c->add(sfGuardGroupPermissionPeer::GROUP_ID, $group->getId());
|
||||
|
||||
$rs = sfGuardGroupPermissionPeer::doSelectRs($c);
|
||||
|
||||
while ($rs->next())
|
||||
{
|
||||
$row = $rs->getRow();
|
||||
|
||||
$selected[] = $row[0];
|
||||
}
|
||||
|
||||
return select_tag($options['control_name'], options_for_select($select_options, $selected), array('multiple' => true, 'size' => 7, 'style' => 'min-width: 180px'));
|
||||
}
|
||||
|
||||
function object_guard_group_list(sfGuardUser $user, $method, $options)
|
||||
{
|
||||
$select_options = array();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardGroupPeer::NAME, array('admin', 'user'), Criteria::NOT_IN);
|
||||
|
||||
$groups = sfGuardGroupPeer::doSelect($c);
|
||||
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
$select_options[$group->getId()] = $group->getDescription();
|
||||
}
|
||||
|
||||
$selected = array();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(sfGuardUserGroupPeer::GROUP_ID);
|
||||
|
||||
$c->add(sfGuardUserGroupPeer::USER_ID, $user->getId());
|
||||
|
||||
$rs = sfGuardUserGroupPeer::doSelectRs($c);
|
||||
|
||||
while ($rs->next())
|
||||
{
|
||||
$row = $rs->getRow();
|
||||
|
||||
$selected[] = $row[0];
|
||||
}
|
||||
|
||||
$disabled = !sfContext::getInstance()->getUser()->isSuperAdmin() || $user->getIsSuperAdmin();
|
||||
|
||||
return select_tag($options['control_name'], options_for_select($select_options, $selected), array('multiple' => true, 'size' => 10, 'style' => 'min-width: 180px', 'disabled' => $disabled));
|
||||
}
|
||||
|
||||
function object_guard_app_permission_list(sfGuardUser $user, $method, $options)
|
||||
{
|
||||
$select_options = _app_permission_select_options();
|
||||
|
||||
$permission = sfGuardUserModulePermissionPeer::retrieveByPK($user->getId());
|
||||
|
||||
$selected = $permission ? $permission->getPermissions() : array();
|
||||
|
||||
$disabled = !sfContext::getInstance()->getUser()->isSuperAdmin() || $user->getIsSuperAdmin();
|
||||
|
||||
return select_tag($options['control_name'], options_for_select($select_options, $selected), array('multiple' => true, 'size' => 12, 'style' => 'min-width: 180px', 'disabled' => $disabled));
|
||||
}
|
||||
|
||||
function object_guard_group_app_permission_list(sfGuardGroup $group, $method, $options)
|
||||
{
|
||||
$select_options = _app_permission_select_options();
|
||||
|
||||
$permission = sfGuardGroupModulePermissionPeer::retrieveByPK($group->getId());
|
||||
|
||||
$selected = $permission ? $permission->getPermissions() : array();
|
||||
|
||||
return select_tag($options['control_name'], options_for_select($select_options, $selected), array('multiple' => true, 'size' => 12, 'style' => 'min-width: 180px'));
|
||||
}
|
||||
|
||||
function _app_permission_select_options()
|
||||
{
|
||||
$modules = stAuthUsersListener::getSecuredModules();
|
||||
|
||||
foreach ($modules as $name => $label)
|
||||
{
|
||||
$select_options[$label] = array(
|
||||
$name . '.access' => $label . ' - ' . __('dostęp', null, 'sfGuardUser'),
|
||||
$name . '.modification' => $label . ' - ' . __('modyfikacja', null, 'sfGuardUser')
|
||||
);
|
||||
}
|
||||
|
||||
return $select_options;
|
||||
}
|
||||
|
||||
function _permission_select_options()
|
||||
{
|
||||
$backend = sfGuardPermissionPeer::retrieveByName('backend');
|
||||
$update = sfGuardPermissionPeer::retrieveByName('update');
|
||||
$webapi_read = sfGuardPermissionPeer::retrieveByName('webapi_read');
|
||||
$webapi_write = sfGuardPermissionPeer::retrieveByName('webapi_write');
|
||||
|
||||
if (null === $webapi_read)
|
||||
{
|
||||
$webapi_read = new sfGuardPermission();
|
||||
|
||||
$webapi_read->setName('webapi_read');
|
||||
|
||||
$webapi_read->save();
|
||||
}
|
||||
|
||||
if (null === $webapi_write)
|
||||
{
|
||||
$webapi_write = new sfGuardPermission();
|
||||
|
||||
$webapi_write->setName('webapi_write');
|
||||
|
||||
$webapi_write->save();
|
||||
}
|
||||
|
||||
return array(
|
||||
__('Panel administracyjny', null, 'sfGuardUser') => array(
|
||||
$backend->getId() => __('Panel administracyjny', null, 'sfGuardUser') . ' - ' . __('dostęp', null, 'sfGuardUser')
|
||||
),
|
||||
__('Panel uaktualnień', null, 'sfGuardUser') => array(
|
||||
$update->getId() => __('Panel uaktualnień', null, 'sfGuardUser') . ' - ' . __('dostęp', null, 'sfGuardUser')
|
||||
),
|
||||
'WebAPI' => array(
|
||||
$webapi_read->getId() => 'WebAPI - ' . __('dostęp', null, 'sfGuardUser'),
|
||||
$webapi_write->getId() => 'WebAPI - ' . __('modyfikacja', null, 'sfGuardUser'),
|
||||
),
|
||||
);
|
||||
}
|
||||
17
apps/backend/modules/sfGuardUser/templates/_edit_actions.php
Normal file
17
apps/backend/modules/sfGuardUser/templates/_edit_actions.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
// auto-generated by sfPropelAdmin
|
||||
// date: 2009/09/10 15:21:05
|
||||
?>
|
||||
<?php echo st_get_admin_actions_head('style="margin-top: 10px; float: right"') ?>
|
||||
<?php echo st_get_admin_action('list', __('Lista', array(), 'stAdminGeneratorPlugin'), 'sfGuardUser/list', array (
|
||||
)) ?>
|
||||
|
||||
<?php if($sf_guard_user->getId() == $sf_user->getGuardUser()->getId() || $sf_user->getGuardUser()->getIsSuperAdmin()): ?>
|
||||
|
||||
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, array (
|
||||
'name' => 'save',
|
||||
)) ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo st_get_admin_actions_foot() ?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php if(!$sf_user->getGuardUser()->getIsSuperAdmin() || $sf_user->getGuardUser()->getId() == $sf_guard_user->getId()): ?>
|
||||
<?php echo st_admin_checkbox_tag('sf_guard_user[is_active]', true, $sf_guard_user->getIsActive(), array('disabled' => true)); ?>
|
||||
<?php echo input_hidden_tag('sf_guard_user[is_active]', $sf_guard_user->getIsActive()) ?>
|
||||
<?php else: ?>
|
||||
<?php echo st_admin_checkbox_tag('sf_guard_user[is_active]', true, $sf_guard_user->getIsActive()); ?>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php if(!$sf_user->getGuardUser()->getIsSuperAdmin() || $sf_user->getGuardUser()->getId() == $sf_guard_user->getId()): ?>
|
||||
<?php echo st_admin_checkbox_tag('sf_guard_user[is_super_admin]', true, $sf_guard_user->getIsSuperAdmin(), array('disabled' => true)); ?>
|
||||
<?php echo input_hidden_tag('sf_guard_user[is_super_admin]', $sf_guard_user->getIsSuperAdmin()) ?>
|
||||
<?php else: ?>
|
||||
<?php echo st_admin_checkbox_tag('sf_guard_user[is_super_admin]', true, $sf_guard_user->getIsSuperAdmin()); ?>
|
||||
<?php endif; ?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
jQuery(function($) {
|
||||
$('#sf_guard_user_is_super_admin').change(function() {
|
||||
$('#group, #permission, #module_permission').attr('disabled', this.checked).trigger("chosen:updated");
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
// auto-generated by sfPropelAdmin
|
||||
// date: 2009/09/10 15:21:05
|
||||
?>
|
||||
<?php if($sf_user->getGuardUser()->getIsSuperAdmin()): ?>
|
||||
<?php echo st_get_admin_actions_head('style="margin-top: 10px; float: right"') ?>
|
||||
<?php echo st_get_admin_action('create', __('Dodaj'), 'sfGuardUser/create', array (
|
||||
)) ?> <?php echo st_get_admin_actions_foot() ?>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
// auto-generated by sfPropelAdmin
|
||||
// date: 2009/09/10 15:21:05
|
||||
?>
|
||||
<td>
|
||||
<ul class="st_object_actions">
|
||||
<li><?php echo link_to(image_tag('backend/icons/edit.gif', array('alt' => __('edit'), 'title' => __('edit'))), 'sfGuardUser/edit?id='.$sf_guard_user->getId()) ?></li>
|
||||
</ul>
|
||||
</td>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// auto-generated by sfPropelAdmin
|
||||
// date: 2009/09/10 15:21:05
|
||||
?>
|
||||
<td>
|
||||
|
||||
<div id="st_object_actions_td_frame">
|
||||
<ul class="st_object_actions">
|
||||
|
||||
|
||||
|
||||
<?php if($sf_user->getGuardUser()->getIsSuperAdmin()): ?>
|
||||
|
||||
<?php if($sf_guard_user->getId() != $sf_user->getGuardUser()->getId()): ?>
|
||||
|
||||
<?php if (method_exists($sf_guard_user, 'getIsSystemDefault') == false || (method_exists($sf_guard_user, 'getIsSystemDefault') && !$sf_guard_user->getIsSystemDefault())): ?>
|
||||
|
||||
<li><?php echo link_to(image_tag('backend/icons/delete.gif', array('alt' => __('delete'), 'title' => __('delete'))), 'sfGuardUser/delete?id='.$sf_guard_user->getId(), array (
|
||||
'post' => true,
|
||||
'confirm' => __('Jesteś pewien?', array(), 'stAdminGeneratorPlugin'),
|
||||
)) ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
1
apps/backend/modules/sfGuardUser/templates/_password.php
Normal file
1
apps/backend/modules/sfGuardUser/templates/_password.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php echo input_password_tag('sf_guard_user[password]', '', array('control_name' => 'sf_guard_user[password]', 'autocomplete' => 'off')) ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo input_password_tag('sf_guard_user[password_bis]', '', array('control_name' => 'sf_guard_user[password_bis]', 'autocomplete' => 'off')) ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo checkbox_tag('webapi_read',1,$sf_guard_user->hasPermission("webapi_read"));?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo checkbox_tag('webapi_write',1,$sf_guard_user->hasPermission("webapi_write"));?>
|
||||
51
apps/backend/modules/sfGuardUser/validate/edit.yml
Normal file
51
apps/backend/modules/sfGuardUser/validate/edit.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
methods:
|
||||
post:
|
||||
- "sf_guard_user{username}"
|
||||
- "sf_guard_user{password}"
|
||||
- "sf_guard_user{password_bis}"
|
||||
|
||||
names:
|
||||
sf_guard_user{username}:
|
||||
required: yes
|
||||
required_msg: Proszę podać nazwę administratora.
|
||||
validators: [usernameUniqueValidator, usernameEmailValidator]
|
||||
|
||||
|
||||
sf_guard_user{password}:
|
||||
required: no
|
||||
required_msg: Proszę podać hasło.
|
||||
group: password
|
||||
validators: passwordValidator
|
||||
|
||||
sf_guard_user{password_bis}:
|
||||
required: no
|
||||
required_msg: Proszę podać hasło.
|
||||
group: password
|
||||
validators: comparePasswordValidator
|
||||
|
||||
usernameUniqueValidator:
|
||||
class: sfPropelUniqueValidator
|
||||
param:
|
||||
class: sfGuardUser
|
||||
column: username
|
||||
unique_error: Podany użytkownik istnieje, proszę podać inną nazwę.
|
||||
|
||||
passwordValidator:
|
||||
class: sfStringValidator
|
||||
param:
|
||||
min: 6
|
||||
min_error: Hasło nie może być krótsze niz 6 znaków.
|
||||
|
||||
comparePasswordValidator:
|
||||
class: sfCompareValidator
|
||||
param:
|
||||
check: "sf_guard_user[password]"
|
||||
compare_error: Hasło nie zostało powtórzone poprawnie.
|
||||
|
||||
usernameEmailValidator:
|
||||
class: sfEmailValidator
|
||||
param:
|
||||
class: sfGuardUser
|
||||
column: username
|
||||
email_error: Nieprawidłowy format adresu e-mail.
|
||||
|
||||
36
apps/backend/modules/stApplication/actions/actions.class.php
Normal file
36
apps/backend/modules/stApplication/actions/actions.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stApplication
|
||||
*
|
||||
* Ten plik należy do aplikacji stApplication 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 stApplication
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: actions.class.php 3123 2008-12-10 13:29:11Z marek $
|
||||
*/
|
||||
|
||||
/**
|
||||
* stApplication actions.
|
||||
*
|
||||
* @author Marek Jakubowicz <marek.jakubowicz@sote.pl>
|
||||
*
|
||||
* @package stApplication
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stApplicationActions extends stActions
|
||||
{
|
||||
/**
|
||||
* Instalator PEAR_Frontend_Web
|
||||
*/
|
||||
public function executeIndex()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
class stApplicationComponents extends sfComponents
|
||||
{
|
||||
public function executeInstaller()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
3
apps/backend/modules/stApplication/config/config.php
Normal file
3
apps/backend/modules/stApplication/config/config.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
stPluginHelper::addRouting('stApplication', '/installer/:action/*', 'stApplication', 'index', 'backend');
|
||||
?>
|
||||
473
apps/backend/modules/stApplication/lib/pearfrontendweb.php
Normal file
473
apps/backend/modules/stApplication/lib/pearfrontendweb.php
Normal file
@@ -0,0 +1,473 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stApplication
|
||||
*
|
||||
* Ten plik należy do aplikacji stApplication 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 stApplication
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: pearfrontendweb.php 3123 2008-12-10 13:29:11Z marek $
|
||||
* @author Christian Dickmann <dickmann@php.net>
|
||||
* @author Pierre-Alain Joye <pajoye@php.net>
|
||||
* @author Tias Guns <tias@ulyssis.org>
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is PEAR_Frontend_Web
|
||||
*/
|
||||
define('PEAR_Frontend_Web',1);
|
||||
@session_start();
|
||||
|
||||
/**
|
||||
* base frontend class
|
||||
*/
|
||||
require_once 'PEAR/Frontend.php';
|
||||
require_once 'PEAR/Command.php';
|
||||
|
||||
// for the open_basedir prisoners, don't allow PEAR to search for a temp dir (would use /tmp), see bug #13167
|
||||
putenv('TMPDIR='.dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'cache'); // +- SOTE zmiana lokalizacji tempdir - wskazanie na cache symfony m@sote.pl
|
||||
|
||||
// set $pear_user_config if it isn't set yet
|
||||
// finds an existing file, or proposes the default location
|
||||
if (!isset($pear_user_config) || $pear_user_config == '') {
|
||||
if (OS_WINDOWS) {
|
||||
$conf_name = 'pear.ini';
|
||||
} else {
|
||||
$conf_name = 'pear.conf';
|
||||
}
|
||||
|
||||
// default backup config: the one from the installer (if available).
|
||||
$install_config = '@pear_install_config@'; // filled in on install
|
||||
// TODO: doesn't work yet ! There is no way to find the system config
|
||||
if (file_exists($install_config)) {
|
||||
$pear_user_config = $install_config;
|
||||
} else {
|
||||
|
||||
// find other config file location
|
||||
$default_config_dirs = array(
|
||||
substr(dirname(__FILE__), 0, strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR)), // strip eg PEAR from .../example/PEAR(/pearfrontendweb.php)
|
||||
dirname($_SERVER['SCRIPT_FILENAME']),
|
||||
PEAR_CONFIG_SYSCONFDIR,
|
||||
);
|
||||
// set the default: __FILE__ without PEAR/
|
||||
$pear_user_config = $default_config_dirs[0].DIRECTORY_SEPARATOR.$conf_name;
|
||||
|
||||
$found = false;
|
||||
foreach ($default_config_dirs as $confdir) {
|
||||
if (file_exists($confdir.DIRECTORY_SEPARATOR.$conf_name)) {
|
||||
$pear_user_config = $confdir.DIRECTORY_SEPARATOR.$conf_name;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
print('<p><b>Warning:</b> Can not find config file, please specify the $pear_user_config variable in '.$_SERVER['PHP_SELF'].'</p>');
|
||||
}
|
||||
}
|
||||
unset($conf_name, $default_config_dirs, $confdir);
|
||||
}
|
||||
|
||||
require_once 'PEAR/Registry.php';
|
||||
require_once 'PEAR/Config.php';
|
||||
|
||||
// moving this here allows startup messages and errors to work properly
|
||||
PEAR_Frontend::setFrontendClass('PEAR_Frontend_Web');
|
||||
// Init PEAR Installer Code and WebFrontend
|
||||
$GLOBALS['_PEAR_Frontend_Web_config'] = &PEAR_Config::singleton($pear_user_config, '');
|
||||
$config = &$GLOBALS['_PEAR_Frontend_Web_config'];
|
||||
if (PEAR::isError($config)) {
|
||||
die('<b>Error:</b> '.$config->getMessage());
|
||||
}
|
||||
|
||||
$ui = &PEAR_Command::getFrontendObject();
|
||||
if (PEAR::isError($ui)) {
|
||||
die('<b>Error:</b> '.$ui->getMessage());
|
||||
}
|
||||
$ui->setConfig($config);
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
|
||||
|
||||
// Cient requests an Image/Stylesheet/Javascript
|
||||
// outputFrontendFile() does exit()
|
||||
if (isset($_GET["css"])) {
|
||||
$ui->outputFrontendFile($_GET["css"], 'css');
|
||||
}
|
||||
if (isset($_GET["js"])) {
|
||||
$ui->outputFrontendFile($_GET["js"], 'js');
|
||||
}
|
||||
if (isset($_GET["img"])) {
|
||||
$ui->outputFrontendFile($_GET["img"], 'image');
|
||||
}
|
||||
|
||||
$verbose = $config->get("verbose");
|
||||
$cmdopts = array();
|
||||
$opts = array();
|
||||
$params = array();
|
||||
|
||||
// create $pear_user_config if it doesn't exit yet
|
||||
if (!file_exists($pear_user_config)) {
|
||||
// I think PEAR_Frontend_Web is running for the first time!
|
||||
// Create config and install it properly ...
|
||||
$ui->outputBegin(null);
|
||||
print('<h3>Preparing PEAR_Frontend_Web for its first time use...</h3>');
|
||||
|
||||
// find pear_dir:
|
||||
if (!isset($pear_dir) || !file_exists($pear_dir)) {
|
||||
// __FILE__ is eg .../example/PEAR/pearfrontendweb.php
|
||||
$pear_dir = dirname(__FILE__); // eg .../example/PEAR
|
||||
}
|
||||
if (substr($pear_dir, -1) == DIRECTORY_SEPARATOR) {
|
||||
$pear_dir = substr($pear_dir, 0, -1); // strip trailing /
|
||||
}
|
||||
// extract base_dir from pear_dir
|
||||
$dir = substr($pear_dir, 0, strrpos($pear_dir, DIRECTORY_SEPARATOR)); // eg .../example
|
||||
|
||||
$dir .= DIRECTORY_SEPARATOR;
|
||||
if (!is_dir($dir)) {
|
||||
PEAR::raiseError('Can not find a base installation directory of PEAR ('.$dir.' doesn\'t work), so we can\'t create a config for it. Please supply it in the variable \'$pear_dir\'. The $pear_dir must have at least the subdirectory PEAR/ and be writable by this frontend.');
|
||||
die();
|
||||
}
|
||||
|
||||
print('Saving config file ('.$pear_user_config.')...');
|
||||
// First of all set some config-vars:
|
||||
// Tries to be compatible with go-pear
|
||||
if (!isset($pear_dir)) {
|
||||
$pear_dir = $dir.'PEAR'; // default (go-pear compatible)
|
||||
}
|
||||
$cmd = PEAR_Command::factory('config-set', $config);
|
||||
$ok = $cmd->run('config-set', array(), array('php_dir', $pear_dir));
|
||||
$ok = $cmd->run('config-set', array(), array('doc_dir', $pear_dir.'/docs'));
|
||||
$ok = $cmd->run('config-set', array(), array('ext_dir', $dir.'ext'));
|
||||
$ok = $cmd->run('config-set', array(), array('bin_dir', $dir.'bin'));
|
||||
$ok = $cmd->run('config-set', array(), array('data_dir', $pear_dir.'/data'));
|
||||
$ok = $cmd->run('config-set', array(), array('test_dir', $pear_dir.'/test'));
|
||||
$ok = $cmd->run('config-set', array(), array('temp_dir', $dir.'temp'));
|
||||
$ok = $cmd->run('config-set', array(), array('download_dir', $dir.'temp/download'));
|
||||
$ok = $cmd->run('config-set', array(), array('cache_dir', $pear_dir.'/cache'));
|
||||
$ok = $cmd->run('config-set', array(), array('cache_ttl', 300));
|
||||
$ok = $cmd->run('config-set', array(), array('default_channel', 'pear.php.net'));
|
||||
$ok = $cmd->run('config-set', array(), array('preferred_mirror', 'pear.php.net'));
|
||||
|
||||
print('Checking package registry...');
|
||||
// Register packages
|
||||
$packages = array(
|
||||
'Archive_Tar',
|
||||
'Console_Getopt',
|
||||
'HTML_Template_IT',
|
||||
'PEAR',
|
||||
'PEAR_Frontend_Web',
|
||||
'Structures_Graph'
|
||||
);
|
||||
$reg = &$config->getRegistry();
|
||||
if (!file_exists($pear_dir.'/.registry')) {
|
||||
PEAR::raiseError('Directory "'.$pear_dir.'/.registry" does not exist. please check your installation');
|
||||
}
|
||||
|
||||
foreach($packages as $pkg) {
|
||||
$info = $reg->packageInfo($pkg);
|
||||
foreach($info['filelist'] as $fileName => $fileInfo) {
|
||||
if($fileInfo['role'] == "php") {
|
||||
$info['filelist'][$fileName]['installed_as'] =
|
||||
str_replace('{dir}',$dir, $fileInfo['installed_as']);
|
||||
}
|
||||
}
|
||||
$reg->updatePackage($pkg, $info, false);
|
||||
}
|
||||
|
||||
print('<p><em>PEAR_Frontend_Web configured succesfully !</em></p>');
|
||||
$msg = sprintf('<p><a href="%s">Click here to continue</a></p>',
|
||||
$_SERVER['PHP_SELF']);
|
||||
print($msg);
|
||||
$ui->outputEnd(null);
|
||||
die();
|
||||
}
|
||||
|
||||
// Check _isProtected() override (disables the 'not protected' warning)
|
||||
if (isset($pear_frontweb_protected) && $pear_frontweb_protected === true) {
|
||||
$GLOBALS['_PEAR_Frontend_Web_protected'] = true;
|
||||
}
|
||||
|
||||
$cache_dir = $config->get('cache_dir');
|
||||
if (!is_dir($cache_dir)) {
|
||||
include_once 'System.php';
|
||||
if (!System::mkDir('-p', $cache_dir)) {
|
||||
PEAR::raiseError('Directory "'.$cache_dir.'" does not exist and cannot be created. Please check your installation');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['command']) && !is_null($_GET['command'])) {
|
||||
$command = $_GET['command'];
|
||||
} else {
|
||||
$command = 'list';
|
||||
}
|
||||
|
||||
// Prepare and begin output
|
||||
$ui->outputBegin($command);
|
||||
|
||||
// Handle some different Commands
|
||||
switch ($command) {
|
||||
case 'install':
|
||||
case 'uninstall':
|
||||
case 'upgrade':
|
||||
if ($_GET['command'] == 'install') {
|
||||
// also install dependencies
|
||||
$opts['onlyreqdeps'] = true;
|
||||
if (isset($_GET['force']) && $_GET['force'] == 'on') {
|
||||
$opts['force'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($_GET['pkg'], '\\\\') !== false) {
|
||||
$_GET['pkg'] = stripslashes($_GET['pkg']);
|
||||
}
|
||||
$params = array($_GET["pkg"]);
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
$reg = &$config->getRegistry();
|
||||
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
|
||||
$err = $reg->parsePackageName($_GET['pkg']);
|
||||
PEAR::staticPopErrorHandling(); // reset error handling
|
||||
|
||||
if (!PEAR::isError($err)) {
|
||||
$ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command=info&pkg='.$_GET['pkg'],
|
||||
'text' => 'View package information'));
|
||||
}
|
||||
break;
|
||||
case 'run-scripts' :
|
||||
$params = array($_GET['pkg']);
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
break;
|
||||
case 'info':
|
||||
case 'remote-info':
|
||||
$reg = &$config->getRegistry();
|
||||
// we decide what it is:
|
||||
$pkg = $reg->parsePackageName($_GET['pkg']);
|
||||
if ($reg->packageExists($pkg['package'], $pkg['channel'])) {
|
||||
$command = 'info';
|
||||
} else {
|
||||
$command = 'remote-info';
|
||||
}
|
||||
|
||||
$params = array(strtolower($_GET['pkg']));
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'search':
|
||||
if (!isset($_POST['search']) || $_POST['search'] == '') {
|
||||
// unsubmited, show forms
|
||||
$ui->outputSearch();
|
||||
} else {
|
||||
if ($_POST['channel'] == 'all') {
|
||||
$opts['allchannels'] = true;
|
||||
} else {
|
||||
$opts['channel'] = $_POST['channel'];
|
||||
}
|
||||
$opts['channelinfo'] = true;
|
||||
|
||||
// submited, do search
|
||||
switch ($_POST['search']) {
|
||||
case 'name':
|
||||
$params = array($_POST['input']);
|
||||
break;
|
||||
case 'description':
|
||||
$params = array($_POST['input'], $_POST['input']);
|
||||
break;
|
||||
default:
|
||||
PEAR::raiseError('Can\'t search for '.$_POST['search']);
|
||||
break;
|
||||
}
|
||||
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'config-show':
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
|
||||
// if this code is reached, the config vars are submitted
|
||||
$set = PEAR_Command::factory('config-set', $config);
|
||||
foreach($GLOBALS['_PEAR_Frontend_Web_Config'] as $var => $value) {
|
||||
if ($var == 'Filename') {
|
||||
continue; // I hate obscure bugs
|
||||
}
|
||||
if ($value != $config->get($var)) {
|
||||
print('Saving '.$var.'... ');
|
||||
$res = $set->run('config-set', $opts, array($var, $value));
|
||||
$config->set($var, $value);
|
||||
}
|
||||
}
|
||||
print('<p><b>Config saved succesfully!</b></p>');
|
||||
|
||||
$ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command='.$command, 'text' => 'Back to the config'));
|
||||
break;
|
||||
case 'list-files':
|
||||
$params = array($_GET['pkg']);
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
break;
|
||||
case 'list-docs':
|
||||
if (!isset($_GET['pkg'])) {
|
||||
PEAR::raiseError('The webfrontend-command list-docs needs at least one \'pkg\' argument.');
|
||||
break;
|
||||
}
|
||||
|
||||
require_once('PEAR/Frontend/Web/Docviewer.php');
|
||||
$reg = $config->getRegistry();
|
||||
$pkg = $reg->parsePackageName($_GET['pkg']);
|
||||
|
||||
$docview = new PEAR_Frontend_Web_Docviewer($ui);
|
||||
$docview->outputListDocs($pkg['package'], $pkg['channel']);
|
||||
break;
|
||||
case 'doc-show':
|
||||
if (!isset($_GET['pkg']) || !isset($_GET['file'])) {
|
||||
PEAR::raiseError('The webfrontend-command list-docs needs one \'pkg\' and one \'file\' argument.');
|
||||
break;
|
||||
}
|
||||
|
||||
require_once('PEAR/Frontend/Web/Docviewer.php');
|
||||
$reg = $config->getRegistry();
|
||||
$pkg = $reg->parsePackageName($_GET['pkg']);
|
||||
|
||||
$docview = new PEAR_Frontend_Web_Docviewer($ui);
|
||||
$docview->outputDocShow($pkg['package'], $pkg['channel'], $_GET['file']);
|
||||
break;
|
||||
case 'list-all':
|
||||
// Deprecated, use 'list-categories' is used instead
|
||||
if (isset($_GET['chan']) && $_GET['chan'] != '') {
|
||||
$opts['channel'] = $_GET['chan'];
|
||||
}
|
||||
$opts['channelinfo'] = true;
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'list-categories':
|
||||
case 'list-packages':
|
||||
if (isset($_GET['chan']) && $_GET['chan'] != '') {
|
||||
$opts['channel'] = $_GET['chan'];
|
||||
} else {
|
||||
// show 'table of contents' before all channel output
|
||||
$ui->outputTableOfChannels();
|
||||
|
||||
$opts['allchannels'] = true;
|
||||
}
|
||||
if (isset($_GET['opt']) && $_GET['opt'] == 'packages') {
|
||||
$opts['packages'] = true;
|
||||
}
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'list-category':
|
||||
if (isset($_GET['chan']) && $_GET['chan'] != '') {
|
||||
$opts['channel'] = $_GET['chan'];
|
||||
}
|
||||
$params = array($_GET['cat']);
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'list':
|
||||
$opts['allchannels'] = true;
|
||||
$opts['channelinfo'] = true;
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'list-upgrades':
|
||||
$opts['channelinfo'] = true;
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
$ui->outputUpgradeAll();
|
||||
|
||||
break;
|
||||
case 'upgrade-all':
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
$ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command=list',
|
||||
'text' => 'Click here to go back'));
|
||||
break;
|
||||
case 'channel-info':
|
||||
if (isset($_GET['chan']))
|
||||
$params[] = $_GET['chan'];
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'channel-discover':
|
||||
if (isset($_GET['chan']) && $_GET['chan'] != '')
|
||||
$params[] = $_GET['chan'];
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ui->startSession();
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
$ui->finishOutput('Channel Discovery', array('link' =>
|
||||
$_SERVER['PHP_SELF'] . '?command=channel-info&chan=' . urlencode($_GET['chan']),
|
||||
'text' => 'Click Here for ' . htmlspecialchars($_GET['chan']) . ' Information'));
|
||||
break;
|
||||
case 'channel-delete':
|
||||
if (isset($_GET["chan"]))
|
||||
$params[] = $_GET["chan"];
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
$ui->finishOutput('Delete Channel', array('link' =>
|
||||
$_SERVER['PHP_SELF'] . '?command=list-channels',
|
||||
'text' => 'Click here to list all channels'));
|
||||
break;
|
||||
case 'list-channels':
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'channel-update':
|
||||
if (isset($_GET['chan'])) {
|
||||
$params = array($_GET['chan']);
|
||||
}
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$ok = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
case 'update-channels':
|
||||
// update every channel manually,
|
||||
// fixes bug PEAR/#10275 (XML_RPC dependency)
|
||||
// will be fixed in next pear release
|
||||
$reg = &$config->getRegistry();
|
||||
$channels = $reg->getChannels();
|
||||
$command = 'channel-update';
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
|
||||
$success = true;
|
||||
$ui->startSession();
|
||||
foreach ($channels as $channel) {
|
||||
if ($channel->getName() != '__uri') {
|
||||
$success &= $cmd->run($command, $opts,
|
||||
array($channel->getName()));
|
||||
}
|
||||
}
|
||||
|
||||
$ui->finishOutput('Update Channel List', array('link' =>
|
||||
$_SERVER['PHP_SELF'] . '?command=list-channels',
|
||||
'text' => 'Click here to list all channels'));
|
||||
break;
|
||||
default:
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
$res = $cmd->run($command, $opts, $params);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$ui->outputEnd($command);
|
||||
?>
|
||||
36
apps/backend/modules/stApplication/lib/stPearFrontendWeb.php
Normal file
36
apps/backend/modules/stApplication/lib/stPearFrontendWeb.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stApplication
|
||||
*
|
||||
* Ten plik należy do aplikacji stApplication 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 stApplication
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: stPearFrontendWeb.php 3123 2008-12-10 13:29:11Z marek $
|
||||
* @author Marek Jakubowicz <marek.jakubowicz@sote.pl>
|
||||
*/
|
||||
|
||||
|
||||
error_reporting(1); // domyslnie wylaczamy wyswietlanie bledow, gdyz pakiety PEAR ladowane do obslugi PEAR_Frontened_Web wyswietlaja komunikaty strict error
|
||||
require_once ("PEAR.php");
|
||||
|
||||
class stPearFrontendWeb {
|
||||
|
||||
static public function installer() {
|
||||
|
||||
// konfiguracja
|
||||
// @see http://pear.php.net/package/PEAR_Frontend_Web/docs/latest/__filesource/fsource_apidoc_PEAR_Frontend_Web_PEAR_Frontend_Web-0.7.3docsexample.php.html
|
||||
$pear_user_config=sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR."install".DIRECTORY_SEPARATOR."src".DIRECTORY_SEPARATOR.".pearrc";
|
||||
$pear_frontweb_protected = true; // system posiada autoryzacje (symfony) nie wyswietlaj komunikatow o braku autoryzacji
|
||||
|
||||
|
||||
include_once (sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.'backend'.DIRECTORY_SEPARATOR.'modules'.
|
||||
DIRECTORY_SEPARATOR.'stApplication'.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'pearfrontendweb.php');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php stPearFrontendWeb::installer();?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo get_partial("installer"); ?>
|
||||
35
apps/backend/modules/stAuthUsers/config/config.php
Normal file
35
apps/backend/modules/stAuthUsers/config/config.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers 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 stAuthUsers
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: config.php 251 2009-03-30 11:35:06Z marek $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dodawanie routingów
|
||||
*/
|
||||
stPluginHelper::addRouting('stAuth', '/auth/users/:action/*', 'sfGuardUser', 'index', 'backend');
|
||||
stPluginHelper::addRouting('stAuthGroups', '/auth/groups/:action/*', 'sfGuardGroup', 'index', 'backend');
|
||||
stPluginHelper::addRouting('stAuthPermissions', '/auth/permission/:action/*', 'sfGuardPermission', 'index', 'backend');
|
||||
stPluginHelper::addRouting('stAuthUsers', '/auth/users/:action/*', 'sfGuardUser', 'index', 'backend');
|
||||
stPluginHelper::addRouting('sf_guard_signin', '/login', 'sfGuardAuth', 'signin', 'backend');
|
||||
stPluginHelper::addRouting('sf_guard_signout', '/logout', 'sfGuardAuth', 'signout', 'backend');
|
||||
stPluginHelper::addRouting('sf_guard_password', '/request_password', 'sfGuardAuth', 'password', 'backend');
|
||||
|
||||
/**
|
||||
* Włączanie modułów
|
||||
*/
|
||||
stPluginHelper::addEnableModule('sfGuardAuth', 'backend');
|
||||
stPluginHelper::addEnableModule('sfGuardUser', 'backend');
|
||||
stPluginHelper::addEnableModule('sfGuardGroup', 'backend');
|
||||
stPluginHelper::addEnableModule('sfGuardPermission', 'backend');
|
||||
144
apps/backend/modules/stBackend/actions/actions.class.php
Normal file
144
apps/backend/modules/stBackend/actions/actions.class.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
class stBackendActions extends stActions
|
||||
{
|
||||
public function executePreviewMode()
|
||||
{
|
||||
$token = stSecureToken::createDBToken();
|
||||
|
||||
return $this->redirect(stRoutingHelper::generateApplicationUrl('@homepage', 'frontend', null, [
|
||||
'preview_mode' => $token,
|
||||
]));
|
||||
}
|
||||
|
||||
public function executeAdditionalApplicationsList()
|
||||
{
|
||||
$applications = array();
|
||||
|
||||
$routing = sfRouting::getInstance();
|
||||
|
||||
foreach (stConfiguration::getInstance()->getDesktopModules() as $modules)
|
||||
{
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
// if (preg_match('/^app|sm/', $module->getName()))
|
||||
{
|
||||
$applications[$module->getRoute()] = $module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (stApplication::getDefaultDesktopApps() as $app => $name)
|
||||
{
|
||||
// if (preg_match('/^app|sm/', $app))
|
||||
{
|
||||
$module = new stBackendDesktopModule($routing, $app);
|
||||
|
||||
$applications[$module->getRoute()] = $module;
|
||||
}
|
||||
}
|
||||
|
||||
// Usuń powtarzajace sie aplikacje, zostaw w pierwszej kolejnosci odwolania do config
|
||||
// np. jesli jest odwolania do Zamowień: order/list i order/config - to zostaw order/config
|
||||
$app_config = array();
|
||||
$applications_config = array();
|
||||
foreach ($applications as $app_route => $app_object)
|
||||
{
|
||||
preg_match("/action=([a-zA-Z0-9]+)/", $app_route, $matches);
|
||||
if (isset($matches[1]))
|
||||
{
|
||||
$app_action = $matches[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$app_action = "index";
|
||||
}
|
||||
$app_name = $app_object->getName();
|
||||
|
||||
// dopisz aplikację, jesli nie byla dodana lub jeśli byla dodana ale dodana akcja jst inna niz config
|
||||
if ((empty($app_config[$app_name])) || ((!empty($app_config[$app_name])) && ($app_config[$app_name] != "config")))
|
||||
{
|
||||
if (empty($app_config[$app_name]))
|
||||
{
|
||||
// pomiń system punktowy (stary modul, ktory nie zostal usuniety i jest w kodzie, jest ukrywany tylko)
|
||||
// opcja do poprawienia, wstawiona tymczasowo
|
||||
if ($app_name != "stPointsBackend") $applications_config[$app_route] = $app_object;
|
||||
}
|
||||
$app_config[$app_name] = $app_action;
|
||||
}
|
||||
}
|
||||
|
||||
// $this->app_config=$app_config;
|
||||
// end
|
||||
|
||||
$this->applications = $applications_config;;
|
||||
|
||||
uasort($this->applications, function ($m1, $m2)
|
||||
{
|
||||
return strnatcmp(strtolower($m1->getLabel()), strtolower($m2->getLabel()));
|
||||
});
|
||||
}
|
||||
|
||||
public function executeLicense()
|
||||
{
|
||||
$block = stCommunication::blockSite(10);
|
||||
|
||||
if (!$block)
|
||||
{
|
||||
stCommunication::refreshLicenseInformation();
|
||||
|
||||
stPartialCache::clear('stBackend', '_updateInfo', array('app' => 'backend'));
|
||||
|
||||
return $this->redirect($this->getRequest()->getReferer());
|
||||
}
|
||||
}
|
||||
|
||||
public function executeCheckService()
|
||||
{
|
||||
|
||||
stCommunication::refreshLicenseInformation();
|
||||
|
||||
sfLoader::loadHelpers(array('Helper', 'stBackend'));
|
||||
|
||||
return $this->renderText(get_service_information());
|
||||
}
|
||||
|
||||
public function executeUpdateInfoRefresh()
|
||||
{
|
||||
stCommunication::refreshLicenseInformation();
|
||||
|
||||
stPartialCache::clear('stBackend', '_updateInfo', array('app' => 'backend'));
|
||||
|
||||
return $this->renderText($this->getRenderComponent('stBackend', 'updateInfo'));
|
||||
}
|
||||
|
||||
public function executeLicenseInfoRefresh()
|
||||
{
|
||||
stCommunication::refreshLicenseInformation();
|
||||
|
||||
stPartialCache::clear('stBackend', '_licenseInfo', array('app' => 'backend'));
|
||||
|
||||
return $this->renderText($this->getRenderComponent('stBackend', 'licenseInfo'));
|
||||
}
|
||||
|
||||
public function executeChangeLeftMenuVisibility()
|
||||
{
|
||||
$config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance());
|
||||
|
||||
$config->setParameter('left_menu.hidden', $this->getRequestParameter('hidden', false));
|
||||
|
||||
$config->save();
|
||||
}
|
||||
|
||||
public function executeChangeContentViewport()
|
||||
{
|
||||
$config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance());
|
||||
|
||||
$config->setParameter('viewport.expanded', $this->getRequestParameter('expanded', false));
|
||||
|
||||
$config->save();
|
||||
|
||||
return sfView::HEADER_ONLY;
|
||||
}
|
||||
}
|
||||
78
apps/backend/modules/stBackend/actions/components.class.php
Normal file
78
apps/backend/modules/stBackend/actions/components.class.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class stBackendComponents extends sfComponents {
|
||||
|
||||
public function executeMenu()
|
||||
{
|
||||
$this->inverted = false;
|
||||
|
||||
$navigationBarItems = sfConfig::get('app_navigation_bar_items');
|
||||
|
||||
$menu = new stNavigationMenu();
|
||||
|
||||
foreach (sfConfig::get('app_navigation_bar_display') as $id => $items)
|
||||
{
|
||||
if (!isset($navigationBarItems[$id]))
|
||||
{
|
||||
throw new Exception(sprintf('Item "%s" does not exist in navigation_bar.items', $id));
|
||||
}
|
||||
|
||||
$navigationBarItem = $navigationBarItems[$id];
|
||||
|
||||
$item = $menu->addItem($id, $navigationBarItem['label'], isset($navigationBarItem['route']) ? $navigationBarItem['route'] : null, $navigationBarItem);
|
||||
|
||||
if ($items)
|
||||
{
|
||||
foreach (array_keys($items) as $childId)
|
||||
{
|
||||
if (!isset($navigationBarItems[$childId]))
|
||||
{
|
||||
throw new Exception(sprintf('Item "%s" does not exist in navigation_bar.items', $id));
|
||||
}
|
||||
|
||||
$navigationBarItem = $navigationBarItems[$childId];
|
||||
|
||||
$item->addItem($childId, $navigationBarItem['label'], isset($navigationBarItem['route']) ? $navigationBarItem['route'] : null, $navigationBarItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$configItem = $menu->getItem('configuration');
|
||||
|
||||
foreach (stConfiguration::getGroups() as $name => $title)
|
||||
{
|
||||
if (stConfiguration::getInstance()->hasDesktopModules($name))
|
||||
{
|
||||
$configItem->addItem($name, $title, '@stConfigurationPlugin?group='.$name.'#'.$name, array(
|
||||
'i18n' => 'stConfigurationBackend',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$this->items = $menu->getItems();
|
||||
}
|
||||
|
||||
public function executeAbuseInformation() {
|
||||
|
||||
}
|
||||
|
||||
public function executeUpdateInfo()
|
||||
{
|
||||
$version = stCommunication::getCurrentVersion();
|
||||
|
||||
stLicenseAbuse::checkLicenseAbuseStatus();
|
||||
|
||||
$this->has_valid_license = stCommunication::hasValidLicense();
|
||||
|
||||
$this->update = version_compare(stRegisterSync::getPackageVersion('soteshop'), $version, '<');
|
||||
}
|
||||
|
||||
public function executeLicenseInfo()
|
||||
{
|
||||
$info = stCommunication::getLicenseInfo();
|
||||
$config = stConfig::getInstance('stRegister');
|
||||
$this->change_subscription_url = stSoteHelper::getChangeSubscriptionUrl($this->getUser()->getCulture());
|
||||
$this->config = $config;
|
||||
$this->license_valid_until = $info['guarantee'];
|
||||
}
|
||||
}
|
||||
12
apps/backend/modules/stBackend/config/cache.yml
Normal file
12
apps/backend/modules/stBackend/config/cache.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
_updateInfo:
|
||||
enabled: on
|
||||
lifetime: 43200
|
||||
|
||||
_licenseInfo:
|
||||
enabled: on
|
||||
lifetime: 43200
|
||||
|
||||
additionalApplicationsList:
|
||||
enabled: off
|
||||
clientLifeTime: 0
|
||||
lifeTime: 0
|
||||
2
apps/backend/modules/stBackend/config/security.yml
Normal file
2
apps/backend/modules/stBackend/config/security.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
license:
|
||||
is_secure: off
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php if(stLicenseAbuse::isBlocked()):?>
|
||||
<div id="abuse_information">
|
||||
<span>
|
||||
<?php echo __('Wystąpił błąd podczas weryfikacji licencji. Proszę o pilny kontakt z SOTE. Sklep może zostać zablokowany.');?>
|
||||
<a href="<?php echo __('http://www.sote.pl/page/block');?>" target="_blank">
|
||||
<?php echo __('Więcej informacji...');?>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
$.post('/update.php/communication/check');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
use_helper('stBackend');
|
||||
/**
|
||||
* @var stBackendDesktopModule[] $applications
|
||||
*/
|
||||
?>
|
||||
<div class="application_shortcuts" style="position: relative;z-index: 10;">
|
||||
<ul>
|
||||
<?php
|
||||
$check_file = sfConfig::get('sf_plugins_dir'). DIRECTORY_SEPARATOR. 'stIfirmaPlugin';
|
||||
foreach ($applications as $application):
|
||||
if (!$application->isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($application->getName(), array('stPointsBackend', 'stAddThisBackend')) && stTheme::hideOldConfiguration())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($application->getRoute()=='stInvoiceBackend/ifirmaConfig' && !file_exists($check_file))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = st_url_for($application->getRoute());
|
||||
|
||||
?>
|
||||
<li>
|
||||
<div class="icon" style="float: left;">
|
||||
<a target="_parent" href="<?php echo $url ?>" style="background-image: url(<?php echo get_app_icon($application->getIcon()) ?>);"></a>
|
||||
</div>
|
||||
<div class="name">
|
||||
<a target="_parent" href="<?php echo $url ?>"><?php echo $application->getLabel() ?></a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
40
apps/backend/modules/stBackend/templates/_licenseInfo.php
Normal file
40
apps/backend/modules/stBackend/templates/_licenseInfo.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<a class="with-icon" href="#">
|
||||
<?php echo st_backend_get_icon('info', array('size' => 22)) ?>
|
||||
<span><?php echo __('Informacje o licencji') ?></span>
|
||||
</a>
|
||||
|
||||
<ul>
|
||||
<li class="update-info-refresh"><div class="static"><a href="<?php echo st_url_for('stBackend/licenseInfoRefresh') ?>"><?php echo st_backend_get_icon('refresh', array('size' => 18)) ?></a></div></li>
|
||||
<li class="preloader_26x26"></li>
|
||||
<li>
|
||||
<span class="static text-nowrap">
|
||||
<?php echo __('Usługa', null, 'stBackendMain') ?>: <?php echo stCommunication::getSubscriptionLabel() ?><br>
|
||||
<?php echo __("Usługa ważna do", null, 'stBackendMain') ?>: <b><?php echo $license_valid_until ?></b><br>
|
||||
<?php echo __('Limit produktów', null, 'stBackendMain') ?>: <?php echo stLimits::getInstance()->getLimit() ?><br>
|
||||
<?php echo __('Limit aktywnych importów', null, 'stBackendMain') ?>: <?php echo stTaskSchedulerImportLimit::getLimit() ?><br>
|
||||
</span>
|
||||
</li>
|
||||
<li><a href="<?php echo $change_subscription_url ?>" target="_blank"><?php echo __($config->get('demo') ? 'Zamów pełną wersję sklepu' : 'Zmień usługę', null, 'stBackendMain') ?></a></li>
|
||||
<li>
|
||||
<span class="static text-nowrap"><?php echo __('Licencja', null, 'stBackendMain') ?>: <?php echo $config->get('license') ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
$('#license-menu .update-info-refresh a').click(function() {
|
||||
var link = $(this);
|
||||
|
||||
$('#license-menu .preloader_26x26').show();
|
||||
|
||||
$.get(link.attr('href'), function(response) {
|
||||
$('#license-menu').html(response);
|
||||
$('#license-menu .preloader_26x26').hide();
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
23
apps/backend/modules/stBackend/templates/_menu.php
Normal file
23
apps/backend/modules/stBackend/templates/_menu.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use_helper('stBackend');
|
||||
/**
|
||||
* @var stNavigationMenuItem[] $items
|
||||
*/
|
||||
?>
|
||||
<ul<?php if ($inverted): ?> class="inverted"<?php endif ?>>
|
||||
<?php foreach ($items as $item): $children = $item->getItems() ?>
|
||||
<li<?php if ($children): ?> class="expandable"<?php endif; ?>>
|
||||
<?php if ($item->getUrl()): ?>
|
||||
<a href="<?php echo st_url_for($item->getUrl()) ?>">
|
||||
<?php if($item->getIcon()): ?><img src="<?php echo get_app_icon($item->getIcon()); ?>" alt="" /><?php endif; ?>
|
||||
<span><?php echo __($item->getTitle(), null, $item->getI18n()) ?></span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span><?php echo __($item->getTitle(), null, $item->getI18n()) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ($children): ?>
|
||||
<?php echo st_get_fast_partial('stBackend/menu', array('items' => $children, 'inverted' => !$inverted), true) ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
72
apps/backend/modules/stBackend/templates/_popupInfo.php
Normal file
72
apps/backend/modules/stBackend/templates/_popupInfo.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<div id="popup-info">
|
||||
<div class="cd-popup" role="alert">
|
||||
<div class="cd-popup-container">
|
||||
<a href="#0" class="cd-popup-close"></a>
|
||||
<img class="open-image-popup" src="/images/backend/icons/open-block.png" />
|
||||
<h5 id="popup-info-title"></h5>
|
||||
<p id="popup-info-desc"></p>
|
||||
<div class="admin_actions" style="float: none;">
|
||||
<input id="popup-info-button" type="button" value="" style="background-image: url(/images/backend/icons/open_add_to_cart.png)">
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
<?php if($isOpen):?>
|
||||
$(document).on("click", "a", function(event) {
|
||||
if($(this).attr('href').match(/.*product\/(import|export)/i)) {
|
||||
event.preventDefault();
|
||||
$('#popup-info-title').text('<?php echo __('Funkcja niedostępna dla wersji Open');?>');
|
||||
$('#popup-info-desc').text('');
|
||||
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/licencja-soteshop.html');?>')");
|
||||
$('#popup-info-button').attr('value', "<?php echo __('Zamów wersję komercyjną');?>");
|
||||
$('.cd-popup-container').css('width', '450px');
|
||||
$('.cd-popup').addClass('is-visible');
|
||||
}
|
||||
});
|
||||
<?php endif;?>
|
||||
|
||||
<?php if($showProductAddInfo):?>
|
||||
$("input[name='duplicate']").attr('onclick','').unbind('click');
|
||||
$(document).on("click", "input[type='button'], input[type='submit']", function(event) {
|
||||
if($(this).attr('name') == 'duplicate'<?php if (!$hasId):?> || $(this).attr('name') == 'save' || $(this).attr('name') == 'save_and_add' <?php endif;?>) {
|
||||
event.preventDefault();
|
||||
$('#popup-info-title').text('<?php echo __('Nie można dodać nowego produktu.');?>');
|
||||
<?php if($isOpen):?>
|
||||
$('#popup-info-desc').html('<?php echo __('Wykorzystano dostępny limit').' '.$sProductsLimit.' '.__('produktów dla wersji Open.<br/>Zamów wersję komercyjną i zwiększ automatycznie limit produktów do 10 000.');?>');
|
||||
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/licencja-soteshop.html');?>')");
|
||||
$('#popup-info-button').attr('value', "<?php echo __('Zamów wersję komercyjną');?>");
|
||||
<?php elseif($productsLimit == 100):?>
|
||||
$('#popup-info-desc').html('<?php echo __('Wykorzystano dostępny limit').' '.$sProductsLimit.' '.__('produktów.<br/>Zwiększ liczbę produtków do 10 000.');?>');
|
||||
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/wynajem-aplikacji.html');?>')");
|
||||
$('#popup-info-button').attr('value', "<?php echo __('Zmień wersję wynajmu programu');?>");
|
||||
$('.cd-popup-container').css('width', '450px');
|
||||
<?php else:?>
|
||||
$('#popup-info-desc').html('<?php echo __('Wykorzystano dostępny limit').' '.$sProductsLimit.' '.__('produktów.<br/>Zwiększ liczbę produktów nawet do 30 000.');?>');
|
||||
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/zwiekszenie-ilosc-produktow.html');?>')");
|
||||
$('#popup-info-button').attr('value', "<?php echo __('Zamów zwiększenie ilości produktów');?>");
|
||||
$('.cd-popup-container').css('width', '450px');
|
||||
<?php endif;?>
|
||||
$('.cd-popup').addClass('is-visible');
|
||||
}
|
||||
});
|
||||
<?php endif;?>
|
||||
|
||||
$('.cd-popup').on('click', function(event) {
|
||||
if($(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup')) {
|
||||
event.preventDefault();
|
||||
$(this).removeClass('is-visible');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).keyup(function(event) {
|
||||
if(event.which == '27') {
|
||||
$('.cd-popup').removeClass('is-visible');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
56
apps/backend/modules/stBackend/templates/_updateInfo.php
Normal file
56
apps/backend/modules/stBackend/templates/_updateInfo.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<a class="with-icon" href="#">
|
||||
<?php echo st_backend_get_icon('refresh', array('size' => 22)) ?>
|
||||
<span><?php echo __('Aktualizacja') ?></span>
|
||||
<?php if ($update || !$has_valid_license || stLicenseAbuse::isBlocked()): ?>
|
||||
<?php echo st_backend_get_icon('info') ?>
|
||||
<?php endif ?>
|
||||
</a>
|
||||
|
||||
<?php if ($update): ?>
|
||||
<ul>
|
||||
<li class="update-info-refresh"><div class="static"><a href="<?php echo st_url_for('stBackend/updateInfoRefresh') ?>"><?php echo st_backend_get_icon('refresh', array('size' => 18)) ?></a></div></li>
|
||||
<li class="preloader_26x26"></li>
|
||||
<li><span class="static"><?php echo __('Twój sklep jest nieaktualny') ?></span></li>
|
||||
<li><span class="static update-info"><?php echo get_service_information() ?></span></li>
|
||||
<?php if ($has_valid_license): ?>
|
||||
<li><a href="/update.php" target="_blank"><?php echo __('Przejdź do aktualizacji') ?></a></li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<span class="static version"><?php echo get_backend_version_information() ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<ul>
|
||||
<li class="update-info-refresh"><div class="static"><a href="<?php echo st_url_for('stBackend/updateInfoRefresh') ?>"><?php echo st_backend_get_icon('refresh', array('size' => 18)) ?></a></div></li>
|
||||
<li class="preloader_26x26"></li>
|
||||
<li><span class="static update-info"><?php echo get_service_information() ?></span></li>
|
||||
<?php if ($has_valid_license): ?>
|
||||
<li>
|
||||
<a href="/update.php" target="_blank">
|
||||
<span><?php echo __('Przejdź do aktualizacji') ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<span class="static version"><?php echo get_backend_version_information() ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
$('#update-menu .update-info-refresh a').click(function() {
|
||||
var link = $(this);
|
||||
|
||||
$('#update-menu .preloader_26x26').show();
|
||||
|
||||
$.get(link.attr('href'), function(response) {
|
||||
$('#update-menu').html(response);
|
||||
$('#update-menu .preloader_26x26').hide();
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php use_helper('stAdminGenerator') ?>
|
||||
|
||||
<?php use_helper('stBackend') ?>
|
||||
<div id="list-all-apps" class="application_shortcuts bs-mt-4">
|
||||
<div class="nav-all-apps">
|
||||
<?php //strtoupper($firstLetter); ?>
|
||||
<?php foreach ($applications as $application):
|
||||
if (!$application->isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = st_url_for($application->getRoute());
|
||||
?>
|
||||
<?php if($application->getName() != 'appProductAttributeBackend' && $application->getName() != 'appAdditionalDescBackend'): ?>
|
||||
<?php
|
||||
if (!isset($firstLetter) || strtolower($application->getLabel()) [0] != strtolower($firstLetter)){
|
||||
echo '<a href="#letter'.$application->getLabel()[0].'">' . strtoupper($application->getLabel()[0]) . '</a>';
|
||||
$firstLetter = strtolower($application->getLabel()[0]);
|
||||
}
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php $firstLetter = null; ?>
|
||||
<ul class="list-all-icons clearfix">
|
||||
<?php foreach ($applications as $application):
|
||||
if (!$application->isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$url = st_url_for($application->getRoute());
|
||||
?>
|
||||
<?php
|
||||
if (!isset($firstLetter) || strtolower($application->getLabel()[0]) != strtolower($firstLetter)) {
|
||||
echo '<li class="line" id="letter' . $application->getLabel()[0] . '"><span>' . strtoupper($application->getLabel()[0]) . '</span></li>';
|
||||
$firstLetter = strtolower($application->getLabel()[0]);
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<div class="icon" style="float: left;">
|
||||
<a target="_parent" href="<?php echo $url ?>" style="background-image: url(<?php echo get_app_icon($application->getIcon()) ?>);"></a>
|
||||
</div>
|
||||
<div class="name">
|
||||
<a target="_parent" href="<?php echo $url ?>"><?php echo $application->getLabel() ?></a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php if(count($applications) == 2): ?>
|
||||
<div style="margin: 10px; min-height: 50px; border: 1px solid #ccc; padding: 10px;">
|
||||
<p style="font-family: Helvetica,Arial,sans-serif; font-size: 12px; padding-top: 15px;"><?php echo __('Brak zainstalowanych dodatkowych aplikacji', null, 'stBackend') ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).on('click', 'a[href^="#"]', function (event) {
|
||||
event.preventDefault();
|
||||
positionTop = $($.attr(this, 'href')).offset().top;
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: positionTop - 140
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
<div id="block-site-info"><?php echo get_service_information() ?></div>
|
||||
106
apps/backend/modules/stBackendMain/actions/actions.class.php
Normal file
106
apps/backend/modules/stBackendMain/actions/actions.class.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBackend
|
||||
*
|
||||
* Ten plik należy do aplikacji stBackend 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 stBackend
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: actions.class.php 16777 2012-01-18 14:57:18Z bartek $
|
||||
* @author Marek Jakubowicz <marek.jakubowicz@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Akcje modułu stBackendMain.
|
||||
*
|
||||
* @package stBackend
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stBackendMainActions extends stActions
|
||||
{
|
||||
|
||||
/**
|
||||
* Lista aplikacji.
|
||||
* Lista wyświetlana na głównej stronie backend w postaci ikonek.
|
||||
*/
|
||||
public function executeList()
|
||||
{
|
||||
$backendMainConfig = stConfig::getInstance($this->getContext(), 'stBackendMain');
|
||||
|
||||
if($backendMainConfig->get('is_icon_menu') == 1)
|
||||
{
|
||||
$this->apps = stApplication::getDefaultDesktopApps();
|
||||
} elseif($backendMainConfig->get('is_icon_menu') == 2) {
|
||||
$this->apps = stApplication::getDefaultDesktopApps('app_default_all_desktop');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function executeChangeBackendView()
|
||||
{
|
||||
$backendMainConfig = stConfig::getInstance($this->getContext(), 'stBackendMain');
|
||||
|
||||
$backendView = $this->getRequestParameter('backend_view');
|
||||
|
||||
if($backendView == "icon")
|
||||
{
|
||||
$backendMainConfig->set('is_icon_menu', 1);
|
||||
$backendMainConfig->save();
|
||||
}
|
||||
|
||||
if($backendView == "icon_all")
|
||||
{
|
||||
$backendMainConfig->set('is_icon_menu', 2);
|
||||
$backendMainConfig->save();
|
||||
}
|
||||
|
||||
if($backendView == "info")
|
||||
{
|
||||
$backendMainConfig->set('is_icon_menu', 0);
|
||||
$backendMainConfig->save();
|
||||
}
|
||||
|
||||
$this->redirect('@homepage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Lista wszystkich zainstalowanych aplikacji.
|
||||
* Lista wyświetlana na głównej stronie backend w postaci ikonek.
|
||||
*/
|
||||
public function executeListAll()
|
||||
{
|
||||
$this->apps = stApplication::getApps();
|
||||
}
|
||||
|
||||
public function executeOpen()
|
||||
{
|
||||
|
||||
$action_stack = $this->getContext()->getActionStack();
|
||||
|
||||
if ($action_stack->getEntry($action_stack->getSize() - 2))
|
||||
{
|
||||
|
||||
$this->module_name = $action_stack->getEntry($action_stack->getSize() - 2)->getModuleName();
|
||||
|
||||
$this->action_name = $action_stack->getEntry($action_stack->getSize() - 2)->getActionName();
|
||||
|
||||
}
|
||||
|
||||
$this->lang = $this->getUser()->getCulture();
|
||||
|
||||
$this->showChangeLicenseButton = false;
|
||||
|
||||
if (stLicense::isOpen()) $this->showChangeLicenseButton = true;
|
||||
}
|
||||
|
||||
public function executeTimeRequestAjax() {
|
||||
return sfView::NONE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBackend
|
||||
*
|
||||
* Ten plik należy do aplikacji stBackend 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 stBackend
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 15035 2011-09-08 13:42:20Z michal $
|
||||
* @author Marek Jakubowicz <marek.jakubowicz@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Akcje modułu stBackendMain.
|
||||
*
|
||||
* @package stBackend
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stBackendMainComponents extends sfComponents
|
||||
{
|
||||
public function executeShowBrowsers()
|
||||
{
|
||||
$this->ie = false;
|
||||
$this->version = "";
|
||||
|
||||
$stWebRequest = new stWebRequest();
|
||||
$httpUserAgent = $stWebRequest->getHttpUserAgent();
|
||||
|
||||
if(ereg("MSIE 8.0", $httpUserAgent))
|
||||
{
|
||||
$this->ie = true;
|
||||
$this->version = "8.0";
|
||||
}
|
||||
}
|
||||
|
||||
public function executeShowNaviBar()
|
||||
{
|
||||
$backendMainConfig = stConfig::getInstance($this->getContext(), 'stBackendMain');
|
||||
$this->isNaviBar = $backendMainConfig->get('is_navi_bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* Desktop icons
|
||||
*/
|
||||
public function executeDesktopIcons()
|
||||
{
|
||||
$this->apps = stApplication::getDefaultDesktopApps();
|
||||
// tmporaray salution for backend emulation m@sote.pl 2011-01-19 not for release!!!
|
||||
// changed also listSuccess.php check diff
|
||||
$i=1;$this->apps1=array();$this->apps2=array();
|
||||
|
||||
foreach ($this->apps as $key=>$val)
|
||||
{
|
||||
$this->apps1[$key]=$val;
|
||||
}
|
||||
// end
|
||||
}
|
||||
|
||||
public function executeTimeRequest() {
|
||||
$this->time = (time()+5400)*1000;
|
||||
}
|
||||
}
|
||||
7
apps/backend/modules/stBackendMain/config/cache.yml
Normal file
7
apps/backend/modules/stBackendMain/config/cache.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
_showNaviBar:
|
||||
enabled: on
|
||||
clientLifeTime: 0
|
||||
lifeTime: 0
|
||||
view:
|
||||
stylesheets: [backend/ddlevelsfiles/ddlevelsmenu-base.css, backend/ddlevelsfiles/ddlevelsmenu-topbar.css, backend/ddlevelsfiles/ddlevelsmenu-sidebar.css]
|
||||
javascripts: [backend/ddlevelsfiles/ddlevelsmenu.js]
|
||||
5
apps/backend/modules/stBackendMain/config/view.yml
Normal file
5
apps/backend/modules/stBackendMain/config/view.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
addSuccess:
|
||||
has_layout: off
|
||||
|
||||
all:
|
||||
has_layout: on
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBackend
|
||||
*
|
||||
* Ten plik należy do aplikacji stBackend 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 stBackend
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: actions.class.php 7165 2010-08-02 12:15:47Z marek $
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Provides an interface to backend desktop
|
||||
*
|
||||
* @package stBackend
|
||||
* @subpackage libs
|
||||
*/
|
||||
class stBackendDesktop
|
||||
{
|
||||
protected static $instance = null;
|
||||
|
||||
protected
|
||||
$modules = array(),
|
||||
$routing = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* Singleton
|
||||
*
|
||||
* @param stBackendDesktop $base_class
|
||||
* @return stBackendDesktop
|
||||
*/
|
||||
public static function getInstance($base_class = null)
|
||||
{
|
||||
if (null === self::$instance)
|
||||
{
|
||||
if (null === $base_class)
|
||||
{
|
||||
$base_class = __CLASS__;
|
||||
}
|
||||
|
||||
self::$instance = new $base_class();
|
||||
|
||||
self::$instance->initialize();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intializes this desktop
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
$this->routing = sfRouting::getInstance();
|
||||
|
||||
$modules = sfConfig::get('app_stBackend_desktop');
|
||||
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
$this->addModule($module);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Adds antother module
|
||||
*
|
||||
* @param mixed $params package name or custom custom array('label' => 'Module label', 'route' => '@myExampleRoute', 'icon' => 'myExample.png')
|
||||
*/
|
||||
public function addModule($params = array())
|
||||
{
|
||||
$this->modules[] = new stBackendDesktopModule($this->routing, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrieves modules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getModules()
|
||||
{
|
||||
return $this->modules;
|
||||
}
|
||||
}
|
||||
173
apps/backend/modules/stBackendMain/templates/OpenSuccess.php
Normal file
173
apps/backend/modules/stBackendMain/templates/OpenSuccess.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php use_helper('I18N', 'stAdminGenerator'); ?>
|
||||
<?php use_stylesheet("backend/open.css"); ?>
|
||||
<?php echo st_get_admin_head('Open', __('Opcja ta jest dostępna TYLKO w wersji komercyjnej.', array()), __('Korzystasz z darmowej wersji Open', array()),NULL) ?>
|
||||
<div id="open_site">
|
||||
<div class="left_side">
|
||||
<div class="feature_title">
|
||||
<div class="feature_title_left"><?php echo __('Dodatkowe funkcje komercyjne') ?></div>
|
||||
<div class="feature_title_right"></div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style="float: left; width: 500px; border-left: 1px solid #BFC0BF; text-align: left; padding-left: 10px;">
|
||||
<div class="open-form-row-first">
|
||||
<div class="open-form-row-title"><?php echo __('Aktualizacje (nowe funkcje) dla wersji 6 komercyjne') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<div class="open-form-row-title"><?php echo __('Kodowanie danych klientów w bazie danych') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($action_name == 'setConfiguration'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Edycja wybranych danych na listach w panelu') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($action_name == 'mode'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Edycja zamówień') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($action_name == 'couponCodeList'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Kody rabatowe') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stPointsBackend' || $action_name == 'pointsInfoEdit'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('System punktowy') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stAllegroBackend' || $action_name == 'allegroList'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Allegro') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row-last">
|
||||
<?php if ($module_name == 'sfGuardGroup'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Uprawnienia administratorów') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row-last">
|
||||
<?php if ($module_name == 'appProductAttributeBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Atrybuty produktów') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row-last">
|
||||
<?php if ($module_name == 'stGroupPriceBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Grupy cenowe') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row-last">
|
||||
<?php if ($action_name == 'addPriceList'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Ceny w walutach') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div class="feature_title">
|
||||
<div class="feature_title_left"><?php echo __('Systemy płatności') ?></div>
|
||||
<div class="feature_title_right"></div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style="float: left; width: 500px; border-left: 1px solid #BFC0BF; text-align: left; padding-left: 10px;">
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stPlatnosciPlBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('PayU') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stDotpayBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Dotpay') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stPrzelewy24Backend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Przelewy24') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stLukasBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Lukas') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stPolcardBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Polcard') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stEcardBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('eCard') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div class="feature_title_last">
|
||||
<div class="feature_title_left"><?php echo __('Porównywarki') ?></div>
|
||||
<div class="feature_title_right"></div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style="float: left; width: 500px; border-left: 1px solid #BFC0BF; text-align: left; padding-left: 10px;">
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stCeneoBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Ceneo') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stZakupomatBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Zakupomat') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stNokautBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Nokaut') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stOferciakBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Oferciak') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stOkazjeBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Okazje') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stRadarBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Radar') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stSkapiecBackend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Skąpiec') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
<div class="open-form-row">
|
||||
<?php if ($module_name == 'stSklepy24Backend'): ?><div class="open-form-row-title-selected"><?php else: ?><div class="open-form-row-title"><?php endif; ?><?php echo __('Sklepy24') ?></div>
|
||||
<div><img src="/images/backend/beta/icons/16x16/tick.png" alt="plus" width="22" height="18"/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div class="right_side">
|
||||
<div style="clear: both;"></div>
|
||||
<div style="float: left; width: 553px; padding-right: 20px;">
|
||||
<div class="order_license"><?php if ($lang == 'pl_PL'): ?> <a target="sote" href="http://www.sote.pl/licencja-soteshop.html"> <?php else: ?> <a target="sote" href="http://www.soteshop.com/soteshop-license.html"> <?php endif; ?><?php echo __('Zamów wersję komercyjną za'); ?></a> <b><?php if ($lang == 'pl_PL'): ?> 1990 zł<?php else: ?> €499.00<?php endif; ?></b><?php echo ', '.__('a otrzymsz dodatkowo') ?>:</div>
|
||||
<div class="open-form-row-right">
|
||||
<div class="open-form-row-right-title"><?php echo __('Gwarancję na program') ?></div>
|
||||
<div class="right-price"><?php if ($lang == 'pl_PL'): ?> 12 miesięcy <?php else: ?> 12 months <?php endif; ?></div>
|
||||
</div>
|
||||
<div class="open-form-row-right">
|
||||
<div class="open-form-row-right-title"><?php echo __('Pomoc techniczną') ?></div>
|
||||
<div class="right-price"><?php if ($lang == 'pl_PL'): ?> 3 miesiące <?php else: ?> 3 months <?php endif; ?></div>
|
||||
</div>
|
||||
<div class="open-form-row-right">
|
||||
<div class="open-form-row-right-title"><?php echo __('Kupon do <a href="http://www.sote.pl/category/aplikacje" target="_blank">WebStore</a>') ?></div>
|
||||
<div class="right-price"><?php if ($lang == 'pl_PL'): ?> 100 zł <?php else: ?> €25.00 <?php endif; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div style="margin: 50px 0px 50px 180px;">
|
||||
<?php if ($lang == 'pl_PL'): ?> <a class="aaa" target="sote" href="http://www.sote.pl/licencja-soteshop.html"> <?php else: ?> <a class="aaa" target="sote" href="http://www.soteshop.com/soteshop-license.html"> <?php endif; ?><span><?php echo __('Zamów wersję komercyjną') ?></span></a>
|
||||
</div>
|
||||
<div style="margin: 10px 0px 60px 130px;">
|
||||
<?php if ($lang == 'pl_PL'): ?>
|
||||
<img src="/images/backend/open/open_ecommerce.png">
|
||||
<?php else: ?>
|
||||
<img src="/images/backend/open/open_en_ecommerce.png">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($showChangeLicenseButton):?>
|
||||
<?php echo st_get_admin_actions_head('style="margin-top: 10px;');?>
|
||||
<?php echo st_get_admin_action('edit', __('Aktywuj wersje komercyjną', null, 'stBackendMain'), 'stShopInfoBackend/changeLicense');?>
|
||||
<?php echo st_get_admin_actions_foot();?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php use_helper('I18N', 'Text', 'stAdminGenerator', 'Object', 'ObjectAdmin', 'stDate', 'stProductImage','stCurrency','stWidgets') ?>
|
||||
<?php $route = sfRouting::getInstance(); ?>
|
||||
|
||||
|
||||
<?php echo st_open_widget('Apps', __('Aplikacje')) ?>
|
||||
<?php $count = 0; ?>
|
||||
<?php foreach ($apps1 as $id => $title): ?>
|
||||
<?php $count = $count + 1; ?>
|
||||
<?php $route_name = '@' . $id ?>
|
||||
<?php $routeName = $route->hasRouteName($id . 'Default') ? $route_name . 'Default' : $route_name; ?>
|
||||
<?php $routeInfo = $route->getRouteByName($routeName); ?>
|
||||
<?php $moduleName = $routeInfo[4]['module']; ?>
|
||||
<div class="img_icons_main">
|
||||
<div class="box_icons_main">
|
||||
<?php echo link_to(image_tag('backend/main/icons/'.$id, array(
|
||||
'id' => 'app_'.$id,
|
||||
'class' => 'qpanel_apps',
|
||||
'width' => '56px',
|
||||
'height' => '56px',
|
||||
|
||||
)), $routeName) ?>
|
||||
<div class="font_normal_main">
|
||||
<?php echo link_to("<nobr>".__($title, null, $moduleName)."</nobr>", $routeName); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php echo st_close_widget();?>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php use_helper('I18N') ?>
|
||||
<?php if($ie):
|
||||
?>
|
||||
<div class="form-errors">
|
||||
<h2><?php echo __('Korzystasz z przeglądarki Internet Explorer 8.') ?></h2>
|
||||
<dl>
|
||||
<dd style="text-align: center">
|
||||
<?php echo __('Dla poprawnego działania panelu administracyjnego sklepu zalecamy skorzystanie z innej przeglądarki, zgodnej ze standardem W3C. Poniżej lista przeglądarek zalecanych do obsługi panela administracyjnego:') ?><br/>
|
||||
<?php echo link_to("FireFox","http://www.mozilla-europe.org/pl/firefox/", "target=>_blank") ?>
|
||||
<?php echo link_to("Chrome","http://www.google.com/chrome/index.html?hl=pl&brand=CHMG&utm_source=pl", "target=>_blank") ?>
|
||||
<?php echo link_to("Opera","http://operapl.net/", "target=>_blank") ?><br/>
|
||||
<?php echo __('Więcej informacji na temat instalacji przeglądarek znajdziecie Państwo') ?> <?php echo link_to(__('tutaj'),"http://www.sote.pl/trac/wiki/doc/webbrowsers", "target=>_blank") ?>.
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
251
apps/backend/modules/stBackendMain/templates/_showNaviBar.php
Normal file
251
apps/backend/modules/stBackendMain/templates/_showNaviBar.php
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php use_helper('I18N') ?>
|
||||
<?php if($isNaviBar == 1): ?>
|
||||
<?php use_stylesheet("backend/ddlevelsfiles/ddlevelsmenu-base.css"); ?>
|
||||
<?php use_stylesheet("backend/ddlevelsfiles/ddlevelsmenu-topbar.css"); ?>
|
||||
<?php use_stylesheet("backend/ddlevelsfiles/ddlevelsmenu-sidebar.css"); ?>
|
||||
|
||||
<?php use_javascript("backend/ddlevelsfiles/ddlevelsmenu.js"); ?>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
<div id="ddtopmenubar" class="mattblackmenu">
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Home'),"@homepage")?></li>
|
||||
<li><?php echo st_link_to(__('Zamówienia', null, 'stOrder'),"order", array('rel' => 'ddsubmenu1'))?></li>
|
||||
<li><?php echo st_link_to(__('Produkty', null, 'stProduct'),"product/index" , array('rel' => 'ddsubmenu2'))?></li>
|
||||
<li><?php echo st_link_to(__('Klienci', null, 'stUser'),"user/index" , array('rel' => 'ddsubmenu3'))?></li>
|
||||
<li><?php echo st_link_to(__('Strony www', null, 'stWebpageBackend'),"webpage/index" , array('rel' => 'ddsubmenu4'))?></li>
|
||||
<li><?php echo st_link_to(__('Integracje'),"#" , array('rel' => 'ddsubmenu5'))?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"configuration/list" , array('rel' => 'ddsubmenu6'))?></li>
|
||||
<li><?php echo st_link_to(__('Aktualizacja'),"../update.php/stInstallerWeb", array('target' => '_blank'))?></li>
|
||||
|
||||
<li style="float:right"><?php echo st_link_to(image_tag('backend/main/icons/info.png'),"stBackendMain/changeBackendView?backend_view=info");?></li>
|
||||
<li style="float:right"><?php echo st_link_to(image_tag('backend/main/icons/icons_all.png'),"stBackendMain/changeBackendView?backend_view=icon_all");?></li>
|
||||
<li style="float:right"><?php echo st_link_to(image_tag('backend/main/icons/icons.png'),"stBackendMain/changeBackendView?backend_view=icon");?></li>
|
||||
<li style="float:right">
|
||||
<div id="change-language">
|
||||
<?php st_include_partial('stLanguageBackend/changeLanguage');?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
ddlevelsmenu.setup("ddtopmenubar", "topbar") //ddlevelsmenu.setup("mainmenuid", "topbar")
|
||||
</script>
|
||||
|
||||
<ul id="ddsubmenu1" class="ddsubmenustyle">
|
||||
<li><?php echo st_link_to(__('Zamówienia', null, 'stOrder'),"order")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista zamówień', null, 'stOrder'),"order")?></li>
|
||||
<li><?php echo st_link_to(__('Lista statusów', null, 'stOrder'),"order/orderStatusList")?></li>
|
||||
<li><?php echo st_link_to(__('Zamówienia Allegro', null, 'stOrder'),"order/allegroList")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"order/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Faktury', null, 'stInvoiceBackend'),"invoice")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Faktury wystawione', null, 'stInvoiceBackend'),"invoice")?></li>
|
||||
<li><?php echo st_link_to(__('Faktury do wystawienia', null, 'stInvoiceBackend'),"invoice/requestList")?></li>
|
||||
<li><?php echo st_link_to(__('Faktury proforma', null, 'stInvoiceBackend'),"invoice/proformaList")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"invoice/configCustom")?></li>
|
||||
<?php if (stSoteshopVersion::getVersion() == stSoteshopVersion::ST_SOTESHOP_VERSION_POLISH): ?>
|
||||
<li><?php echo st_link_to(__('Konfiguracja Ifirma', '', 'stIfirma'),"invoice/ifirmaConfig")?></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Płatności', null, 'stPayment'),"payment")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Płatności klienta', null, 'stPayment'),"payment")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"payment_type")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Dostawy', null, 'stDeliveryBackend'),"delivery/index")?></li>
|
||||
</ul>
|
||||
|
||||
<ul id="ddsubmenu2" class="ddsubmenustyle">
|
||||
<li><?php echo st_link_to(__('Produkty', null, 'stProduct'),"product/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista produktów', null, 'stProduct'),"product/index")?></li>
|
||||
<li><?php echo st_link_to(__('Prezentacja produktu', null, 'stProduct'),"product/presentationConfig")?></li>
|
||||
<li><?php echo st_link_to(__('Eksport', null, 'stProduct'),"product/export")?></li>
|
||||
<li><?php echo st_link_to(__('Import', null, 'stProduct'),"product/import")?></li>
|
||||
<li><?php echo st_link_to(__('Magazyn', null, 'stProduct'),"product/depositoryList")?></li>
|
||||
<li><?php echo st_link_to(__('Lista szablonów opcji', null, 'stProduct'),"product/optionsTemplatesList")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"product/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Kategorie', null, 'stCategory'),"category/manager")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Menadżer kategorii', null, 'stCategory'),"category/manager")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"category/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Grupy produktow', null, 'stProductGroup'),"product_group/index")?></li>
|
||||
<li><?php echo st_link_to(__('Producenci', null, 'stProducer'),"producer/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista producentów', null, 'stProducer'),"producer/index")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"producer/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Grupy rabatowe', null, 'stDiscountBackend'),"discount/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista rabatów', null, 'stDiscountBackend'),"discount/list")?></li>
|
||||
<li><?php echo st_link_to(__('Progi rabatowe', null, 'stDiscountBackend'),"discount/rangeList")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Recenzje', null, 'stReview'),"review/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista recenzji produktów', null, 'stReview'),"review/index")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Rekomendacje', null, 'stRecommendSendBackend'),"recommend_send/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Polecenia produktów', null, 'stRecommendSendBackend'),"recommend_send")?></li>
|
||||
<li><?php echo st_link_to(__('Polecenia sklepu', null, 'stRecommendSendBackend'),"recommend_shop_send")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"recommend_config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Zapytania', null, 'stQuestionBackend'),"question/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista zapytań', null, 'stQuestionBackend'),"question/index")?></li>
|
||||
<li><?php echo st_link_to(__('Lista statusów', null, 'stQuestionBackend'),"question/questionStatusList")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"question/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="ddsubmenu3" class="ddsubmenustyle">
|
||||
<li><?php echo st_link_to(__('Klienci', null, 'stUser'),"user/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista klientów', null, 'stUser'),"user/index")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"user/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Partnerzy', null, 'stPartnerBackend'),"partner")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista partnerów', null, 'stPartnerBackend'),"partner")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"partner/configCustom")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Newsletter', null, 'stNewsletterBackend'),"newsletter")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Wiadomości', null, 'stNewsletterBackend'),"newsletter")?></li>
|
||||
<li><?php echo st_link_to(__('Adresy', null, 'stNewsletterBackend'),"newsletter/newsletterUserList")?></li>
|
||||
<li><?php echo st_link_to(__('Grupy', null, 'stNewsletterBackend'),"newsletter/newsletterGroupList")?></li>
|
||||
<li><?php echo st_link_to(__('Eksport', null, 'stNewsletterBackend'),"newsletter/export")?></li>
|
||||
<li><?php echo st_link_to(__('Import', null, 'stNewsletterBackend'),"newsletter/import")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"newsletter/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="ddsubmenu4" class="ddsubmenustyle">
|
||||
<li><?php echo st_link_to(__('Strony www', null, 'stWebpageBackend'),"webpage/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista stron www', null, 'stWebpageBackend'),"webpage/index")?></li>
|
||||
<li><?php echo st_link_to(__('Linki', null, 'stWebpageBackend'),"webpage/webpageGroupMainList")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Boksy informacyjne', null, 'stBoxBackend'),"box/index")?></li>
|
||||
<li><?php echo st_link_to(__('Teksty', null, 'stTextBackend'),"text/index")?></li>
|
||||
<li><?php echo st_link_to(__('Nowosci', null, 'stNewsBackend'),"news")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('News', null, 'stNewsBackend'),"news")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"news/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="ddsubmenu5" class="ddsubmenustyle">
|
||||
<?php if (stSoteshopVersion::getVersion() == stSoteshopVersion::ST_SOTESHOP_VERSION_POLISH): ?>
|
||||
<li><?php echo st_link_to(__('Udostępnianie oferty', null, 'stPriceCompare'),"price_compare")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista', null, 'stPriceCompare'),"price_compare")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Ceneo'),"ceneo")?></li>
|
||||
<li><?php echo st_link_to(__('Nokaut'),"nokaut")?></li>
|
||||
<li><?php echo st_link_to(__('Oferciak'),"oferciak")?></li>
|
||||
<li><?php echo st_link_to(__('Okazje'),"okazje")?></li>
|
||||
<li><?php echo st_link_to(__('Radar'),"radar")?></li>
|
||||
<li><?php echo st_link_to(__('Skąpiec'),"skapiec")?></li>
|
||||
<li><?php echo st_link_to(__('Sklepy24'),"sklepy24")?></li>
|
||||
<li><?php echo st_link_to(__('Zakupomat'),"zakupomat")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Dodawanie produktów', null, 'stPriceCompare'),"price_compare")?></li>
|
||||
<li><?php echo st_link_to(__('Przypomnienia', null, 'stPriceCompare'),"price_compare/remind")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Allegro'),"allegro/index")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista aukcji', null, 'stAllegroBackend'),"allegro/list")?></li>
|
||||
<li><?php echo st_link_to(__('Szablony', null, 'stAllegroBackend'),"allegro_template/list")?></li>
|
||||
<li><?php echo st_link_to(__('Import kategorii', null, 'stAllegroBackend'),"allegro/categoryConfig")?></li>
|
||||
<li><?php echo st_link_to(__('Import zamówień', null, 'stAllegroBackend'),"allegro/orderCustom")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"allegro/config")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li><?php echo st_link_to(__('Google Analytics'),"@stGoogleAnalyticsPlugin")?></li>
|
||||
<li><?php echo st_link_to(__('Portale spolecznosciowe', null, 'stAddThisBackend'),"addthis/index")?></li>
|
||||
</ul>
|
||||
|
||||
<ul id="ddsubmenu6" class="ddsubmenustyle">
|
||||
<li><?php echo st_link_to(__('Administracja sklepem', null, 'stConfigurationBackend'),"configuration/list")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Informacje o sklepie', null, 'stShopInfoBackend'),"@stShopInfoPlugin")?></li>
|
||||
<li><?php echo st_link_to(__('Administratorzy', null, 'sfGuardUser'),"auth/users/index")?></li>
|
||||
<li><?php echo st_link_to(__('Bezpieczenstwo', null, 'stSecurityBackend'),"security/index")?></li>
|
||||
<li><?php echo st_link_to(__('Optymalizacja', null, 'stOptimizationBackend'),"optimization/index")?></li>
|
||||
<li><?php echo st_link_to(__('Migracja danych', null, 'stMigration'),"migration")?></li>
|
||||
<li><?php echo st_link_to(__('Blokowanie sklepu', null, 'stLockBackend'),"lock")?></li>
|
||||
<li><?php echo st_link_to(__('API', null, 'stWebApiBackend'),"webapi/index")?></li>
|
||||
<li><?php echo st_link_to(__('Uaktualnienia'),"../update.php")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja modułów', null, 'stConfigurationBackend'),"configuration/list")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Waluty', null, 'stCurrencyBackend'),"currency/index")?></li>
|
||||
<li><?php echo st_link_to(__('Wersje jezykowe', null, 'stLanguageBackend'),"@stLanguagePlugin")?></li>
|
||||
<li><?php echo st_link_to(__('Stawki Vat', null, 'stTaxBackend'),"tax/index")?></li>
|
||||
<li><?php echo st_link_to(__('Obsluga poczty', null, 'stMailAccountBackend'),"mail_account/list")?></li>
|
||||
<li><?php echo st_link_to(__('Dostepnosc', null, 'stAvailabilityBackend'),"availability/index")?></li>
|
||||
<li><?php echo st_link_to(__('Mapa serwisu', null, 'stSitemapBackend'),"sitemap/index")?></li>
|
||||
<li><?php echo st_link_to(__('Nawigacja', null, 'stNavigationBackend'),"navigation")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja zdjęć', null, 'stAssetImageConfiguration'),"image-configuration/watermark")?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Płatności', null, 'stConfigurationBackend'),"configuration/list")?>
|
||||
<ul>
|
||||
<?php if (stSoteshopVersion::getVersion() == stSoteshopVersion::ST_SOTESHOP_VERSION_POLISH): ?>
|
||||
<li><?php echo st_link_to(__('PayU'),"platnoscipl")?></li>
|
||||
<li><?php echo st_link_to(__('Dotpay'),"dotpay")?></li>
|
||||
<li><?php echo st_link_to(__('Polcard'),"polcard")?></li>
|
||||
<li><?php echo st_link_to(__('Przelewy24'),"przelewy24")?></li>
|
||||
<li><?php echo st_link_to(__('Żagiel S.A.'),"zagiel")?></li>
|
||||
<li><?php echo st_link_to(__('eCard'),"ecard")?></li>
|
||||
<li><?php echo st_link_to(__('LUKAS Raty'),"lukas")?></li>
|
||||
<?php endif; ?>
|
||||
<li><?php echo st_link_to(__('Moneybookers'),"moneybookers")?></li>
|
||||
<li><?php echo st_link_to(__('Paypal'),"paypal")?></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Edycja grafiki', null, 'stThemeBackend'),"theme/index")?></li>
|
||||
<li><?php echo st_link_to(__('Pozycjonowanie', null, 'stPositioningBackend'),"positioning")?></li>
|
||||
<li><?php echo st_link_to(__('Wyszukiwarka', null, 'stSearchBackend'),"search/list")?>
|
||||
<ul>
|
||||
<li><?php echo st_link_to(__('Lista wyszukiwania', null, 'stSearchBackend'),"search/list")?></li>
|
||||
<li><?php echo st_link_to(__('Optymalizacja', null, 'stSearchBackend'),"search/optimize")?></li>
|
||||
<li><?php echo st_link_to(__('Konfiguracja'),"search/config")?></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><?php echo st_link_to(__('Koszyk', null, 'stBasket'),"basket")?></li>
|
||||
<li><?php echo st_link_to(__('Raporty', null, 'sfStats'),"@stStatsPlugin")?></li>
|
||||
<li><?php echo st_link_to(__('Fast Cache'),"fastcache/index")?></li>
|
||||
</ul>
|
||||
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php sfContext::getInstance()->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype');?>
|
||||
<script type="text/javascript">
|
||||
function delayer()
|
||||
{
|
||||
var d = new Date();
|
||||
if (d.getTime() <= <?php echo $time;?>) {
|
||||
new Ajax.Request('<?php echo url_for('stBackendMain/timeRequestAjax'); ?>', {asynchronous:true});
|
||||
setTimeout('delayer()', 900000);
|
||||
}
|
||||
}
|
||||
delayer();
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php use_helper('Javascript','stAdminGenerator', 'stAlert') ?>
|
||||
|
||||
<div id="main_nav">
|
||||
<div id="qpanel_main">
|
||||
<div id="qpanel_list">
|
||||
<?php foreach ($apps as $id => $title): ?>
|
||||
|
||||
<div id="img_icons_all">
|
||||
<?php if (sfRouting::getInstance()->hasRouteName($id)): ?>
|
||||
<?php echo st_link_to(image_tag('backend/main/icons/'.$id, array(
|
||||
'id' => 'app_'.$id,
|
||||
'class' => 'qpanel_apps'
|
||||
)),"@$id")?>
|
||||
<?php else: ?>
|
||||
<?php echo image_tag('backend/main/icons/stDefaultApp') ?>
|
||||
<?php endif ?>
|
||||
<div class="font_normal">
|
||||
<?php echo $title ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
73
apps/backend/modules/stBackendMain/templates/listSuccess.php
Normal file
73
apps/backend/modules/stBackendMain/templates/listSuccess.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php use_helper('I18N', 'Text', 'stAdminGenerator', 'Object', 'ObjectAdmin', 'stDate', 'stProductImage','stCurrency','stWidgets') ?>
|
||||
<div id="main_nav">
|
||||
|
||||
<?php $route = sfRouting::getInstance(); ?>
|
||||
|
||||
<?php if(@$apps): ?>
|
||||
<div id="qpanel_main">
|
||||
<div id="qpanel_list">
|
||||
<?php foreach ($apps as $id => $title): ?>
|
||||
<?php $route_name = '@' . $id ?>
|
||||
<?php $routeName = $route->hasRouteName($id . 'Default') ? $route_name . 'Default' : $route_name; ?>
|
||||
<?php $routeInfo = $route->getRouteByName($routeName); ?>
|
||||
<?php $moduleName = $routeInfo[4]['module']; ?>
|
||||
<div class="img_icons_main">
|
||||
<div class="box_icons_main">
|
||||
<?php echo link_to(image_tag('backend/main/icons/'.$id, array(
|
||||
'id' => 'app_'.$id,
|
||||
'class' => 'qpanel_apps',
|
||||
'width' => '56px',
|
||||
'height' => '56px',
|
||||
|
||||
)), $routeName) ?>
|
||||
<div class="font_normal_main">
|
||||
<?php echo link_to("<nobr>".__($title, null, $moduleName)."</nobr>", $routeName); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="img_icons_main">
|
||||
<div class="box_icons_main">
|
||||
<?php echo st_link_to(image_tag('backend/main/icons/stUpdate.png', array(
|
||||
'id' => 'app_stUpdate',
|
||||
'class' => 'qpanel_apps'
|
||||
)), 'stInstallerWeb/index', array('for_app' => 'update'))?>
|
||||
<div class="font_normal_main">
|
||||
<?php echo st_link_to(__('Uaktualnienia'), 'stInstallerWeb/index', array('for_app' => 'update')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div id="sf_admin_container">
|
||||
|
||||
<div id="column1" class="column" style="width: 49%; float: left;">
|
||||
|
||||
<?php // echo st_get_component("stBackendMain",'desktopIcons') ?>
|
||||
|
||||
<div id="last-order-widget">
|
||||
<?php echo st_get_component("stOrder",'lastOrderWidget') ?>
|
||||
</div>
|
||||
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
||||
<div id="column2" class="column" style="width: 50%; float: left;">
|
||||
|
||||
<div id="product-last-order-widget">
|
||||
<?php echo st_get_component("stOrder",'productLastOrderWidget') ?>
|
||||
</div>
|
||||
|
||||
<div id="register-user-widget">
|
||||
<?php echo st_get_component("stUser",'registerUserWidget') ?>
|
||||
</div>
|
||||
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
35
apps/backend/modules/stBasket/actions/actions.class.php
Normal file
35
apps/backend/modules/stBasket/actions/actions.class.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
*
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: actions.class.php 34 2009-08-24 14:00:47Z marcin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Akcja aplikacji stBasket
|
||||
*
|
||||
* @package stBasket
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stBasketActions extends autostBasketActions
|
||||
{
|
||||
public function executeBasketProductList()
|
||||
{
|
||||
|
||||
parent::executeBasketProductList();
|
||||
|
||||
$this->pager->getCriteria()->add(BasketProductPeer::BASKET_ID, $this->forward_parameters['basket_id']);
|
||||
$this->pager->init();
|
||||
|
||||
}
|
||||
}
|
||||
87
apps/backend/modules/stBasket/actions/components.class.php
Normal file
87
apps/backend/modules/stBasket/actions/components.class.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
*
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: components.class.php 5372 2010-06-01 08:24:52Z marcin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Komponenty aplikacji stBasket
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
*
|
||||
* @package stBasket
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stBasketComponents extends autostBasketComponents
|
||||
{
|
||||
protected static $basket = null;
|
||||
/**
|
||||
* Wyświetla łączną kwotę koszyka
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public function executeItemsTotalAmount()
|
||||
{
|
||||
$this->amount = 0;
|
||||
|
||||
$items = $this->basket->getBasketProducts();
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$this->amount += $item->getTotalAmount(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wyświetla łączną ilość produktów w koszyku
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public function executeItemsTotalQuantity()
|
||||
{
|
||||
$this->quantity = 0;
|
||||
|
||||
$items = $this->basket->getBasketProducts();
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$this->quantity += $item->getQuantity();
|
||||
}
|
||||
}
|
||||
|
||||
public function executeBasketClient()
|
||||
{
|
||||
if (is_null(self::$basket))
|
||||
{
|
||||
$c = new Criteria();
|
||||
$c->add(BasketPeer::ID, $this->forward_parameters['basket_id']);
|
||||
$basket = BasketPeer::doSelectJoinAll($c);
|
||||
self::$basket = $basket[0];
|
||||
}
|
||||
|
||||
$this->basket = self::$basket;
|
||||
}
|
||||
|
||||
public function executeBasketDate()
|
||||
{
|
||||
if (is_null(self::$basket))
|
||||
{
|
||||
$c = new Criteria();
|
||||
$c->add(BasketPeer::ID, $this->forward_parameters['basket_id']);
|
||||
$basket = BasketPeer::doSelectJoinAll($c);
|
||||
self::$basket = $basket[0];
|
||||
}
|
||||
|
||||
$this->basket = self::$basket;
|
||||
}
|
||||
}
|
||||
21
apps/backend/modules/stBasket/config/config.php
Normal file
21
apps/backend/modules/stBasket/config/config.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
*
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: config.php 34 2009-08-24 14:00:47Z marcin $
|
||||
*/
|
||||
|
||||
stPluginHelper::addRouting('stBasket', '/basket/:action/*', 'stBasket', 'config', 'backend');
|
||||
stPluginHelper::addRouting('stBasketDefault', '/basket', 'stBasket', 'config', 'backend');
|
||||
$dispatcher = stEventDispatcher::getInstance();
|
||||
$dispatcher->connect('stAdminGenerator.generateStProduct', array('stBasketListener', 'generateStProduct'));
|
||||
?>
|
||||
66
apps/backend/modules/stBasket/config/generator.yml
Normal file
66
apps/backend/modules/stBasket/config/generator.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: Basket
|
||||
basket_product_model_class: BasketProduct
|
||||
theme: simple
|
||||
applications: [stOrder, stUser, stProduct]
|
||||
custom_actions:
|
||||
list: [basket_product]
|
||||
description: Podgląd aktualnych zakupów w sklepie klientów zarejestrowanych
|
||||
documentation:
|
||||
pl: https://www.sote.pl/docs/koszyk
|
||||
en: https://www.soteshop.com/docs/shopping_cart
|
||||
list:
|
||||
title: Lista
|
||||
display: [=updated_at, sf_guard_user, ~items_total_quantity, ~items_total_amount]
|
||||
fields:
|
||||
sf_guard_user: {name: Klient}
|
||||
updated_at: {name: Ostatnia aktywność, params: link_to="stBasket/basketProductList?basket_id=%%id%%"}
|
||||
items_total_quantity: {name: Ilość produktów}
|
||||
items_total_amount: {name: Łączna wartość (brutto)}
|
||||
actions: []
|
||||
sort: [updated_at, desc]
|
||||
basket_product_list:
|
||||
description:
|
||||
title: Lista produktów w koszyku klienta %%~basket_client%% z dnia %%~basket_date%%
|
||||
display: [code, _name, _product_price, quantity, _product_total]
|
||||
fields:
|
||||
code: {name: Kod}
|
||||
name: {name: Nazwa}
|
||||
product_price: {name: Cena}
|
||||
product_total: {name: Razem}
|
||||
quantity: {name: Ilość}
|
||||
forward_parameters: [basket_id]
|
||||
actions: []
|
||||
config:
|
||||
title: Konfiguracja
|
||||
menu:
|
||||
display: [config]
|
||||
fields:
|
||||
config: {name: Konfiguracja, action: stBasket/config}
|
||||
display:
|
||||
NONE: [ajax, max_quantity]
|
||||
"Prezentacja koszyka": [show_products, show_crosseling, show_code_in_basket, show_photo_in_basket, show_netto_in_basket, show_tax_in_basket, show_uom_in_basket, show_discount_in_basket]
|
||||
fields:
|
||||
remember_items:
|
||||
name: Zapamiętuj koszyk klienta
|
||||
type: select
|
||||
display: [1, 7, 14]
|
||||
options:
|
||||
1: {name: przez 24 godziny}
|
||||
7: {name: przez 1 tydzień}
|
||||
14: {name: przez 2 tygodnie}
|
||||
max_quantity: {name: Limit ilości sztuk danego produktu, value: 1000}
|
||||
ajax: {name: Dodaj produkt bez przeładowania strony, type: checkbox}
|
||||
show_products: {name: Pokaż produkty polecane na stronie koszyka, type: checkbox, old_config: true}
|
||||
show_crosseling: {name: Pokaż cross-seling na stronie koszyka, type: checkbox, old_config: true}
|
||||
show_code_in_basket: {name: Pokaż kod, type: checkbox}
|
||||
show_photo_in_basket: {name: Pokaż zdjęcie, type: checkbox}
|
||||
show_netto_in_basket: {name: Pokaż pole netto, type: checkbox}
|
||||
show_tax_in_basket: {name: Pokaż pole VAT, type: checkbox}
|
||||
show_uom_in_basket: {name: Pokaż pole jednostka miary, type: checkbox}
|
||||
show_discount_in_basket: {name: Pokaż pole rabat, type: checkbox}
|
||||
actions:
|
||||
_save: {name: Zapisz}
|
||||
hideable: [Prezentacja koszyka]
|
||||
@@ -0,0 +1,6 @@
|
||||
config:
|
||||
display:
|
||||
"Koszyk": [hide_basket, show_basket_quantity]
|
||||
fields:
|
||||
hide_basket: {name: Ukryj koszyk, checked: false, type: checkbox}
|
||||
show_basket_quantity: {name: Włącz możliwość wpisywania ilość sztuk na karcie produktu, type: checkbox, checked: false}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class stBasketBreadcrumbsBuilder extends autoStBasketBreadcrumbsBuilder
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
*
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: stModuleImportExport.class.php 34 2009-08-24 14:00:47Z marcin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage libs
|
||||
*/
|
||||
class stBasketWebApi extends autostBasketWebApi {
|
||||
|
||||
}
|
||||
29
apps/backend/modules/stBasket/lib/stModuleWebApi.class.php
Normal file
29
apps/backend/modules/stBasket/lib/stModuleWebApi.class.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
*
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: stModuleWebApi.class.php 34 2009-08-24 14:00:47Z marcin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* SOTESHOP/stBasket
|
||||
* Ten plik należy do aplikacji stBasket 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 stBasket
|
||||
* @subpackage libs
|
||||
*/
|
||||
class stBasketWebApi extends autostBasketWebApi {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo $basket->getSfGuardUserId() ? $basket->getSfGuardUser() : __('niezalogowany'); ?>
|
||||
1
apps/backend/modules/stBasket/templates/_basketDate.php
Normal file
1
apps/backend/modules/stBasket/templates/_basketDate.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php echo format_date($basket->getUpdatedAt(), "f") ?>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php use_helper('stCurrency') ?>
|
||||
<?php echo st_back_price($amount, true, true) ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo $quantity ?>
|
||||
19
apps/backend/modules/stBasket/templates/_name.php
Normal file
19
apps/backend/modules/stBasket/templates/_name.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
if ($basket_product->hasPriceModifiers())
|
||||
{
|
||||
echo content_tag('div', $basket_product->getName(), array('style' => 'text-align: left'));
|
||||
|
||||
$content = '';
|
||||
|
||||
foreach ($basket_product->getPriceModifiers() as $price_modifier)
|
||||
{
|
||||
$content .= content_tag('li', $price_modifier['label'], array('style' => 'list-style: circle inside none'));
|
||||
}
|
||||
|
||||
echo content_tag('ul', $content, array('style' => 'text-align: left'));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $basket_product->getName();
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php use_helper('stCurrency') ?>
|
||||
<?php echo st_back_price(stCurrency::calculateVat($basket_product->getPrice(), $basket_product->getVat()), true, true) ?>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php use_helper('stCurrency') ?>
|
||||
<?php echo st_back_price(stCurrency::calculateVat($basket_product->getPrice(), $basket_product->getVat()) * $basket_product->getQuantity(), true, true) ?>
|
||||
35
apps/backend/modules/stBasket/templates/configSuccess.php
Normal file
35
apps/backend/modules/stBasket/templates/configSuccess.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?>
|
||||
|
||||
<?php st_include_partial('stBasket/header', array(
|
||||
'related_object' => $related_object,
|
||||
'title' => __('Konfiguracja',
|
||||
array(), 'stBasket'),
|
||||
'route' => 'stBasket/config',
|
||||
'hideable' => $hideable,
|
||||
)) ?>
|
||||
|
||||
<?php st_include_partial('stBasket/config_menu', array('config' => $config, 'labels' => $labels, 'forward_parameters' => $forward_parameters, 'related_object' => $related_object)) ?>
|
||||
|
||||
<div id="sf_admin_content" class="admin-content-edit">
|
||||
<?php st_include_partial('stAdminGenerator/message', array('config' => $config, 'labels' => $labels, 'forward_parameters' => $forward_parameters)) ?>
|
||||
<?php st_include_partial('stBasket/config_form', array('config' => $config, 'labels' => $labels, 'forward_parameters' => $forward_parameters)) ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$config_product = stConfig::getInstance('stProduct');
|
||||
if ($config_product->get('global_price_netto')){
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
document.getElementById("config_show_netto_in_basket").disabled = true;
|
||||
document.getElementById("config_show_netto_in_basket").value = 1;
|
||||
var config_show_netto_in_basket = document.createElement("input");
|
||||
config_show_netto_in_basket.setAttribute("type", "hidden");
|
||||
config_show_netto_in_basket.setAttribute("name", "config[show_netto_in_basket]");
|
||||
config_show_netto_in_basket.setAttribute("value", "1");
|
||||
document.getElementById("config_actions").appendChild(config_show_netto_in_basket);
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<?php st_include_partial('stBasket/footer', array('related_object' => null, 'forward_parameters' => $forward_parameters)) ?>
|
||||
12
apps/backend/modules/stBasket/validate/config.yml
Normal file
12
apps/backend/modules/stBasket/validate/config.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
fields:
|
||||
config{max_quantity}:
|
||||
required:
|
||||
msg: Wartość nie może być pusta
|
||||
sfNumberValidator:
|
||||
min: 1
|
||||
min_error: Minimalna wartość to 1
|
||||
max: 1000000
|
||||
max_error: Maksymalna wartość to 1000000
|
||||
nan_error: Wartość musi być liczbą całkowitą
|
||||
type: integer
|
||||
type_error: Wartość musi być liczbą całkowitą
|
||||
673
apps/backend/modules/stCategory/actions/actions.class.php
Normal file
673
apps/backend/modules/stCategory/actions/actions.class.php
Normal file
@@ -0,0 +1,673 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SOTESHOP/stCategory
|
||||
*
|
||||
* Ten plik należy do aplikacji stCategory 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 stCategory
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: actions.class.php 10063 2010-12-30 12:57:19Z marcin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Akcje kategorii
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
*
|
||||
* @package stCategory
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stCategoryActions extends autostCategoryActions
|
||||
{
|
||||
public function executeList()
|
||||
{
|
||||
return $this->redirect('@stCategory?action=manager');
|
||||
}
|
||||
|
||||
public function executeAjaxJstreeJson()
|
||||
{
|
||||
$results = CategoryPeer::doSelectByParentIdAsJsTreeFormat($this->getRequestParameter('id'));
|
||||
|
||||
return $this->renderJSON($results);
|
||||
}
|
||||
public function executeAjaxCategoryFilterChildren()
|
||||
{
|
||||
$url = $this->getRequestParameter('url');
|
||||
$id = $this->getRequestParameter('id');
|
||||
$parent = CategoryPeer::retrieveByPK($id);
|
||||
|
||||
if (null === $parent)
|
||||
{
|
||||
return sfView::HEADER_ONLY;
|
||||
}
|
||||
|
||||
$result = $this->getRenderPartial('stCategory/categories', array('parent' => $parent, 'expanded' => array(), 'selected' => null, 'url' => $url));
|
||||
|
||||
return $this->renderText($result);
|
||||
}
|
||||
|
||||
public function executeAjaxCategoryTree()
|
||||
{
|
||||
$roots = CategoryPeer::doSelectRoots(new Criteria());
|
||||
|
||||
$html_data = '';
|
||||
|
||||
$this->default = $this->getRequestParameter('default');
|
||||
$this->show_default = $this->getRequestParameter('show_default', true);
|
||||
$this->allow_assign_leaf_only = $this->getRequestParameter('allow_assign_leaf_only', false);
|
||||
$this->tree_id = $this->getRequestParameter('tree_id');
|
||||
$this->limit = $this->getRequestParameter('limit');
|
||||
|
||||
$allow_assign_root = $this->getRequestParameter('allow_assign_root', false);
|
||||
|
||||
$path = array();
|
||||
|
||||
$assigned = $this->getRequestParameter('assigned');
|
||||
|
||||
$this->assigned = $assigned ? array_flip(explode(',', $assigned)) : array();
|
||||
|
||||
|
||||
if ($this->assigned)
|
||||
{
|
||||
foreach (CategoryPeer::retrieveByPKs(array_keys($this->assigned)) as $cat)
|
||||
{
|
||||
foreach ($cat->getPath('doSelectIds') as $p)
|
||||
{
|
||||
$path[] = $p;
|
||||
}
|
||||
}
|
||||
|
||||
$path = array_flip($path);
|
||||
}
|
||||
|
||||
|
||||
if (!$path && $roots)
|
||||
{
|
||||
$path[$roots[0]->getId()] = $roots[0]->getId();
|
||||
}
|
||||
|
||||
|
||||
foreach ($roots as $root)
|
||||
{
|
||||
$id = $root->getId();
|
||||
|
||||
$assigned = isset($this->assigned[$id]);
|
||||
|
||||
if (isset($path[$root->getId()]))
|
||||
{
|
||||
$params = array('status' => 'open', 'children' => $this->getAjaxTreeChildren($root, $path));
|
||||
}
|
||||
else
|
||||
{
|
||||
$params = array('status' => $root->hasChildren() ? 'closed' : 'leaf');
|
||||
}
|
||||
|
||||
if ($allow_assign_root && !$this->allow_assign_leaf_only)
|
||||
{
|
||||
if (1 == $this->limit)
|
||||
{
|
||||
$content = stJQueryToolsHelper::getJsTreeHtmlSingleAssignedControl('jstree_category', $id, $assigned, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = stJQueryToolsHelper::getJsTreeHtmlAssignedControl('jstree_category', $id, $assigned, false);
|
||||
}
|
||||
|
||||
$params['content'] = $content;
|
||||
}
|
||||
|
||||
$params['scope'] = $this->tree_id;
|
||||
|
||||
$html_data .= stJQueryToolsHelper::getJsTreeHtmlRow($root->getId(), htmlspecialchars(strtr($root->getOptName(), array("\n" => "", "\r" => "")), ENT_QUOTES), $params);
|
||||
}
|
||||
|
||||
$this->html_data = $html_data;
|
||||
}
|
||||
|
||||
public function executeAjaxCategoryChildren()
|
||||
{
|
||||
$id = $this->getRequestParameter('id');
|
||||
|
||||
$assigned = $this->getRequestParameter('assigned');
|
||||
|
||||
$this->default = $this->getRequestParameter('default');
|
||||
$this->show_default = $this->getRequestParameter('show_default');
|
||||
$this->allow_assign_leaf_only = $this->getRequestParameter('allow_assign_leaf_only', false);
|
||||
$this->tree_id = $this->getRequestParameter('tree_id');
|
||||
$this->limit = $this->getRequestParameter('limit');
|
||||
|
||||
if ($assigned)
|
||||
{
|
||||
$this->assigned = array_flip(explode(',', $assigned));
|
||||
}
|
||||
|
||||
$parent = CategoryPeer::retrieveByPK($id);
|
||||
|
||||
if (!$parent)
|
||||
{
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
$html_data = $this->getAjaxTreeChildren($parent);
|
||||
|
||||
return $this->renderText($html_data);
|
||||
}
|
||||
|
||||
public function executeSetRootPosition()
|
||||
{
|
||||
$id = $this->getRequestParameter("id");
|
||||
|
||||
$move = $this->getRequestParameter('move');
|
||||
|
||||
$node = CategoryPeer::retrieveByPK($id);
|
||||
|
||||
if ($node->isRoot())
|
||||
{
|
||||
if ($move == 'up')
|
||||
{
|
||||
$this->treeMoveUp($node);
|
||||
}
|
||||
elseif ($move == 'down')
|
||||
{
|
||||
$this->treeMoveDown($node);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirect('stCategory/manager');
|
||||
}
|
||||
|
||||
public function executeIndex()
|
||||
{
|
||||
$this->redirect('category/manager');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wyświetla zarządzanie kategoriami
|
||||
*/
|
||||
public function executeManager()
|
||||
{
|
||||
$category_id = $this->getRequestParameter('category_id');
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
$selected = array();
|
||||
|
||||
if ($category_id)
|
||||
{
|
||||
$category = CategoryPeer::retrieveByPK($category_id);
|
||||
|
||||
if ($category && $category->getLevel() > 1)
|
||||
{
|
||||
foreach ($category->getPath() as $current)
|
||||
{
|
||||
$selected[] = $current->getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->roots = CategoryPeer::doSelectByParentIdAsJsTreeFormat(null, $selected);
|
||||
$this->maxRootPosition = CategoryPeer::getMaxRootPosition();
|
||||
|
||||
$this->setFlash('info', $i18n->__('Aby dodać/usunąć/edytować kategorię należy kliknąć prawym przyciskiem myszy na nazwę kategorii.'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dodaje nowe drzewo kategorii
|
||||
*/
|
||||
public function executeAddTree()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$name = $this->getRequestParameter("category_tree_name");
|
||||
|
||||
$tree = new Category();
|
||||
|
||||
$tree->setCulture(stLanguage::getOptLanguage());
|
||||
|
||||
$tree->setName($name);
|
||||
|
||||
$tree->makeRoot();
|
||||
|
||||
$tree->save();
|
||||
|
||||
$tree->setScope($tree->getId());
|
||||
|
||||
$tree->save();
|
||||
|
||||
$this->redirect('category/manager');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dodaje nową kategorię do drzewa
|
||||
*/
|
||||
public function executeAjaxAdd()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$name = $this->getRequestParameter("name");
|
||||
|
||||
$parentId = $this->getRequestParameter("parent_id");
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$parent = CategoryPeer::retrieveByPK($parentId);
|
||||
|
||||
$category = new Category();
|
||||
|
||||
$category->setCulture(stLanguage::getHydrateCulture());
|
||||
|
||||
$category->setName($name);
|
||||
|
||||
$category->insertAsLastChildOf($parent);
|
||||
|
||||
$category->save();
|
||||
|
||||
return $this->renderJSON(array('id' => $category->getId(), 'name' => $category->getName()));
|
||||
}
|
||||
|
||||
public function executeAjaxDelete()
|
||||
{
|
||||
$id = $this->getRequestParameter("id");
|
||||
|
||||
$category = CategoryPeer::retrieveByPK($id);
|
||||
|
||||
if ($category)
|
||||
{
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
if (stConfig::getInstance('stCategory')->get('check_for_product_before_delete') && $category->hasProducts())
|
||||
{
|
||||
return $this->renderJSON(array("error" => $i18n->__('Kategoria nie może być usunięta dopóki ma przypisane produkty', null, 'stCategory')));
|
||||
}
|
||||
|
||||
$category->delete();
|
||||
}
|
||||
|
||||
return sfView::HEADER_ONLY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aktualizuje nazwę kategorii i zwraca jej nazwę jako odpowiedź na wywołanie Ajax
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function executeAjaxRename()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$name = $this->getRequestParameter("name");
|
||||
$id = $this->getRequestParameter("id");
|
||||
|
||||
$category = CategoryPeer::retrieveByPK($id);
|
||||
|
||||
if ($category)
|
||||
{
|
||||
$category->setCulture(stLanguage::getHydrateCulture());
|
||||
|
||||
$category->setName($name);
|
||||
|
||||
$category->save();
|
||||
|
||||
return $this->renderJSON(array('id' => $category->getId(), 'name' => $name));
|
||||
}
|
||||
|
||||
return sfView::HEADER_ONLY;
|
||||
}
|
||||
|
||||
public function executeAjaxMove()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$category_id = $this->getRequestParameter('id');
|
||||
|
||||
$sibling_id = $this->getRequestParameter('sibling_id');
|
||||
|
||||
$parent_id = $this->getRequestParameter('parent_id');
|
||||
|
||||
$category = CategoryPeer::retrieveByPK($category_id);
|
||||
|
||||
if ($category)
|
||||
{
|
||||
if ($sibling_id)
|
||||
{
|
||||
$category->moveToPrevSiblingOf(CategoryPeer::retrieveByPK($sibling_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
$category->moveToLastChildOf(CategoryPeer::retrieveByPK($parent_id));
|
||||
}
|
||||
|
||||
$category->save();
|
||||
|
||||
ProductHasCategoryPeer::cleanCache();
|
||||
}
|
||||
|
||||
return sfView::HEADER_ONLY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Usuwa całe drzewo lub gałąź kategorii
|
||||
*/
|
||||
public function executeDelete()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$category = CategoryPeer::retrieveByPK($this->getRequestParameter("id"));
|
||||
|
||||
|
||||
if ($category)
|
||||
{
|
||||
if (stConfig::getInstance('stCategory')->get('check_for_product_before_delete') && $category->hasProducts())
|
||||
{
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
$this->setFlash('warning', $i18n->__('Drzewo nie może być usuniętę dopóki ma przypisane produkty', null, 'stCategory'));
|
||||
return $this->redirect($this->getRequest()->getReferer());
|
||||
}
|
||||
|
||||
$category->delete();
|
||||
}
|
||||
|
||||
$this->redirect('category/manager');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wiąże produkt z wybranymi kategoriami
|
||||
*/
|
||||
public function executeAddToManager()
|
||||
{
|
||||
$this->product_id = $this->getRequestParameter('product_id');
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$categories = $this->getRequestParameter('category');
|
||||
|
||||
CategoryPeer::addProduct($this->product_id, $categories);
|
||||
}
|
||||
}
|
||||
|
||||
public function validateAddTree()
|
||||
{
|
||||
$ok = true;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
$name = $this->getRequestParameter('category_tree_name');
|
||||
|
||||
if (empty($name))
|
||||
{
|
||||
$this->getRequest()->setError('category_tree_name', 'Musisz podać nazwę drzewa');
|
||||
|
||||
$ok = false;
|
||||
}
|
||||
elseif (CategoryPeer::checkByName($name))
|
||||
{
|
||||
$this->getRequest()->setError('category_tree_name', 'Nazwa już istnieje');
|
||||
|
||||
$ok = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ok = false;
|
||||
}
|
||||
|
||||
return $ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* Informuje o błędzie dodania drzewa kategorii
|
||||
*/
|
||||
public function handleErrorAddTree()
|
||||
{
|
||||
return $this->forward('stCategory', 'manager');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dodaje zdjęcie do produktu
|
||||
*
|
||||
* @param Product $product Produkt
|
||||
*/
|
||||
protected function saveCategoryImage($category)
|
||||
{
|
||||
$category_images = $this->getRequestParameter('category_images');
|
||||
$plupload = stJQueryToolsHelper::parsePluploadFromRequest($category_images);
|
||||
|
||||
if ($plupload['delete'])
|
||||
{
|
||||
$category->destroyAsset();
|
||||
}
|
||||
|
||||
if ($plupload['modified'])
|
||||
{
|
||||
foreach ($plupload['modified'] as $filename)
|
||||
{
|
||||
$ext = sfAssetsLibraryTools::getFileExtension($filename);
|
||||
$category->createAsset($category->getId() . '.' . $ext, $plupload['dir'].'/'.$filename);
|
||||
$category->save();
|
||||
}
|
||||
}
|
||||
|
||||
stJQueryToolsHelper::pluploadCleanup($plupload);
|
||||
}
|
||||
|
||||
protected function processDelete($id)
|
||||
{
|
||||
$category = CategoryPeer::retrieveByPK($id);
|
||||
|
||||
if (stConfig::getInstance('stCategory')->get('check_for_product_before_delete') && $category->hasProducts())
|
||||
{
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
$this->setFlash('warning', $i18n->__('Kategoria nie może być usunięta dopóki ma przypisane produkty', null, 'stCategory'));
|
||||
return $this->redirect($this->getRequest()->getReferer());
|
||||
}
|
||||
|
||||
return parent::processDelete($id);
|
||||
}
|
||||
|
||||
protected function saveCategory($category)
|
||||
{
|
||||
$v = strip_tags($category->getName());
|
||||
|
||||
$category->setName($v);
|
||||
|
||||
parent::saveCategory($category);
|
||||
|
||||
$this->saveCategoryImage($category);
|
||||
}
|
||||
|
||||
protected function saveConfig()
|
||||
{
|
||||
|
||||
parent::saveConfig();
|
||||
|
||||
appCategoryHorizontalListener::clearCache();
|
||||
|
||||
$fc = new stFunctionCache('stCategoryTree');
|
||||
|
||||
$fc->removeAll();
|
||||
|
||||
stTheme::clearSmartyCache(true);
|
||||
|
||||
stFastCacheManager::clearCache();
|
||||
|
||||
}
|
||||
|
||||
protected function treeMoveUp(Category $node, $by = 1)
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$position = $node->getRootPosition();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(CategoryPeer::ROOT_POSITION, $position - $by);
|
||||
|
||||
$prev = CategoryPeer::doSelectOne($c);
|
||||
|
||||
if ($prev)
|
||||
{
|
||||
$node->setRootPosition($prev->getRootPosition());
|
||||
|
||||
$prev->setRootPosition($position);
|
||||
|
||||
$node->save();
|
||||
|
||||
$prev->save();
|
||||
}
|
||||
}
|
||||
|
||||
protected function treeMoveDown(Category $node, $by = 1)
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), 'stCategory', false);
|
||||
|
||||
$position = $node->getRootPosition();
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(CategoryPeer::ROOT_POSITION, $position + $by);
|
||||
|
||||
$next = CategoryPeer::doSelectOne($c);
|
||||
|
||||
if ($next)
|
||||
{
|
||||
$node->setRootPosition($next->getRootPosition());
|
||||
|
||||
$next->setRootPosition($position);
|
||||
|
||||
$node->save();
|
||||
|
||||
$next->save();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getAjaxTreeChildren(Category $parent, $path = array())
|
||||
{
|
||||
$html_data = '';
|
||||
|
||||
foreach ($parent->getChildren() as $child)
|
||||
{
|
||||
$id = $child->getId();
|
||||
|
||||
$assigned = isset($this->assigned[$id]);
|
||||
|
||||
$content = '';
|
||||
|
||||
if (!$this->allow_assign_leaf_only || $child->isLeaf())
|
||||
{
|
||||
if (1 == $this->limit)
|
||||
{
|
||||
$content = stJQueryToolsHelper::getJsTreeHtmlSingleAssignedControl('jstree_category', $id, $assigned, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = stJQueryToolsHelper::getJsTreeHtmlAssignedControl('jstree_category', $id, $assigned, false);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->show_default)
|
||||
{
|
||||
$content .= stJQueryToolsHelper::getJsTreeHtmlDefaultControl('jstree_category', $id, $this->default == $id, !$assigned);
|
||||
}
|
||||
|
||||
if (isset($path[$id]))
|
||||
{
|
||||
$params = array(
|
||||
'status' => 'open',
|
||||
'content' => $content,
|
||||
'children' => $this->getAjaxTreeChildren($child, $path, $this->assigned),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$params = array(
|
||||
'status' => $child->hasChildren() ? 'closed' : 'leaf',
|
||||
'content' => $content,
|
||||
);
|
||||
}
|
||||
|
||||
$params['scope'] = $this->tree_id;
|
||||
|
||||
$html_data .= stJQueryToolsHelper::getJsTreeHtmlRow($child->getId(), htmlspecialchars(strtr($child->getOptName(), array("\n" => "", "\r" => "")), ENT_QUOTES), $params);
|
||||
}
|
||||
|
||||
return $html_data;
|
||||
}
|
||||
|
||||
public function executeProductAddGroup()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
|
||||
|
||||
$ids = $this->getRequestParameter('product[selected]', array($this->getRequestParameter('id')));
|
||||
$related_id = $this->getRequestParameter('forward_parameters[category_id]');
|
||||
$forward_parameters = $this->getUser()->getAttributeHolder()->getAll('sf_admin/autoStCategory/product_forward_parameters');
|
||||
|
||||
$langages = LanguagePeer::doSelectActive(new Criteria());
|
||||
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
$c = new Criteria();
|
||||
$c->add(ProductHasCategoryPeer::CATEGORY_ID, $related_id);
|
||||
$c->add(ProductHasCategoryPeer::PRODUCT_ID, $id);
|
||||
|
||||
if (!ProductHasCategoryPeer::doCount($c))
|
||||
{
|
||||
$product_has_category = new ProductHasCategory();
|
||||
$product_has_category->setCategoryId($related_id);
|
||||
$product_has_category->setProductId($id);
|
||||
$product_has_category->save();
|
||||
$product = $product_has_category->getProduct();
|
||||
foreach ($langages as $lang)
|
||||
{
|
||||
$product->setCulture($lang->getOriginalLanguage());
|
||||
stNewSearch::buildIndex($product, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirect('stCategory/productList?page='.$this->getRequestParameter('page', 1).'&category_id='.$forward_parameters['category_id']);
|
||||
}
|
||||
|
||||
|
||||
public function executeProductRemoveGroup()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
|
||||
|
||||
$ids = $this->getRequestParameter('product[selected]', array($this->getRequestParameter('id')));
|
||||
$related_id = $this->getRequestParameter('forward_parameters[category_id]');
|
||||
$forward_parameters = $this->getUser()->getAttributeHolder()->getAll('sf_admin/autoStCategory/product_forward_parameters');
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(ProductHasCategoryPeer::CATEGORY_ID, $related_id);
|
||||
$c->add(ProductHasCategoryPeer::PRODUCT_ID, array_values($ids), Criteria::IN);
|
||||
|
||||
$langages = LanguagePeer::doSelectActive(new Criteria());
|
||||
|
||||
foreach (ProductHasCategoryPeer::doSelectJoinProduct($c) as $product_has_category)
|
||||
{
|
||||
$product = $product_has_category->getProduct();
|
||||
$product_has_category->delete();
|
||||
foreach ($langages as $lang)
|
||||
{
|
||||
$product->setCulture($lang->getOriginalLanguage());
|
||||
stNewSearch::buildIndex($product, true);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirect('stCategory/productList?page='.$this->getRequestParameter('page', 1).'&category_id='.$forward_parameters['category_id']);
|
||||
}
|
||||
|
||||
public function addProductFiltersCriteria($c){
|
||||
|
||||
parent::addProductFiltersCriteria($c);
|
||||
|
||||
if (isset($this->filters['list_image']) && $this->filters['list_image'] !== ''){
|
||||
$c->add(ProductPeer::OPT_IMAGE, null, $this->filters['list_image'] ? Criteria::ISNOTNULL : Criteria::ISNULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
80
apps/backend/modules/stCategory/actions/components.class.php
Normal file
80
apps/backend/modules/stCategory/actions/components.class.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SOTESHOP/stCategory
|
||||
*
|
||||
* Ten plik należy do aplikacji stCategory 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 stCategory
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 318 2009-09-07 12:39:29Z michal $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Komponenty aplikacji stCategory
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
*
|
||||
* @package stCategory
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stCategoryComponents extends autoStCategoryComponents
|
||||
{
|
||||
/**
|
||||
* Wyświetla komponent umożliwiający dodanie dowolnego modelu do kategorii
|
||||
*/
|
||||
public function executeAddToManager()
|
||||
{
|
||||
$this->iterators = stNestedIterator::retrieveTree();
|
||||
}
|
||||
|
||||
public function executeTree()
|
||||
{
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(CategoryPeer::RGT, 2, Criteria::GREATER_THAN);
|
||||
|
||||
$c->addAscendingOrderByColumn(CategoryPeer::ROOT_POSITION);
|
||||
|
||||
$this->roots = CategoryPeer::doSelectRootsWithI18n($c);
|
||||
|
||||
if (!isset($this->selected))
|
||||
{
|
||||
$this->selected = $this->getUser()->getAttribute('category_filter', null, 'soteshop/stProduct');
|
||||
}
|
||||
|
||||
$this->expanded = CategoryPeer::doSelectExpanded($this->selected);
|
||||
|
||||
if (!isset($this->url))
|
||||
{
|
||||
$this->url = $this->getController()->genUrl('@stProductDefault');
|
||||
}
|
||||
}
|
||||
|
||||
public function executeTreeBreadcrumbs()
|
||||
{
|
||||
if (!$this->selected)
|
||||
{
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
$this->breadcrumbs = CategoryPeer::doSelectExpanded($this->selected) ;
|
||||
|
||||
if (!$this->breadcrumbs)
|
||||
{
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
if (!isset($this->url))
|
||||
{
|
||||
$this->url = $this->getController()->genUrl('@stProductDefault');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
29
apps/backend/modules/stCategory/config/config.php
Normal file
29
apps/backend/modules/stCategory/config/config.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stCategory
|
||||
*
|
||||
* Ten plik należy do aplikacji stCategory 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 stCategory
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: config.php 318 2009-09-07 12:39:29Z michal $
|
||||
*/
|
||||
|
||||
stPluginHelper::addRouting('stCategory', '/category/:action/*', 'stCategory', 'index', 'backend');
|
||||
|
||||
stPluginHelper::addRouting('stCategoryAction', '/category/:action', 'stCategory', 'index', 'backend');
|
||||
|
||||
|
||||
// pobieramy instancję obiektu sfEventDispatcher
|
||||
$dispatcher = stEventDispatcher::getInstance();
|
||||
|
||||
// dodajemy sluchacza dla zdarzenia generator.generate
|
||||
$dispatcher->connect('stAdminGenerator.generateStProduct', array('stCategoryInProductImportExportListener', 'generate'));
|
||||
|
||||
stPluginHelper::addRouting('stCategory', '/category/:action/*', 'stCategory', 'manager', 'backend');
|
||||
?>
|
||||
131
apps/backend/modules/stCategory/config/generator.yml
Normal file
131
apps/backend/modules/stCategory/config/generator.yml
Normal file
@@ -0,0 +1,131 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: Category
|
||||
product_model_class: Product
|
||||
theme: simple
|
||||
custom_actions:
|
||||
list: [product]
|
||||
head:
|
||||
package: stCategory
|
||||
|
||||
documentation:
|
||||
pl: "https://www.sote.pl/docs/kategorie"
|
||||
en: "https://www.soteshop.com/docs/categories"
|
||||
|
||||
list:
|
||||
menu:
|
||||
display: [manager]
|
||||
fields:
|
||||
manager: {name: Menedżer kategorii, action: "@stCategory?action=manager"}
|
||||
config: {name: Konfiguracja, action: "@stCategory?action=config"}
|
||||
edit:
|
||||
title: Edycja podstawowa
|
||||
menu:
|
||||
display: [product]
|
||||
fields:
|
||||
product: {name: Przypisz produkty, action: "@stCategory?action=productList&category_id=%%id%%"}
|
||||
display:
|
||||
"NONE": [_is_active, is_hidden, _show_children_products, _main_page, name, _image, description]
|
||||
fields:
|
||||
is_active: {name: Aktywna, required: false}
|
||||
is_hidden: {name: Ukryj w drzewie kategorii, required: false}
|
||||
show_children_products: {name: Pokaż produkty z podkategorii, required: false}
|
||||
name: {name: Nazwa kategorii, params: disabled=false, required: true}
|
||||
description: {name: Opis, type: textarea_tag, params: size=90x20 rich=true tinymce_options='height:400,width:600' disabled=false}
|
||||
image: {name: Załącz/Zmień zdjęcie}
|
||||
main_page: {name: Pokaż na stronie głównej}
|
||||
actions:
|
||||
_list: {name: Menedżer kategorii, action: @stCategory?action=manager&category_id=%%id%%, i18n: stCategory}
|
||||
_save: {name: Zapisz}
|
||||
|
||||
product_list:
|
||||
use_stylesheet: [backend/stProductList.css]
|
||||
use_helper: [stProduct/stProduct]
|
||||
forward_parameters: [category_id]
|
||||
title: Przypisz produkty
|
||||
filters:
|
||||
list_image: {partial: filter_list_image, module: stProduct}
|
||||
display: [list_image, opt_name, code, opt_price_brutto, active, list_stock]
|
||||
fields:
|
||||
code: {name: Kod, width: 1%}
|
||||
opt_name: {name: Nazwa, params: truncate_text=true}
|
||||
list_image: {name: Zdjęcie, width: 1%, callback: list_product_image}
|
||||
opt_price_brutto: {name: Cena, width: 1%, callback: list_product_price, label_callback: list_product_price_label}
|
||||
active: {name: Aktywny, width: 1%, align: center}
|
||||
list_stock: {name: Magazyn, align: right, width: 1%, i18n: stDepositoryBackend, callback: list_stock, sort_field: product.stock}
|
||||
build_options:
|
||||
related_id: forward_parameters.category_id
|
||||
through_class: ProductHasCategory
|
||||
select_actions:
|
||||
actions:
|
||||
_add_group: {name: Dodaj do kategorii}
|
||||
_remove_group: {name: Usuń z kategorii}
|
||||
menu: {use: edit.menu}
|
||||
object_actions: []
|
||||
actions: []
|
||||
|
||||
config:
|
||||
old_config:
|
||||
"Drzewo kategorii": true
|
||||
"Konfiguracja wyświetlania poziomych kategorii": true
|
||||
description: Zarządzanie kategoriami w sklepie.
|
||||
title: Konfiguracja
|
||||
display:
|
||||
"NONE": [show_children_products, hide_categories_without_products, show_image_category_description]
|
||||
"Drzewo kategorii": [tree_type, hide_root, expand_root, expand_always, show_product_count]
|
||||
"Podkategorie": [show_subcategories, cut_subcategories_name, cut_subcategories_name_num]
|
||||
"Kategorie na stronie głównej": [category_main_menu_all_depths, show_category_main_menu, subcategory_main_menu_num, cut_tree_cat_name, cut_tree_cat_name_num, cut_tree_subcat_name, cut_tree_subcat_name_num, show_category_main_menu_desc_mobile, show_category_main_menu_desc, cut_main_description, cut_main_description_num, show_category_main_menu_btn_mobile, show_category_main_menu_btn]
|
||||
"Konfiguracja wyświetlania poziomych kategorii": [menu_on, _cathor_tree, image_on, description_on]
|
||||
fields:
|
||||
hide_categories_without_products: {name: Ukrywaj kategorie bez produktów, type: checkbox}
|
||||
show_children_products: {name: Pokaż produkty z podkategorii, type: checkbox}
|
||||
show_image_category_description: {name: Pokaż zdjęcie przy opisie kategorii, type: checkbox}
|
||||
show_subcategories: {name: Pokaż podkategorie po kliknięciu w kategorię, type: checkbox}
|
||||
show_category_main_menu: {name: Pokaż menu kategorii na stronie głównej, type: checkbox}
|
||||
category_main_menu_all_depths: {name: Zezwalaj na pokazywanie kategorii ze wszystkich poziomów, type: checkbox}
|
||||
main_page: {name: Strona główna}
|
||||
image: {name: Zdjęcie}
|
||||
hide_root: {name: Ukryj nazwę drzew kategorii, type: checkbox}
|
||||
show_product_count: {name: Pokaż ilość produktów w kategorii, type: checkbox}
|
||||
expand_always: {name: Zawsze rozwinięte, type: checkbox, help: Niezależnie od wybranej kategorii drzewo zawsze jest rozwinięte do wybranego poziomu w "Prezentacja drzewa kategorii"}
|
||||
tree_type:
|
||||
name: Rodzaj drzewa
|
||||
type: select
|
||||
display: [default, ajax]
|
||||
options:
|
||||
default: {name: Domyślne, value: default}
|
||||
ajax: {name: Dynamiczne (zalecane przy dużej liczbie kategorii), value: ajaxTree}
|
||||
expand_root:
|
||||
name: Prezentacja drzewa kategorii
|
||||
type: select
|
||||
display: [never, level_1, level_2, level_3, level_4, level_5, always]
|
||||
options:
|
||||
never: {name: Zwinięte, value: -1}
|
||||
level_1: {name: Rozwinięte do 1 poziomu, value: 0}
|
||||
level_2: {name: Rozwinięte do 2 poziomu, value: 1}
|
||||
level_3: {name: Rozwinięte do 3 poziomu, value: 2}
|
||||
level_4: {name: Rozwinięte do 4 poziomu, value: 3}
|
||||
level_5: {name: Rozwinięte do 5 poziomu, value: 4}
|
||||
always: {name: Rozwinięte bez ograniczeń, value: 10000}
|
||||
subcategory_main_menu_num: {name: Ilość wyświetlanych podkategorii, params: size=2}
|
||||
cut_subcategories_name: {name: Skracaj nazwę podkategorii, type: checkbox, old_config: true}
|
||||
cut_subcategories_name_num: {name: Ile znaków skracać nazwę podkategorii, params: size=2, old_config: true}
|
||||
cut_tree_cat_name: {name: Skracaj nazwę kategorii, type: checkbox}
|
||||
cut_tree_cat_name_num: {name: Ile znaków skracać nazwę kategorii, params: size=2}
|
||||
cut_tree_subcat_name: {name: Skracaj nazwę podkategorii, type: checkbox}
|
||||
cut_tree_subcat_name_num: {name: Ile znaków skracać nazwę podkategorii, params: size=2}
|
||||
show_category_main_menu_btn_mobile: {name: Pokaż przycisk (mobile), type: checkbox}
|
||||
show_category_main_menu_btn: {name: Pokaż przycisk (desktop), type: checkbox}
|
||||
show_category_main_menu_desc_mobile: {name: Pokaż opis kategorii (mobile), type: checkbox}
|
||||
show_category_main_menu_desc: {name: Pokaż opis kategorii (desktop), type: checkbox}
|
||||
cut_main_description: {name: Skracaj opis kategorii, type: checkbox}
|
||||
cut_main_description_num: {name: Ile znaków skracać opis kategorii, params: size=3}
|
||||
menu_on: {name: Włącz poziome kategorie, type: checkbox}
|
||||
cathor_tree: {name: Drzewo kategorii, hide_label: true}
|
||||
image_on: {name: Pokaż obrazek kategorii, type: checkbox}
|
||||
description_on: {name: Pokaż opis kategorii, type: checkbox}
|
||||
|
||||
actions:
|
||||
_list: {name: Menedżer kategorii, action: manager, i18n: stCategory}
|
||||
_save: {name: Zapisz}
|
||||
@@ -0,0 +1,8 @@
|
||||
export:
|
||||
fields:
|
||||
product_categories: {name: Kategorie, class: CategoryPeer, md5hash: true }
|
||||
|
||||
import:
|
||||
fields:
|
||||
product_categories: {class: CategoryPeer, md5hash: true }
|
||||
|
||||
2
apps/backend/modules/stCategory/config/security.yml
Normal file
2
apps/backend/modules/stCategory/config/security.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
soap:
|
||||
is_secure: off
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class stCategoryBreadcrumbsBuilder extends autoStCategoryBreadcrumbsBuilder
|
||||
{
|
||||
}
|
||||
290
apps/backend/modules/stCategory/lib/stModuleWebApi.class.php
Normal file
290
apps/backend/modules/stCategory/lib/stModuleWebApi.class.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stWebApiPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stWebApiPlugin 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 stWebApiPlugin
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: stModuleWebApi.class.php 16947 2012-02-01 14:10:42Z piotr $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Komponenty aplikacji stCategory
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
*
|
||||
* @package stWebApiPlugin
|
||||
* @subpackage libs
|
||||
*/
|
||||
class stCategoryWebApi extends autoStCategoryWebApi
|
||||
{
|
||||
public static function getLink(Category $category, StCategoryWebApi $api)
|
||||
{
|
||||
return $api->__getCategoryUrl($category);
|
||||
}
|
||||
|
||||
public function AddCategory($object)
|
||||
{
|
||||
if (isset($object->_culture))
|
||||
$this->__setCulture($object->_culture);
|
||||
|
||||
stWebApi::getLogin($object->_session_hash, 'webapi_write');
|
||||
$this->TestAndValidateAddCategoryFields($object);
|
||||
|
||||
if (!$object->parent_id)
|
||||
{
|
||||
$item = new Category();
|
||||
$item->setCulture(stLanguage::getHydrateCulture());
|
||||
|
||||
$item->makeRoot();
|
||||
$item->setName($object->name);
|
||||
$item->save();
|
||||
|
||||
$item->setScope($item->getId());
|
||||
$item->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
$parent = CategoryPeer::retrieveByPK($object->parent_id);
|
||||
|
||||
if (!is_object($parent))
|
||||
throw new SoapFault('2', sprintf($this->__(WEBAPI_ADD_ERROR), $this->__('niepoprawny parametr parent_id')));
|
||||
|
||||
$parent->setCulture(stLanguage::getHydrateCulture());
|
||||
|
||||
$item = new Category();
|
||||
$item->setCulture(stLanguage::getHydrateCulture());
|
||||
$item->setName($object->name);
|
||||
$item->insertAsLastChildOf($parent);
|
||||
$item->save();
|
||||
}
|
||||
|
||||
if ($item)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isset($object->main_page))
|
||||
$item->setMainPage($object->main_page);
|
||||
|
||||
if (isset($object->description))
|
||||
$item->setDescription($object->description);
|
||||
|
||||
if (isset($object->is_active))
|
||||
$item->setIsActive($object->is_active);
|
||||
|
||||
if (isset($object->is_hidden))
|
||||
$item->setIsHidden($object->is_hidden);
|
||||
|
||||
if (isset($object->show_children_products))
|
||||
$item->setShowChildrenProducts($object->show_children_products);
|
||||
|
||||
$item->save();
|
||||
|
||||
if (isset($object->image) && isset($object->image_filename))
|
||||
$this->setCategoryImage($item, $object->image_filename, $object->image);
|
||||
|
||||
if (isset($object->url))
|
||||
{
|
||||
$item->setUrl($object->url);
|
||||
$item->save();
|
||||
}
|
||||
} catch (Exception $e)
|
||||
{
|
||||
throw new SoapFault('2', $this->__(WEBAPI_ADD_ERROR));
|
||||
}
|
||||
|
||||
ProductHasCategoryPeer::cleanCache();
|
||||
|
||||
$object = new StdClass();
|
||||
$this->getFieldsForAddCategory($object, $item);
|
||||
ProductHasCategoryPeer::cleanCache();
|
||||
return $object;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new SoapFault('1', $this->__(WEBAPI_ADD_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
public function setCategoryImage($item, $filename, $image)
|
||||
{
|
||||
$tmpFile = sfConfig::get('sf_cache_dir') . '/webapi_category.tmp';
|
||||
|
||||
if (is_object($item->getSfAsset()))
|
||||
{
|
||||
$item->getSfAsset()->delete();
|
||||
$item->setSfAsset(null);
|
||||
}
|
||||
|
||||
file_put_contents($tmpFile, base64_decode($image));
|
||||
$item->createAsset($item->getId() . '.' . pathinfo($filename, PATHINFO_EXTENSION), $tmpFile);
|
||||
$item->save();
|
||||
}
|
||||
|
||||
public function UpdateCategory($object)
|
||||
{
|
||||
if (isset($object->_culture))
|
||||
$this->__setCulture($object->_culture);
|
||||
|
||||
stWebApi::getLogin($object->_session_hash, 'webapi_write');
|
||||
$this->TestAndValidateUpdateCategoryFields($object);
|
||||
|
||||
$item = CategoryPeer::retrieveByPk($object->id);
|
||||
if ($item)
|
||||
{
|
||||
try
|
||||
{
|
||||
$item->setCulture(sfContext::getInstance()->getUser()->getCulture());
|
||||
|
||||
if (isset($object->name))
|
||||
$item->setName($object->name);
|
||||
|
||||
if (isset($object->main_page))
|
||||
$item->setMainPage($object->main_page);
|
||||
|
||||
if (isset($object->description))
|
||||
$item->setDescription($object->description);
|
||||
|
||||
if (isset($object->is_active))
|
||||
$item->setIsActive($object->is_active);
|
||||
|
||||
if (isset($object->is_hidden))
|
||||
$item->setIsHidden($object->is_hidden);
|
||||
|
||||
if (isset($object->show_children_products))
|
||||
$item->setShowChildrenProducts($object->show_children_products);
|
||||
|
||||
if (isset($object->url))
|
||||
$item->setUrl($object->url);
|
||||
|
||||
$item->save();
|
||||
|
||||
if (isset($object->image) && isset($object->image_filename))
|
||||
$this->setCategoryImage($item, $object->image_filename, $object->image);
|
||||
|
||||
} catch (Exception $e)
|
||||
{
|
||||
throw new SoapFault('2', sprintf($this->__(WEBAPI_UPDATE_ERROR), $e->getMessage()));
|
||||
}
|
||||
|
||||
ProductHasCategoryPeer::cleanCache();
|
||||
|
||||
$object = new StdClass();
|
||||
$object->_update = 1;
|
||||
return $object;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new SoapFault('1', $this->__(WEBAPI_INCORRECT_ID));
|
||||
}
|
||||
}
|
||||
|
||||
public function getFieldsForGetCategory($object, $item)
|
||||
{
|
||||
parent::getFieldsForGetCategory($object, $item);
|
||||
$this->addCustomFields($object, $item);
|
||||
}
|
||||
|
||||
public function getFieldsForGetCategoryList($object, $item)
|
||||
{
|
||||
parent::getFieldsForGetCategoryList($object, $item);
|
||||
$this->addCustomFields($object, $item);
|
||||
}
|
||||
|
||||
public function getFieldsForGetCategoryChildrens($object, $item)
|
||||
{
|
||||
parent::getFieldsForGetCategoryChildrens($object, $item);
|
||||
$this->addCustomFields($object, $item);
|
||||
}
|
||||
|
||||
public function getGetCategoryChildrensCriteria($object)
|
||||
{
|
||||
$c = parent::getGetCategoryChildrensCriteria($object);
|
||||
|
||||
if ($object->parent_id != 0) {
|
||||
$c->add(CategoryPeer::PARENT_ID, $object->parent_id);
|
||||
} else {
|
||||
$c->add(CategoryPeer::PARENT_ID, null, Criteria::ISNULL);
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function getGetProductCategoryListCriteria($object)
|
||||
{
|
||||
$c = parent::getGetProductCategoryListCriteria($object);
|
||||
$c->add(ProductHasCategoryPeer::PRODUCT_ID, $object->id);
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function getGetCategoryListCriteria($object)
|
||||
{
|
||||
$c = parent::getGetCategoryListCriteria($object);
|
||||
|
||||
if (isset($object->parent_id))
|
||||
{
|
||||
$c->add(CategoryPeer::PARENT_ID, $object->parent_id);
|
||||
}
|
||||
|
||||
if (isset($object->product_id))
|
||||
{
|
||||
$c->addJoin(ProductHasCategoryPeer::CATEGORY_ID, CategoryPeer::ID);
|
||||
$c->add(ProductHasCategoryPeer::PRODUCT_ID, $object->product_id);
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function getProductCategoryList($object)
|
||||
{
|
||||
if (isset($object->_culture))
|
||||
{
|
||||
$this->__setCulture($object->_culture);
|
||||
}
|
||||
stWebApi::getLogin($object->_session_hash, 'webapi_read');
|
||||
$this->TestAndValidategetProductCategoryListFields($object);
|
||||
$c = $this->getGetProductCategoryListCriteria($object);
|
||||
|
||||
if (!isset($object->_limit))
|
||||
$object->_limit = 20;
|
||||
|
||||
// ustawiamy kryteria wyboru
|
||||
$c->setLimit($object->_limit);
|
||||
$c->setOffset($object->_offset);
|
||||
|
||||
$items = ProductHasCategoryPeer::doSelect($c);
|
||||
|
||||
if ($items)
|
||||
{
|
||||
// Zwracanie wyniku, dla wszystkich pol z tablicy 'out'
|
||||
$items_array = array();
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$object = new StdClass();
|
||||
$this->getFieldsForgetProductCategoryList($object, $item);
|
||||
$items_array[] = $object;
|
||||
}
|
||||
return $items_array;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
protected function addCustomFields($object, Category $category)
|
||||
{
|
||||
if (is_object($category->getSfAsset()))
|
||||
{
|
||||
$object->image_filename = basename($category->getSfAsset()->getPath());
|
||||
$object->image = base64_encode(file_get_contents(sfConfig::get('sf_web_dir') . '/' . $category->getSfAsset()->getPath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
17
apps/backend/modules/stCategory/templates/_addToManager.php
Normal file
17
apps/backend/modules/stCategory/templates/_addToManager.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php use_helper('stAdminGenerator') ?>
|
||||
<?php use_stylesheet('backend/stCategory.css') ?>
|
||||
<?php foreach ($iterators as $iterator): ?>
|
||||
<h3>
|
||||
<?php echo $iterator->getRoot()->getName() ?>
|
||||
</h3>
|
||||
<ul id="st_category_tree-list">
|
||||
<?php foreach ($iterator->getDescendants() as $descendat): ?>
|
||||
<li style="margin-left: <?php echo $descendat->getLevel()*20 ?>px">
|
||||
<?php echo checkbox_tag('category['.$descendat->getId().']', $descendat->getId(), $descendat->hasDatabaseRecord($object) || $sf_request->getParameter('category['.$descendat->getId().']')) ?>
|
||||
<?php echo label_for('category['.$descendat->getId().']', $descendat->getName()) ?>
|
||||
<br class="st_clear_all" />
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<br class="st_clear_all" />
|
||||
<?php endforeach; ?>
|
||||
12
apps/backend/modules/stCategory/templates/_categories.php
Normal file
12
apps/backend/modules/stCategory/templates/_categories.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<ul class="open">
|
||||
<?php foreach ($parent->getChildren('doSelectWithI18n') as $child): ?>
|
||||
|
||||
<li class="<?php echo isset($expanded[$child->getId()]) ? ' selected' : '' ?> children">
|
||||
<?php if ($child->hasChildren()): ?><span class="expandable<?php echo isset($expanded[$child->getId()]) ? ' open' : '' ?>" style="padding-left: <?php echo ($child->getDepth() - 1) * 9 ?>px"></span><?php else: ?><span class="leaf"></span><?php endif; ?><a href="<?php echo $url ?>?category_id=<?php echo $child->getId() ?>" data-id="<?php echo $child->getId() ?>" style="padding-left: <?php echo ($child->getDepth() - 1) * 10 + 27 ?>px"><?php echo $child->getName() ?></a>
|
||||
<?php if ($child->hasChildren() && isset($expanded[$child->getId()])): ?>
|
||||
<?php echo st_get_partial('stCategory/categories', array('parent' => $child, 'expanded' => $expanded, 'selected' => $selected, 'url' => $url)) ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
22
apps/backend/modules/stCategory/templates/_categoryRow.php
Normal file
22
apps/backend/modules/stCategory/templates/_categoryRow.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Szablon pomocniczy prezentujący pojedynczy element kategorii
|
||||
*/
|
||||
?>
|
||||
<span class="st_category_tree-<?php echo $categoryTree->getLevel() > 1 ? 'child' : 'parent' ?>">
|
||||
<?php if (!$categoryTree->isRoot()): ?>
|
||||
<span class="st_category_tree-nest-number">
|
||||
<?php echo stNestedIterator::getDepthNumber($categoryTree) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<span class="st_category_tree-name" id="category_<?php echo $categoryTree->getId() ?>">
|
||||
<?php echo $categoryTree->getName() ?>
|
||||
</span>
|
||||
</span>
|
||||
<?php st_include_partial('category_menu', array('categoryTree' => $categoryTree)) ?>
|
||||
<br style="clear: both" />
|
||||
<?php echo input_in_place_editor_tag('category_'.$categoryTree->getId(),'category/categoryEdit?id='.$categoryTree->getId(), array(
|
||||
'cols' => 20,
|
||||
'rows' => 1,
|
||||
'complete' => " { var options = \$A($('st_tree_list').options); options.each(function(option) { if (option.value == {$categoryTree->getId()}) option.text = $('category_{$categoryTree->getId()}').innerHTML; }); }",
|
||||
)) ?>
|
||||
26
apps/backend/modules/stCategory/templates/_category_menu.php
Normal file
26
apps/backend/modules/stCategory/templates/_category_menu.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php if (!$categoryTree->isRoot()): ?>
|
||||
<ul class="st_category_tree-menu">
|
||||
<li <?php echo get_tooltip('Awansuj kategorię') ?>>
|
||||
<?php echo link_to(image_tag('/images/backend/category_tree/arrows/arrow_left.png'), 'category/promote?id='.$categoryTree->getId()) ?>
|
||||
</li>
|
||||
<li <?php echo get_tooltip('Przesuń kategorię w górę') ?>>
|
||||
<?php echo link_to(image_tag('/images/backend/category_tree/arrows/arrow_up.png'), 'category/moveUp?id='.$categoryTree->getId()) ?>
|
||||
</li>
|
||||
<li <?php echo get_tooltip('Przesuń kategorię w dół') ?>>
|
||||
<?php echo link_to(image_tag('/images/backend/category_tree/arrows/arrow_down.png'), 'category/moveDown?id='.$categoryTree->getId()) ?>
|
||||
</li>
|
||||
<li <?php echo get_tooltip('Degraduj kategorię') ?>>
|
||||
<?php echo link_to(image_tag('/images/backend/category_tree/arrows/arrow_right.png'), 'category/degrade?id='.$categoryTree->getId()) ?>
|
||||
</li>
|
||||
<li <?php echo get_tooltip('Przejdź do edycji kategorii') ?>>
|
||||
<?php echo link_to(image_tag('backend/icons/edit.png'), 'category/edit?id='.$categoryTree->getId()) ?>
|
||||
</li>
|
||||
<li <?php echo get_tooltip('Usuń kategorię - usuwa daną kategorię wraz z jej podkategoriami') ?>>
|
||||
<?php echo link_to(image_tag('backend/icons/delete.png'), 'category/delete?id='.$categoryTree->getId()) ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<ul class="st_category_tree-menu">
|
||||
<li <?php echo get_tooltip('Usuń drzewo') ?>><?php echo link_to(image_tag('backend/icons/delete.png'), 'category/delete?id='.$categoryTree->getId()) ?></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div id="category_tree_name">
|
||||
<div>
|
||||
<?php echo input_tag($name, null) ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php echo st_get_admin_actions(array(
|
||||
array("label" => __("Dodaj"), "type" => "create")
|
||||
)) ?>
|
||||
</div>
|
||||
</div>
|
||||
15
apps/backend/modules/stCategory/templates/_category_url.php
Normal file
15
apps/backend/modules/stCategory/templates/_category_url.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php $category = $category_has_positioning->getCategory();?>
|
||||
|
||||
<?php echo input_tag('category_has_positioning[category_url]', $category->getFriendlyUrl(), array('size' => '80')) ?>
|
||||
|
||||
<?php list($culture) = explode('_', $category->getCulture()); ?>
|
||||
|
||||
<p>
|
||||
<?php echo st_link_to(null, 'stProduct/frontendList?url=' . $category->getFriendlyUrl(), array(
|
||||
'absolute' => true,
|
||||
'for_app' => 'frontend',
|
||||
'for_lang' => $culture,
|
||||
'no_script_name' => true,
|
||||
'class' => 'st_admin_external_link',
|
||||
'target' => '_blank')) ?>
|
||||
</p>
|
||||
28
apps/backend/modules/stCategory/templates/_cathor_tree.php
Normal file
28
apps/backend/modules/stCategory/templates/_cathor_tree.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$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;
|
||||
}
|
||||
?>
|
||||
<label><?php echo __('Drzewo kategorii') ?></label>
|
||||
<div class="content">
|
||||
<?php if($select!=0): ?>
|
||||
<?php echo select_tag('config[cathor_tree]', options_for_select($select,
|
||||
array($config->get('cathor_tree'))
|
||||
)) ?>
|
||||
<?php else: ?>
|
||||
<?php echo __('Brak drzew kategorii'); ?>
|
||||
<?php endif; ?>
|
||||
<br class="st_clear_all">
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php use_javascript('backend/stCategory.js?version=1') ?>
|
||||
4
apps/backend/modules/stCategory/templates/_edit_url.php
Normal file
4
apps/backend/modules/stCategory/templates/_edit_url.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php echo input_tag('category[edit_url]', $category->getUrl(), array('disabled' => $category->getAutoGenerateUrl(), 'size' => '64')) ?>
|
||||
|
||||
<?php echo checkbox_tag('category[auto_generate_url]', true, $category->getAutoGenerateUrl(), array('onchange' => "$('category_edit_url').disabled = this.checked")) ?>
|
||||
<?php echo label_for('category_auto_generate_url', __('Generuj automatycznie'), array('style' => 'float: none; display: inline; padding: 0px')) ?>
|
||||
12
apps/backend/modules/stCategory/templates/_image.php
Normal file
12
apps/backend/modules/stCategory/templates/_image.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
use_helper('stCategoryImage', 'stJQueryTools');
|
||||
|
||||
$images = array();
|
||||
|
||||
if (!$category->isNew() && $category->getSfAsset())
|
||||
{
|
||||
$images[$category->getSfAssetId()] = st_category_image_path($category, 'full');
|
||||
}
|
||||
|
||||
echo plupload_images_tag('category_images', $images, array('crop' => 'category', 'limit' => 1));
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo image_tag('/'.sfConfig::get('sf_upload_dir_name')."/photos/".$category->getImage())?>
|
||||
8
apps/backend/modules/stCategory/templates/_is_active.php
Normal file
8
apps/backend/modules/stCategory/templates/_is_active.php
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
<?php echo st_admin_checkbox_tag('category[is_active]', 1, $category->getIsActive(), array (
|
||||
'disabled' => $category->hasParent() && $category->getParent() && !$category->getParent()->getIsActive()
|
||||
)); ?>
|
||||
|
||||
<?php if ($category->hasParent() && $category->getParent() && !$category->getParent()->getIsActive()): ?>
|
||||
<a href="#" class="help" style="vertical-align: middle" title="<?php echo __('Nie możesz aktywować kategorii w przypadku, gdy kategoria narzędna jest nieaktywna') ?>"></a>
|
||||
<?php endif ?>
|
||||
1
apps/backend/modules/stCategory/templates/_lang.php
Normal file
1
apps/backend/modules/stCategory/templates/_lang.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php st_include_component('stLanguageBackend', 'showLanguages')?>
|
||||
3
apps/backend/modules/stCategory/templates/_main_page.php
Normal file
3
apps/backend/modules/stCategory/templates/_main_page.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php echo st_admin_checkbox_tag('category[main_page]', 1, $category->getMainPage(), array (
|
||||
'disabled' => $category->isRoot(),
|
||||
)); ?>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php echo st_admin_checkbox_tag('category[show_children_products]', 1, $category->getShowChildrenProducts(), array (
|
||||
'disabled' => stConfig::getInstance('stCategory')->get('show_children_products'),
|
||||
)); ?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user