first commit

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

View File

@@ -0,0 +1,201 @@
<?php
/**
* SOTESHOP/stAdminGeneratorPlugin
*
* Ten plik należy do aplikacji stAdminGeneratorPlugin 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 stAdminGeneratorPlugin
* @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 17502 2012-03-22 15:35:51Z marcin $
* @author Marcin Butlak <marcin.butlak@sote.pl>
* @var stAdminGenerator $this
*/
?>
[?php
/**
* <?php echo $this->getGeneratedModuleName() ?> actions.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*
* @package stAdminGeneratorPlugin
* @subpackage actions
<?php $singularNames = array(); foreach ($this->getAllActionsByType('edit') as $action_name):
$this->setParameterValuePrefix($action_name);
if (isset($singularNames[$this->getSingularName()]))
{
continue;
}
$singularNames[$this->getSingularName()] = true;
?>
* @property <?php echo $this->getClassName() ?> $<?php echo $this->getSingularName() . "\n" ?>
<?php $this->resetParameterValuePrefix() ?>
<?php endforeach; ?>
* @property <?php echo $this->params['model_class'] ?> $related_object
*/
class <?php echo $this->getGeneratedModuleName() ?>Components extends sfComponents
{
<?php foreach ($this->getAllActionsByType('edit') as $action_name): ?>
<?php $this->setParameterValuePrefix($action_name) ?>
public function execute<?php echo $this->getCustomActionPhpName() ?>EditMenu()
{
$this-><?php echo $this->getSingularName() ?> = $this->related_object;
$i18n = $this->getContext()->getI18n();
if (!$this-><?php echo $this->getSingularName() ?>->isNew())
{
$this->items = array(stAdminGeneratorHelper::generateModelUrl($this-><?php echo $this->getSingularName() ?>, '<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>', $this->forward_parameters, false) => $i18n->__('<?php echo $this->getParameterValue('edit.title', 'Edycja') ?>', null, '<?php echo $this->getI18nCatalogue('edit.menu.fields._edit') ?>'));
<?php foreach ($this->getParameterValue('edit.menu.display', array()) as $item): if ($item == 'edit') continue; $action = $this->replaceConstants($this->getParameterValue('edit.menu.fields.'.$item.'.action')) ?>
$this->items[stAdminGeneratorHelper::applyParametersToUrl("<?php echo $action ?>", $this->forward_parameters)] = $i18n->__('<?php echo $this->getParameterValue('edit.menu.fields.'.$item.'.name') ?>', null, '<?php echo $this->getI18nCatalogue('edit.menu.fields.'.$item) ?>');
<?php endforeach; ?>
}
else
{
$this->items = array(stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'Create', 'create') ?>', $this->forward_parameters) => $i18n->__('<?php echo $this->getParameterValue('create.title', 'Dodaj') ?>', null, '<?php echo $this->getI18nCatalogue('edit.menu.fields._edit') ?>'));
}
$result = stEventDispatcher::getInstance()->filter(new sfEvent($this, '<?php echo $this->getGeneratedModuleName() ?>Components.<?php echo lcfirst($this->getCustomActionPhpName('edit', '', 'edit')) ?>Menu'), $this->items);
if (null !== $result->getReturnValue())
{
$this->items = $result->getReturnValue();
}
<?php if (!$this->getParameterValue('documentation', null, false)): ?>
if (!$this->items)
{
return sfView::NONE;
}
<?php endif ?>
$this->processMenuItems();
$this->selected_item_path = stAdminGeneratorHelper::getCurrentMenuPath();
}
<?php $this->resetParameterValuePrefix(); ?>
<?php endforeach; ?>
public function executeListMenu()
{
$i18n = $this->getContext()->getI18n();
<?php $items = $this->getParameterValue('list.menu.display', array()) ?>
$this->items = array();
<?php foreach ($items as $item): $action = $this->getParameterValue('list.menu.fields.'.$item.'.action'); if ($action == $this->getModuleName().'/config' || $item == 'config') continue ?>
$this->items["<?php echo $this->replaceConstants($this->getParameterValue('list.menu.fields.'.$item.'.action')) ?>"] = $i18n->__('<?php echo $this->getParameterValue('list.menu.fields.'.$item.'.name') ?>', null, '<?php echo $this->getI18nCatalogue('list.menu.fields.'.$item) ?>');
<?php endforeach; ?>
<?php if (!$items && null !== $this->getParameterValue('list', null, false)): ?>
$this->items["<?php echo $this->getModuleName() ?>/list"] = $i18n->__("Lista", null, 'stAdminGeneratorPlugin');
<?php endif ?>
$result = stEventDispatcher::getInstance()->filter(new sfEvent($this, '<?php echo $this->getGeneratedModuleName() ?>Components.listMenu'), $this->items);
if (null !== $result->getReturnValue())
{
$this->items = $result->getReturnValue();
}
if (method_exists($this, 'addListMenuItems'))
{
$this->items = call_user_func([$this, 'addListMenuItems'], $this->items);
}
<?php if (null !== $this->getParameterValue('config', null, false)): ?>
$this->items['<?php echo $this->getParameterValue('list.menu.fields.config.action', $this->getModuleName().'/config', false) ?>'] = $i18n->__('Konfiguracja', null, 'stAdminGeneratorPlugin');
<?php endif ?>
<?php if (!$this->getParameterValue('documentation', null, false)): ?>
if (!$this->items)
{
return sfView::NONE;
}
<?php endif ?>
$this->processMenuItems();
$this->selected_item_path = stAdminGeneratorHelper::getCurrentMenuPath();
}
public function executeConfigMenu()
{
$i18n = $this->getContext()->getI18n();
$this->items = array();
<?php foreach ($this->getParameterValue('config.menu.display', array()) as $item): $action = $this->getParameterValue('config.menu.fields.'.$item.'.action'); if ($action == $this->getModuleName().'/config' || $item == 'config') continue ?>
$this->items["<?php echo $this->replaceConstants($this->getParameterValue('config.menu.fields.'.$item.'.action')) ?>"] = $i18n->__('<?php echo $this->getParameterValue('config.menu.fields.'.$item.'.name') ?>', null, '<?php echo $this->getI18nCatalogue('config.menu.fields.'.$item) ?>');
<?php endforeach; ?>
$result = stEventDispatcher::getInstance()->filter(new sfEvent($this, '<?php echo $this->getGeneratedModuleName() ?>Components.configMenu'), $this->items);
if (null !== $result->getReturnValue())
{
$this->items = $result->getReturnValue();
}
$this->items['<?php echo $this->getParameterValue('config.menu.fields.config.action', $this->getModuleName().'/config', false) ?>'] = $i18n->__('Konfiguracja');
$this->processMenuItems();
$this->selected_item_path = stAdminGeneratorHelper::getCurrentMenuPath();
}
<?php foreach ($this->getAllActionsByType('custom') as $action_name): ?>
<?php $this->setParameterValuePrefix($action_name) ?>
public function execute<?php echo $this->getCustomActionPhpName() ?>CustomMenu()
{
$i18n = $this->getContext()->getI18n();
$this->items = array();
<?php foreach ($this->getParameterValue('custom.menu.display', array()) as $item): ?>
$this->items["<?php echo $this->replaceConstants($this->getParameterValue('custom.menu.fields.'.$item.'.action')) ?>"] = $i18n->__('<?php echo $this->getParameterValue('custom.menu.fields.'.$item.'.name') ?>', null, '<?php echo $this->getI18nCatalogue('custom.menu.fields.'.$item) ?>');
<?php endforeach; ?>
$result = stEventDispatcher::getInstance()->filter(new sfEvent($this, '<?php echo $this->getGeneratedModuleName() ?>Components.customMenu'), $this->items);
if (null !== $result->getReturnValue())
{
$this->items = $result->getReturnValue();
}
<?php if (!$this->getParameterValue('documentation', null, false)): ?>
if (!$this->items)
{
return sfView::NONE;
}
<?php endif ?>
$this->processMenuItems();
$this->selected_item_path = stAdminGeneratorHelper::getCurrentMenuPath();
}
<?php $this->resetParameterValuePrefix() ?>
<?php endforeach; ?>
protected function processMenuItems()
{
$controller = $this->getController();
$currentUrl = parse_url($this->getRequest()->getUri(), PHP_URL_PATH);
foreach ($this->items as $route => $name)
{
$url = $controller->genUrl($route);
if ($currentUrl == $url || strpos($currentUrl, $url.'/') === 0)
{
stAdminGeneratorHelper::setCurrentMenuPath($url);
break;
}
}
}
<?php if(is_array($this->getParameterValue('include_component_files'))): ?>
<?php foreach ($this->getParameterValue('include_component_files') as $file ): ?><?php
if (is_readable(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.$file)): ?><?php
include(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.$file); ?><?php
endif; ?><?php
endforeach; ?>
<?php endif; ?>
}

View File

@@ -0,0 +1,248 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php
class <?php echo $this->getGeneratedModuleName() ?>BreadcrumbsBuilder
{
/**
* Instacja klasy modelu
*
* @var BaseObject|null
*/
protected $relatedObject;
/**
* Instacja kontektu aplikacji
*
* @var sfContext
*/
protected $context;
/**
* Dodatkowe parametry
*
* @var array|null
*/
protected $forwardParameters;
/**
* Instacja klasy "okruszków chleba"
* @var stNavigationBreadcrumbs
*/
protected $breadcrumbs;
/**
* Tytuł aplikacji
*
* @var string
*/
protected $appTitle;
/**
* Routing aplikacji
*
* @var string
*/
protected $appRoute;
/**
* Domyślna ścieżka dla modułu <?php echo $this->getModuleName()."\n" ?>
* @var stNavigationBreadcrumbs
*/
protected $defaultBreadcrumbs = null;
<?php foreach ($this->getAllActionsByType('edit') as $action_name): ?>
<?php $this->setParameterValuePrefix($action_name) ?>
/**
* Instancja klasy do obsługi "okruszków chleba" dla <?php echo $action_name ?>_edit
*
* @var stNavigationBreadcrumbs
*/
protected $editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = null;
<?php $this->resetParameterValuePrefix() ?>
<?php endforeach; ?>
<?php foreach ($this->getAllActionsByType('list') as $action_name): ?>
<?php $this->setParameterValuePrefix($action_name) ?>
/**
* Instancja klasy do obsługi "okruszków chleba" dla <?php echo $action_name ?>_list
*
* @var stNavigationBreadcrumbs
*/
protected $listBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = null;
<?php $this->resetParameterValuePrefix() ?>
<?php endforeach; ?>
<?php if ($this->getParameterValue('import')) : ?>
/**
* Instancja klasy do obsługi "okruszków chleba" dla import
*
* @var stNavigationBreadcrumbs
*/
protected $importBreadcrumbs = null;
<?php endif ?>
<?php if ($this->getParameterValue('export')) : ?>
/**
* Instancja klasy do obsługi "okruszków chleba" dla export
*
* @var stNavigationBreadcrumbs
*/
protected $exportBreadcrumbs = null;
<?php endif ?>
/**
* Inicjalzuje "ukruszki chleba" dla modułu <?php echo $this->getModuleName()."\n" ?>
*
* @param BaseObject $related_object
*/
public function __construct(sfContext $context, stNavigationBreadcrumbs $breadcrumbs, $relatedObject = null, array $forwardParameters = array())
{
$this->relatedObject = $relatedObject;
$this->context = $context;
$this->breadcrumbs = $breadcrumbs;
$this->forwardParameters = $forwardParameters;
$this->initialize();
}
/**
* Inicjalizacja
*
* @return void
*/
public function initialize()
{
$i18n = $this->context->getI18N();
<?php if ($this->getAppTitle()): ?>
$this->appTitle = $i18n->__('<?php echo $this->getAppTitle() ?>', null, '<?php echo $this->getModuleName() ?>');
$this->appRoute = '<?php echo $this->getParameterValue('route', null, false) ?>';
<?php elseif ($package = $this->getParameterValue('head.package', $this->getModuleName(), false)): ?>
$this->appTitle = $i18n->__(stApplication::getAppName('<?php echo $package ?>'), null, '<?php echo $this->getModuleName() ?>');
$this->appRoute = stApplication::getAppRoute('<?php echo $package ?>');
<?php endif ?>
}
/**
* Zwraca instancje klasy do obsługi "okruszków chleba" z podstawową ścieżką
* @return stNavigationBreadcrumbs
*/
public function getDefaultBreadcrumbs()
{
if (null === $this->defaultBreadcrumbs)
{
$this->defaultBreadcrumbs = $this->breadcrumbs;
$this->defaultBreadcrumbs->add($this->appTitle, $this->appRoute);
}
return $this->defaultBreadcrumbs;
}
<?php foreach ($this->getAllActionsByType('edit') as $action_name): ?>
<?php $this->setParameterValuePrefix($action_name) ?>
/**
* Zwraca instancje klasy do obsługi "okurszków chleba" dla <?php echo $action_name ?>_edit
* @param <?php echo $this->getClassName() ?> $<?php echo $this->getSingularName()."\n" ?>
* @return stNavigationBreadcrumbs
*/
public function get<?php echo $this->getCustomActionPhpName() ?>EditBreadcrumbs(<?php echo $this->getClassName() ?> $<?php echo $this->getSingularName() ?>)
{
if (null === $this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>)
{
<?php if (!empty($action_name) && $this->getParameterValue('list.build_options.related_id')): ?>
$this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = $this->get<?php echo $this->getCustomActionPhpName() ?>ListBreadcrumbs();
<?php elseif (!empty($action_name) && $this->getParameterValue('edit.build_options.related_id')): ?>
$this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = $this->getEditBreadcrumbs($this->relatedObject);
<?php elseif (!empty($action_name)): ?>
$this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = $this->get<?php echo $this->getParameterValue($action_name.'_list') ? $this->getCustomActionPhpName() : '' ?>ListBreadcrumbs();
<?php else: ?>
$this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = $this->getDefaultBreadcrumbs();
<?php endif ?>
<?php if (empty($action_name) || !$this->getParameterValue('edit.build_options.related_id') || $this->getParameterValue('edit.build_options.related_class') != $this->getClassName()): ?>
if (!$<?php echo $this->getSingularName() ?>->isNew())
{
$editUrl = stAdminGeneratorHelper::applyParametersToUrl('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>?<?php echo $this->getPrimaryKeyUrlParams() ?>, $this->forwardParameters);
if (method_exists($<?php echo $this->getSingularName() ?>, 'getAdminGeneratorTitle') && null !== $<?php echo $this->getSingularName() ?>->getAdminGeneratorTitle($this->context->getI18N()))
{
$this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>->add($<?php echo $this->getSingularName() ?>->getAdminGeneratorTitle($this->context->getI18N()), $editUrl);
}
elseif (!method_exists($<?php echo $this->getSingularName() ?>, 'getAdminGeneratorTitle') && method_exists($<?php echo $this->getSingularName() ?>, 'getName') && $<?php echo $this->getSingularName() ?>->getName())
{
$this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>->add($<?php echo $this->getSingularName() ?>->getName(), $editUrl);
}
}
<?php endif ?>
}
return $this->editBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>;
}
<?php $this->resetParameterValuePrefix() ?>
<?php endforeach; ?>
<?php foreach ($this->getAllActionsByType('list') as $action_name): ?>
<?php $this->setParameterValuePrefix($action_name) ?>
/**
* Zwraca instancje klasy do obsługi "okurszków chleba" dla <?php echo $action_name ?>_list
* @return stNavigationBreadcrumbs
*/
public function get<?php echo $this->getCustomActionPhpName() ?>ListBreadcrumbs()
{
if (null === $this->listBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>)
{
$i18n = $this->context->getI18N();
<?php if (!empty($action_name) && $this->getParameterValue('list.build_options.related_id')): ?>
$this->listBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = $this->getEditBreadcrumbs($this->relatedObject);
<?php else: ?>
$this->listBreadcrumbs<?php echo $this->getCustomActionPhpName() ?> = $this->getDefaultBreadcrumbs();
<?php endif ?>
$this->listBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>->add($i18n->__('<?php echo $this->getParameterValue('list.title', 'Lista') ?>', null, '<?php echo $this->getParameterValue('list.i18n', $this->getModuleName()) ?>'), stAdminGeneratorHelper::applyParametersToUrl('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>', $this->forwardParameters));
}
return $this->listBreadcrumbs<?php echo $this->getCustomActionPhpName() ?>;
}
<?php $this->resetParameterValuePrefix() ?>
<?php endforeach; ?>
<?php if ($this->getParameterValue('import')) : ?>
/**
* Zwraca instancje klasy do obsługi "okurszków chleba" dla import
* @return stNavigationBreadcrumbs
*/
public function getImportBreadcrumbs()
{
if (null === $this->importBreadcrumbs)
{
$i18n = $this->context->getI18N();
$this->importBreadcrumbs = $this->getDefaultBreadcrumbs()
->add($i18n->__('<?php echo $this->getParameterValue('import.title', 'Import') ?>', null, '<?php echo $this->getParameterValue('import.i18n', $this->getModuleName()) ?>'), stAdminGeneratorHelper::applyParametersToUrl('<?php echo $this->getModuleName() ?>/import', $this->forwardParameters));
}
return $this->importBreadcrumbs;
}
<?php endif ?>
<?php if ($this->getParameterValue('export')) : ?>
/**
* Zwraca instancje klasy do obsługi "okurszków chleba" dla export
* @return stNavigationBreadcrumbs
*/
public function getExportBreadcrumbs()
{
if (null === $this->exportBreadcrumbs)
{
$i18n = $this->context->getI18N();
$this->exportBreadcrumbs = $this->getDefaultBreadcrumbs()
->add($i18n->__('<?php echo $this->getParameterValue('export.title', 'Eksport') ?>', null, '<?php echo $this->getParameterValue('export.i18n', $this->getModuleName()) ?>'), stAdminGeneratorHelper::applyParametersToUrl('<?php echo $this->getModuleName() ?>/export', $this->forwardParameters));
}
return $this->exportBreadcrumbs;
}
<?php endif ?>
}

View File

@@ -0,0 +1,53 @@
[?php
class <?php echo $this->getGeneratedModuleName() ?>ImportExport extends stImportExportPropel
{
<?php echo 'public $model = "'.(strlen($this->getParameterValue('import_export_model_class'))?$this->getParameterValue('import_export_model_class'):$this->getClassName()).'"'; ?>;
<?php
$export = array();
$import = array();
$export['fields'] = $this->getParameterValue('export.fields', array());
foreach ($export['fields'] as $key => $field)
{
if (isset($field['type'])) continue;
$export['fields'][$key]['type'] = null;
}
$import['fields'] = $this->getParameterValue('import.fields', array());
foreach ($import['fields'] as $key => $field)
{
if (isset($field['type'])) continue;
$import['fields'][$key]['type'] = null;
}
$import['primary_key'] = $this->getParameterValue('import.primary_key');
$import['default_class'] = $this->getParameterValue('import.default_class');
$export['primary_key'] = ($this->getParameterValue('export.primary_key'))?$this->getParameterValue('export.primary_key'):$this->getParameterValue('import.primary_key');
?>
<?php if($this->getParameterValue('export.limit')>0) echo 'protected $export_limit = '.$this->getParameterValue('export.limit').';' ?>
<?php if($this->getParameterValue('import.limit')>0) echo 'protected $import_limit = '.$this->getParameterValue('import.limit').';' ?>
<?php echo 'public static function getExport()' ?>
<?php echo '{' ?>
<?php echo ' return '.var_export($export,true).';' ?>
<?php echo '}' ?>
<?php echo 'public static function getImport()' ?>
<?php echo '{' ?>
<?php echo ' return '.var_export($import,true).';' ?>
<?php echo '}' ?>
public function __construct($method='', $class = '', $file='', $profile = 0)
{
$this->import = self::getImport();
$this->export = self::getExport();
parent::__construct($method, $class, $file, $profile);
}
}
?]

View File

@@ -0,0 +1,728 @@
[?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 15190 2011-09-22 09:58:05Z piotr $
* @author Michał Prochowski <michal.prochowski@sote.pl>,
*/
<?php
/**
* @var stAdminGenerator $this
*/
if(!defined('IS_WEBAPI')):
define('IS_WEBAPI', 1); ?>
<?php function testRequireFields(array $webApiFields, array $fields, string $fieldPrefix = '') {
foreach ($fields as $value):?><?php
$fieldName = str_replace('=','',$value);
if ($value[0] == '=' || isset($webApiFields[$fieldName]['required']) && $webApiFields[$fieldName]['required']): ?>
if (!isset($object-><?php print $fieldName ?>))
{
self::throwSoapFault('3', WEBAPI_REQUIRE_ERROR, ['%s' => "<?php echo $fieldPrefix ?><?php print $fieldName ?>"]);
}
<?php endif;
endforeach;
} ?>
<?php function validateFields(array $webApiFields, array $webApiTypes, array $fields, array &$validateTypes, string $fieldPrefix = '') {
foreach ($fields as $value):
$fieldName = str_replace('=','',$value);
if (isset($webApiFields[$fieldName]['type'])):
$type = $webApiFields[$fieldName]['type'];
switch ($type):
case 'int':
case 'integer': ?>
if (isset($object-><?php print $fieldName ?>) && !is_numeric($object-><?php print $fieldName ?>))
{
self::throwSoapFault('3', WEBAPI_VALIDATE_ERROR, ['%s' => "<?php echo $fieldPrefix ?><?php print $fieldName ?>"]);
}
<?php break; ?>
<?php case 'double': ?>
if (isset($object-><?php print $fieldName ?>) && !is_numeric($object-><?php print $fieldName ?>))
{
self::throwSoapFault('3', WEBAPI_VALIDATE_ERROR, ['%s' => "<?php echo $fieldPrefix ?><?php print $fieldName ?>"]);
}
<?php break; ?>
<?php case 'string': ?>
if (isset($object-><?php print $fieldName ?>) && !is_string($object-><?php print $fieldName ?>))
{
self::throwSoapFault('3', WEBAPI_VALIDATE_ERROR, ['%s' => "<?php echo $fieldPrefix ?><?php print $fieldName ?>"]);
}
<?php break; ?>
<?php case 'date': ?>
<?php case 'dateTime': ?>
if (isset($object-><?php print $fieldName ?>) && $object-><?php print $fieldName ?> && (!strtotime($object-><?php print $fieldName ?>) || is_numeric($object-><?php print $fieldName ?>)))
{
self::throwSoapFault('3', WEBAPI_VALIDATE_ERROR, ['%s' => "<?php echo $fieldPrefix ?><?php print $fieldName ?>"]);
}
// zmiana daty z soap na mysql
if (isset($object-><?php print $fieldName ?>))
{
$object-><?php print $fieldName ?> = $object-><?php print $fieldName ?> ? date_format(date_create($object-><?php print $fieldName ?>), 'Y-m-d H:i:s') : null;
}
<?php break; ?>
<?php default:
if (isset($webApiTypes[$type]) || in_array($type, ['ArrayOfInteger', 'ArrayOfString', 'ArrayOfDouble'])):
if (!in_array($type, ['ArrayOfInteger', 'ArrayOfString', 'ArrayOfDouble']))
{
$validateTypes[$type] = $type;
}
?>
// zmiana daty z soap na mysql
if (isset($object-><?php print $fieldName ?>))
{
$this->validate<?php echo ucfirst($type) ?>($object-><?php print $fieldName ?>, "<?php echo $fieldPrefix ?><?php print $fieldName ?>");
}
<?php endif ?>
<?php break; ?>
<?php endswitch; ?>
<?php endif; ?>
<?php endforeach;
} ?>
<?php function setFields(array $webApiFields, $methodName, $fields, $modelClass) { ?>
/**
* Aktualizuje pola modelu dla żądania SOAP
*
* @param object $object
* @param <?php echo $modelClass ?> $item
*/
public function setFieldsFor<?php echo $methodName ?>($object, $item)
{
if (method_exists($item, 'setCulture'))
{
$item->setCulture($this->__getCulture());
}
<?php foreach ($fields as $value) : $fieldName = str_replace('=','',$value); ?>
<?php if (isset($webApiFields[$fieldName]['custom'])): ?>
if(isset($object-><?php print $fieldName ?>) && method_exists(static::class, 'set<?php print sfInflector::camelize($fieldName) ?>'))
{
call_user_func([static::class, 'set<?php print sfInflector::camelize($fieldName) ?>'], $item, $object-><?php print $fieldName ?>, $this);
}
<?php else: ?>
if(isset($object-><?php print $fieldName ?>) && method_exists($item, 'set<?php print sfInflector::camelize($fieldName)?>'))
{
call_user_func([$item, 'set<?php print sfInflector::camelize($fieldName) ?>'], $object-><?php print $fieldName ?>);
}
<?php endif; ?>
<?php endforeach; ?>
}
<?php } ?>
<?php function getFields(array $webApiFields, $methodName, $fields, $modelClass, $peerMethod) { ?>
/**
* Zwraca pola modelu dla odpowiedzi SOAP
*
* @param object $object
* @param <?php echo $modelClass ?> $item
*/
public function getFieldsFor<?php echo $methodName ?>($object, $item)
{
if (method_exists($item, 'setCulture'))
{
$item->setCulture($this->__getCulture());
}
<?php if ($peerMethod == 'doSelectWithI18n'): ?>
$object->_culture = stSimpleLanguageHelper::cultureToShortcut($item->getCulture());
$object->_is_translated = !empty($item->getCurrent<?php echo $modelClass ?>I18n()->getCulture());
<?php endif ?>
<?php foreach ($fields as $value) : $fieldName = str_replace('=','',$value); ?>
<?php if (isset($webApiFields[$fieldName]['custom'])): ?>
if (method_exists(static::class, 'get<?php print sfInflector::camelize($fieldName) ?>'))
{
$object-><?php print $fieldName ?> = stWebApi::formatData(call_user_func([static::class, 'get<?php print sfInflector::camelize($fieldName) ?>'], $item, $this), '<?php print $webApiFields[$fieldName]['type'] ?>');
}
<?php else: ?>
if (method_exists($item,'get<?php print sfInflector::camelize($fieldName) ?>'))
{
$object-><?php print $fieldName ?> = stWebApi::formatData($item->get<?php print sfInflector::camelize($fieldName); ?>(), '<?php print isset($webApiFields[$fieldName]['type']) ? $webApiFields[$fieldName]['type'] : 'string' ?>');
<?php if ($fieldName == 'culture'): ?>
$object-><?php print $fieldName ?> = stSimpleLanguageHelper::cultureToShortcut($object-><?php print $fieldName ?>);
<?php endif ?>
}
<?php endif; ?>
<?php endforeach; ?>
}
<?php } ?>
<?php function TestAndValidate(array $webApiFields, array $webApiTypes, string $methodName, array $inFields, array &$validateTypes) { ?>
public function TestAndValidate<?php echo $methodName ?>Fields($object)
{
<?php if ($inFields) testRequireFields($webApiFields, $inFields); ?>
<?php if ($inFields) validateFields($webApiFields, $webApiTypes, $inFields, $validateTypes); ?>
}
<?php } ?>
<?php endif ?>
/**
* Klasa StApiProduct
*
* @package stWebApiPlugin
* @subpackage libs
*/
class <?php echo $this->getGeneratedModuleName() ?>WebApi extends stWebApiBase
{
protected $_culture = null;
<?php
if ($this->getParameterValue('webapi')):
$webApiTypes = $this->getParameterValue('webapi.types', []);
$validateTypes = [];
foreach (stWebApiAdminGeneratorHelper::getMethods($this) as $methodName => $method):
if (isset($method['custom']) && $method['custom']) continue;
$type = $method['type'];
$inFields = isset($method['fields']['in']) ? $method['fields']['in'] : [];
$outFields = isset($method['fields']['out']) ? $method['fields']['out'] : [];
$methodWebApiFields = stWebApiAdminGeneratorHelper::getMethodFields($this, $methodName);
$peerMethod = stWebApiAdminGeneratorHelper::getPeerMethod($this, $methodName);
$modelClass = stWebApiAdminGeneratorHelper::getModelClass($this, $methodName);
$this->changeModelClass($modelClass);
if (is_array($inFields)) {
TestAndValidate($methodWebApiFields, $webApiTypes, $methodName, $inFields, $validateTypes);
}
if (!in_array($type, array('count', 'delete', 'list')) && is_array($inFields)) {
setFields($methodWebApiFields, $methodName, $inFields, $modelClass);
}
if (!in_array($type, array('count', 'delete')) && is_array($outFields)) {
getFields($methodWebApiFields, $methodName, $outFields, $modelClass, $peerMethod);
}
?>
<?php switch ($type) :
case 'add': ?>
/**
* Dodawanie danych
*
* @param object $object obiekt z parametrami
* @return object okiekt z numer id dodanych danych
* @throws WEBAPI_ADD_ERROR WEBAPI_REQUIRE_ERROR
* @todo dodać waliadacje danych
*/
public function <?php echo $methodName ?>($object)
{
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_write');
<?php if ($inFields): ?>
$this->TestAndValidate<?php echo $methodName ?>Fields($object);
<?php endif;?>
$item = new <?php print $modelClass; ?>();
<?php if ($inFields): ?>
$this->setFieldsFor<?php echo $methodName ?>($object, $item);
<?php endif;?>
//Zapisywanie danych do bazy
try
{
$this->save<?php echo $modelClass ?>For<?php echo $methodName ?>($item);
}
catch (Exception $e)
{
self::throwSoapFault('2', WEBAPI_ADD_ERROR , ['%s' => $e->getMessage()]);
}
// Zwracanie danych
$object = new stdClass();
<?php if ($outFields) : ?>
$this->getFieldsFor<?php echo $methodName ?>($object, $item);
<?php endif;?>
return $object;
}
<?php break; ?>
<?php case 'update': ?>
/**
* Aktualizacja danych
*
* @param object $object obiekt z parametrami
* @return object obiekt z true
* @throws WEBAPI_INCORRECT_ID WEBAPI_UPDATE_ERROR WEBAPI_REQUIRE_ERROR
* @todo dodać walidacje danych
*/
public function <?php echo $methodName ?>($object)
{
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_write');
<?php if ($inFields): ?>
$this->TestAndValidate<?php echo $methodName ?>Fields($object);
<?php endif;?>
$item = <?php print $modelClass; ?>Peer::retrieveByPk($object->id);
if ($item)
{
<?php if ($inFields): ?>
$this->setFieldsFor<?php echo $methodName ?>($object, $item);
<?php endif;?>
//Zapisywanie danych do bazy
try
{
$this->save<?php echo $modelClass ?>For<?php echo $methodName ?>($item);
}
catch (Exception $e)
{
self::throwSoapFault('2', WEBAPI_UPDATE_ERROR, ['%s' => $e->getMessage()]);
}
// Zwracanie danych
$object = new stdClass();
$object->_update = 1;
return $object;
}
else
{
self::throwSoapFault('1', WEBAPI_INCORRECT_ID);
}
}
public function Batch<?php echo $methodName ?>($object)
{
$offset = 0;
$mapping = [];
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_write');
$result = new stdClass();
$result->_errors = [];
$result->_updates = [];
foreach ($object->_batch_items as $index => $o)
{
try
{
$this->TestAndValidate<?php echo $methodName ?>Fields($o);
$mapping[$o->id] = $index;
}
catch (SoapFault $e)
{
$error = new stdClass();
$error->dataIndex = $index;
$error->code = '2';
$error->message = $e->getMessage();
$result->_errors[$index] = $error;
}
}
if (!empty($result->_errors))
{
return $result;
}
$c = new Criteria();
$c->add(<?php print $modelClass; ?>Peer::ID, array_keys($mapping), Criteria::IN);
$c->setLimit(40);
$count = <?php print $modelClass; ?>Peer::doCount($c);
while($offset < $count)
{
$c->setOffset($offset);
$items = <?php print $modelClass; ?>Peer::<?php echo false !== strpos($methodName, 'I18n') ? 'doSelectWithI18n' : 'doSelect' ?>($c);
foreach ($items as $item)
{
$index = $mapping[$item->getId()];
<?php if ($inFields): ?>
$this->setFieldsFor<?php echo $methodName ?>($object->_batch_items[$index], $item);
try
{
$this->save<?php echo $modelClass ?>For<?php echo $methodName ?>($item);
usleep(20000);
$update = new stdClass();
$update->dataIndex = $index;
$update->status = true;
$result->_updates[] = $update;
unset($mapping[$item->getId()]);
}
catch (Exception $e)
{
$error = new stdClass();
$error->dataIndex = $index;
$error->code = '2';
$error->message = self::translate(WEBAPI_UPDATE_ERROR, ['%s' => $e->getMessage()]);
$result->_errors[] = $error;
}
<?php endif;?>
$offset++;
}
}
foreach ($mapping as $id => $index)
{
$error = new stdClass();
$error->dataIndex = $index;
$error->code = '3';
$error->message = self::translate(WEBAPI_INCORRECT_ID);
$result->_errors[] = $error;
}
return $result;
}
<?php break; ?>
<?php case 'get': ?>
/**
* Pobieranie danych
*
* @param object $object obiekt z parametrami
* @return object okiekt z danymi
* @throws WEBAPI_INCORRECT_ID WEBAPI_REQUIRE_ERROR
*/
public function <?php echo $methodName ?>($object)
{
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
<?php if ($inFields): ?>
$this->TestAndValidate<?php echo $methodName ?>Fields($object);
<?php endif;?>
$item = <?php print $modelClass; ?>Peer::retrieveByPk($object->id);
if ($item)
{
$object = new stdClass();
<?php if ($outFields): ?>
$this->getFieldsFor<?php echo $methodName ?>($object, $item);
<?php endif;?>
return $object;
}
else
{
self::throwSoapFault('1', WEBAPI_INCORRECT_ID);
}
}
<?php break; ?>
<?php case 'delete': ?>
/**
* Usuwanie danych
*
* @param object $object obiekt z danymi
* @return object obiekt z true
* @throws WEBAPI_INCORRECT_ID WEBAPI_DELETE_ERROR WEBAPI_REQUIRE_ERROR
*/
public function <?php echo $methodName ?>($object)
{
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_write');
<?php if ($inFields): ?>
$this->TestAndValidate<?php echo $methodName ?>Fields($object);
<?php endif;?>
$item = <?php print $modelClass; ?>Peer::retrieveByPk($object->id);
if ($item)
{
// Zwracanie danych
$obj = new stdClass();
$item->delete();
$obj->_delete = 1;
return $obj;
}
else
{
self::throwSoapFault('1', WEBAPI_INCORRECT_ID);
}
}
<?php break; ?>
<?php case 'count': ?>
/**
* Zwraca criteria dla metody <?php echo $methodName ?>
*
* @return Criteria
*/
public function get<?php echo $methodName ?>Criteria($object)
{
$c = new Criteria();
if (defined('<?php print $modelClass; ?>Peer::UPDATED_AT'))
{
if (isset($object->_modified_from) && isset($object->_modified_to))
{
$criterion = $c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_to, Criteria::LESS_EQUAL));
$c->add($criterion);
}
else
{
if (isset($object->_modified_from))
{
$criterion = $c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$c->add($criterion);
}
if (isset($object->_modified_to))
{
$criterion = $c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_to, Criteria::LESS_EQUAL);
$c->add($criterion);
}
}
}
<?php if ($peerMethod == 'doCountWithI18n'): ?>
if (isset($object->_is_translated))
{
$c->addJoin(<?php echo $modelClass ?>Peer::ID, sprintf("%s AND %s = '%s'", <?php echo $modelClass ?>I18nPeer::ID, <?php echo $modelClass ?>I18nPeer::CULTURE, $this->__getCulture()), Criteria::LEFT_JOIN);
$c->add(<?php echo $modelClass ?>I18nPeer::ID, null, $object->_is_translated ? Criteria::ISNOTNULL : Criteria::ISNULL);
}
<?php endif ?>
<?php if (false !== strpos($methodName, 'PositioningI18n')): ?>
$c->add(<?php echo $modelClass ?>Peer::OPT_TYPE, 1);
<?php endif ?>
return $c;
}
/**
* Licznie ilości rekordów
*
* @return object okiekt z liczba rekordów
* @throws WEBAPI_COUNT_ERROR
*/
public function <?php echo $methodName ?>($object)
{
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
<?php if ($inFields): ?>
$this->TestAndValidate<?php echo $methodName ?>Fields($object);
<?php endif;?>
try
{
$c = $this->get<?php echo ucfirst($methodName) ?>Criteria($object);
//Zwracanie danych
$obj = new stdClass();
$obj->_count = <?php print $modelClass; ?>Peer::<?php echo $peerMethod == 'doCountWithI18n' ? 'doCount' : $peerMethod ?>($c);
return $obj;
}
catch (Exception $e)
{
self::throwSoapFault('1', WEBAPI_COUNT_ERROR, ['%s' => $e->getMessage()]);
}
}
<?php break; ?>
<?php case 'list': ?>
/**
* Zwraca criteria dla metody <?php echo $methodName ?>
*
* @return Criteria
*/
public function get<?php echo ucfirst($methodName) ?>Criteria($object)
{
$c = new Criteria();
if (defined('<?php print $modelClass; ?>Peer::UPDATED_AT'))
{
if (isset($object->_modified_from) && isset($object->_modified_to))
{
$criterion = $c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_to, Criteria::LESS_EQUAL));
$c->add($criterion);
}
else
{
if (isset($object->_modified_from))
{
$criterion = $c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$c->add($criterion);
}
if (isset($object->_modified_to))
{
$criterion = $c->getNewCriterion(<?php print $modelClass; ?>Peer::UPDATED_AT, $object->_modified_to, Criteria::LESS_EQUAL);
$c->add($criterion);
}
}
}
<?php if ($peerMethod == 'doSelectWithI18n'): ?>
if (isset($object->_is_translated))
{
$c->add(<?php echo $modelClass ?>I18nPeer::ID, null, $object->_is_translated ? Criteria::ISNOTNULL : Criteria::ISNULL);
}
<?php endif ?>
<?php if (false !== strpos($methodName, 'PositioningI18n')): ?>
$c->add(<?php echo $modelClass ?>Peer::OPT_TYPE, 1);
<?php endif ?>
return $c;
}
/**
* Pobieranie danych
*
* @param object $object obiekt z parametrami
* @return object okiekt z danymi
* @throws WEBAPI_INCORRECT_ID WEBAPI_REQUIRE_ERROR
*/
public function <?php echo $methodName ?>($object)
{
if (isset($object->_culture))
{
$this->__setCulture($object->_culture);
}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
<?php if ($inFields): ?>
$this->TestAndValidate<?php echo $methodName ?>Fields($object);
<?php endif;?>
$c = $this->get<?php echo ucfirst($methodName) ?>Criteria($object);
if (!isset($object->_limit)) $object->_limit = 20;
// ustawiamy kryteria wyboru
$c->setLimit($object->_limit);
$c->setOffset($object->_offset);
if (defined('<?php print $modelClass;?>Peer::CREATED_AT'))
{
$c->addAscendingOrderByColumn(<?php print $modelClass;?>Peer::CREATED_AT);
}
<?php if ($peerMethod == 'doSelectWithI18n'): ?>
$items = <?php print $modelClass; ?>Peer::<?php echo $peerMethod ?>($c, $this->__getCulture());
<?php else: ?>
$items = <?php print $modelClass; ?>Peer::<?php echo $peerMethod ?>($c);
<?php endif ?>
if ($items)
{
// Zwracanie wyniku, dla wszystkich pol z tablicy 'out'
$items_array = array();
foreach ($items as $item)
{
$object = new stdClass();
<?php if ($outFields): ?>
$this->getFieldsFor<?php echo $methodName ?>($object, $item);
<?php endif;?>
$items_array[] = $object;
}
return $items_array;
}
return array();
}
<?php break; ?>
<?php endswitch; ?>
<?php if ($type == 'add' || $type == 'update'): ?>
/**
* Zapisuje model bazy danych
*
* @param <?php echo $modelClass ?> $item
*/
protected function save<?php echo $modelClass ?>For<?php echo $methodName ?>(<?php echo $modelClass ?> $item): int
{
return $item->save();
}
<?php endif ?>
<?php $this->restoreModelClass() ?>
<?php endforeach; ?>
<?php while(!empty($validateTypes)):
$type = array_pop($validateTypes);
?>
protected function validate<?php echo ucfirst($type) ?>($object, string $fieldPath)
{
<?php if (isset($webApiTypes[$type]['arrayType'])):
$arrayType = $webApiTypes[$type]['arrayType'];
$validateTypes[$arrayType] = $arrayType;
?>
if (!is_array($object))
{
self::throwSoapFault('3', WEBAPI_VALIDATE_ERROR, ['%s' => $fieldPath]);
}
foreach ($object as $index => $item)
{
$this->validate<?php echo ucfirst($arrayType) ?>($item, $fieldPath . '['.$index.']');
}
<?php else:
$webApiFields = $webApiTypes[$type]['fields'];
$fieldNames = array_keys($webApiFields);
?>
<?php testRequireFields($webApiFields, $fieldNames, '{$fieldPath}.'); ?>
<?php validateFields($webApiFields, $webApiTypes, $fieldNames, $validateTypes, '{$fieldPath}.'); ?>
<?php endif ?>
}
<?php endwhile ?>
<?php else: ?>
// moduł nie posiada skonfigurowanej obsługi WebApi
<?php endif ?>
};
?]

