create area loop and shipping conf events name
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
<loops>
|
||||
<loop class="Thelia\Core\Template\Loop\Accessory" name="accessory"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Area" name="area"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AssociatedContent" name="associated_content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Attribute" name="attribute"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeAvailability" name="attribute_availability"/>
|
||||
|
||||
@@ -405,34 +405,6 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\FolderController::updatePositionAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Countries routes management -->
|
||||
|
||||
<route id="admin.configuration.countries.default" path="/admin/configuration/countries">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.create" path="/admin/configuration/countries/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.update" path="/admin/configuration/country/update/{country_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::updateAction</default>
|
||||
<requirement key="country_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.save" path="/admin/configuration/country/save/{country_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::processUpdateAction</default>
|
||||
<requirement key="country_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.delete" path="/admin/configuration/countries/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.toggle-default" path="/admin/configuration/country/toggleDefault">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::toggleDefaultAction</default>
|
||||
</route>
|
||||
|
||||
<!-- content routes management -->
|
||||
<route id="admin.content.create" path="/admin/content/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\ContentController::createAction</default>
|
||||
@@ -716,7 +688,7 @@
|
||||
<!-- Shipping zones routes management -->
|
||||
|
||||
<route id="admin.configuration.shipping-configuration.default" path="/admin/configuration/shipping_configuration">
|
||||
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::indexAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.shipping-configuration.update.view" path="/admin/configuration/shipping_configuration/update/{shipping_configuration_id}" methods="get">
|
||||
@@ -726,6 +698,35 @@
|
||||
|
||||
<!-- end shipping routes management -->
|
||||
|
||||
<!-- Countries routes management -->
|
||||
|
||||
<route id="admin.configuration.countries.default" path="/admin/configuration/countries">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.create" path="/admin/configuration/countries/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.update" path="/admin/configuration/country/update/{country_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::updateAction</default>
|
||||
<requirement key="country_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.save" path="/admin/configuration/country/save/{country_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::processUpdateAction</default>
|
||||
<requirement key="country_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.delete" path="/admin/configuration/countries/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.toggle-default" path="/admin/configuration/country/toggleDefault">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::toggleDefaultAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end countries routes management -->
|
||||
|
||||
<!-- feature and features value management -->
|
||||
|
||||
|
||||
@@ -22,15 +22,16 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
/**
|
||||
* Class ShippingConfigurationController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
124
core/lib/Thelia/Core/Template/Loop/Area.php
Normal file
124
core/lib/Thelia/Core/Template/Loop/Area.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
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 <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
{loop name="countries" type="country" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<td>{$TITLE}</td>
|
||||
<td><a href="{url path="/admin/configuration/country/update/{$ID}"}">{$TITLE}</a></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio change-default-toggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input class="change-default-toggle" type="radio" name="by_default" value="{$ID}" {if $IS_DEFAULT}checked="checked"{/if}/>
|
||||
|
||||
@@ -41,66 +41,24 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="area-list" type="area" backend_context="1"}
|
||||
<tr>
|
||||
<td>France</td>
|
||||
<td><a href="{url path="/admin/configuration/shipping_configuration/update/$ID"}">{$NAME}</a></td>
|
||||
|
||||
{module_include location='shipping_configuration_table_row'}
|
||||
|
||||
<td>
|
||||
{if ! $SECURED}
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-change" title="{intl l='Change this shipping configuration'}" href="{url path="/admin/configuration/shipping_configuration/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-delete" title="{intl l='Delete this shipping configuration'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
{else}
|
||||
<i title="{intl l='This shipping configuration could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Outre-Mer DOM</td>
|
||||
|
||||
{module_include location='shipping_configuration_table_row'}
|
||||
|
||||
<td>
|
||||
{if ! $SECURED}
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-change" title="{intl l='Change this shipping configuration'}" href="{url path="/admin/configuration/shipping_configuration/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-delete" title="{intl l='Delete this shipping configuration'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
{else}
|
||||
<i title="{intl l='This shipping configuration could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Outre-Mer TOM</td>
|
||||
|
||||
{module_include location='shipping_configuration_table_row'}
|
||||
|
||||
<td>
|
||||
{if ! $SECURED}
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-change" title="{intl l='Change this shipping configuration'}" href="{url path="/admin/configuration/shipping_configuration/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-delete" title="{intl l='Delete this shipping configuration'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
{else}
|
||||
<i title="{intl l='This shipping configuration could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||
{/if}
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-configuration.change"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-change" title="{intl l='Change this shipping configuration'}" href="{url path="/admin/configuration/shipping_configuration/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.shipping-configuration.delete"}
|
||||
<a class="btn btn-default btn-xs shipping-configuration-delete" title="{intl l='Delete this shipping configuration'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user