Finish Import / Export categories management
modifié: core/lib/Thelia/Config/Resources/routing/admin.xml modifié: core/lib/Thelia/Controller/Admin/ExportController.php modifié: core/lib/Thelia/Controller/Admin/ImportExportController.php modifié: core/lib/Thelia/Core/FileFormat/Formatting/Formatter/JsonFormatter.php modifié: core/lib/Thelia/Core/FileFormat/Formatting/Formatter/XMLFormatter.php modifié: core/lib/Thelia/Core/FileFormat/Formatting/FormatterInterface.php modifié: core/lib/Thelia/Core/Template/Loop/Export.php modifié: core/lib/Thelia/Core/Template/Loop/Formatter.php nouveau fichier: core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php nouveau fichier: core/lib/Thelia/ImportExport/Export/ExportType.php nouveau fichier: core/lib/Thelia/ImportExport/Export/MailingExport.php modifié: core/lib/Thelia/ImportExport/ExportHandlerInterface.php modifié: core/lib/Thelia/Model/Export.php modifié: core/lib/Thelia/Model/ExportCategory.php modifié: core/lib/Thelia/Model/ImportCategory.php modifié: templates/backOffice/default/export-page.html modifié: templates/backOffice/default/export.html modifié: templates/backOffice/default/import.html modifié: templates/backOffice/default/includes/export-form-definition.html
This commit is contained in:
@@ -1158,7 +1158,7 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\TranslationsController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<!-- export management -->
|
||||
<!-- import and export management -->
|
||||
|
||||
<route id="export.list" path="/admin/export">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default>
|
||||
@@ -1176,6 +1176,18 @@
|
||||
<requirement key="value">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="export.category.position" path="/admin/export/position/category/{action}/{id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::changeCategoryPosition</default>
|
||||
<requirement key="action">up|down</requirement>
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="export.category.position.update" path="/admin/export/position/category/update/{id}/{value}">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::updateCategoryPosition</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
<requirement key="value">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="export.action" path="/admin/export/{id}" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Admin\ImportExportController::export</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
|
||||
@@ -16,6 +16,7 @@ use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Template\Loop\ImportExportType;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\ExportCategoryQuery;
|
||||
use Thelia\Model\ExportQuery;
|
||||
|
||||
/**
|
||||
@@ -31,15 +32,7 @@ class ExportController extends BaseAdminController
|
||||
return $response;
|
||||
}
|
||||
|
||||
$export_order = $this->getRequest()->query->get("export_order");
|
||||
|
||||
if (!in_array($export_order, ImportExportType::getAllowedOrders())) {
|
||||
$export_order = ImportExportType::DEFAULT_ORDER;
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", $export_order)
|
||||
;
|
||||
$this->setOrders();
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
@@ -58,9 +51,7 @@ class ExportController extends BaseAdminController
|
||||
$export->downPosition();
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", "manual")
|
||||
;
|
||||
$this->setOrders(null, "manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
@@ -75,13 +66,63 @@ class ExportController extends BaseAdminController
|
||||
|
||||
$export->updatePosition($value);
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", "manual")
|
||||
;
|
||||
$this->setOrders(null, "manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
|
||||
public function changeCategoryPosition($action, $id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::UPDATE])) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$category = $this->getCategory($id);
|
||||
|
||||
if ($action === "up") {
|
||||
$category->upPosition();
|
||||
} elseif ($action === "down") {
|
||||
$category->downPosition();
|
||||
}
|
||||
|
||||
$this->setOrders("manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
|
||||
public function updateCategoryPosition($id, $value)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::UPDATE])) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$category = $this->getCategory($id);
|
||||
|
||||
$category->updatePosition($value);
|
||||
|
||||
$this->setOrders("manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
|
||||
protected function setOrders($category = null, $export = null)
|
||||
{
|
||||
if ($category === null) {
|
||||
$category = $this->getRequest()->query->get("category_order");
|
||||
}
|
||||
|
||||
if ($export === null) {
|
||||
$export = $this->getRequest()->query->get("export_order");
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("category_order", $category)
|
||||
;
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", $export)
|
||||
;
|
||||
}
|
||||
|
||||
protected function getExport($id)
|
||||
{
|
||||
@@ -99,4 +140,21 @@ class ExportController extends BaseAdminController
|
||||
}
|
||||
return $export;
|
||||
}
|
||||
|
||||
protected function getCategory($id)
|
||||
{
|
||||
$category = ExportCategoryQuery::create()->findPk($id);
|
||||
|
||||
if (null === $category) {
|
||||
throw new \ErrorException(
|
||||
Translator::getInstance()->trans(
|
||||
"There is no id \"%id\" in the export categories",
|
||||
[
|
||||
"%id" => $id
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Model\ExportQuery;
|
||||
|
||||
/**
|
||||
* Class ImportExportController
|
||||
@@ -20,23 +21,40 @@ use Thelia\Core\HttpFoundation\Response;
|
||||
*/
|
||||
class ImportExportController extends BaseAdminController
|
||||
{
|
||||
public function import()
|
||||
public function import($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
public function export($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function importView()
|
||||
public function importView($id)
|
||||
{
|
||||
if (null === $export = $this->getExport($id)) {
|
||||
return $this->render("404");
|
||||
}
|
||||
|
||||
return $this->render("import-page");
|
||||
}
|
||||
|
||||
public function exportView()
|
||||
public function exportView($id)
|
||||
{
|
||||
if (null === $export = $this->getExport($id)) {
|
||||
return $this->render("404");
|
||||
}
|
||||
|
||||
return $this->render("export-page");
|
||||
}
|
||||
|
||||
protected function getExport($id)
|
||||
{
|
||||
$export = ExportQuery::create()
|
||||
->findPk($id)
|
||||
;
|
||||
|
||||
return $export;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
namespace Thelia\Core\FileFormat\Formatting\Formatter;
|
||||
use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\Export\ExportType;
|
||||
|
||||
/**
|
||||
* Class JsonFormatter
|
||||
@@ -87,4 +88,11 @@ class JsonFormatter extends AbstractFormatter
|
||||
);
|
||||
}
|
||||
|
||||
public function getExportType()
|
||||
{
|
||||
return array(
|
||||
ExportType::EXPORT_TABLE,
|
||||
ExportType::EXPORT_UNBOUNDED,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace Thelia\Core\FileFormat\Formatting\Formatter;
|
||||
use Thelia\Core\FileFormat\Formatter\Exception\BadFormattedStringException;
|
||||
use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\Export\ExportType;
|
||||
|
||||
/**
|
||||
* Class XMLFormatter
|
||||
@@ -141,4 +142,12 @@ class XMLFormatter extends AbstractFormatter
|
||||
$data = new FormatterData($this->getAliases());
|
||||
return $data->setData($array);
|
||||
}
|
||||
|
||||
public function getExportType()
|
||||
{
|
||||
return array(
|
||||
ExportType::EXPORT_TABLE,
|
||||
ExportType::EXPORT_UNBOUNDED,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,4 +36,17 @@ interface FormatterInterface
|
||||
* a FormatterData object.
|
||||
*/
|
||||
public function decode($rawData);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* return a string that defines the handled format type.
|
||||
*
|
||||
* Thelia types are defined in \Thelia\ImportExport\Export\ExportType
|
||||
*
|
||||
* examples:
|
||||
* return ExportType::EXPORT_TABLE;
|
||||
* return ExportType::EXPORT_UNBOUNDED;
|
||||
*/
|
||||
public function getExportType();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
use Thelia\Model\ExportQuery;
|
||||
use Thelia\Model\Map\ExportTableMap;
|
||||
|
||||
/**
|
||||
* Class Export
|
||||
|
||||
@@ -17,6 +17,7 @@ use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\ExportQuery;
|
||||
use Thelia\Type\EnumType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
@@ -39,19 +40,27 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
|
||||
|
||||
$rawFormatters = array_change_key_case($service->getAll());
|
||||
|
||||
$allowedFormatter = $this->getAllowed_formatter();
|
||||
$exportId = $this->getExport();
|
||||
$formatters = [];
|
||||
if ($allowedFormatter !== null) {
|
||||
$allowedFormatter = explode(",", $allowedFormatter);
|
||||
if ($exportId !== null) {
|
||||
$export = ExportQuery::create()->findPk($exportId);
|
||||
|
||||
if (null !== $export) {
|
||||
$types = $export->getHandleClassInstance($this->container)
|
||||
->getHandledType();
|
||||
|
||||
foreach($allowedFormatter as $formatter) {
|
||||
$formatter = trim(strtolower($formatter));
|
||||
if (is_scalar($types)) {
|
||||
$types = [$types];
|
||||
}
|
||||
|
||||
if (isset($rawFormatters[$formatter])) {
|
||||
$formatters[$formatter] = $rawFormatters[$formatter];
|
||||
/** @var \Thelia\Core\FileFormat\Formatting\AbstractFormatter $formatter */
|
||||
foreach ($rawFormatters as $key=>$formatter) {
|
||||
if (in_array($formatter->getExportType(), $types)) {
|
||||
$formatters[$key] = $formatter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$formatters = $rawFormatters;
|
||||
}
|
||||
@@ -118,7 +127,7 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createAnyTypeArgument("allowed_formatter"),
|
||||
Argument::createIntTypeArgument("export"),
|
||||
new Argument(
|
||||
"order",
|
||||
new TypeCollection(
|
||||
|
||||
58
core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php
Normal file
58
core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Both;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\ExportHandlerInterface;
|
||||
use Thelia\ImportExport\ImportHandlerInterface;
|
||||
|
||||
/**
|
||||
* Class NewsletterImportExport
|
||||
* @package Thelia\ImportExport\Both
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class NewsletterImportExport implements ExportHandlerInterface, ImportHandlerInterface
|
||||
{
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*
|
||||
* Dependency injection: load the container to be able to get parameters and services
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds
|
||||
*/
|
||||
public function buildFormatterData()
|
||||
{
|
||||
// TODO: Implement buildFormatterData() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds
|
||||
*/
|
||||
public function importFromFormatterData(FormatterData $data)
|
||||
{
|
||||
// TODO: Implement importFromFormatterData() method.
|
||||
}
|
||||
|
||||
}
|
||||
33
core/lib/Thelia/ImportExport/Export/ExportType.php
Normal file
33
core/lib/Thelia/ImportExport/Export/ExportType.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Export;
|
||||
|
||||
/**
|
||||
* Class ExportType
|
||||
* @package Thelia\ImportExport\Export
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class ExportType
|
||||
{
|
||||
/**
|
||||
* This type is for unbounded formats, in general serialization formats
|
||||
* example: XML, json, yaml
|
||||
*/
|
||||
const EXPORT_UNBOUNDED = "export.unbounded";
|
||||
|
||||
/**
|
||||
* This type is for tabled format ( matrix ), most used by spreadsheet application.
|
||||
* example: CSV, ODS, XLS
|
||||
*/
|
||||
const EXPORT_TABLE = "export.table";
|
||||
}
|
||||
47
core/lib/Thelia/ImportExport/Export/MailingExport.php
Normal file
47
core/lib/Thelia/ImportExport/Export/MailingExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Export;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\ExportHandlerInterface;
|
||||
|
||||
/**
|
||||
* Class MailingExport
|
||||
* @package Thelia\ImportExport\Export
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class MailingExport implements ExportHandlerInterface
|
||||
{
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*
|
||||
* Dependency injection: load the container to be able to get parameters and services
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds
|
||||
*/
|
||||
public function buildFormatterData()
|
||||
{
|
||||
$data = new FormatterData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,4 +33,21 @@ interface ExportHandlerInterface
|
||||
* The method builds
|
||||
*/
|
||||
public function buildFormatterData();
|
||||
|
||||
/**
|
||||
* @return string|array
|
||||
*
|
||||
* Define all the type of export/formatters that this can handle
|
||||
* return a string if it handle a single type ( specific exports ),
|
||||
* or an array if multiple.
|
||||
*
|
||||
* Thelia types are defined in \Thelia\ImportExport\Export\ExportType
|
||||
*
|
||||
* example:
|
||||
* return array(
|
||||
* ExportType::EXPORT_TABLE,
|
||||
* ExportType::EXPORT_UNBOUNDED,
|
||||
* );
|
||||
*/
|
||||
public function getHandledType();
|
||||
}
|
||||
@@ -74,6 +74,11 @@ class Export extends BaseExport
|
||||
$this->setPosition($position)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
* @return ExportHandlerInterface
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public function getHandleClassInstance(ContainerInterface $container)
|
||||
{
|
||||
$class = $this->getHandleClass();
|
||||
|
||||
@@ -2,9 +2,73 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Model\Base\CategoryQuery;
|
||||
use Thelia\Model\Base\ExportCategory as BaseExportCategory;
|
||||
use Thelia\Model\Map\ExportCategoryTableMap;
|
||||
|
||||
class ExportCategory extends BaseExportCategory
|
||||
{
|
||||
public function upPosition()
|
||||
{
|
||||
if (($position = $this->getPosition()) > 1) {
|
||||
|
||||
}
|
||||
$previous = ExportCategoryQuery::create()
|
||||
->findOneByPosition($position - 1)
|
||||
;
|
||||
|
||||
if (null !== $previous) {
|
||||
$previous->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position - 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function downPosition()
|
||||
{
|
||||
$max = CategoryQuery::create()
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->select(ExportCategoryTableMap::POSITION)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$count = CategoryQuery::create()->count();
|
||||
|
||||
if ($count > $max) {
|
||||
$max = $count;
|
||||
}
|
||||
|
||||
$position = $this->getPosition();
|
||||
|
||||
if ($position < $max) {
|
||||
|
||||
$next = ExportCategoryQuery::create()
|
||||
->findOneByPosition($position + 1)
|
||||
;
|
||||
|
||||
if (null !== $next) {
|
||||
$next->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position + 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updatePosition($position)
|
||||
{
|
||||
$reverse = ExportCategoryQuery::create()
|
||||
->findOneByPosition($position)
|
||||
;
|
||||
|
||||
if (null !== $reverse) {
|
||||
$reverse->setPosition($this->getPosition())->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position)->save();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,72 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Model\Base\ImportCategory as BaseImportCategory;
|
||||
use Thelia\Model\Map\ImportCategoryTableMap;
|
||||
|
||||
class ImportCategory extends BaseImportCategory
|
||||
{
|
||||
public function upPosition()
|
||||
{
|
||||
if (($position = $this->getPosition()) > 1) {
|
||||
|
||||
$previous = ImportCategoryQuery::create()
|
||||
->findOneByPosition($position - 1)
|
||||
;
|
||||
|
||||
if (null !== $previous) {
|
||||
$previous->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position - 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function downPosition()
|
||||
{
|
||||
$max = CategoryQuery::create()
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->select(ImportCategoryTableMap::POSITION)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$count = CategoryQuery::create()->count();
|
||||
|
||||
if ($count > $max) {
|
||||
$max = $count;
|
||||
}
|
||||
|
||||
$position = $this->getPosition();
|
||||
|
||||
if ($position < $max) {
|
||||
|
||||
$next = ImportCategoryQuery::create()
|
||||
->findOneByPosition($position + 1)
|
||||
;
|
||||
|
||||
if (null !== $next) {
|
||||
$next->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position + 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updatePosition($position)
|
||||
{
|
||||
$reverse = ImportCategoryQuery::create()
|
||||
->findOneByPosition($position)
|
||||
;
|
||||
|
||||
if (null !== $reverse) {
|
||||
$reverse->setPosition($this->getPosition())->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position)->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{$admin_current_location = 'tools'}
|
||||
{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Export: %name' name=$NAME}{/block}
|
||||
|
||||
{block name="check-resource"}admin.export{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
<!-- -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var compression_switch = $(".export-compression-switch");
|
||||
var compression_row = $(".export-compression-selection-row");
|
||||
|
||||
compression_switch.on("switch-change", function(e, data) {
|
||||
var is_checked = data.value;
|
||||
|
||||
if (is_checked) {
|
||||
compression_row.show();
|
||||
} else {
|
||||
compression_row.hide();
|
||||
}
|
||||
});
|
||||
|
||||
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
|
||||
compression_row.show();
|
||||
} else {
|
||||
compression_row.hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{module_include location='configuration-js'}
|
||||
{/block}
|
||||
@@ -10,6 +10,14 @@
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
{if $category_order != "manual"}
|
||||
{assign url_category "category_order="|cat:$category_order}
|
||||
{/if}
|
||||
{if $export_order != "manual"}
|
||||
{assign url_export "export_order="|cat:$export_order}
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="configuration">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
@@ -24,36 +32,42 @@
|
||||
|
||||
{module_include location='tools_top'}
|
||||
|
||||
{loop name="export-category" type="export-category"}
|
||||
{if $LOOP_COUNT % 3}
|
||||
{loop name="export-category" type="export-category" order=$category_order}
|
||||
<div class="row">
|
||||
{/if}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>
|
||||
<!-- add up and down arrows -->
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
<a href="{url path="/admin/export/position/category/up/{$ID}{if $url_export}?{$url_export}{/if}"}">
|
||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||
</a>
|
||||
{$POSITION}
|
||||
<a href="{url path="/admin/export/position/category/down/{$ID}{if $url_export}?{$url_export}{/if}"}">
|
||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||
</a>
|
||||
{$TITLE}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-1">
|
||||
<a href="{url path="/admin/export"}?export_order=id{if $export_order == "id"}_reverse{/if}">
|
||||
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=id{if $export_order == "id"}_reverse{/if}">
|
||||
{intl l="ID"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-9">
|
||||
<a href="{url path="/admin/export"}?export_order=alpha{if $export_order == "alpha"}_reverse{/if}">
|
||||
<th class="col-md-8">
|
||||
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=alpha{if $export_order == "alpha"}_reverse{/if}">
|
||||
{intl l="Name"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-2">
|
||||
<a href="{url path="/admin/export"}?export_order=manual{if $export_order == "manual"}_reverse{/if}">
|
||||
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=manual{if $export_order == "manual"}_reverse{/if}">
|
||||
{intl l="Position"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
{intl l="Actions"}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -66,14 +80,21 @@
|
||||
<a href="{$URL}">{$TITLE}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{url path="/admin/export"}/position/up/{$ID}">
|
||||
<a href="{url path="/admin/export/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}">
|
||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||
</a>
|
||||
{$POSITION}
|
||||
<a href="{url path="/admin/export/position/down"}/{$ID}">
|
||||
<a href="{url path="/admin/export/position/down/{$ID}{if $url_category}?{$url_category}{/if}"}">
|
||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs" href="{$URL}" title="{intl l="Do this export"}">
|
||||
<span class="glyphicon glyphicon-open"></span>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
@@ -82,46 +103,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $LOOP_COUNT % 3}
|
||||
</div>
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="export-category"}
|
||||
<div class="alert alert-info">
|
||||
{intl l="You don't have any export"}
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
{module_include location='configuration_bottom'}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
<!-- -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var compression_switch = $(".export-compression-switch");
|
||||
var compression_row = $(".export-compression-selection-row");
|
||||
|
||||
compression_switch.on("switch-change", function(e, data) {
|
||||
var is_checked = data.value;
|
||||
|
||||
if (is_checked) {
|
||||
compression_row.show();
|
||||
} else {
|
||||
compression_row.hide();
|
||||
}
|
||||
});
|
||||
|
||||
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
|
||||
compression_row.show();
|
||||
} else {
|
||||
compression_row.hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{module_include location='configuration-js'}
|
||||
{/block}
|
||||
@@ -10,6 +10,14 @@
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
{if $category_order != "manual"}
|
||||
{assign url_category "category_order="|cat:$category_order}
|
||||
{/if}
|
||||
{if $import_order != "manual"}
|
||||
{assign url_import "import_order="|cat:$import_order}
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="configuration">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
@@ -24,69 +32,86 @@
|
||||
|
||||
{module_include location='tools_top'}
|
||||
|
||||
{loop name="import-category" type="import-category"}
|
||||
{if $LOOP_COUNT % 3}
|
||||
{loop name="import-category" type="import-category" order=$category_order}
|
||||
<div class="row">
|
||||
{/if}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>
|
||||
<!-- add up and down arrows -->
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
<a href="{url path="/admin/import/position/category/up/{$ID}{if $url_import}?{$url_import}{/if}"}">
|
||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||
</a>
|
||||
{$POSITION}
|
||||
<a href="{url path="/admin/import/position/category/down/{$ID}{if $url_import}?{$url_import}{/if}"}">
|
||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||
</a>
|
||||
{$TITLE}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-1">
|
||||
<a href="{url path="/admin/import"}?import_order=id{if $import_order == "id"}_reverse{/if}">
|
||||
{intl l="ID"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-9">
|
||||
<a href="{url path="/admin/import"}?import_order=alpha{if $import_order == "alpha"}_reverse{/if}">
|
||||
{intl l="Name"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-2">
|
||||
<a href="{url path="/admin/import"}?import_order=manual{if $import_order == "manual"}_reverse{/if}">
|
||||
{intl l="Position"}
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="col-md-1">
|
||||
<a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=id{if $import_order == "id"}_reverse{/if}">
|
||||
{intl l="ID"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-8">
|
||||
<a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=alpha{if $import_order == "alpha"}_reverse{/if}">
|
||||
{intl l="Name"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-2">
|
||||
<a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=manual{if $import_order == "manual"}_reverse{/if}">
|
||||
{intl l="Position"}
|
||||
</a>
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
{intl l="Actions"}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop name="import-categ-list" type="import" order=$import_order category=$ID}
|
||||
<tr>
|
||||
<td>
|
||||
{$ID}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{$URL}">{$TITLE}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{url path="/admin/import"}/position/up/{$ID}">
|
||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||
{loop name="import-categ-list" type="import" order=$import_order category=$ID}
|
||||
<tr>
|
||||
<td>
|
||||
{$ID}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{$URL}">{$TITLE}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{url path="/admin/import/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}">
|
||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||
</a>
|
||||
{$POSITION}
|
||||
<a href="{url path="/admin/import/position/down/{$ID}{if $url_category}?{$url_category}{/if}"}">
|
||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs" href="{$URL}" title="{intl l="Do this import"}">
|
||||
<span class="glyphicon glyphicon-open"></span>
|
||||
</a>
|
||||
{$POSITION}
|
||||
<a href="{url path="/admin/import/position/down"}/{$ID}">
|
||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $LOOP_COUNT % 3}
|
||||
</div>
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="import-category"}
|
||||
<div class="alert alert-info">
|
||||
{intl l="You don't have any import"}
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
{module_include location='configuration_bottom'}
|
||||
</div>
|
||||
</div>
|
||||
@@ -107,14 +132,14 @@
|
||||
var compression_row = $(".import-compression-selection-row");
|
||||
|
||||
compression_switch.on("switch-change", function(e, data) {
|
||||
var is_checked = data.value;
|
||||
var is_checked = data.value;
|
||||
|
||||
if (is_checked) {
|
||||
compression_row.show();
|
||||
} else {
|
||||
compression_row.hide();
|
||||
}
|
||||
});
|
||||
if (is_checked) {
|
||||
compression_row.show();
|
||||
} else {
|
||||
compression_row.hide();
|
||||
}
|
||||
});
|
||||
|
||||
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
|
||||
compression_row.show();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="col-md-3">
|
||||
{custom_render_form_field form=$form field="formatter"}
|
||||
<select>
|
||||
{loop name="export-formatters" type="formatter"}
|
||||
{loop name="export-formatters" type="formatter" export=$ID}
|
||||
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
|
||||
{$NAME} (.{$EXTENSION})
|
||||
</option>
|
||||
|
||||
Reference in New Issue
Block a user