View File

@@ -0,0 +1,14 @@
<div class="application-menu">
<ul>
[?php foreach ($items as $action => $name): $url = url_for($action) ?]
<li class="[?php echo $selected_item_path == $url ? 'selected' : 'none' ?]"><a href="[?php echo $url ?]"[?php if ($url[0] != '/'): ?] target="_blank"[?php endif ?]>[?php echo $name ?]</a></li>
[?php endforeach; ?]
<?php if ($this->getParameterValue('documentation')): ?>
<li class="none">
<a href="[?php echo $sf_user->getCulture() == 'pl_PL' ? '<?php echo $this->getParameterValue('documentation.pl') ?>' : '<?php echo $this->getParameterValue('documentation.en') ?>' ?]" target="_blank">
[?php echo __("Dokumentacja", null, 'stAdminGeneratorPlugin') ?]
</a>
</li>
<?php endif ?>
</ul>
</div>

View File

@@ -0,0 +1,21 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php echo st_get_admin_actions_head('style="margin-top: 10px; float: right"') ?]
<?php $configActions = $this->getParameterValue('config.actions') ?>
<?php if (null !== $configActions): ?>
<?php foreach ((array) $configActions as $actionName => $params): ?>
<?php if ($actionName == '_delete') continue ?>
<?php if ($actionName == '_list' && !isset($params['action'])) $params['action'] = $this->getCustomActionNameCamelized('', 'List', 'list') ?>
[?php if (!st_admin_is_action_hidden('<?php echo $actionName ?>')): ?]
<?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, false, 'config'), $params) ?>
[?php endif ?]
<?php endforeach; ?>
<?php else: ?>
<?php echo $this->getButtonToAction('_list', array('action' => $this->getCustomActionNameCamelized('', 'List', 'list')), false, 'config') ?>
<?php echo $this->getButtonToAction('_save', array(), false, 'config') ?>
<?php endif; ?>
[?php echo st_get_admin_actions_foot() ?]

