diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index d4d63ac77..ba530611c 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -7,6 +7,7 @@ + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index b2292b334..cfdce8aeb 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -405,34 +405,6 @@ Thelia\Controller\Admin\FolderController::updatePositionAction - - - - Thelia\Controller\Admin\CountryController::defaultAction - - - - Thelia\Controller\Admin\CountryController::createAction - - - - Thelia\Controller\Admin\CountryController::updateAction - \d+ - - - - Thelia\Controller\Admin\CountryController::processUpdateAction - \d+ - - - - Thelia\Controller\Admin\CountryController::deleteAction - - - - Thelia\Controller\Admin\CountryController::toggleDefaultAction - - Thelia\Controller\Admin\ContentController::createAction @@ -716,7 +688,7 @@ - Thelia\Controller\Admin\ShippingConfigurationController::indexAction + Thelia\Controller\Admin\ShippingConfigurationController::defaultAction @@ -726,6 +698,35 @@ + + + + Thelia\Controller\Admin\CountryController::defaultAction + + + + Thelia\Controller\Admin\CountryController::createAction + + + + Thelia\Controller\Admin\CountryController::updateAction + \d+ + + + + Thelia\Controller\Admin\CountryController::processUpdateAction + \d+ + + + + Thelia\Controller\Admin\CountryController::deleteAction + + + + Thelia\Controller\Admin\CountryController::toggleDefaultAction + + + diff --git a/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php b/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php index 92b73a83e..3ca6fec35 100644 --- a/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php +++ b/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php @@ -22,15 +22,16 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; +use Thelia\Core\Event\TheliaEvents; /** * Class ShippingConfigurationController * @package Thelia\Controller\Admin * @author Manuel Raynaud */ -class ShippingConfigurationController extends BaseAdminController +class ShippingConfigurationController extends AbstractCrudController { - public function indexAction() +/* public function indexAction() { if (null !== $response = $this->checkAuth("admin.shipping-configuration.view")) return $response; return $this->render("shipping-configuration", array("display_shipping_configuration" => 20)); @@ -41,5 +42,159 @@ class ShippingConfigurationController extends BaseAdminController return $this->render("shipping-configuration-edit", array( "shipping_configuration_id" => $shipping_configuration_id )); + }*/ + + public function __construct() + { + parent::__construct( + 'area', + null, + null, + + 'admin.shipping.default', + 'admin.shipping.create', + 'admin.shipping.update', + 'admin.shipping.delete', + + TheliaEvents::SHIPPING_CREATE, + TheliaEvents::SHIPPING_UPDATE, + TheliaEvents::SHIPPING_DELETE + ); + } + + /** + * Return the creation form for this object + */ + protected function getCreationForm() + { + // TODO: Implement getCreationForm() method. + } + + /** + * Return the update form for this object + */ + protected function getUpdateForm() + { + // TODO: Implement getUpdateForm() method. + } + + /** + * Hydrate the update form for this object, before passing it to the update template + * + * @param unknown $object + */ + protected function hydrateObjectForm($object) + { + // TODO: Implement hydrateObjectForm() method. + } + + /** + * Creates the creation event with the provided form data + * + * @param unknown $formData + */ + protected function getCreationEvent($formData) + { + // TODO: Implement getCreationEvent() method. + } + + /** + * Creates the update event with the provided form data + * + * @param unknown $formData + */ + protected function getUpdateEvent($formData) + { + // TODO: Implement getUpdateEvent() method. + } + + /** + * Creates the delete event with the provided form data + */ + protected function getDeleteEvent() + { + // TODO: Implement getDeleteEvent() method. + } + + /** + * Return true if the event contains the object, e.g. the action has updated the object in the event. + * + * @param unknown $event + */ + protected function eventContainsObject($event) + { + // TODO: Implement eventContainsObject() method. + } + + /** + * Get the created object from an event. + * + * @param unknown $createEvent + */ + protected function getObjectFromEvent($event) + { + // TODO: Implement getObjectFromEvent() method. + } + + /** + * Load an existing object from the database + */ + protected function getExistingObject() + { + // TODO: Implement getExistingObject() method. + } + + /** + * Returns the object label form the object event (name, title, etc.) + * + * @param unknown $object + */ + protected function getObjectLabel($object) + { + // TODO: Implement getObjectLabel() method. + } + + /** + * Returns the object ID from the object + * + * @param unknown $object + */ + protected function getObjectId($object) + { + // TODO: Implement getObjectId() method. + } + + /** + * Render the main list template + * + * @param unknown $currentOrder, if any, null otherwise. + */ + protected function renderListTemplate($currentOrder) + { + return $this->render("shipping-configuration"); + } + + /** + * Render the edition template + */ + protected function renderEditionTemplate() + { + // TODO: Implement renderEditionTemplate() method. + } + + /** + * Redirect to the edition template + */ + protected function redirectToEditionTemplate() + { + // TODO: Implement redirectToEditionTemplate() method. + } + + /** + * Redirect to the list template + */ + protected function redirectToListTemplate() + { + return $this->render("shipping-configuration"); } } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 4e4f55ba8..515ed8a25 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -232,6 +232,12 @@ final class TheliaEvents const BEFORE_UPDATECOUNTRY = "action.before_updateCountry"; const AFTER_UPDATECOUNTRY = "action.after_updateCountry"; + // -- SHIPPING CONFIGURATION MANAGEMENT + + const SHIPPING_CREATE = 'action.createShipping'; + const SHIPPING_UPDATE = 'action.updateShipping'; + const SHIPPING_DELETE = 'action.deleteShipping'; + // -- Categories Associated Content ---------------------------------------- const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent"; diff --git a/core/lib/Thelia/Core/Template/Loop/Area.php b/core/lib/Thelia/Core/Template/Loop/Area.php new file mode 100644 index 000000000..48baf2fbb --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Area.php @@ -0,0 +1,124 @@ +. */ +/* */ +/*************************************************************************************/ + +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\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\AreaQuery; + + +/** + * Class Area + * @package Thelia\Core\Template\Loop + * @author Manuel Raynaud + */ +class Area extends BaseLoop +{ + public $timestampable = true; + + /** + * + * define all args used in your loop + * + * + * example : + * + * public function getArgDefinitions() + * { + * return new ArgumentCollection( + * Argument::createIntListTypeArgument('id'), + * new Argument( + * 'ref', + * new TypeCollection( + * new Type\AlphaNumStringListType() + * ) + * ), + * Argument::createIntListTypeArgument('category'), + * Argument::createBooleanTypeArgument('new'), + * Argument::createBooleanTypeArgument('promo'), + * Argument::createFloatTypeArgument('min_price'), + * Argument::createFloatTypeArgument('max_price'), + * Argument::createIntTypeArgument('min_stock'), + * Argument::createFloatTypeArgument('min_weight'), + * Argument::createFloatTypeArgument('max_weight'), + * Argument::createBooleanTypeArgument('current'), + * + * ); + * } + * + * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id') + ); + } + + /** + * + * this function have to be implement in your own loop class. + * + * All loops parameters can be accessible via getter. + * + * for example, ref parameter is accessible through getRef method + * + * @param $pagination + * + * @return mixed + */ + public function exec(&$pagination) + { + $id = $this->getId(); + + $search = AreaQuery::create(); + + if ($id) { + $search->filterById($id, Criteria::IN); + } + + $areas = $this->search($search, $pagination); + + $loopResult = new LoopResult($areas); + + foreach ($areas as $area) { + $loopResultRow = new LoopResultRow($loopResult, $area, $this->versionable, $this->timestampable, $this->countable); + + $loopResultRow + ->set('ID', $area->getId()) + ->set('NAME', $area->getName()) + ->set('POSTAGE', $area->getPostage()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } + + +} \ No newline at end of file diff --git a/templates/admin/default/countries.html b/templates/admin/default/countries.html index 48dda2c4d..6791131df 100644 --- a/templates/admin/default/countries.html +++ b/templates/admin/default/countries.html @@ -52,7 +52,7 @@ {loop name="countries" type="country" backend_context="1" lang=$lang_id order=$order} {$ID} - {$TITLE} + {$TITLE}
diff --git a/templates/admin/default/shipping-configuration.html b/templates/admin/default/shipping-configuration.html index 067256d5f..7cd88bb1d 100644 --- a/templates/admin/default/shipping-configuration.html +++ b/templates/admin/default/shipping-configuration.html @@ -41,66 +41,24 @@ + {loop name="area-list" type="area" backend_context="1"} - France + {$NAME} {module_include location='shipping_configuration_table_row'} - {if ! $SECURED} -
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"} - - {/loop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"} - - {/loop} -
- {else} - - {/if} - - - - Outre-Mer DOM - - {module_include location='shipping_configuration_table_row'} - - - {if ! $SECURED} -
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"} - - {/loop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"} - - {/loop} -
- {else} - - {/if} - - - - Outre-Mer TOM - - {module_include location='shipping_configuration_table_row'} - - - {if ! $SECURED} -
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"} - - {/loop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"} - - {/loop} -
- {else} - - {/if} +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"} + + {/loop} + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"} + + {/loop} +
+ {/loop}