Split import export management in two

modifié:         core/lib/Thelia/Config/Resources/config.xml
	modifié:         core/lib/Thelia/Config/Resources/loop.xml
	modifié:         core/lib/Thelia/Config/Resources/routing/admin.xml
	nouveau fichier: core/lib/Thelia/Controller/Admin/ImportExportController.php
	nouveau fichier: core/lib/Thelia/Core/Template/Loop/Export.php
	nouveau fichier: core/lib/Thelia/Core/Template/Loop/ExportCategory.php
	nouveau fichier: core/lib/Thelia/Core/Template/Loop/Import.php
	nouveau fichier: core/lib/Thelia/Core/Template/Loop/ImportCategory.php
	modifié:         core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php
	modifié:         core/lib/Thelia/Core/Template/Loop/ImportExportType.php
	nouveau fichier: core/lib/Thelia/Model/Base/Export.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportCategory.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportCategoryI18n.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportCategoryI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportCategoryQuery.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportI18n.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/Base/ExportQuery.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportType.php -> core/lib/Thelia/Model/Base/Import.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportCategory.php -> core/lib/Thelia/Model/Base/ImportCategory.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportCategoryI18n.php -> core/lib/Thelia/Model/Base/ImportCategoryI18n.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportCategoryI18nQuery.php -> core/lib/Thelia/Model/Base/ImportCategoryI18nQuery.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportCategoryQuery.php -> core/lib/Thelia/Model/Base/ImportCategoryQuery.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportTypeI18n.php -> core/lib/Thelia/Model/Base/ImportI18n.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportTypeI18nQuery.php -> core/lib/Thelia/Model/Base/ImportI18nQuery.php
	renommé:         core/lib/Thelia/Model/Base/ImportExportTypeQuery.php -> core/lib/Thelia/Model/Base/ImportQuery.php
	nouveau fichier: core/lib/Thelia/Model/Export.php
	nouveau fichier: core/lib/Thelia/Model/ExportCategory.php
	nouveau fichier: core/lib/Thelia/Model/ExportCategoryI18n.php
	renommé:         core/lib/Thelia/Model/ImportExportCategoryQuery.php -> core/lib/Thelia/Model/ExportCategoryI18nQuery.php
	renommé:         core/lib/Thelia/Model/ImportExportTypeQuery.php -> core/lib/Thelia/Model/ExportCategoryQuery.php
	nouveau fichier: core/lib/Thelia/Model/ExportI18n.php
	renommé:         core/lib/Thelia/Model/ImportExportTypeI18nQuery.php -> core/lib/Thelia/Model/ExportI18nQuery.php
	renommé:         core/lib/Thelia/Model/ImportExportCategoryI18nQuery.php -> core/lib/Thelia/Model/ExportQuery.php
	nouveau fichier: core/lib/Thelia/Model/Import.php
	nouveau fichier: core/lib/Thelia/Model/ImportCategory.php
	nouveau fichier: core/lib/Thelia/Model/ImportCategoryI18n.php
	nouveau fichier: core/lib/Thelia/Model/ImportCategoryI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/ImportCategoryQuery.php
	supprimé:        core/lib/Thelia/Model/ImportExportCategory.php
	supprimé:        core/lib/Thelia/Model/ImportExportCategoryI18n.php
	supprimé:        core/lib/Thelia/Model/ImportExportType.php
	supprimé:        core/lib/Thelia/Model/ImportExportTypeI18n.php
	nouveau fichier: core/lib/Thelia/Model/ImportI18n.php
	nouveau fichier: core/lib/Thelia/Model/ImportI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/ImportQuery.php
	nouveau fichier: core/lib/Thelia/Model/Map/ExportCategoryI18nTableMap.php
	nouveau fichier: core/lib/Thelia/Model/Map/ExportCategoryTableMap.php
	nouveau fichier: core/lib/Thelia/Model/Map/ExportI18nTableMap.php
	nouveau fichier: core/lib/Thelia/Model/Map/ExportTableMap.php
	renommé:         core/lib/Thelia/Model/Map/ImportExportCategoryI18nTableMap.php -> core/lib/Thelia/Model/Map/ImportCategoryI18nTableMap.php
	renommé:         core/lib/Thelia/Model/Map/ImportExportCategoryTableMap.php -> core/lib/Thelia/Model/Map/ImportCategoryTableMap.php
	renommé:         core/lib/Thelia/Model/Map/ImportExportTypeI18nTableMap.php -> core/lib/Thelia/Model/Map/ImportI18nTableMap.php
	renommé:         core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php -> core/lib/Thelia/Model/Map/ImportTableMap.php
	modifié:         local/config/schema.xml
	modifié:         setup/thelia.sql
	modifié:         templates/backOffice/default/export.html