View File

@@ -0,0 +1,136 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php echo form_tag(stAdminGeneratorHelper::applyParametersToUrl('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionNameCamelized('', 'Config', 'config') ?>?culture='.$config->getCulture(), $forward_parameters), array(
'id' => 'admin_config_form',
'name' => 'admin_config_form',
'class' => 'admin_form',
'multipart' => true,
)) ?]
<?php foreach ($this->getColumnCategories('config.display') as $category):
$columns = $this->getColumns('config.display', $category);
if (empty($columns))
{
continue;
}
$category_name = $category[0] == '-' ? substr($category, 1) : $category;
$fieldset_id = $this->normalizeColumnName($category_name);
$category_old_config = $this->getParameterValue("config.old_config.".$category);
$category_install_version = $this->getParameterValue("config.hide_install_version.".$category);
$show_condition = ["!st_admin_is_field_removed('$fieldset_id')"];
if ($category_install_version)
{
$show_condition[] = "!stSoteshop::checkInstallVersion('$category_install_version')";
}
if ($category_old_config)
{
$show_condition[] = "!stTheme::hideOldConfiguration()";
}
?>
[?php if (<?php echo implode(" && ", $show_condition) ?>): ?]
<fieldset id="sf_fieldset_<?php echo $fieldset_id ?>"[?php if (st_admin_is_field_hidden('<?php echo $fieldset_id ?>')): ?] class="hidden always"[?php endif ?]>
<?php if ($category != 'NONE'): ?>
<h2>[?php echo __('<?php echo $category_name ?>', null, "<?php echo $this->getParameterValue("config.i18n.".$category_name, $this->getModuleName()) ?>") ?]</h2>
<?php endif; ?>
<div class="content">
<?php $hides = $this->getParameterValue('config.hide', array()) ?>
<?php foreach ($columns as $name => $column):
if (in_array($column->getName(), $hides) || $column->isPrimaryKey())
{
continue;
}
$credentials = $this->getParameterValue('config.fields.'.$column->getName().'.credentials');
$i18n_catalogue = $this->getParameterValue("config.fields.".$column->getName().".i18n", $this->getModuleName());
$params = $this->getParameterValue('config.fields.'.$column->getName().'.params');
$required = $this->getParameterValue('config.fields.'.$column->getName().'.required', $column->isNotNull());
$old_config = $this->getParameterValue('config.fields.'.$column->getName().'.old_config');
$install_version = $this->getParameterValue('config.fields.'.$column->getName().'.hide_install_version');
$type = $this->getParameterValue("config.fields.".$column->getName().".type");
$row_type = $type ? 'row_type_'.$type : '';
$show_condition = ["!st_admin_is_field_removed('{$column->getName()}')"];
if ($this->getParameterValue('config.fields.'.$column->getName().'.custom'))
{
$row_type .= ' row_type_custom';
}
if ($type == 'checkbox' || $type == 'checkbox_tag')
{
$row_type .= ' row_type_plain';
}
if ($install_version)
{
$show_condition[] = "!stSoteshop::checkInstallVersion('$install_version')";
}
if ($old_config)
{
$show_condition[] = "!stTheme::hideOldConfiguration()";
}
if ($credentials)
{
$credentialsStr = str_replace("\n", ' ', var_export($credentials, true));
$show_condition[] = "\$this->getUser()->hasCredential($credentialsStr)";
}
?>
[?php if (<?php echo implode(" && ", $show_condition) ?>): ?]
<?php if (true !== $this->getParameterValue("config.fields.".$column->getName().".hide_row")): ?>
<div class="row row_<?php echo $column->getName() ?>[?php if ($sf_user->getParameter('<?php echo $column->getName() ?>', false, 'soteshop/stAdminGenerator/hidden')): ?] hidden always[?php endif ?] <?php echo $row_type ?>">
<?php if (true !== $this->getParameterValue("config.fields.".$column->getName().".hide_label")): ?>
<label for="config_<?php echo $column->getName() ?>"<?php if ($column->isNotNull() || $this->getParameterValue("config.fields.".$column->getName().".required")): ?> class="required" <?php endif; ?>>
[?php echo rtrim(__($labels['config{<?php echo $column->getName() ?>}'], array(), '<?php echo $i18n_catalogue ?>'), ':'); ?]<?php if ($help = $this->getParameterValue("config.fields.".$column->getName().".help", '')): ?> <a href="#" class="help" title="[?php echo htmlspecialchars(__('<?php echo $help ?>', null, '<?php echo $i18n_catalogue ?>')) ?]"></a><?php endif; ?>
</label>
<div class="field[?php if ($sf_request->hasError('config{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]">
<?php endif; // hide_label ?>
<?php endif; // hide_row ?>
[?php if ($sf_request->hasError('config{<?php echo $column->getName() ?>}')): ?]
[?php echo form_error('config{<?php echo $column->getName() ?>}', array('class' => 'form-error-msg')) ?]
[?php endif; ?]
[?php echo <?php echo $this->getColumnFormTag($column,'config'); ?>; ?]
<?php if (true !== $this->getParameterValue("config.fields.".$column->getName().".hide_row")): ?>
<?php if (true !== $this->getParameterValue("config.fields.".$column->getName().".hide_label")): ?>
</div>
<div class="clr"></div>
<?php endif; // hide_label ?>
</div>
<?php endif; // hide_row ?>
[?php endif; ?]
<?php endforeach; ?>
</div>
</fieldset>
[?php endif; ?]
<?php endforeach; ?>
<div id="config_actions">[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>config_actions', array('config' => $config, 'forward_parameters' => $forward_parameters)) ?]</div>
</form>
<script type="text/javascript">
jQuery(function($) {
function fieldsetVisibility()
{
$('#admin_config_form fieldset').each(function() {
var fieldset = $(this);
if (!fieldset.find('.content > .row:not(.hidden)').length) {
fieldset.addClass('hidden');
} else if (!fieldset.hasClass('always')) {
fieldset.removeClass('hidden');
}
});
}
$('#admin_config_form').on('update:fieldsetVisibility', fieldsetVisibility);
$(document).ready(function() {
$('#config_actions').stickyBox();
fieldsetVisibility();
});
});
</script>

View File

@@ -0,0 +1,21 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php st_view_slot_start('application-menu') ?]
<?php if ($menu = $this->getMenuComponentBy('config.menu.use')): ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', '<?php echo $menu ?>', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(), 'related_object' => $related_object)) ?]
<?php if (strpos($this->getParameterValue('list.menu.use'), 'edit.') !== false): ?>
<?php if ($this->getParameterValue($this->getCustomActionName('', '_').'list.menu.display')): ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>Menu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array())); ?]
<?php elseif ($this->getParameterValue('list.menu.display', null, false)): ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', 'listMenu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array())); ?]
<?php endif ?>
<?php endif ?>
<?php elseif (!$this->getParameterValue('list.menu.display')): ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', 'configMenu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array())) ?]
<?php else: ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', 'listMenu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(), 'related_object' => $related_object)) ?]
<?php endif; ?>
[?php st_view_slot_end() ?]

View File

@@ -0,0 +1,14 @@
<div class="custom-menu">
<ul>
[?php foreach ($items as $action => $name): $url = url_for($action) ?]
<li class="[?php echo $selected_item_path == $url ? 'selected' : 'none' ?]"><a href="[?php echo $url ?]">[?php echo $name ?]</a></li>
[?php endforeach; ?]
<?php if ($this->getParameterValue('documentation')): ?>
<li class="none">
<a href="[?php echo $sf_user->getCulture() == 'pl_PL' ? '<?php echo $this->getParameterValue('documentation.pl') ?>' : '<?php echo $this->getParameterValue('documentation.en') ?>' ?]?hash=085c1d2475cb9de3342947e98937e077" target="_blank">
[?php echo __("Dokumentacja", null, 'stAdminGeneratorPlugin') ?]
</a>
</li>
<?php endif ?>
</ul>
</div>

View File

@@ -0,0 +1,19 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
<div class="edit-menu">
<ul>
[?php foreach ($items as $action => $name): $url = url_for($action) ?]
<li class="[?php echo $selected_item_path == $url ? 'selected' : 'none' ?]"><a href="[?php echo $url ?]"[?php if ($url[0] != '/'): ?] target="_blank"[?php endif ?]>[?php echo $name ?]</a></li>
[?php endforeach; ?]
<?php if ($this->getParameterValue('documentation', null, false)): ?>
<li class="none">
<a href="[?php echo $sf_user->getCulture() == 'pl_PL' ? '<?php echo $this->getParameterValue('documentation.pl', null, false) ?>' : '<?php echo $this->getParameterValue('documentation.en', null, false) ?>' ?]?hash=085c1d2475cb9de3342947e98937e077" target="_blank">
[?php echo __("Dokumentacja", null, 'stAdminGeneratorPlugin') ?]
</a>
</li>
<?php endif ?>
</ul>
</div>

View File

@@ -0,0 +1,45 @@
<?php
/**
* @var stAdminGenerator $this
*/
$editActions = $this->getParameterValue('edit.actions');
$returnUrlCallback = sfInflector::underscore($this->getModuleName()).'_'.$this->getCustomActionName().'_return_url';
?>
[?php echo st_get_admin_actions_head('style="float: left"') ?]
<?php if (null === $editActions || (null !== $editActions && array_key_exists('_delete', $editActions))): ?>
[?php if (method_exists($<?php echo $this->getSingularName() ?>, 'getIsSystemDefault') == false || (method_exists($<?php echo $this->getSingularName() ?>, 'getIsSystemDefault') && !$<?php echo $this->getSingularName() ?>->getIsSystemDefault())): ?]
<?php if (!isset($editActions['_delete']['action'])) $editActions['_delete']['action'] = $this->getCustomActionNameCamelized('', 'Delete', 'delete') ?>
<?php echo $this->addCredentialCondition($this->getButtonToAction('_delete', $editActions['_delete'], true), $editActions['_delete']) ?>
[?php endif; ?]
<?php endif; ?>
<?php if ($this->getParameterValue('edit.editable')): ?>
[?php if ($sf_user->getParameter('mode', 'show', '<?php echo stAdminGenerator::getModuleNamespace($this->getModuleName(), $this->getCustomActionNameCamelized('', 'Edit', 'edit'), 'config') ?>') == 'edit'): ?]
[?php echo st_get_admin_action('preview', __('Tryb przegladania', null, 'stAdminGeneratorPlugin'), '<?php echo $this->getModuleName() ?>/setConfiguration?for_action=<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>&params[mode]=show') ?]
[?php else: ?]
[?php echo st_get_admin_action('edit', __('Tryb edycji', null, 'stAdminGeneratorPlugin'), '<?php echo $this->getModuleName() ?>/setConfiguration?for_action=<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>&params[mode]=edit') ?]
[?php endif; ?]
<?php endif; ?>
</ul>
[?php echo st_get_admin_actions_head('style="float: right"') ?]
<?php if (null !== $editActions): ?>
<?php foreach ((array) $editActions as $actionName => $params): ?>
<?php if ($actionName == '_delete' || isset($params['name']) && false === $params['name']) continue ?>
[?php if (!st_admin_is_action_hidden('<?php echo $actionName ?>')): ?]
<?php if ($actionName == '_list' && !isset($params['action'])) $params['action'] = $this->getCustomActionNameCamelized('', 'List', 'list'); $params['callback'] = $returnUrlCallback ?>
<?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, $actionName == '_list' ? false : true), $params) ?>
[?php endif ?]
<?php endforeach; ?>
<?php else: ?>
[?php if (!st_admin_is_action_hidden('_list')): ?]
<?php echo $this->getButtonToAction('_list', array('action' => $this->getCustomActionNameCamelized('', 'List', 'list'), 'callback' => $returnUrlCallback), false) ?>
[?php endif ?]
[?php if (!st_admin_is_action_hidden('_save')): ?]
<?php echo $this->getButtonToAction('_save', $params, true) ?>
[?php endif ?]
[?php if (!st_admin_is_action_hidden('_save_and_add')): ?]
<?php echo $this->getButtonToAction('_save_and_add', $params, true) ?>
[?php endif ?]
<?php endif; ?>
[?php echo st_get_admin_actions_foot() ?]

View File

@@ -0,0 +1,214 @@
<?php
/**
* @var stAdminGenerator $this
*/
$default_i18n_catalogue = $this->getParameterValue('edit.i18n', $this->getModuleName());
if (is_array($default_i18n_catalogue))
{
$default_i18n_catalogue = $this->getModuleName();
}
?>
[?php
$mode = $admin_configuration->getParameter('mode', '<?php echo $this->getParameterValue('edit.editable') ? 'show': 'edit' ?>', $sf_context->getModuleName(), '<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>');
?]
[?php echo form_tag(stAdminGeneratorHelper::generateModelUrl($<?php echo $this->getSingularName() ?>, $sf_context->getModuleName(), '<?php echo $this->getCustomActionNameCamelized('', 'Save', 'save') ?>', $forward_parameters), array(
'id' => 'admin_edit_form',
'name' => 'admin_edit_form',
'class' => 'admin_form',
'multipart' => true,
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
<?php if (false !== strpos($this->getParameterValue('edit.fields.'.$column->getName().'.type'), 'admin_double_list')): ?>
'onsubmit' => 'double_list_submit(); return true;'
<?php break 2; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('','_') ?>edit_form_start', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]
<?php foreach ($this->getColumnCategories('edit.display') as $category):
$columns = $this->getColumns('edit.display', $category);
if (empty($columns))
{
continue;
}
$category_name = $category[0] == '-' ? substr($category, 1) : $category;
$fieldset_id = $this->normalizeColumnName($category_name);
$category_install_version = $this->getParameterValue("edit.hide_install_version.".$category);
$category_old_config = $this->getParameterValue("edit.old_config.".$category);
$show_condition = ["!st_admin_is_field_removed('$fieldset_id')"];
if ($category_install_version)
{
$show_condition[] = "!stSoteshop::checkInstallVersion('$category_install_version')";
}
if ($category_old_config)
{
$show_condition[] = "!stTheme::hideOldConfiguration()";
}
?>
[?php if (<?php echo implode(" && ", $show_condition) ?>): ?]
<fieldset id="sf_fieldset_<?php echo $fieldset_id ?>"[?php if (st_admin_is_field_hidden('<?php echo $fieldset_id ?>')): ?] class="hidden always"[?php endif ?]>
<?php if ($category != 'NONE'): ?>
<h2>[?php echo __('<?php echo $category_name ?>', null, '<?php echo $this->getParameterValue("edit.i18n.".$category_name, $default_i18n_catalogue) ?>') ?]</h2>
<?php endif; ?>
<div class="content">
<?php $hides = $this->getParameterValue('edit.hide', array()) ?>
<?php foreach ($columns as $name => $column):
if (in_array($column->getName(), $hides)) continue;
if ($column->isPrimaryKey() && !$column->isForeignKey()) continue;
$credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials');
$i18n_catalogue = $this->getParameterValue("edit.fields.".$column->getName().".i18n", $default_i18n_catalogue);
$only_for = $this->getParameterValue('edit.fields.'.$column->getName().'.only_for');
$hide_on_create = $this->getParameterValue('edit.fields.'.$column->getName().'.hide_on_create');
$hide_on_edit = $this->getParameterValue('edit.fields.'.$column->getName().'.hide_on_edit');
$old_config = $this->getParameterValue('edit.fields.'.$column->getName().'.old_config');
$install_version = $this->getParameterValue('edit.fields.'.$column->getName().'.hide_install_version');
$user_params = $this->getParameterValue('edit.fields.'.$column->getName().'.params');
$type = $this->getParameterValue('edit.fields.'.$column->getName().'.type');
$user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params);
$virtual = $column->isComponent() || $column->isPartial() || null !== $this->getParameterValue('edit.fields.' . $column->getName() . '.callback');
$plain_on_edit = $this->getParameterValue('edit.fields.'.$column->getName().'.plain_on_edit', false);
$plain_callback = method_exists($this->getClassName(), 'isAdminGeneratorPlainField') ? sprintf('!$%s->isAdminGeneratorPlainField(\'%s\')', $this->getSingularName(), $column->getName()) : sprintf('$%s->isNew()', $this->getSingularName());
$show_condition = ["!st_admin_is_field_removed('{$column->getName()}')"];
if ($install_version)
{
$show_condition[] = "!stSoteshop::checkInstallVersion('$install_version')";
}
if ($old_config)
{
$show_condition[] = "!stTheme::hideOldConfiguration()";
}
if ($hide_on_create || $only_for == 'edit')
{
$show_condition[] = "!empty(\${$this->getSingularName()}->getPrimaryKey())";
}
elseif ($hide_on_edit || $only_for == 'create')
{
$show_condition[] = "\${$this->getSingularName()}->isNew()";
}
if ($credentials)
{
$credentialsStr = str_replace("\n", ' ', var_export($credentials, true));
$show_condition[] = "\$this->getUser()->hasCredential($credentialsStr)";
}
if (!$type)
{
$type = 'plain';
}
if ($column->getCreoleType() == CreoleTypes::BOOLEAN)
{
$type = 'checkbox_tag';
}
$row_type = $type ? 'row_type_' . $type : '';
if ($this->getParameterValue('edit.fields.'.$column->getName().'.custom'))
{
$row_type .= ' row_type_custom';
}
?>
[?php if (<?php echo implode(" && ", $show_condition) ?>): ?]
<?php if (true !== $this->getParameterValue("edit.fields.".$column->getName().".hide_row")): ?>
<div class="row row_<?php echo $column->getName() ?>[?php if (st_admin_is_field_hidden('<?php echo $column->getName() ?>')): ?] hidden always[?php endif ?]<?php if (isset($user_params['rich']) && $type == 'textarea_tag'): ?> tinymce-type<?php endif ?> <?php echo !$plain_on_edit ? $row_type : sprintf('[?php echo %s ? \'%s\' : \'row_type_plain\' ?]', $plain_callback, $row_type) ?>">
<?php if (true !== $this->getParameterValue("edit.fields.".$column->getName().".hide_label")): ?>
<label for="<?php echo $this->getSingularName() ?>_<?php echo $column->getName() ?>"<?php if ($this->getParameterValue("edit.fields.".$column->getName().".required", $column->isNotNull())): ?> class="required" <?php endif; ?>>
[?php echo __($labels['<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}'], array(), '<?php echo $i18n_catalogue ?>'); ?]<?php if ($help = $this->getParameterValue("edit.fields.".$column->getName().".help", '')): ?> <a href="#" class="help" title="[?php echo htmlspecialchars(__('<?php echo $help ?>', null, '<?php echo $i18n_catalogue ?>')) ?]"></a><?php endif; ?>
</label>
<div class="field[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]">
<?php endif; // hide label ?>
[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?]
[?php echo form_error('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}', array('class' => 'form-error-msg')) ?]
[?php endif; ?]
<?php endif; // hide row ?>
<?php if ($related_class = $this->getParameterValue("edit.fields." . $column->getName() . ".related_class")): ?>
<?php $this->changeModelClass($related_class) ?>
<?php $related_fields = $this->getColumns("edit.fields." . $column->getName() . ".related_fields.display") ?>
[?php $<?php echo $this->getSingularName() ?> = new <?php echo $related_class ?>() ?]
<table cellspacing="0" class="st_record_list">
<thead>
<tr>
<?php foreach ($related_fields as $related_column): ?>
<th>[?php echo __('<?php echo $this->getParameterValue('edit.fields.' . $column->getName() . '.related_fields.' . $related_column->getName() . '.name', $related_column->getName()) ?>') ?]</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr>
<?php foreach ($related_fields as $related_column): ?>
<td>[?php $value = <?php echo $this->getRelatedColumnEditTag($column, $related_column); ?>; echo $value ? $value : '&nbsp;' ?]</td>
<?php endforeach; ?>
<?php $this->restoreModelClass() ?>
<tr>
</tbody>
<tfoot>
<tr>
<th colspan="<?php echo count($related_fields); ?>">
[?php echo st_get_admin_actions_head('style="margin: 0px; float: right"') ?]
[?php echo st_get_admin_action('add', __('Dodaj'), null, array("onclick" => "window.alert('test'); return false;")) ?]
[?php echo st_get_admin_actions_foot() ?]
</th>
</tr>
</tfoot>
</table>
<?php else: // related_class ?>
<?php if (!$virtual && $plain_on_edit): ?>
[?php echo <?php echo $plain_callback ?> ? <?php echo $this->getColumnEditTag($column); ?> : st_admin_object_plain_field_tag($<?php echo $this->getSingularName() ?>, '<?php echo $this->getColumnGetter($column) ?>', ['type' => '<?php echo $type == 'checkbox' || $type == 'checkbox_tag' ? 'bool' : null ?>']) ?]
<?php else: ?>
[?php echo <?php echo $this->getColumnEditTag($column) ?> ?]
<?php endif ?>
<?php endif; // related_class ?>
<?php if (true !== $this->getParameterValue("edit.fields.".$column->getName().".hide_row")): ?>
<?php if (true !== $this->getParameterValue("edit.fields.".$column->getName().".hide_label")): ?>
<div class="clr"></div>
</div>
<?php endif; // hide_label ?>
</div>
<?php endif; // hide_row ?>
[?php endif; ?]
<?php endforeach; // edit.display.category ?>
</div>
</fieldset>
[?php endif; ?]
<?php endforeach; // edit.display ?>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('','_') ?>edit_form_end', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]
<div id="edit_actions">[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('','_') ?>edit_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]</div>
</form>
<script type="text/javascript">
jQuery(function($) {
function fieldsetVisibility()
{
$('#admin_edit_form fieldset').each(function() {
var fieldset = $(this);
if (!fieldset.find('.content .row:not(.hidden)').length) {
fieldset.addClass('hidden');
} else if (!fieldset.hasClass('always')) {
fieldset.removeClass('hidden');
}
});
}
$('#admin_edit_form').on('update:fieldsetVisibility', fieldsetVisibility);
$(document).ready(function() {
$('#edit_actions').stickyBox();
fieldsetVisibility();
});
});
</script>

View File

@@ -0,0 +1,31 @@
<?php
/**
* @var stAdminGenerator $this
*/
$returnUrlCallback = sfInflector::underscore($this->getModuleName()).$this->getCustomActionName('_').'_return_url';
?>
<?php if (null !== $this->getParameterValue('list') || null === $this->getParameterValue('list') && (empty($this->getCustomActionName()) || null === $this->getParameterValue('edit.build_options.related_id'))): ?>
[?php st_view_slot_start('application-menu') ?]
<?php if (null !== $this->getParameterValue('list')): ?>
<div class="edit-menu">
<ul>
<li>
<a href="[?php echo st_url_for(is_callable('<?php echo $returnUrlCallback ?>') ? call_user_func('<?php echo $returnUrlCallback ?>') : <?php echo $this->getReturnUrl() ?>) ?]">
[?php echo st_admin_get_icon('prev') ?]
<span>[?php echo __('Powrót', null, 'stAdminGeneratorPlugin') ?]</span>
</a>
</li>
</ul>
</div>
<?php endif ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>Menu', array(
'forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(),
'related_object' => $related_object,
)) ?]
[?php st_view_slot_end() ?]
<?php elseif ($this->getParameterValue('edit.build_options.related_id')): ?>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/edit_menu', array(
'forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(),
'related_object' => $related_object,
)) ?]
<?php endif ?>

View File

@@ -0,0 +1,8 @@
<div class="horizontal_list">
<ul>
[?php foreach ($items as $action => $name): ?]
<li class="simple">[?php echo link_to(__($name), $action) ?]</li>
[?php endforeach; ?]
<li class="clear_item"></li>
</ul>
</div>

View File

@@ -0,0 +1,5 @@
[?php use_helper('I18N', 'Date', 'Text', 'stAdminGenerator') ?]
[?php echo st_get_admin_actions_head('style="float: left"') ?]
[?php echo st_get_admin_action('file', __('Pobierz plik', array(), 'stImportExportBackend'), $link , array ( 'name' => 'save',)) ?]
[?php echo st_get_admin_actions_foot() ?]

View File

@@ -0,0 +1,61 @@
[?php echo st_get_admin_foot() ?]
[?php if (!stLicense::hasSupport() && !stLicense::isOpen()): ?]
<style type="text/css">
#support_tooltip {
padding-left: 25px;
background: rgba(255, 255, 255, 0.1);
display: none;
z-index: 1000;
}
#support_tooltip div {
border-radius: 50px 0px 0px 50px;
min-height: 28px;
background: url(/images/backend/premium.png) no-repeat scroll left center rgb(255, 255, 255);
padding: 22px 10px 12px 80px;
border: 1px solid rgb(204, 204, 204);
box-shadow: 0px 0px 5px rgb(204, 204, 204);
}
</style>
<script type="text/javascript">
jQuery(function($) {
var support = $('.support');
support.each(function() {
var value = '';
var widget = $(this);
widget.attr('disabled', 'disabled');
if (this.type == 'checkbox' && this.checked)
{
widget.after($('<input type="hidden" value="'+widget.val()+'" name="'+widget.attr('name')+'" />'));
}
else if (this.type != 'checkbox')
{
widget.after($('<input type="hidden" value="'+widget.val()+'" name="'+widget.attr('name')+'" />'));
}
var container = $('<div style="width: '+widget.width()+'px; height: '+widget.height()+'px; display: inline-block; position: absolute; z-index: 1" />');
widget.before(container);
container.tooltip({
tip: '#support_tooltip',
"delay": 10,
"position": "center right",
"offset":[3, -10],
predelay: 0,
});
});
});
</script>
<div id="support_tooltip">
<div>
[?php if (stLicense::isOpen()): ?]
<a target="_blank" href="[?php echo $sf_user->getCulture() == 'pl_PL' ? 'http://www.sote.pl/licencja-soteshop.html' : 'http://www.soteshop.com/soteshop-license.html' ?]">[?php echo __('Zamów wersje komercyjną', null, 'stAdminGeneratorPlugin') ?]</a>
[?php else: ?]
<a target="_blank" href="[?php echo get_7_link() ?]">[?php echo __('Zamów aktualizację do wersji 7', null, 'stAdminGeneratorPlugin') ?]</a>
[?php endif; ?]
</div>
</div>
[?php endif ?]

View File

@@ -0,0 +1,34 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php
if (isset($related_object) && !$related_object->isNew())
{
if (method_exists($related_object, 'getAdminGeneratorTitle') && $related_object->getAdminGeneratorTitle($sf_context->getI18N()))
{
$title = content_tag('span', $related_object->getAdminGeneratorTitle($sf_context->getI18N()), array('class' => 'admin-generator-title')) . ' ' . content_tag('span', $title, array('class' => 'admin-generator-title'));
}
elseif (!method_exists($related_object, 'getAdminGeneratorTitle') && method_exists($related_object, 'getName') && $related_object->getName())
{
$title = content_tag('span', $related_object->getName(), array('class' => 'admin-generator-title')) . ' ' . content_tag('span', $title, array('class' => 'admin-generator-title'));
}
}
?]
<?php if ($this->getParameterValue('head.package', null, false)): ?>
[?php echo st_get_admin_head('<?php echo $this->getParameterValue('head.package', $this->getModuleName(), false) ?>', $title, array(
'hideable' => isset($hideable) ? $hideable : array(),
'culture' => isset($culture) ? $culture : null,
'route' => isset($route) ? $route : null,
'favorite' => isset($favorite) ? $favorite : null,
)) ?]
<?php else: $title = $this->getAppTitle() ?>
[?php echo st_get_admin_head(array('<?php echo $this->getParameterValue('route', $this->getModuleName(), false) ?>', __('<?php echo $title ?>'), '<?php echo $this->getParameterValue('icon', $this->getModuleName().'.svg', false) ?>'), $title, array(
'hideable' => isset($hideable) ? $hideable : array(),
'culture' => isset($culture) ? $culture : null,
'route' => isset($route) ? $route : null,
'favorite' => isset($favorite) ? $favorite : null,
)) ?]
<?php endif; ?>

View File

@@ -0,0 +1,8 @@
<div class="horizontal_list">
<ul>
[?php foreach ($items as $action => $name): ?]
<li class="simple">[?php echo link_to(__($name), $action) ?]</li>
[?php endforeach; ?]
<li class="clear_item"></li>
</ul>
</div>

View File