This commit is contained in:
Benjamin Perche
2014-07-10 10:31:57 +02:00
parent 0cb0e89382
commit 658c848171
57 changed files with 12983 additions and 1648 deletions

View File

@@ -0,0 +1,38 @@
<?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\Core\Template\Loop;
use Thelia\Model\ExportQuery;
use Thelia\Model\Map\ExportTableMap;
/**
* Class Export
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class Export extends ImportExportType
{
protected function getBaseUrl()
{
return $this->container->getParameter("export.base_url");
}
protected function getQueryModel()
{
return ExportQuery::create();
}
protected function getCategoryName()
{
return "ExportCategoryId";
}
}

View File

@@ -0,0 +1,28 @@
<?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\Core\Template\Loop;
use Thelia\Model\ExportCategoryQuery;
/**
* Class ExportCategory
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ExportCategory extends ImportExportCategory
{
protected function getQueryModel()
{
return ExportCategoryQuery::create();
}
}

View File

@@ -0,0 +1,37 @@
<?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\Core\Template\Loop;
use Thelia\Model\ImportQuery;
/**
* Class Import
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class Import extends ImportExportType
{
protected function getBaseUrl()
{
return $this->container->getParameter("export.base_url");
}
protected function getQueryModel()
{
return ImportQuery::create();
}
protected function getCategoryName()
{
return "ImportCategoryId";
}
}

View File

@@ -0,0 +1,27 @@
<?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\Core\Template\Loop;
use Thelia\Model\ImportCategoryQuery;
/**
* Class ImportCategory
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ImportCategory extends ImportExportCategory
{
protected function getQueryModel()
{
return ImportCategoryQuery::create();
}
}

View File

@@ -18,7 +18,6 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Base\ImportExportCategoryQuery;
use Thelia\Type\EnumListType;
use Thelia\Type\TypeCollection;
@@ -27,7 +26,7 @@ use Thelia\Type\TypeCollection;
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface
abstract class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
@@ -38,7 +37,6 @@ class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \Thelia\Model\ImportExportCategory $category */
foreach ($loopResult->getResultDataCollection() as $category)
{
$loopResultRow = new LoopResultRow($category);
@@ -62,7 +60,7 @@ class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface
*/
public function buildModelCriteria()
{
$query = ImportExportCategoryQuery::create();
$query = $this->getQueryModel();
if (null !== $ids = $this->getId()) {
$query->filterById($ids, Criteria::IN);
@@ -133,4 +131,6 @@ class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface
)
);
}
abstract protected function getQueryModel();
}

View File

@@ -11,11 +11,14 @@
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Tools\URL;
use Thelia\Type\EnumListType;
use Thelia\Type\TypeCollection;
@@ -24,8 +27,10 @@ use Thelia\Type\TypeCollection;
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
abstract class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
/**
* @param LoopResult $loopResult
*
@@ -33,9 +38,27 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
*/
public function parseResults(LoopResult $loopResult)
{
// TODO: Implement parseResults() method.
}
foreach ($loopResult->getResultDataCollection() as $type) {
$loopResultRow = new LoopResultRow($type);
$url = URL::getInstance()->absoluteUrl(
$this->getBaseUrl() . DS . $type->getId()
);
$loopResultRow
->set("ID", $type->getId())
->set("TITLE", $type->getTitle())
->set("DESCRIPTION", $type->getDescription())
->set("URL", $type->isImport() ? $url : null)
->set("POSITION", $type->getPosition())
->set("CATEGORY_ID", $type->getImportExportCategoryId())
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
/**
* this method returns a Propel ModelCriteria
@@ -44,7 +67,42 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
*/
public function buildModelCriteria()
{
// TODO: Implement buildModelCriteria() method.
$query = $this->getQueryModel();
if (null !== $ids = $this->getId()) {
$query->filterById($ids);
}
if (null !== $categories = $this->getCategory()) {
$query->filterBy($this->getCategoryName(), $categories, Criteria::IN);
}
if (null !== $orders = $this->getOrder()) {
foreach ($orders as $order) {
switch($order) {
case "id":
$query->orderById();
break;
case "id_reverse":
$query->orderById(Criteria::DESC);
break;
case "alpha":
$query->addAscendingOrderByColumn("i18n_TITLE");
break;
case "alpha_reverse":
$query->addDescendingOrderByColumn("i18n_TITLE");
break;
case "manual":
$query->orderByPosition();
break;
case "manual_reverse":
$query->orderByPosition(Criteria::DESC);
break;
}
}
}
return $query;
}
/**
@@ -75,6 +133,7 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('category'),
new Argument(
"order",
new TypeCollection(
@@ -84,4 +143,10 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
)
);
}
abstract protected function getBaseUrl();
abstract protected function getQueryModel();
abstract protected function getCategoryName();
}