@@ -0,0 +1,197 @@
<?php
/**
* @var stAdminGenerator $this
*/
$object_actions = $this->getParameterValue('list.object_actions');
?>
<table id="st_record_list" cellspacing="0" cellpadding="0" class="st_record_list record_list"<?php if ($this->getParameterValue('list.auto_width')): ?> style="width: 100%"<?php endif; ?>>
<thead>
<tr>
[?php if ($<?php echo $this->getSingularName() ?>_action_select_options): ?]
<th width="1%">
[?php echo st_admin_checkbox_tag('<?php echo $this->getSingularName() ?>[select_control_head]', true, false, array('class' => 'selector_control')) ?]
</th>
[?php endif; ?]
<?php if ($object_actions && isset($object_actions['_edit'])): ?>
<th width="1%">&nbsp;</th>
<?php endif; ?>
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_th_tabular', array('forward_parameters' => $forward_parameters, 'pager' => $pager)) ?]
<?php if ($this->getParameterValue('list.build_options.through_class')): $i18n_catalogue = $this->getParameterValue('list.fields._assigned.i18n', 'stAdminGeneratorPlugin') ?>
<th width="1%">
<a href="[?php echo st_url_for(stAdminGeneratorHelper::applyParametersToUrl('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>?sort=assigned&type='.($sf_user->getAttribute('type', 'asc', 'sf_admin/<?php echo $this->getGeneratedModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>sort') == 'asc' ? 'desc' : 'asc'), $forward_parameters)) ?]">
<span class="align-middle">
[?php echo __('<?php echo $this->getParameterValue('list.fields._assigned', 'Przypisany') ?>', array(), '<?php echo $i18n_catalogue ?>') ?]
</span>
[?php if ($sf_user->getAttribute('sort', null, 'sf_admin/<?php echo $this->getGeneratedModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>sort') == 'assigned'): ?]
[?php echo st_admin_get_icon($sf_user->getAttribute('type', 'asc', 'sf_admin/<?php echo $this->getGeneratedModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>sort') == 'asc' ? 'expand' : 'collapse', ['size' => 18]) ?]
[?php endif; ?]
</a>
</th>
<?php endif; ?>
<?php if ($this->isObjectActionVisible()): ?>
<th width="1%">&nbsp;</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php
$mark_as = $this->getParameterValue('list.mark_as');
if ($mark_as)
{
$mark_as_field = strtoupper($this->getParameterValue('list.mark_as.field', 'IS_MARKED_AS_READ'));
if (!defined($this->getPeerClassName().'::'.$mark_as_field))
{
throw new sfConfigurationException(sprintf('Parameter list.mark_as.field must be a mapped field in model %s', $this->getClassName()));
}
}
?>
[?php $i = 1; $k=1; foreach ($pager->getResults() as $<?php echo $this->getSingularName() ?>): $odd = fmod(++$i, 2); ?]
<?php foreach ($this->getColumns('list.display') as $column): if ($this->getParameterValue('list.editable.'.$column->getName()) === null) continue; ?>
[?php if (form_has_error('<?php echo $this->getSingularName() ?>{'.$<?php echo $this->getSingularName() ?>->getPrimaryKey().'}{<?php echo $column->getName() ?>}')): ?]
<tr><td colspan="<?php echo $this->getRecordListColSpan() ?>">[?php echo form_error('<?php echo $this->getSingularName() ?>['.$<?php echo $this->getSingularName() ?>->getPrimaryKey().'][<?php echo $column->getName() ?>]', array('class' => 'list_error')); ?]</td></tr>
[?php endif; ?]
<?php endforeach; ?>
<tr class="[?php if ($odd): ?]highlight[?php endif ?]<?php if ($mark_as): ?>[?php if (!method_exists($<?php echo $this->getSingularName() ?>, 'getIsMarkedAsRead') && !$<?php echo $this->getSingularName() ?>->get<?php echo sfInflector::camelize(strtolower($mark_as_field)) ?>() || method_exists($<?php echo $this->getSingularName() ?>, 'getIsMarkedAsRead') && !$<?php echo $this->getSingularName() ?>->getIsMarkedAsRead()): ?] marked_as_not_read[?php endif ?]<?php endif ?>">
[?php if ($<?php echo $this->getSingularName() ?>_action_select_options): ?]
<td>
[?php echo st_admin_checkbox_tag('<?php echo $this->getSingularName() ?>[selected][' . <?php echo $this->getPrimaryKeyField() ?> . ']', <?php echo $this->getPrimaryKeyField(':') ?>, false, array('class' => 'selector')) ?]
</td>
[?php endif; ?]
<?php if ($object_actions && isset($object_actions['_edit'])): ?>
<?php if (($object_actions = $this->getParameterValue('list.object_actions')) && isset($object_actions['_edit'])): ?>
<td>
<ul class="st_object_actions">
<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?>
<?php if ($actionName=='_edit'):?>
<?php if (!isset($params['action'])) $params['action'] = $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>
[?php if (!method_exists($<?php echo $this->getSingularName() ?>, 'isAdminGeneratorActionVisible') || $<?php echo $this->getSingularName() ?>->isAdminGeneratorActionVisible('_edit')): ?]
<?php echo $this->addCredentialCondition($this->getLinkToAction($actionName, $params, true), $params) ?>
[?php endif ?]
<?php endif ?>
<?php endforeach; ?>
</ul>
[?php echo input_hidden_tag('<?php echo $this->getSingularName() ?>['.<?php echo $this->getPrimaryKeyField() ?>.'][id]', <?php echo $this->getPrimaryKeyField() ?>) ?]
</td>
<?php endif; ?>
<?php endif; ?>
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_td_tabular', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]
<?php if ($this->getParameterValue('list.build_options.through_class')): ?>
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_td_assigned', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]
<?php endif; ?>
<?php if ($this->isObjectActionVisible()): ?>
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_td_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]
<?php endif; ?>
</tr>
[?php endforeach; ?]
[?php if (!$pager->getNbResults()): ?]
<tr>
[?php echo st_admin_table_column_message(__(isset($empty_message) ? $empty_message : 'Brak rekordów - zmień kryteria wyszukiwania', null, '<?php echo $this->getModuleName() ?>'), <?php echo $this->getRecordListColSpan() ?>) ?]
</tr>
[?php endif; ?]
</tbody>
</table>
<script type="text/javascript">
jQuery(function($) {
var highlighted = false;
var selectors = null;
function submitChanges() {
$('#record_list_form')
.attr('action', "[?php echo st_url_for('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionNameCamelized('', 'UpdateList', 'updateList') ?>') ?]")
.submit();
}
function submitSelectFormChanges(select, ajax) {
var form = select.closest('form');
if (ajax) {
$(document).trigger('preloader', 'show');
$.post(select.val(), form.serialize(), function(response) {
$(document).trigger('preloader', ['update', response]);
});
} else {
form.attr('action', select.val());
form.submit();
}
}
$('#update-list-form').click(function() {
submitChanges();
return false;
});
$('#filter_list_form .is_empty_field input[type=checkbox]').change(function() {
var input = $(this);
var inputs = input.closest('.field').find('input, select').not('[type=checkbox]');
inputs.prop('disabled', input.prop('checked'));
}).change();
let recordList = $('#st_record_list');
recordList.on('change', 'input.selector', function() {
var input = $(this);
if (input.prop('checked')) {
if (highlighted) {
highlighted = false;
$('body td.highlight').removeClass('highlight');
}
input.closest('tr').addClass('selected');
} else {
input.closest('tr').removeClass('selected');
}
});
[?php if ($sf_user->getParameter('mode', null, '<?php echo stAdminGenerator::getModuleNamespace($this->getModuleName(), $this->getCustomActionNameCamelized('', 'List', 'list'), 'config') ?>') == 'edit'): ?]
recordList.find('input.editable').keypress(function(e) {
if (e.which == 13) {
submitChanges();
return false;
}
});
[?php endif ?]
recordList.find('input.selector_control').change(function() {
let selectors = recordList.find('input.selector');
selectors.prop('checked', $(this).prop('checked')).change();
});
$('.list_select_control select').change(function() {
let select = $(this);
let selectors = recordList.find('input.selector');
if (select.val()) {
if (selectors.is(':checked')) {
var option = select.find(':selected');
var category = option.data('category');
var ajax = option.data('ajax');
var confirm_msg = '[?php echo __("Jesteś pewien, że chcesz wykonać operację", null, "stAdminGeneratorPlugin")." \"%action%\" ".__("na wybranych rekordach?", null, "stAdminGeneratorPlugin") ?]';
var confirm = option.data('confirm');
if (confirm !== 0) {
var message = category ? category+': '+option.text() : option.text();
var confirmed = window.confirm(confirm_msg.replace('%action%', confirm ? confirm : message));
if (confirmed)
{
submitSelectFormChanges(select, ajax);
}
}
else {
submitSelectFormChanges(select, ajax);
}
select.val("");
} else {
highlighted = true;
selectors.closest('td').addClass('highlight');
select.val("");
window.alert('[?php echo __("Musisz wybrać przynajmniej jeden rekord", null, "stAdminGeneratorPlugin") ?]');
}
}
});
});
</script>

View File

@@ -0,0 +1,17 @@
[?php $routing = sfRouting::getInstance(); ?]
[?php $module = stConfiguration::getInstance()->getDesktopModule($sf_context->getModuleName()); ?]
<div class="list-menu">
<ul>
[?php foreach ($items as $action => $name): $url = url_for($action) ?]
<li class="[?php echo $selected_item_path == $url ? 'selected' : 'none' ?]"><a href="[?php echo $url ?]"[?php if ($url[0] != '/'): ?] target="_blank"[?php endif ?]>[?php echo $name ?]</a></li>
[?php endforeach; ?]
<?php if ($this->getParameterValue('documentation', null, false)): ?>
<li class="none">
<a href="[?php echo $sf_user->getCulture() == 'pl_PL' ? '<?php echo $this->getParameterValue('documentation.pl', null, false) ?>' : '<?php echo $this->getParameterValue('documentation.en', null, false) ?>' ?]?hash=085c1d2475cb9de3342947e98937e077" target="_blank">
[?php echo __("Dokumentacja", null, 'stAdminGeneratorPlugin') ?]
</a>
</li>
<?php endif ?>
</ul>
</div>

View File

@@ -0,0 +1,28 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
<?php if ($this->getParameterValue('list.editable')): ?>
[?php echo st_get_admin_actions_head('style="margin-top: 10px; float: left"') ?]
[?php if ($sf_user->getParameter('mode', null, '<?php echo stAdminGenerator::getModuleNamespace($this->getModuleName(), $this->getCustomActionNameCamelized('', 'List', 'list'), 'config') ?>') == 'edit' && $pager->getNbResults() > 0): ?]
[?php echo st_get_admin_action('list', __('Tryb przegladania', null, 'stAdminGeneratorPlugin'), '<?php echo $this->getModuleName() ?>/setConfiguration?for_action=<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>&params[mode]=list&page='.$pager->getPage()) ?]
[?php echo st_get_admin_action('save', __('Zapisz', null, 'stAdminGeneratorPlugin'), null, array('id' => 'update-list-form')) ?]
[?php elseif ($pager->getNbResults() > 0): ?]
[?php echo st_get_admin_action('edit', __('Tryb edycji', null, 'stAdminGeneratorPlugin'), '<?php echo $this->getModuleName() ?>/setConfiguration?for_action=<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>&params[mode]=edit&page='.$pager->getPage()) ?]
[?php endif; ?]
</ul>
<?php endif; ?>
[?php echo st_get_admin_actions_head('style="margin-top: 10px;"') ?]
<?php $listActions = $this->getParameterValue('list.actions') ?>
<?php if (null !== $listActions): ?>
<?php foreach ((array) $listActions as $actionName => $params): ?>
[?php if (!st_admin_is_action_hidden('<?php echo $actionName ?>')): ?]
<?php if ($actionName == '_create' && !isset($params['action'])) $params['action'] = $this->getCustomActionNameCamelized('', 'Create', 'create') ?>
<?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, false, 'list'), $params) ?>
[?php endif ?]
<?php endforeach; ?>
<?php else: ?>
<?php echo $this->getButtonToAction('_create', array('action' => $this->getCustomActionNameCamelized('', 'Create', 'create')), false, 'list') ?>
<?php endif; ?>
[?php echo st_get_admin_actions_foot() ?]

View File

@@ -0,0 +1,11 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
<div id="st_record_list-empty">
[?php echo st_admin_get_large_icon(isset($icon) ? $icon : null) ?]
<h2>[?php echo $title ?]</h2>
<p>[?php echo $message ?]</p>
[?php echo $actions ?]
</div>

View File

@@ -0,0 +1,255 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php echo form_tag(stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>', $forward_parameters), array('id' => 'filter_list_form', 'class' => 'admin_form', 'style' => 'display: none')) ?]
<div class="list_filters">
<ul class="header">
<?php foreach ($this->getColumns('list.display') as $column): ?>
<?php
$filterable = $this->getParameterValue('list.fields.'.$column->getName().'.filterable', true);
if ($filterable == false)
{
continue;
}
$namespace = 'list.filters.'.$column->getName();
$i18n_catalogue = $this->getParameterValue('list.fields.'.$column->getName().'.i18n', $this->getModuleName());
$label = $this->getParameterValue('list.fields.'.$column->getName().'.name');
$label = $this->getParameterValue($namespace.'.name', $label);
if (null === $label)
{
$label = $column->getName();
}
$callback = $this->getParameterValue('list.fields.'.$column->getName().'.label_callback');
$name = $column->getName();
$credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials');
if ($credentials)
{
$credentials = str_replace("\n", ' ', var_export($credentials, true));
}
$p = array();
if ($filter_field = $this->getParameterValue($namespace.'.filter_field'))
{
$p = array('alternative_name' => $column->getName());
$column = $this->getAdminColumnFromField($filter_field);
}
$type = $column->getCreoleType();
echo " <!-- {$column->getName()}:{$column->getCreoleType()}:{$column->isReal()} --> ";
$component = $this->getParameterValue($namespace.'.component');
$partial = $this->getParameterValue($namespace.'.partial');
?>
<?php $install_version = $this->getParameterValue('list.fields.'.$column->getName().'.hide_install_version') ?>
<?php if ($install_version): ?>
[?php if (!stSoteshop::checkInstallVersion('<?php echo $install_version ?>')): ?]
<?php endif ?>
<?php $old_config = $this->getParameterValue('list.fields.'.$column->getName().'.old_config') ?>
<?php if ($old_config): ?>
[?php if (!stTheme::hideOldConfiguration()): ?]
<?php endif ?>
<?php if ($credentials): ?>
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
<?php endif; ?>
<?php if ($component || $partial || $column->isReal()): ?>
<li [?php if ($sf_user->getParameter('<?php echo $column->getName() ?>', false, 'soteshop/stAdminGenerator/hidden')): ?] class="hidden"[?php endif ?]>
<?php if ($callback): ?>
[?php echo label_for('filters[<?php echo $name ?>]', <?php echo $callback ?>('<?php echo $label ?>')) ?]
<?php else: ?>
[?php echo label_for('filters[<?php echo $name ?>]', __('<?php echo $label ?>', null, '<?php echo $i18n_catalogue ?>')) ?]
<?php endif; ?>
<?php if ($component): $component = (substr($component, 0, 1)) . substr(sfInflector::camelize($component), 1) ?>
[?php st_include_component('<?php echo $this->getParameterValue($namespace.'.module', $this->getModuleName()) ?>', '<?php echo $component ?>', array('forward_parameters' => $forward_parameters, 'filters' => $filters, 'name' => 'filters[<?php echo $name ?>]', 'value' => isset($filters['<?php echo $name ?>']) ? $filters['<?php echo $name ?>'] : null)) ?]
<?php elseif ($partial): ?>
[?php st_include_partial('<?php echo $this->getParameterValue($namespace.'.module', $this->getModuleName()) ?>/<?php echo $partial ?>', array('forward_parameters' => $forward_parameters, 'filters' => $filters, 'name' => 'filters[<?php echo $name ?>]', 'value' => isset($filters['<?php echo $name ?>']) ? $filters['<?php echo $name ?>'] : null)) ?]
<?php elseif ($column->isReal()): ?>
[?php echo <?php echo $this->getColumnFilterTag($column, $p) ?> ?]
<?php endif; ?>
</li>
<?php endif; ?>
<?php if ($credentials): ?>
[?php endif; ?]
<?php endif; ?>
<?php if ($old_config): ?>
[?php endif; ?]
<?php endif ?>
<?php if ($install_version): ?>
[?php endif; ?]
<?php endif ?>
<?php endforeach; ?>
<?php if ($this->getParameterValue('list.build_options.through_class')): ?>
<li>
[?php echo label_for('filters[assigned]', __('Przypisany', null, 'stAdminGeneratorPlugin')) ?]
[?php echo select_tag('filters[assigned]', options_for_select(array('' => '---', 1 => __('tak', null, 'stAdminGeneratorPlugin'), 0 => __('nie', null, 'stAdminGeneratorPlugin')), isset($filters['assigned']) ? $filters['assigned'] : null)) ?]
</li>
<?php endif; ?>
<?php if ($this->getParameterValue('list.mark_as') && $this->getParameterValue('list.mark_as.filterable', true)): ?>
<li>
[?php echo label_for('filters[_is_marked_as]', __('Oznaczone jako', null, 'stAdminGeneratorPlugin')) ?]
[?php echo select_tag('filters[_is_marked_as]', options_for_select(array('read' => __('Przeczytane', array(), 'stAdminGeneratorPlugin'), 'unread' => __('Nieprzeczytane', array(), 'stAdminGeneratorPlugin')), isset($filters['_is_marked_as']) ? $filters['_is_marked_as'] : null, array (
'include_custom' => __("---", null, 'stAdminGeneratorPlugin'),
)), array (
)) ?]
</li>
<?php endif ?>
<li class="filter-control">
<label>&nbsp;</label>
[?php echo st_get_admin_button('search', null) ?]
</li>
[?php if ($filters): ?]
<li class="filter-control">
<label>&nbsp;</label>
[?php echo st_get_admin_button('close', null, null, array('class' => 'reset-filters', 'type' => 'button')) ?]
</li>
[?php endif; ?]
<?php if ($this->getParameterValue('list.additional_filters')): ?>
<li style="float: right; padding-left: 10px; padding-right: 0px">
<a href="#" class="advanced_search_trigger">[?php echo st_admin_get_icon('expand', array('title' => __('rozwiń', null, 'stAdminGeneratorPlugin'))) ?]</a>
</li>
<?php endif; ?>
</ul>
<div class="clr"></div>
<?php if ($this->getParameterValue('list.additional_filters')): ?>
<div class="advanced_search hidden">
<?php foreach ($this->getColumns('list.additional_filters') as $column): ?>
<?php
$namespace = 'list.filters.'.$column->getName();
$i18n_catalogue = $this->getParameterValue('list.fields.'.$column->getName().'.i18n', $this->getModuleName());
$label = $this->getParameterValue('list.fields.'.$column->getName().'.name', $column->getName());
$label = $this->getParameterValue($namespace.'.name', $label);
$name = $column->getName();
$credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials');
if ($credentials)
{
$credentials = str_replace("\n", ' ', var_export($credentials, true));
}
$p = array();
if ($filter_field = $this->getParameterValue($namespace.'.filter_field'))
{
$p = array('alternative_name' => $column->getName());
$column = $this->getAdminColumnFromField($filter_field);
}
$type = $column->getCreoleType();
?>
<?php $install_version = $this->getParameterValue('list.fields.'.$column->getName().'.hide_install_version') ?>
<?php if ($install_version): ?>
[?php if (!stSoteshop::checkInstallVersion('<?php echo $install_version ?>')): ?]
<?php endif ?>
<?php $old_config = $this->getParameterValue('list.fields.'.$column->getName().'.old_config') ?>
<?php if ($old_config): ?>
[?php if (!stTheme::hideOldConfiguration()): ?]
<?php endif ?>
<?php if ($credentials): ?>
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
<?php endif; ?>
<?php if ($component = $this->getParameterValue($namespace.'.component')): $component = (substr($component, 0, 1)) . substr(sfInflector::camelize($component), 1) ?>
<div class="row">
[?php echo label_for('filters[<?php echo $name ?>]', __('<?php echo $label ?>', null, '<?php echo $i18n_catalogue ?>')) ?]
<div class="field">
[?php st_include_component('<?php echo $this->getParameterValue($namespace.'.module', $this->getModuleName()) ?>', '<?php echo $component ?>', array('forward_parameters' => $forward_parameters, 'filters' => $filters)) ?]
</div>
</div>
<?php elseif ($partial = $this->getParameterValue($namespace.'.partial')): ?>
<div class="row">
[?php echo label_for('filters[<?php echo $name ?>]', __('<?php echo $label ?>', null, '<?php echo $i18n_catalogue ?>')) ?]
<div class="field">
[?php st_include_partial('<?php echo $this->getParameterValue($namespace.'.module', $this->getModuleName()) ?>/<?php echo $partial ?>', array('forward_parameters' => $forward_parameters, 'filters' => $filters)) ?]
</div>
</div>
<?php elseif ($column->isReal()): ?>
<div class="row">
[?php echo label_for('filters[<?php echo $name ?>]', __('<?php echo $label ?>', null, '<?php echo $i18n_catalogue ?>')) ?]
<div class="field">
[?php echo <?php echo $this->getAdvancedFilterTag($column, $p) ?> ?]
</div>
</div>
<?php endif; ?>
<?php if ($credentials): ?>
[?php endif; ?]
<?php endif; ?>
<?php if ($old_config): ?>
[?php endif; ?]
<?php endif ?>
<?php if ($install_version): ?>
[?php endif ?]
<?php endif ?>
<?php endforeach; ?>
<div class="clr"></div>
[?php echo st_get_admin_actions(array(
array('label' => "Filtruj", 'type' => 'search')
)) ?]
</div>
<?php endif; ?>
</div>
</form>
<script type="text/javascript">
jQuery(function($) {
var namespace = '[?php echo $sf_context->getModuleName() ?].[?php echo $sf_context->getActionName() ?].additional_filters';
var search_trigger = $('#filter_list_form a.advanced_search_trigger');
if ($('#filter_list_form ul').children('li:not(.filter-control)').length) {
$('#filter_list_form').show();
}
$('#filter_list_form .reset-filters').click(function() {
var form = $(this).closest('form');
form.prop('action', form.prop('action') + '?filters_clear=1');
form.submit();
});
search_trigger.toggle(
function() {
$('#filter_list_form div.advanced_search').removeClass('hidden');
search_trigger.addClass('expanded');
localStorage.setItem(namespace, 'expanded');
},
function() {
$('#filter_list_form div.advanced_search').addClass('hidden');
search_trigger.removeClass('expanded');
localStorage.removeItem(namespace);
}
);
if (localStorage.getItem(namespace) == 'expanded') {
search_trigger.click();
}
[?php if (isset($filters['_expanded'])): ?]
if (!search_trigger.hasClass('expanded')) {
search_trigger.click();
}
[?php endif ?]
});
</script>

View File

@@ -0,0 +1,19 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
<?php if ($this->getParameterValue('list.build_options.related_id')): ?>
[?php if (isset($related_object)): ?]
[?php st_include_partial('<?php echo $this->getParameterValue('list.build_options.parent_module', $this->getModuleName()) ?>/edit_menu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(), 'related_object' => $related_object)) ?]
[?php else: ?]
[?php st_view_slot_start('application-menu') ?]
[?php st_include_component('<?php echo $this->getModuleName() ?>', 'listMenu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array())) ?]
[?php st_view_slot_end() ?]
[?php endif ?]
<?php else : ?>
[?php st_view_slot_start('application-menu') ?]
[?php st_include_component('<?php echo $this->getModuleName() ?>', 'listMenu', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array())) ?]
[?php st_view_slot_end() ?]
<?php endif; ?>

View File

@@ -0,0 +1,111 @@
[?php if ($pager->haveToPaginate()): ?]
<ul class="pager float_left">
[?php if ($pager->getPage() == 1): ?]
<li class="first">
<b class="disabled">
[?php echo st_admin_get_icon('first-page', array('title' => __('pierwsza', null, 'stAdminGeneratorPlugin'))) ?]
</b>
</li>
<li class="prev">
<b class="disabled">
[?php echo st_admin_get_icon('prev', array('title' => __('poprzednia', null, 'stAdminGeneratorPlugin'))) ?]
</b>
</li>
[?php else: ?]
<li class="first">
<a href="[?php echo $url ?]?page=1">
[?php echo st_admin_get_icon('first-page', array('title' => __('pierwsza', null, 'stAdminGeneratorPlugin'))) ?]
</a>
</li>
<li class="prev">
<a href="[?php echo $url ?]?page=[?php echo $pager->getPreviousPage() ?]">
[?php echo st_admin_get_icon('prev', array('title' => __('poprzednia', null, 'stAdminGeneratorPlugin'))) ?]
</a>
</li>
[?php endif ?]
[?php foreach ($pager->getLinks(10) as $page): ?]
<li class="page">
[?php if ($page == $pager->getPage()): ?]
<b>[?php echo $page ?]</b>
[?php else: ?]
<a href="[?php echo $url ?]?page=[?php echo $page ?]">[?php echo $page ?]</a>
[?php endif ?]
</li>
[?php endforeach; ?]
[?php if ($pager->getPage() == $pager->getLastPage()): ?]
<li class="next">
<b class="disabled">
[?php echo st_admin_get_icon('next', array('title' => __('następna', null, 'stAdminGeneratorPlugin'))) ?]
</b>
</li>
<li class="last">
<b class="disabled">
[?php echo st_admin_get_icon('last-page', array('title' => __('ostatnia', null, 'stAdminGeneratorPlugin'))) ?]
</b>
</li>
[?php else: ?]
<li class="next">
<a href="[?php echo $url ?]?page=[?php echo $pager->getNextPage() ?]">
[?php echo st_admin_get_icon('next', array('title' => __('następna', null, 'stAdminGeneratorPlugin'))) ?]
</a>
</li>
<li class="last">
<a href="[?php echo $url ?]?page=[?php echo $pager->getLastPage() ?]">
[?php echo st_admin_get_icon('last-page', array('title' => __('ostatnia', null, 'stAdminGeneratorPlugin'))) ?]
</a>
</li>
[?php endif ?]
<li class="jump_to_page">
[?php echo input_tag('<?php echo $this->getSingularName() ?>_page', $pager->getPage(), array('maxlength' => 4, 'size' => 3)) ?]
<a href="[?php echo $url ?]">
[?php echo st_admin_get_icon('next', array('title' => __('przejdź do strony', null, 'stAdminGeneratorPlugin'))) ?]
</a>
</li>
</ul>
[?php endif; ?]
<ul class="pager_controls float_right">
<li>[?php st_include_partial('stAdminGenerator/list_max_per_page', array('prefix' => $prefix, 'pager' => $pager, 'module' => '<?php echo $this->getModuleName() ?>', 'action' => '<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>')) ?]</li>
[?php if ($pager->getNbResults() < 20): ?]
<li>
[?php echo __('wyników: %1%', array('%1%' => $pager->getNbResults()), 'stAdminGeneratorPlugin') ?]
</li>
[?php elseif ($pager->getNbResults() >= 20): ?]
<li>
[?php echo __('z %1%', array('%1%' => $pager->getNbResults()), 'stAdminGeneratorPlugin') ?]
</li>
[?php endif; ?]
</ul>
<div class="clr"></div>
<script type="text/javascript">
jQuery(function($) {
var jump_to_page = $('ul.pager > .jump_to_page');
var input = jump_to_page.children('input');
var link = jump_to_page.children('a');
link.click(function(event) {
window.location = this.href+'?page='+input.val();
event.preventDefault();
});
input.change(function() {
this.value = this.value.replace(/[^0-9]/g, '').replace(/$0+/g, '');
});
input.keypress(function(event) {
if (event.keyCode == Event.KEY_RETURN)
{
window.location = link.attr('href')+'?page='+this.value;
event.preventDefault();
}
});
});
</script>

View File

@@ -0,0 +1,23 @@
<div class="list_select_control">
[?php if ($<?php echo $this->getSingularName() ?>_action_select_options): ?]
<select name="<?php echo $this->getSingularName() ?>_action" style="width: 125px">
<option value="">[?php echo __('Zaznaczone:', null, 'stAdminGeneratorPlugin') ?]</option>
[?php foreach($<?php echo $this->getSingularName() ?>_action_select_options as $group => $options): ?]
[?php if ($group != 'NONE'): ?]
[?php $i18n_group = __($group, null, '<?php echo $this->getModuleName() ?>') ?]
<optgroup label="[?php echo $i18n_group ?]">
[?php endif; ?]
[?php foreach($options as $value => $option): ?]
[?php if (is_array($option)): ?]
<option value="[?php echo $value ?]" data-category="[?php echo $group != 'NONE' ? $i18n_group : '' ?]" data-confirm="[?php echo isset($option['confirm']) ? $option['confirm'] : '' ?]" data-ajax="[?php echo isset($option['ajax']) && $option['ajax'] ?]">[?php echo $option['name'] ?]</option>
[?php else: ?]
<option value="[?php echo $value ?]" data-category="[?php echo $group != 'NONE' ? $i18n_group : '' ?]">[?php echo $option ?]</option>
[?php endif; ?]
[?php endforeach; ?]
[?php if ($group != 'NONE'): ?]
</optgroup>
[?php endif; ?]
[?php endforeach; ?]
</select>
[?php endif; ?]
</div>

View File

@@ -0,0 +1,3 @@
<td>
[?php echo checkbox_tag('<?php echo $this->getSingularName() ?>[selected][' . $<?php echo $this->getSingularName() ?>->getPrimaryKey() . ']', $<?php echo $this->getSingularName() ?>->getPrimaryKey(), false, array('class' => 'selector')) ?]
</td>

View File

@@ -0,0 +1,26 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
<?php if ($this->isObjectActionVisible()): ?>
<td>
<ul class="st_object_actions">
<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): if ($actionName == '_edit') continue; ?>
<?php if ($actionName == '_delete' && !isset($params['action'])) $params['action'] = $this->getCustomActionNameCamelized('', 'Delete', 'delete') ?>
<?php if ($actionName == '_delete'): ?>
[?php if (method_exists($<?php echo $this->getSingularName() ?>, 'getIsSystemDefault') == false || (method_exists($<?php echo $this->getSingularName() ?>, 'getIsSystemDefault') && !$<?php echo $this->getSingularName() ?>->getIsSystemDefault())): ?]
<?php endif; ?>
[?php if (!method_exists($<?php echo $this->getSingularName() ?>, 'isAdminGeneratorActionVisible') || $<?php echo $this->getSingularName() ?>->isAdminGeneratorActionVisible('<?php echo $actionName ?>')): ?]
<?php echo $this->addCredentialCondition($this->getLinkToAction($actionName, $params, true), $params) ?>
[?php endif ?]
<?php if ($actionName == '_delete'): ?>
[?php endif; ?]
<?php endif; ?>
<?php endforeach; ?>
</ul>
</td>
<?php endif; ?>

View File

@@ -0,0 +1,13 @@
<?php if ($through_class = $this->getParameterValue('list.build_options.through_class')): ?>
<?php $class = $this->getClassName() ?>
<?php $through_column = $this->getParameterValue('list.build_options.through_column') ?>
<?php $related_class = stPropelManyToMany::getRelatedClass($class, $through_class, $through_column) ?>
<?php $related_column = stPropelManyToMany::getRelatedColumn($class, $through_class, $through_column) ?>
<?php $column = stPropelManyToMany::getColumn($class, $through_class, $through_column) ?>
[?php
$c = new Criteria();
$c->add(<?php echo $through_class ?>Peer::<?php echo $related_column->getColumnName() ?>, <?php echo $this->getForwardParameterBy('list.build_options.related_id') ?>);
$assigned = $<?php echo $this->getSingularName() ?>->count<?php echo $through_class ?>s<?php if ($through_column) echo 'RelatedBy' . sfInflector::camelize($through_column) ?>($c);
?]
<td class="column_assigned">[?php if ($assigned) echo st_admin_get_icon('check-circle'); else echo '&nbsp;'; ?]</td>
<?php endif; ?>

View File

@@ -0,0 +1,80 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php $list_mode = $sf_user->getParameter('mode', null, '<?php echo stAdminGenerator::getModuleNamespace($this->getModuleName(), $this->getCustomActionNameCamelized('', 'List', 'list'), 'config') ?>'); ?]
<?php $hs = $this->getParameterValue('list.hide', array()) ?>
<?php foreach ($this->getColumns('list.display') as $column):
if (in_array($column->getName(), $hs) || $this->getParameterValue('list.fields.'.$column->getName().'.filter_only'))
{
continue;
}
$credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials');
$old_config = $this->getParameterValue('list.fields.'.$column->getName().'.old_config');
$install_version = $this->getParameterValue('list.fields.'.$column->getName().'.hide_install_version');
$show_condition = ["!st_admin_is_field_removed('{$column->getName()}')"];
if ($install_version)
{
$show_condition[] = "!stSoteshop::checkInstallVersion('$install_version')";
}
if ($old_config)
{
$show_condition[] = "!stTheme::hideOldConfiguration()";
}
if ($credentials)
{
$compiledCredentials = str_replace("\n", ' ', var_export($credentials, true));
$show_condition[] = "\$sf_user->hasCredential($compiledCredentials)";
}
?>
[?php if (<?php echo implode(" && ", $show_condition) ?>): ?]
<?php
$type = $column->getCreoleType();
$align = $this->getParameterValue('list.fields.'.$column->getName().'.align');
$width = $this->getParameterValue('list.fields.'.$column->getName().'.width');
$params = $this->getParameterValue('list.fields.'.$column->getName());
$params = isset($params['params']) ? sfToolkit::stringToArray($params['params']) : array();
$objectActions = $this->getParameterValue('list.object_actions');
$link = null;
if ($column->isLink())
{
if (isset($params['link_to']))
{
$link = '"' . $this->replaceConstants($params['link_to'], $this->getSingularName() . '->') . '"';
}
elseif (!empty($objectActions) && isset($objectActions['_edit']))
{
$link = "'" . $this->getModuleName() . '/' . $this->getCustomActionNameCamelized('', 'Edit', 'edit') . '?' . $this->getPrimaryKeyUrlParams();
}
}
$column_value = $this->getColumnListTag($column);
$columnClass = '';
if ($this->getParameterValue('list.fields.'.$column->getName().'.wrappable', false))
{
$columnClass = ' wrappable';
}
?>
[?php if ($list_mode != 'edit'): ?]
<td class="column_<?php echo $column->getName() ?><?php if ($type == CreoleTypes::BOOLEAN): ?> column_boolean<?php endif; ?>[?php if (st_admin_is_field_hidden('<?php echo $column->getName() ?>')): ?] hidden[?php endif ?] <?php echo $columnClass ?>" style="<?php if ($align): ?>text-align: <?php echo $align ?>;<?php endif; ?><?php if ($width): ?> width: <?php echo $width ?>;<?php endif; ?>">
<?php if (null !== $link): ?>
<a href="[?php echo st_url_for(stAdminGeneratorHelper::applyParametersToUrl(<?php echo $link ?>, $forward_parameters)) ?]">
[?php echo <?php echo $column_value ?> ?]
</a>
<?php else: ?>
[?php echo <?php echo $column_value ?> ?]
<?php endif; ?>
</td>
[?php else: ?]
<td class="column_<?php echo $column->getName() ?>[?php if (st_admin_is_field_hidden('<?php echo $column->getName() ?>')): ?] hidden[?php endif ?] <?php echo $columnClass ?>" style="<?php if ($align): ?>text-align: <?php echo $align ?>;<?php endif; ?><?php if ($width): ?> width: <?php echo $width ?>;<?php endif; ?>">
[?php echo <?php echo $this->getEditColumnListTag($column) ?> ?]
</td>
[?php endif; ?]
[?php endif; ?]
<?php endforeach; ?>

View File

@@ -0,0 +1,102 @@
<?php $hides = $this->getParameterValue('list.hide', array()) ?>
<?php foreach ($this->getColumns('list.display') as $column): if (in_array($column->getName(), $hides) || $this->getParameterValue('list.fields.'.$column->getName().'.filter_only')) continue ?>
<?php
$credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials');
if ($credentials)
{
$credentials = str_replace("\n", ' ', var_export($credentials, true));
}
$i18n_catalogue = $this->getParameterValue('list.fields.'.$column->getName().'.i18n', $this->getModuleName());
$width = $this->getParameterValue('list.fields.'.$column->getName().'.width');
$align = $this->getParameterValue('list.fields.'.$column->getName().'.align');
$min_width = $this->getParameterValue('list.fields.'.$column->getName().'.min_width');
?>
<?php $install_version = $this->getParameterValue('list.fields.'.$column->getName().'.hide_install_version') ?>
<?php if ($install_version): ?>
[?php if (!stSoteshop::checkInstallVersion('<?php echo $install_version ?>')): ?]
<?php endif ?>
<?php $old_config = $this->getParameterValue('list.fields.'.$column->getName().'.old_config') ?>
<?php if ($old_config): ?>
[?php if (!stTheme::hideOldConfiguration()): ?]
<?php endif ?>
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
<?php endif; ?>
<th id="sf_admin_list_th_<?php echo $column->getName() ?>" style="<?php if ($width): ?>width: <?php echo $width ?>;<?php endif; ?><?php if ($min_width): ?>min-width: <?php echo $min_width ?>;<?php endif; ?><?php if ($align): ?> text-align: <?php echo $align ?>;<?php endif; ?>"[?php if ($sf_user->getParameter('<?php echo $column->getName() ?>', false, 'soteshop/stAdminGenerator/hidden')): ?] class="hidden"[?php endif ?]>
<?php
if ($this->getParameterValue('list.fields.'.$column->getName().'.display'))
{
$columns = $this->getColumns('list.fields.'.$column->getName().'.display');
}
else
{
$columns = array($column);
}
?>
<?php foreach ($columns as $index => $column): ?>
<?php
$name = str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name'));
$i18n_catalogue = $this->getParameterValue('list.fields.'.$column->getName().'.i18n', $i18n_catalogue);
$callback = $this->getParameterValue('list.fields.'.$column->getName().'.label_callback');
$sortable = $this->getParameterValue('list.fields.'.$column->getName().'.sortable', true);
$url = sprintf('%s/%s?sort=%s',
$this->getModuleName(),
$this->getCustomActionNameCamelized('', 'List', 'list'),
$column->getName());
?>
<?php if ($sortable && ($column->isReal() || $this->getParameterValue('list.fields.'.$column->getName().'.sort_field'))): ?>
[?php if (isset($for_filters)): ?]
[?php echo __('<?php echo $name ?>', array(), '<?php echo $i18n_catalogue ?>') ?]
[?php else: ?]
[?php if ($sf_user->getAttribute('type', null, 'sf_admin/<?php echo $this->getGeneratedModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>sort') == 'asc'): ?]
<a href="[?php echo st_url_for(stAdminGeneratorHelper::applyParametersToUrl('<?php echo $url ?>&type=desc', $forward_parameters)) ?]?page=[?php echo $pager->getPage() ?]">
<span class="align-middle">
<?php if ($callback): ?>
[?php echo <?php echo $callback ?>('<?php echo $name ?>'); ?]
<?php else: ?>
[?php echo __('<?php echo $name ?>', array(), '<?php echo $i18n_catalogue ?>') ?]
<?php endif; ?>
</span>
[?php if ($sf_user->getAttribute('sort', null, 'sf_admin/<?php echo $this->getGeneratedModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>sort') == '<?php echo $column->getName() ?>'): ?]
[?php echo st_admin_get_icon('expand', ['size' => 18]) ?]
[?php endif; ?]
</a>
[?php else: ?]
<a href="[?php echo st_url_for(stAdminGeneratorHelper::applyParametersToUrl('<?php echo $url ?>&type=asc', $forward_parameters)) ?]?page=[?php echo $pager->getPage() ?]">
<span class="align-middle">
<?php if ($callback): ?>
[?php echo <?php echo $callback ?>('<?php echo $name ?>'); ?]
<?php else: ?>
[?php echo __('<?php echo $name ?>', array(), '<?php echo $i18n_catalogue ?>') ?]
<?php endif; ?>
</span>
[?php if ($sf_user->getAttribute('sort', null, 'sf_admin/<?php echo $this->getGeneratedModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>sort') == '<?php echo $column->getName() ?>'): ?]
[?php echo st_admin_get_icon('collapse', ['size' => 18]) ?]
[?php endif; ?]
</a>
[?php endif; ?]
[?php endif; ?]
<?php else: ?>
[?php echo __('<?php echo $name ?>', array(), '<?php echo $i18n_catalogue ?>') ?]
<?php endif; ?>
<?php echo $this->getHelpAsIcon($column, 'list') ?>
<?php endforeach; ?>
</th>
<?php if ($credentials): ?>
[?php endif; ?]
<?php endif; ?>
<?php if ($old_config): ?>
[?php endif; ?]
<?php endif ?>
<?php if ($install_version): ?>
[?php endif; ?]
<?php endif ?>
<?php endforeach; ?>

View File

@@ -0,0 +1,10 @@
<div class="horizontal_list">
<ul>
[?php foreach ($items as $item): ?]
<li class="simple:selected">[?php echo link_to() ?]</li>
[?php endforeach; ?]
<li class="clear_item"></li>
</ul>
</div>

View File

@@ -0,0 +1,348 @@
[?php echo html_entity_decode('&lt;?xml version="1.0" encoding="UTF-8"?&gt;') ?]
<?php
/**
* @var stAdminGenerator $this
*/
$ArrayOfInteger = null;
$ArrayOfString = null;
$ArrayOfDouble = null;
$customTypes = $this->getParameterValue('webapi.types', []);
$methods = stWebApiAdminGeneratorHelper::getMethods($this);
$webApiFields = stWebApiAdminGeneratorHelper::getFields($this);
$customTypes['BatchError'] = [
'fields' => [
'dataIndex' => ['type' => 'integer'],
'code' => ['type' => 'string'],
'message' => ['type' => 'string'],
],
];
$customTypes['BatchUpdate'] = [
'fields' => [
'dataIndex' => ['type' => 'integer'],
'status' => ['type' => 'boolean']
],
];
$customTypes['ArrayOfBatchErrors'] = [
'arrayType' => 'BatchError',
];
$customTypes['ArrayOfBatchUpdates'] = [
'arrayType' => 'BatchUpdate',
];
foreach ($methods as $methodName => $method)
{
$type = isset($method['type']) ? $method['type'] : null;
if ($type != 'update')
{
continue;
}
$batchItemType = $methodName . 'Item';
$batchArrayOfItemType = 'ArrayOf' . $batchItemType .'s';
$batchItemTypeFields = [];
$webApiCustomFields = isset($method['custom_fields']) ? array_replace($webApiFields, $method['custom_fields']) : $webApiFields;
foreach ($method['fields']['in'] as $fieldName)
{
$required = $fieldName[0] == '=';
$fieldName = ltrim($fieldName, '=');
$fields = $webApiCustomFields[$fieldName];
$fields['required'] = $required;
$batchItemTypeFields[$fieldName] = $fields;
}
$customTypes[$batchArrayOfItemType] = [
'arrayType' => $batchItemType,
];
$customTypes[$batchItemType] = [
'fields' => $batchItemTypeFields,
];
$methods['Batch' . $methodName] = [
'type' => 'update',
'inOutTypes' => ['in' => 'object', 'out' => 'object'],
'fields' => [
'in' => ['=_batch_items'],
'out' => ['_errors', '_updates'],
],
'custom_fields' => [
'_batch_items' => ['type' => $batchArrayOfItemType]
],
];
}
?>
<definitions name="StWebApi" targetNamespace="urn:StWebApi"
xmlns:typens="urn:StWebApi"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:StWebApi">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<?php foreach ($methods as $methodName => $method):
$inFields = isset($method['fields']['in']) ? $method['fields']['in'] : [];
$outFields = isset($method['fields']['out']) ? $method['fields']['out'] : [];
$peerMethod = isset($method['peer_method']) ? $method['peer_method'] : null;
$type = isset($method['type']) ? $method['type'] : null;
if (in_array($peerMethod, ['doSelectWithI18n', 'doCountWithI18n']))
{
$inFields = array_merge(array('_is_translated'), $inFields);
}
if (!isset($method['culture']) || $method['culture'] !== false)
{
$inFields = array_merge(array('_culture'), $inFields);
}
if (!isset($method['secure']) || $method['secure'] !== false)
{
$inFields = array_merge(array('=_session_hash'), $inFields);
}
if ($peerMethod == 'doSelectWithI18n')
{
$outFields = array_merge(array('_culture', '_is_translated'), $outFields);
}
$webApiCustomFields = isset($method['custom_fields']) ? array_replace($webApiFields, $method['custom_fields']) : $webApiFields;
?>
<xsd:complexType name="<?php echo $methodName ?>">
<xsd:all>
<?php foreach ($inFields as $field): $field_name = str_replace("=","",$field) ?>
<xsd:element name="<?php echo $field_name ?>"
type="<?php
if (!isset($webApiCustomFields[$field_name]))
{
throw new Exception(sprintf('Field "%s" is not defined in webapi.fields', $field_name));
}
$type = $webApiCustomFields[$field_name]['type'];
$type = ($type[0] == strtolower($type[0]) ? 'xsd:' : 'typens:').$type;
if ($type == 'typens:ArrayOfInteger')
{
$ArrayOfInteger = true;
}
elseif ($type == 'typens:ArrayOfString')
{
$ArrayOfString = true;
}
elseif ($type == 'typens:ArrayOfDouble')
{
$ArrayOfDouble = true;
}
echo $type;
?>" minOccurs="<?php echo intval($field{0} == '=') ?>"></xsd:element>
<?php endforeach; ?>
</xsd:all>
</xsd:complexType>
<?php if ($method['inOutTypes']['in'] == "array"): ?>
<xsd:complexType name="ArrayOf<?php echo $methodName ?>">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="typens:<?php echo $methodName ?>[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<?php endif; ?>
<xsd:complexType name="<?php echo $methodName ?>Response">
<xsd:all>
<?php if (is_array($outFields)): ?>
<?php foreach ($outFields as $field): $field_name = str_replace("=","",$field) ?>
<xsd:element name="<?php echo $field_name ?>"
type="<?php
if (!isset($webApiCustomFields[$field_name]))
{
throw new Exception(sprintf('Field "%s" is not defined in webapi.fields', $field_name));
}
$type = $webApiCustomFields[$field_name]['type'];
$type = ($type[0] == strtolower($type[0]) ? 'xsd:' : 'typens:').$type;
if ($type == 'typens:ArrayOfInteger')
{
$ArrayOfInteger = true;
}
elseif ($type == 'typens:ArrayOfString')
{
$ArrayOfString = true;
}
elseif ($type == 'typens:ArrayOfDouble')
{
$ArrayOfDouble = true;
}
echo $type;
?>" minOccurs="0"></xsd:element>
<?php endforeach; ?>
<?php endif; ?>
</xsd:all>
</xsd:complexType>
<?php if ($method['inOutTypes']['out']=="array"): ?>
<xsd:complexType name="ArrayOf<?php echo $methodName ?>Response">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="typens:<?php echo $methodName ?>Response[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach ($customTypes as $name => $type): ?>
<xsd:complexType name="<?php echo $name ?>">
<?php if (isset($type['arrayType']) && $type['arrayType']): $type_prefix = isset($customTypes[$type['arrayType']]) || isset($methods[$type['arrayType']]) ? 'typens' : 'xsd' ?>
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="<?php echo $type_prefix ?>:<?php echo $type['arrayType'] ?>[]" />
</xsd:restriction>
</xsd:complexContent>
<?php else: ?>
<xsd:all>
<?php foreach ($type['fields'] as $fieldName => $field):
$type_prefix = isset($customTypes[$field['type']]) || in_array($field['type'], ['ArrayOfInteger', 'ArrayOfString', 'ArrayOfDouble']) ? 'typens' : 'xsd';
if ($field['type'] == 'ArrayOfInteger')
{
$ArrayOfInteger = true;
}
elseif ($field['type'] == 'ArrayOfString')
{
$ArrayOfString = true;
}
elseif ($field['type'] == 'ArrayOfDouble')
{
$ArrayOfDouble = true;
}
?>
<xsd:element type="<?php echo $type_prefix ?>:<?php echo $field['type'] ?>" name="<?php echo $fieldName ?>" minOccurs="<?php echo intval(isset($field['required']) && $field['required']) ?>" />
<?php endforeach ?>
</xsd:all>
<?php endif ?>
</xsd:complexType>
<?php endforeach ?>
<?php if ($ArrayOfInteger): ?>
<xsd:complexType name="ArrayOfInteger">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:integer[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<?php endif; ?>
<?php if ($ArrayOfString): ?>
<xsd:complexType name="ArrayOfString">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<?php endif; ?>
<?php if ($ArrayOfDouble): ?>
<xsd:complexType name="ArrayOfDouble">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:double[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<?php endif; ?>
</xsd:schema>
</types>
<?php foreach ($methods as $methodName => $method): ?>
<?php if ($method['inOutTypes']['in'] == "array"): ?>
<message name="<?php echo $methodName ?>">
<part name="<?php echo $methodName ?>"
type="typens:ArrayOf<?php echo $methodName ?>" />
</message>
<?php endif; ?>
<?php if ($method['inOutTypes']['in'] == "object"): ?>
<message name="<?php echo $methodName ?>">
<part name="<?php echo $methodName ?>"
type="typens:<?php echo $methodName ?>" />
</message>
<?php endif; ?>
<?php if ($method['inOutTypes']['out'] == "array"): ?>
<message name="<?php echo $methodName ?>Response">
<part name="<?php echo $methodName ?>Response"
type="typens:ArrayOf<?php echo $methodName ?>Response" />
</message>
<?php endif; ?>
<?php if ($method['inOutTypes']['out'] == "object"): ?>
<message name="<?php echo $methodName ?>Response">
<part name="<?php echo $methodName ?>Response"
type="typens:<?php echo $methodName ?>Response" />
</message>
<?php endif; ?>
<?php endforeach; ?>
<wsdl:portType name="<?php echo $this->getModuleName(); ?>PortType">
<?php foreach ($methods as $methodName => $method): ?>
<operation name="<?php echo $methodName ?>">
<documentation><?php echo $methodName ?></documentation>
<?php if (!empty($method['inOutTypes']['in'])): ?>
<input message="typens:<?php echo $methodName ?>"></input>
<?php endif; ?>
<?php if (!empty($method['inOutTypes']['out'])): ?>
<output message="typens:<?php echo $methodName ?>Response"></output>
<?php endif; ?>
</operation>
<?php endforeach; ?>
</wsdl:portType>
<binding name="StWebApiBinding" type="typens:<?php echo $this->getModuleName(); ?>PortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<?php foreach ($methods as $methodName => $method): ?>
<operation name="<?php echo $methodName ?>">
<soap:operation soapAction="urn:StWebApiSoapServer" />
<input>
<soap:body use="encoded" namespace="urn:StWebApi"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:StWebApi"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<?php endforeach; ?>
</binding>
<service name="StWebApiSoapServer">
<port name="<?php echo $this->getModuleName(); ?>PortType" binding="typens:StWebApiBinding">
<soap:address
location="[?php echo st_url_for('<?php echo $this->getModuleName() ?>/soap', true) ?]" />
</port>
</service>
</definitions>

View File

@@ -0,0 +1,60 @@
[?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?]
<?php if ($stylesheets = $this->getParameterValue('config.use_stylesheet')): ?>
[?php
<?php foreach ($stylesheets as $stylesheet): ?>
use_stylesheet('<?php echo $stylesheet ?>?v='.filemtime(__FILE__));
<?php endforeach; ?>
?]
<?php endif; ?>
<?php if ($javascripts = $this->getParameterValue('config.use_javascript')): ?>
[?php
<?php foreach ($javascripts as $javascript): ?>
use_javascript('<?php echo $javascript ?>?v='.filemtime(__FILE__));
<?php endforeach; ?>
?]
<?php endif; ?>
[?php
<?php if ($helpers = $this->getParameterValue('config.use_helper')): ?>
<?php foreach ($helpers as $helper): $tmp = explode('/', $helper) ?>
<?php if (isset($tmp[1])): ?>
sfLoader::loadHelpers('<?php echo $tmp[1] ?>', '<?php echo $tmp[0] ?>');
<?php else: ?>
sfLoader::loadHelpers('<?php echo $tmp[0] ?>', '<?php echo $this->getModuleName() ?>');
<?php endif; ?>
<?php endforeach ?>
<?php endif; ?>
?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/header', array(
'title' => <?php echo $this->getI18NString('config.title', 'Konfiguracja', false) ?><?php if ($this->showConfigCulturePicker('config')): ?>,
'culture' => $config->getCulture()<?php endif; ?>,
'route' => '<?php echo $this->getModuleName().'/'.$this->getCustomActionNameCamelized('', 'Config', 'config') ?>',
'hideable' => isset($hideable) ? $hideable : null,
'related_object' => isset($related_object) ? $related_object : null
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/config_menu', array(
'config' => $config,
'labels' => $labels,
'forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(),
'related_object' => isset($related_object) ? $related_object : null
)) ?]
<div id="sf_admin_content" class="admin-content-edit">
[?php st_include_partial('stAdminGenerator/message', array(
'config' => $config, 'labels' => $labels,
'forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(),
'i18n_catalogue' => '<?php echo $this->getModuleName() ?>',
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>config_form', array(
'config' => $config,
'labels' => $labels,
'forward_parameters' => isset($forward_parameters) ? $forward_parameters : array(),
)) ?]
</div>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/footer', array('forward_parameters' => isset($forward_parameters) ? $forward_parameters : array())) ?]

View File

@@ -0,0 +1,58 @@
[?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/header', array(
'related_object' => $related_object,
'title' => <?php echo $this->getI18NString('custom.title', null, false) ?>,
'culture' => <?php if ($this->getParameterValue('custom.show_culture_picker')): ?>$sf_request->getParameter('culture', stLanguage::getOptLanguage())<?php else: ?>null<?php endif; ?>,
'route' => stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'Custom', 'custom') ?>', $forward_parameters),
)) ?]
<?php if ($stylesheets = $this->getParameterValue('custom.use_stylesheet')): ?>
[?php
<?php foreach ($stylesheets as $stylesheet): ?>
use_stylesheet('<?php echo $stylesheet ?>?v='.filemtime(__FILE__));
<?php endforeach; ?>
?]
<?php endif; ?>
<?php if ($javascripts = $this->getParameterValue('custom.use_javascript')): ?>
[?php
<?php foreach ($javascripts as $javascript): ?>
use_javascript('<?php echo $javascript ?>?v='.filemtime(__FILE__));
<?php endforeach; ?>
?]
<?php endif; ?>
[?php
<?php if ($helpers = $this->getParameterValue('custom.use_helper')): ?>
<?php foreach ($helpers as $helper): $tmp = explode('/', $helper) ?>
<?php if (isset($tmp[1])): ?>
sfLoader::loadHelpers('<?php echo $tmp[1] ?>', '<?php echo $tmp[0] ?>');
<?php else: ?>
sfLoader::loadHelpers('<?php echo $tmp[0] ?>', '<?php echo $this->getModuleName() ?>');
<?php endif; ?>
<?php endforeach ?>
<?php endif; ?>
?]
[?php st_view_slot_start('application-menu') ?]
<?php if ($menu = $this->getMenuComponentBy('custom.menu.use')): ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', '<?php echo $menu ?>', array('forward_parameters' => $forward_parameters, 'related_object' => $related_object)) ?]
<?php else: ?>
[?php st_include_component('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'Custom', 'custom') ?>Menu', array('forward_parameters' => $forward_parameters)) ?]
<?php endif; ?>
[?php st_view_slot_end() ?]
<div id="sf_admin_header">
[?php echo stSocketView::openComponents('<?php echo $this->getModuleName() ?>.<?php echo$this->getCustomActionNameCamelized('', 'Custom', 'custom') ?>.Header', array('forward_parameters' => $forward_parameters)); ?]
</div>
<div id="sf_admin_content" class="admin-content-edit">
[?php st_include_partial('stAdminGenerator/message', array('forward_parameters' => $forward_parameters, 'i18n_catalogue' => '<?php echo $this->getModuleName() ?>')) ?]
[?php echo stSocketView::openComponents('<?php echo $this->getModuleName() ?>.<?php echo$this->getCustomActionNameCamelized('', 'Custom', 'custom') ?>.Content', array('forward_parameters' => $forward_parameters)); ?]
</div>
<div id="sf_admin_footer">
[?php echo stSocketView::openComponents('<?php echo $this->getModuleName() ?>.<?php echo$this->getCustomActionNameCamelized('', 'Custom', 'custom') ?>.Footer', array('forward_parameters' => $forward_parameters)); ?]
</div>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/footer', array('related_object' => null, 'forward_parameters' => $forward_parameters)) ?]

View File

@@ -0,0 +1,5 @@
[?php echo $pb->showProgressBar($actual_step); ?]
[?php if ($errors):?]
[?php echo link_to_remote(__('Wyświetl błędy eksportu', array(), 'stImportExportBackend'), array('update'=>'export_log', 'url'=>'stProduct/exportLog?file='.$logFile))?].
[?php endif; ?]
<div id="export_log"></div>

View File

@@ -0,0 +1,10 @@
[?php echo $pb->showProgressBar($actual_step); ?]
<div id="st-import-export-errors">
[?php if ($errors):?]
[?php echo link_to_remote(__('Wyświetl błędy importu', array(), 'stImportExportBackend'), array(
'update' => 'st-import-export-logs',
'url' => '<?php echo $this->getModuleName() ?>/importLog?file='.$logFile
)) ?]
[?php endif; ?]
<div id="st-import-export-logs"></div>
</div>

View File

@@ -0,0 +1,80 @@
<?php
/**
* @var stAdminGenerator $this
*/
$class_name = $this->getClassName();
$ajax = $this->getParameterValue('edit.ajax');
?>
[?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'VisualEffect', 'stAdminGenerator', 'stDate') ?]
<?php if ($stylesheets = $this->getParameterValue('edit.use_stylesheet')): ?>
[?php
<?php foreach ($stylesheets as $stylesheet): ?>
use_stylesheet('<?php echo $stylesheet ?>');
<?php endforeach; ?>
?]
<?php endif; ?>
<?php if ($javascripts = $this->getParameterValue('edit.use_javascript')): ?>
[?php
<?php foreach ($javascripts as $javascript): ?>
use_javascript('<?php echo $javascript ?>');
<?php endforeach; ?>
?]
<?php endif; ?>
[?php
<?php if ($helpers = $this->getParameterValue('edit.use_helper')): ?>
<?php foreach ($helpers as $helper): $tmp = explode('/', $helper) ?>
<?php if (isset($tmp[1])): ?>
sfLoader::loadHelpers('<?php echo $tmp[1] ?>', '<?php echo $tmp[0] ?>');
<?php else: ?>
sfLoader::loadHelpers('<?php echo $tmp[0] ?>', '<?php echo $this->getModuleName() ?>');
<?php endif; ?>
<?php endforeach ?>
<?php endif; ?>
?]
<?php if (!$ajax): ?>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/header', array(
'related_object' => $<?php echo null === $this->getParameterValue('list') && $this->getParameterValue('edit.build_options.related_id') ? 'related_object' : $this->getSingularName() ?>,
'hideable' => $hideable,
'title' => $<?php echo $this->getSingularName() ?>->isNew() ? <?php echo $this->getI18NString('create.title', 'Dodaj', false) ?> : <?php echo $this->getI18NString('edit.title', 'Edycja', false) ?><?php if (method_exists($class_name, 'setCulture') && $this->getParameterValue('edit.culture', true)): ?>,
'culture' => !$<?php echo $this->getSingularName() ?>->isNew() ? $<?php echo $this->getSingularName() ?>->getCulture() : null<?php endif; ?>,
'route' => stAdminGeneratorHelper::generateModelUrl($<?php echo $this->getSingularName() ?>, $sf_context->getModuleName(), '<?php echo $this->getCustomActionNameCamelized('', 'Edit', 'edit') ?>', $forward_parameters),
'admin_configuration' => $admin_configuration,
'forward_parameters' => $forward_parameters,
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>edit_menu', array('related_object' => $<?php echo !empty($this->getCustomActionName()) && null === $this->getParameterValue('list') && $this->getParameterValue('edit.build_options.related_id') ? 'related_object' : $this->getSingularName() ?>, 'forward_parameters' => $forward_parameters)) ?]
<div id="sf_admin_content" class="admin-content-edit">
[?php st_include_partial('stAdminGenerator/message', array(
'labels' => $labels,
'forward_parameters' => $forward_parameters,
'i18n_catalogue' => '<?php echo $this->getModuleName() ?>',
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>edit_form', array(
'<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>,
'labels' => $labels,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'admin_configuration' => $admin_configuration,
)) ?]
</div>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/footer', array('related_object' => $related_object, 'forward_parameters' => $forward_parameters)) ?]
<?php else: ?>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/edit_messages', array(
'<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>,
'labels' => $labels,
'forward_parameters' => $forward_parameters,
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>edit_form', array(
'<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>,
'labels' => $labels,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'admin_configuration' => $admin_configuration
)) ?]
[?php init_tooltip('.help') ?]
<?php endif; // edit.ajax ?>

View File

@@ -0,0 +1,8 @@
[?php
if ($handle) {
while (!feof($handle)) {
print fread($handle, 8192);
}
fclose($handle);
}
?]

View File

@@ -0,0 +1,26 @@
<table class="st_record_list" cellspacing="0">
<thead>
<tr>
<th>[?php echo __('Identyfikator', null, 'stImportExportBackend') ?]</th>
<th>[?php echo __('Typ', null, 'stImportExportBackend') ?]</th>
<th>[?php echo __('Opis', null, 'stImportExportBackend') ?]</th>
</tr>
</thead>
<tbody>
[?php foreach ($logs as $log): ?]
[?php if (count($log)==3): ?]
<tr>
<td>[?php echo $log[0]; ?]</td>
<td>[?php switch($log[2]) {
case stImportExportLog::$FATAL: echo __('Błąd krytyczny', array(), 'stImportExportBackend'); break;
case stImportExportLog::$WARNING: echo __('Błąd', array(), 'stImportExportBackend'); break;
case stImportExportLog::$NOTICE: echo __('Ostrzeżenie', array(), 'stImportExportBackend'); break;
default: echo __('Ostrzeżenie'); break;
}
?]</td>
<td>[?php echo $log[1]; ?]</td>
</tr>
[?php endif; ?]
[?php endforeach; ?]
</tbody>
</table>

View File

@@ -0,0 +1,69 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php use_helper('I18N', 'Date', 'Text', 'stAdminGenerator', 'stImportExport') ?]
[?php use_stylesheet('backend/stProgressBarPlugin/stProgressBarPlugin.css?v4'); ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/header', array(
'related_object' => null,
'title' => <?php echo $this->getI18NString('export.title', null, false) ?>,
'route' => '<?php echo $this->getModuleName() . '/' . $this->getCustomActionNameCamelized('', 'List', 'list') ?>'
)) ?]
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_menu', array('related_object' => null, 'forward_parameters' => $forward_parameters)) ?]
[?php if (!$export): ?]
[?php echo form_tag(stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', 'export', $forward_parameters), array('id'=>'sf_admin_config_form', 'class' => 'admin_form')) ?]
[?php echo st_admin_section_start() ?]
[?php echo st_admin_get_form_field('export[type]', __("Wybierz format exportu", array(), 'stImportExportBackend'), $default_export_type, 'st_export_type_picker', array(
'types' => $export_types
)) ?]
[?php if (null !== $profiles): ?]
[?php echo st_admin_get_form_field('export[profile]', __("Wybierz Profil", array(), 'stImportExportBackend'), $default_export_type, 'st_export_profile_picker', array(
'profiles' => $profiles,
'model' => '<?php echo $this->getClassName() ?>',
'module' => '<?php echo $this->getModuleName() ?>',
'forward_parameters' => $forward_parameters,
)) ?]
[?php endif ?]
[?php foreach ($custom_parameters as $name => $parameters): ?]
[?php echo st_admin_get_form_field('export[custom_parameters]['.$name.']', __($parameters['name'], null, isset($parameters['i18n']) ? $parameters['i18n'] : $sf_context->getModuleName()), null, 'st_export_custom_parameter', array(
'parameters' => $parameters,
'parameter_name' => $name,
)) ?]
[?php endforeach ?]
[?php echo st_admin_section_end() ?]
<div id="edit_actions">
[?php echo st_get_admin_actions(array(
array(
'label' => __('Pobierz przykładowy plik', null, 'stImportExportBackend'),
'type' => 'download',
'params' => array('name' => 'sample_file', 'show_preloader' => false),
),
array(
'label' => __('Eksportuj', null, 'stImportExportBackend'),
'type' => 'save',
'params' => array('name' => 'save'),
),
)) ?]
</div>
</form>
[?php else: ?]
<div id="sf_admin_content_config">
[?php echo form_tag('<?php echo $this->getModuleName() ?>/export', array('id' => 'sf_admin_config_form', 'class' => 'admin_form')) ?]
[?php echo st_admin_section_start() ?]
[?php echo $pb->showProgressBar($actual_step,true); ?]
[?php if ($errors):?]
[?php echo link_to_remote(__('Wyświetl błędy eksportu', array(), 'stImportExportBackend'), array('update'=>'export_log', 'url'=>'stProduct/exportLog?file='.$logFile))?].
[?php endif; ?]
<div id="export_log"></div>
[?php echo st_admin_section_end() ?]
</form>
</div>
[?php endif; ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/footer', array('related_object' => null, 'forward_parameters' => $forward_parameters)) ?]

View File

@@ -0,0 +1,26 @@
<table class="st_record_list" cellspacing="0">
<thead>
<tr>
<th>[?php echo __('Identyfikator', null, 'stImportExportBackend') ?]</th>
<th>[?php echo __('Typ', null, 'stImportExportBackend') ?]</th>
<th>[?php echo __('Opis', null, 'stImportExportBackend') ?]</th>
</tr>
</thead>
<tbody>
[?php foreach ($logs as $log): ?]
[?php if (is_array($log) && count($log)==3): ?]
<tr>
<td>[?php echo $log[0]; ?]</td>
<td>[?php switch($log[2]) {
case stImportExportLog::$FATAL: echo __('Błąd krytyczny', array(), 'stImportExportBackend'); break;
case stImportExportLog::$WARNING: echo __('Błąd', array(), 'stImportExportBackend'); break;
case stImportExportLog::$NOTICE: echo __('Ostrzeżenie', array(), 'stImportExportBackend'); break;
default: echo __('Ostrzeżenie'); break;
}
?]</td>
<td>[?php echo $log[1]; ?]</td>
</tr>
[?php endif; ?]
[?php endforeach; ?]
</tbody>
</table>

View File

@@ -0,0 +1,52 @@
[?php use_helper('I18N', 'Date', 'Text', 'stAdminGenerator', 'stImportExport') ?]
[?php use_stylesheet('backend/stProgressBarPlugin/stProgressBarPlugin.css?v4'); ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/header', array(
'related_object' => null,
'title' => <?php echo $this->getI18NString('import.title', null, false) ?>,
'route' => '<?php echo $this->getModuleName() . '/' . $this->getCustomActionNameCamelized('', 'List', 'list') ?>',
'forward_parameters' => $forward_parameters,
)) ?]
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_menu', array('related_object' => null, 'forward_parameters' => $forward_parameters)) ?]
[?php st_include_partial('stAdminGenerator/message', array('labels' => array('import{filename}' => __('Plik z danymi', array(), 'stImportExportBackend'), 'import{type}' => __('Wybierz format importu', array(), 'stImportExportBackend') ))) ?]
[?php if (!$import): ?]
[?php echo form_tag(stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', 'import', $forward_parameters), array('multipart'=>true,'id'=>'sf_admin_config_form', 'class' => 'admin_form')) ?]
[?php echo st_admin_section_start() ?]
[?php echo st_admin_get_form_field('import[type]', __("Wybierz format importu", array(), 'stImportExportBackend'), $default_import_type, 'st_export_type_picker', array(
'types' => $import_types
)) ?]
[?php echo st_admin_get_form_field('import[filename]', __("Plik z danymi", array(), 'stImportExportBackend'), null, 'input_file_tag', array(
'accept' => '.csv,.xml',
)) ?]
[?php echo st_admin_section_end() ?]
<div id="edit_actions">
[?php echo st_get_admin_actions(array(
array(
'label' => __('Pobierz przykładowy plik', null, 'stImportExportBackend'),
'type' => 'download',
'params' => array('name' => 'sample_file', 'show_preloader' => false),
),
array(
'label' => __('Importuj', null, 'stImportExportBackend'),
'type' => 'save',
'params' => array('name' => 'save'),
),
)) ?]
</div>
</form>
[?php else: ?]
<div id="sf_admin_content_config">
[?php echo form_tag('<?php echo $this->getModuleName() ?>/import',array('multipart' => true, 'id' => 'sf_admin_config_form', 'class' => 'admin_form')) ?]
[?php echo st_admin_section_start() ?]
[?php echo $pb->showProgressBar(0,true); ?]
[?php echo st_admin_section_end() ?]
</form>
</div>
[?php endif; ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/footer', array('related_object' => null, 'forward_parameters' => $forward_parameters)) ?]

View File

@@ -0,0 +1,214 @@
<?php
/**
* @var stAdminGenerator $this
*/
?>
[?php use_helper('I18N', 'Text', 'stAdminGenerator', 'Object', 'Validation', 'ObjectAdmin', 'stDate', 'stViewSlot') ?]
[?php $module_name = sfContext::getInstance()->getModuleName(); ?]
[?php $action_name = sfContext::getInstance()->getActionName(); ?]
<?php if ($stylesheets = $this->getParameterValue('list.use_stylesheet')) : ?>
[?php
<?php foreach ($stylesheets as $stylesheet) : ?>
use_stylesheet('<?php echo $stylesheet ?>?v='.filemtime(__FILE__));
<?php endforeach; ?>
?]
<?php endif; ?>
<?php if ($javascripts = $this->getParameterValue('list.use_javascript')) : ?>
[?php
<?php foreach ($javascripts as $javascript) : ?>
use_javascript('<?php echo $javascript ?>?v='.filemtime(__FILE__));
<?php endforeach; ?>
?]
<?php endif; ?>
[?php
<?php if ($helpers = $this->getParameterValue('list.use_helper')) : ?>
<?php foreach ($helpers as $helper) : $tmp = explode('/', $helper) ?>
<?php if (isset($tmp[1])) : ?>
sfLoader::loadHelpers('<?php echo $tmp[1] ?>', '<?php echo $tmp[0] ?>');
<?php else : ?>
sfLoader::loadHelpers('<?php echo $tmp[0] ?>', '<?php echo $this->getModuleName() ?>');
<?php endif; ?>
<?php endforeach ?>
<?php endif; ?>
?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/header', array(
'related_object' => $related_object,
'hideable' => $pager->getNbResults() || $filters ? $hideable : array(),
'title' => <?php echo $this->getI18NString('list.title', 'Lista', false) ?>,
'route' => '<?php echo $this->getModuleName() . '/' . $this->getCustomActionNameCamelized('', 'List', 'list') ?>',
'filters' => $filters,
'admin_configuration' => $admin_configuration,
'forward_parameters' => $forward_parameters,
)) ?]
[?php st_include_partial('<?php echo $this->getCustomActionName('', '_') ?>list_menu', array(
'related_object' => $related_object,
'forward_parameters' => $forward_parameters,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
[?php st_include_partial('stAdminGenerator/message', array('labels' => array(), 'i18n_catalogue' => '<?php echo $this->getModuleName() ?>')) ?]
[?php $list_actions = st_get_partial('<?php echo $this->getCustomActionName('', '_') ?>list_actions', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
[?php echo st_view_slot_get('<?php echo $this->getModuleName() . '.after' . $this->getCustomActionPhpName('', '_') ?>ListHeader', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
[?php if ($pager->getNbResults() || $filters || stAdminGeneratorHelper::getIgnoreEmptyList()): ?]
<div id="sf_admin_content">
[?php echo st_view_slot_get('<?php echo $this->getModuleName() . '.before' . $this->getCustomActionPhpName('', '_') ?>List', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_custom_content_before', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
<div <?php if (!$this->getParameterValue('list.auto_width')) : ?> style="display: table; width: 100%; clear: both;" <?php endif; ?>>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_filters', array('filters' => $filters, 'forward_parameters' => $forward_parameters, 'admin_configuration' => $admin_configuration)) ?]
[?php echo form_tag(stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>', $forward_parameters), array('id' => 'record_list_form', 'class' => 'admin_form')) ?]
[?php echo input_hidden_tag('page', $pager->getPage()) ?]
[?php foreach($forward_parameters as $name => $value): ?]
[?php echo input_hidden_tag("forward_parameters[{$name}]", $value); ?]
[?php endforeach ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_pager', array('pager' => $pager, 'forward_parameters' => $forward_parameters, 'url' => stAdminGeneratorHelper::generateUrl('<?php echo $this->getModuleName() ?>', '<?php echo $this->getCustomActionNameCamelized('', 'List', 'list') ?>', $forward_parameters), 'prefix' => 'head', 'admin_configuration' => $admin_configuration)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'<?php echo $this->getSingularName() ?>_action_select_options' => $<?php echo $this->getSingularName() ?>_action_select_options,
'filters' => $filters,
'admin_configuration' => $admin_configuration,
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_custom_content_after', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
[?php echo st_view_slot_get('<?php echo $this->getModuleName() . '.after' . $this->getCustomActionPhpName('', '_') ?>List', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
<div id="list_actions">
[?php if ($pager->getNbResults() || $filters): ?]
<div class="float_left">[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_select_control', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'<?php echo $this->getSingularName() ?>_action_select_options' => $<?php echo $this->getSingularName() ?>_action_select_options
)) ?]</div>
[?php endif; ?]
[?php echo $list_actions ?]
</div>
</form>
</div>
<div class="clr"></div>
</div>
[?php else: ?]
<?php
$icon = null;
$package = $this->getParameterValue('head.package', null, false);
if ($package)
{
$icon = $package;
}
else
{
$icon = $this->getParameterValue('large_icon', $this->getParameterValue('icon', $this->getModuleName(), false), false);
}
$message = $this->getParameterValue('list.empty_message');
if (!is_array($message))
{
$message = array('message' => $message);
}
if (!isset($message['message']))
{
$message['message'] = 'Brak rekordów';
}
if (!isset($message['i18n']))
{
$message['i18n'] = 'stAdminGeneratorPlugin';
}
if (!isset($message['icon']))
{
$message['icon'] = $icon;
}
?>
[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_empty_message', array(
'pager' => $pager,
'filters' => $filters,
'forward_parameters' => $forward_parameters,
'message' => __('<?php echo $message['message'] ?>', array(), '<?php echo $message['i18n'] ?>'),
'icon' => '<?php echo isset($message['icon']) ? $message['icon'] : $icon ?>',
<?php if (!$package): ?>
'title' => <?php echo !isset($message['title']) ? $this->getI18NString('label', null, false) : sprintf("__('%s', null, '%s')", addcslashes($message['title'], "'"), $message['i18n']) ?>,
<?php else: ?>
'title' => <?php echo !isset($message['title']) ? "__(stApplication::getAppName('$package'), null, '{$this->getModuleName()}')" : sprintf("__('%s', null, '%s')", addcslashes($message['title'], "'"), $message['i18n']) ?>,
<?php endif ?>
'actions' => !$pager->getNbResults() && !$filters ? $list_actions : null,
)) ?]
[?php if ($pager->getNbResults() || $filters): ?]
<div id="list_actions">
<div class="float_left">[?php st_include_partial('<?php echo $this->getModuleName() ?>/<?php echo $this->getCustomActionName('', '_') ?>list_select_control', array(
'pager' => $pager, 'forward_parameters' => $forward_parameters,
'<?php echo $this->getSingularName() ?>_action_select_options' => $<?php echo $this->getSingularName() ?>_action_select_options
)) ?]</div>
[?php echo $list_actions ?]
</div>
[?php endif; ?]
[?php endif; ?]
[?php echo st_view_slot_get('<?php echo $this->getModuleName() . '.before' . $this->getCustomActionPhpName('', '_') ?>ListFooter', array(
'pager' => $pager,
'forward_parameters' => $forward_parameters,
'related_object' => $related_object,
'filters' => $filters,
'admin_configuration' => $admin_configuration
)) ?]
[?php st_include_partial('<?php echo $this->getModuleName() ?>/footer', array('related_object' => $related_object)) ?]
<script type="text/javascript">
jQuery(function($) {
$('#list_actions').stickyBox();
});
</script>