Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By Manuel Raynaud (22) and others
# Via Manuel Raynaud (7) and others
* 'master' of https://github.com/thelia/thelia: (32 commits)
  refactor name for updating actions
  choose UPDATE word for name actions
  add update address action and create tests
  404 not found management
  Working Fix unset namespace
  modify travis script
  test rewriting exception
  Fixed minor bug in Currencies
  Finished currency edition
  Added route methods
  address action implementation
  hot fix
  rewriting
  add address create controller and event
  Added AdminUtilities Smarty plugin, optimized templates
  update customer model createOrUpdate method
  update address model
  fix redirect process in viewListener
  refactor reset_install script
  refactor install process, database management in dedicated class
  ...

Conflicts:
	local/config/schema.xml
	reset_install.sh
This commit is contained in:
gmorel
2013-09-04 15:42:38 +02:00
103 changed files with 4436 additions and 1827 deletions

View File

@@ -84,7 +84,7 @@ class RegisterRouterPass implements CompilerPassInterface
$container->setDefinition("router.".$moduleCode, $definition);
$chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), -1));
$chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), 1));
}
}
}

View File

@@ -0,0 +1,267 @@
<?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\Event;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Model\Address;
use Thelia\Model\Customer;
/**
* Class AddressCreateOrUpdateEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class AddressCreateOrUpdateEvent extends Event
{
/**
* @var string address label
*/
protected $label;
/**
* @var int title id
*/
protected $title;
/**
* @var string|null company name
*/
protected $company;
/**
* @var string first name
*/
protected $firstname;
/**
* @var string last name
*/
protected $lastname;
/**
* @var string address
*/
protected $address1;
/**
* @var string address line 2
*/
protected $address2;
/**
* @var string address line 3
*/
protected $address3;
/**
* @var string zipcode
*/
protected $zipcode;
/**
* @var string city
*/
protected $city;
/**
* @var int country id
*/
protected $country;
/**
* @var string cell phone
*/
protected $cellphone;
/**
* @var string phone
*/
protected $phone;
/**
* @var \Thelia\Model\Customer
*/
protected $customer;
/**
* @var \Thelia\Model\Address
*/
protected $address;
function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
{
$this->address1 = $address1;
$this->address2 = $address2;
$this->address3 = $address3;
$this->cellphone = $cellphone;
$this->city = $city;
$this->company = $company;
$this->country = $country;
$this->firstname = $firstname;
$this->label = $label;
$this->lastname = $lastname;
$this->phone = $phone;
$this->title = $title;
$this->zipcode = $zipcode;
}
/**
* @return string
*/
public function getAddress1()
{
return $this->address1;
}
/**
* @return string
*/
public function getAddress2()
{
return $this->address2;
}
/**
* @return string
*/
public function getAddress3()
{
return $this->address3;
}
/**
* @return string
*/
public function getCellphone()
{
return $this->cellphone;
}
/**
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* @return null|string
*/
public function getCompany()
{
return $this->company;
}
/**
* @return int
*/
public function getCountry()
{
return $this->country;
}
/**
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* @return int
*/
public function getTitle()
{
return $this->title;
}
/**
* @return string
*/
public function getZipcode()
{
return $this->zipcode;
}
/**
* @param \Thelia\Model\Customer $customer
*/
public function setCustomer(Customer $customer)
{
$this->customer = $customer;
}
/**
* @return \Thelia\Model\Customer
*/
public function getCustomer()
{
return $this->customer;
}
/**
* @param \Thelia\Model\Address $address
*/
public function setAddress(Address $address)
{
$this->address = $address;
$this->setCustomer($address->getCustomer());
}
/**
* @return \Thelia\Model\Address
*/
public function getAddress()
{
return $this->address;
}
}

View File

@@ -38,11 +38,8 @@ use Thelia\Model\Coupon;
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CouponEvent extends ActionEvent
class CouponCreateOrUpdateEvent extends ActionEvent
{
/** @var int Coupon Id */
protected $id = null;
/** @var CouponRuleCollection Array of CouponRuleInterface */
protected $rules = null;
@@ -85,6 +82,9 @@ class CouponEvent extends ActionEvent
/** @var string Coupon effect */
protected $effect;
/** @var string Language code ISO (ex: fr_FR) */
protected $lang = null;
/**
* Constructor
*
@@ -101,7 +101,7 @@ class CouponEvent extends ActionEvent
* @param boolean $isRemovingPostage Is removing Postage
* @param int $maxUsage Coupon quantity
* @param CouponRuleCollection $rules CouponRuleInterface to add
* @param int $id Coupon id
* @param string $lang Coupon Language code ISO (ex: fr_FR)
*/
function __construct(
$code,
@@ -111,19 +111,18 @@ class CouponEvent extends ActionEvent
$shortDescription,
$description,
$isEnabled,
$expirationDate,
\DateTime $expirationDate,
$isAvailableOnSpecialOffers,
$isCumulative,
$isRemovingPostage,
$maxUsage,
$rules,
$id = null
$lang
) {
$this->amount = $amount;
$this->code = $code;
$this->description = $description;
$this->expirationDate = $expirationDate;
$this->id = $id;
$this->isAvailableOnSpecialOffers = $isAvailableOnSpecialOffers;
$this->isCumulative = $isCumulative;
$this->isEnabled = $isEnabled;
@@ -133,16 +132,7 @@ class CouponEvent extends ActionEvent
$this->shortDescription = $shortDescription;
$this->title = $title;
$this->effect = $effect;
}
/**
* Return Coupon Id
*
* @return int
*/
public function getId()
{
return $this->id;
$this->lang = $lang;
}
/**
@@ -242,7 +232,7 @@ class CouponEvent extends ActionEvent
*
* @return boolean
*/
public function getIsAvailableOnSpecialOffers()
public function isAvailableOnSpecialOffers()
{
return $this->isAvailableOnSpecialOffers;
}
@@ -278,7 +268,15 @@ class CouponEvent extends ActionEvent
return $this->effect;
}
/**
* Coupon Language code ISO (ex: fr_FR)
*
* @return string
*/
public function getLang()
{
return $this->lang;
}
/**
* @param \Thelia\Model\Coupon $coupon

View File

@@ -27,6 +27,7 @@ use Thelia\Model\Currency;
class CurrencyChangeEvent extends CurrencyCreateEvent
{
protected $currency_id;
protected $is_default;
public function __construct($currency_id)
{
@@ -44,4 +45,16 @@ class CurrencyChangeEvent extends CurrencyCreateEvent
return $this;
}
}
public function getIsDefault()
{
return $this->is_default;
}
public function setIsDefault($is_default)
{
$this->is_default = $is_default;
return $this;
}
}

View File

@@ -65,6 +65,8 @@ class CurrencyCreateEvent extends CurrencyEvent
public function setSymbol($symbol)
{
$this->symbol = $symbol;
return $this;
}
public function getCode()

View File

@@ -64,7 +64,7 @@ final class TheliaEvents
/**
* sent on customer account update
*/
const CUSTOMER_UPDATEACCOUNT = "action.modifyCustomer";
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
/**
* Sent before the logout of the administrator.
@@ -88,12 +88,21 @@ final class TheliaEvents
/**
* Sent once the customer change form has been successfully validated, and before customer update in the database.
*/
const BEFORE_CHANGECUSTOMER = "action.before_changecustomer";
const BEFORE_CHANGECUSTOMER = "action.before_updateCustomer";
/**
* Sent just after a successful update of a customer in the database.
*/
const AFTER_CHANGECUSTOMER = "action.after_changecustomer";
const AFTER_CHANGECUSTOMER = "action.after_updateCustomer";
/**
* sent for address creation
*/
const ADDRESS_CREATE = "action.createAddress";
/**
* sent for address creation
*/
const ADDRESS_UPDATE = "action.updateAddress";
/**
* Sent once the category creation form has been successfully validated, and before category insertion in the database.
@@ -104,7 +113,7 @@ final class TheliaEvents
* Create, change or delete a category
*/
const CATEGORY_CREATE = "action.createCategory";
const CATEGORY_MODIFY = "action.modifyCategory";
const CATEGORY_UPDATE = "action.updateCategory";
const CATEGORY_DELETE = "action.deleteCategory";
/**
@@ -134,12 +143,12 @@ final class TheliaEvents
/**
* Sent just before a successful change of a category in the database.
*/
const BEFORE_CHANGECATEGORY = "action.before_changecategory";
const BEFORE_UPDATECATEGORY = "action.before_updateCategory";
/**
* Sent just after a successful change of a category in the database.
*/
const AFTER_CHANGECATEGORY = "action.after_changecategory";
const AFTER_UPDATECATEGORY = "action.after_updateCategory";
/**
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
@@ -154,7 +163,7 @@ final class TheliaEvents
/**
* sent when a cart item is modify
*/
const AFTER_CARTCHANGEITEM = "cart.modifyItem";
const AFTER_CARTUPDATEITEM = "cart.updateItem";
/**
* sent for addArticle action
@@ -164,7 +173,7 @@ final class TheliaEvents
/**
* sent on modify article action
*/
const CART_CHANGEITEM = "action.changeArticle";
const CART_UPDATEITEM = "action.updateArticle";
const CART_DELETEITEM = "action.deleteArticle";
@@ -254,14 +263,14 @@ final class TheliaEvents
const CONFIG_CREATE = "action.createConfig";
const CONFIG_SETVALUE = "action.setConfigValue";
const CONFIG_MODIFY = "action.changeConfig";
const CONFIG_UPDATE = "action.updateConfig";
const CONFIG_DELETE = "action.deleteConfig";
const BEFORE_CREATECONFIG = "action.before_createConfig";
const AFTER_CREATECONFIG = "action.after_createConfig";
const BEFORE_CHANGECONFIG = "action.before_changeConfig";
const AFTER_CHANGECONFIG = "action.after_changeConfig";
const BEFORE_UPDATECONFIG = "action.before_updateConfig";
const AFTER_UPDATECONFIG = "action.after_updateConfig";
const BEFORE_DELETECONFIG = "action.before_deleteConfig";
const AFTER_DELETECONFIG = "action.after_deleteConfig";
@@ -269,30 +278,35 @@ final class TheliaEvents
// -- Messages management ---------------------------------------------
const MESSAGE_CREATE = "action.createMessage";
const MESSAGE_MODIFY = "action.changeMessage";
const MESSAGE_UPDATE = "action.updateMessage";
const MESSAGE_DELETE = "action.deleteMessage";
const BEFORE_CREATEMESSAGE = "action.before_createMessage";
const AFTER_CREATEMESSAGE = "action.after_createMessage";
const BEFORE_CHANGEMESSAGE = "action.before_changeMessage";
const AFTER_CHANGEMESSAGE = "action.after_changeMessage";
const BEFORE_UPDATEMESSAGE = "action.before_updateMessage";
const AFTER_UPDATEMESSAGE = "action.after_updateMessage";
const BEFORE_DELETEMESSAGE = "action.before_deleteMessage";
const AFTER_DELETEMESSAGE = "action.after_deleteMessage";
// -- Currencies management ---------------------------------------------
const CURRENCY_CREATE = "action.createCurrency";
const CURRENCY_MODIFY = "action.changeCurrency";
const CURRENCY_DELETE = "action.deleteCurrency";
const CURRENCY_CREATE = "action.createCurrency";
const CURRENCY_UPDATE = "action.updateCurrency";
const CURRENCY_DELETE = "action.deleteCurrency";
const CURRENCY_SET_DEFAULT = "action.setDefaultCurrency";
const CURRENCY_UPDATE_RATES = "action.updateCurrencyRates";
const BEFORE_CREATECURRENCY = "action.before_createCurrency";
const AFTER_CREATECURRENCY = "action.after_createCurrency";
const BEFORE_CHANGECURRENCY = "action.before_changeCurrency";
const AFTER_CHANGECURRENCY = "action.after_changeCurrency";
const BEFORE_UPDATECURRENCY = "action.before_updateCurrency";
const AFTER_UPDATECURRENCY = "action.after_updateCurrency";
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
}

View File

@@ -86,7 +86,7 @@ class ViewListener implements EventSubscriberInterface
} catch (AuthenticationException $ex) {
// Redirect to the login template
$event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate())));
Redirect::exec(URL::viewUrl($ex->getLoginTemplate()));
}
}

View File

@@ -67,7 +67,7 @@ class SecurityContext
*/
public function hasAdminUser()
{
return $this->getSession()->getAdminUser() != null;
return $this->getSession()->getAdminUser() !== null;
}
/**
@@ -87,7 +87,7 @@ class SecurityContext
*/
public function hasCustomerUser()
{
return $this->getSession()->getCustomerUser() != null;
return $this->getSession()->getCustomerUser() !== null;
}
/**

View File

@@ -114,22 +114,24 @@ class Address extends BaseLoop
foreach ($addresses as $address) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("ID", $address->getId());
$loopResultRow->set("NAME", $address->getName());
$loopResultRow->set("CUSTOMER", $address->getCustomerId());
$loopResultRow->set("TITLE", $address->getTitleId());
$loopResultRow->set("COMPANY", $address->getCompany());
$loopResultRow->set("FIRSTNAME", $address->getFirstname());
$loopResultRow->set("LASTNAME", $address->getLastname());
$loopResultRow->set("ADDRESS1", $address->getAddress1());
$loopResultRow->set("ADDRESS2", $address->getAddress2());
$loopResultRow->set("ADDRESS3", $address->getAddress3());
$loopResultRow->set("ZIPCODE", $address->getZipcode());
$loopResultRow->set("CITY", $address->getCity());
$loopResultRow->set("COUNTRY", $address->getCountryId());
$loopResultRow->set("PHONE", $address->getPhone());
$loopResultRow->set("CELLPHONE", $address->getCellphone());
$loopResultRow->set("DEFAULT", $address->getIsDefault());
$loopResultRow
->set("ID", $address->getId())
->set("NAME", $address->getName())
->set("CUSTOMER", $address->getCustomerId())
->set("TITLE", $address->getTitleId())
->set("COMPANY", $address->getCompany())
->set("FIRSTNAME", $address->getFirstname())
->set("LASTNAME", $address->getLastname())
->set("ADDRESS1", $address->getAddress1())
->set("ADDRESS2", $address->getAddress2())
->set("ADDRESS3", $address->getAddress3())
->set("ZIPCODE", $address->getZipcode())
->set("CITY", $address->getCity())
->set("COUNTRY", $address->getCountryId())
->set("PHONE", $address->getPhone())
->set("CELLPHONE", $address->getCellphone())
->set("DEFAULT", $address->getIsDefault())
;
$loopResult->addRow($loopResultRow);
}

View File

@@ -107,8 +107,6 @@ class CategoryTree extends BaseI18nLoop
$visible = $this->getVisible();
$exclude = $this->getExclude();
//echo "exclude=".print_r($exclude);
$loopResult = new LoopResult();
$this->buildCategoryTree($id, $visible, 0, $depth, $exclude, $loopResult);

View File

@@ -34,6 +34,8 @@ use Thelia\Model\LangQuery;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ConfigQuery;
use Thelia\Type\BooleanOrBothType;
use Thelia\Type\TypeCollection;
use Thelia\Type\EnumListType;
/**
* Config loop, to access configuration variables
@@ -59,7 +61,21 @@ class Config extends BaseI18nLoop
Argument::createIntListTypeArgument('exclude'),
Argument::createAnyTypeArgument('variable'),
Argument::createBooleanOrBothTypeArgument('hidden'),
Argument::createBooleanOrBothTypeArgument('secured')
Argument::createBooleanOrBothTypeArgument('secured'),
new Argument(
'order',
new TypeCollection(
new EnumListType(
array(
'id', 'id_reverse',
'name', 'name_reverse',
'title', 'title_reverse',
'value', 'value_reverse',
)
)
),
'name'
)
);
}
@@ -94,7 +110,39 @@ class Config extends BaseI18nLoop
if (! is_null($secured) && $secured != BooleanOrBothType::ANY)
$search->filterBySecured($secured ? 1 : 0);
$search->orderByName(Criteria::ASC);
$orders = $this->getOrder();
foreach($orders as $order) {
switch ($order) {
case 'id':
$search->orderById(Criteria::ASC);
break;
case 'id_reverse':
$search->orderById(Criteria::DESC);
break;
case 'name':
$search->orderByName(Criteria::ASC);
break;
case 'name_reverse':
$search->orderByName(Criteria::DESC);
break;
case 'title':
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case 'title_reverse':
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case 'value':
$search->orderByValue(Criteria::ASC);
break;
case 'value_reverse':
$search->orderByValue(Criteria::DESC);
break;
}
}
$results = $this->search($search, $pagination);
@@ -116,9 +164,13 @@ class Config extends BaseI18nLoop
->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("HIDDEN" , $result->getHidden())
->set("SECURED" , $result->getSecured())
->set("CREATE_DATE" , $result->getCreatedAt())
->set("UPDATE_DATE" , $result->getUpdatedAt())
;
->set("CREATE_DATE" , $result->getCreatedAt())
->set("UPDATE_DATE" , $result->getUpdatedAt())
->set("VERSION" , $result->getVersion())
->set("VERSION_DATE" , $result->getVersionCreatedAt())
->set("VERSION_AUTHOR" , $result->getVersionCreatedBy())
;
$loopResult->addRow($loopResultRow);
}

View File

@@ -66,8 +66,9 @@ class Currency extends BaseI18nLoop
'code', 'code_reverse',
'symbol', 'symbol_reverse',
'rate', 'rate_reverse',
'is_default', 'is_default_reverse',
'manual', 'manual_reverse')
)
)
),
'manual'
)
@@ -143,6 +144,13 @@ class Currency extends BaseI18nLoop
$search->orderByRate(Criteria::DESC);
break;
case 'is_default':
$search->orderByByDefault(Criteria::ASC);
break;
case 'is_default_reverse':
$search->orderByByDefault(Criteria::DESC);
break;
case 'manual':
$search->orderByPosition(Criteria::ASC);
break;
@@ -169,7 +177,11 @@ class Currency extends BaseI18nLoop
->set("SYMBOL" , $currency->getSymbol())
->set("RATE" , $currency->getRate())
->set("POSITION" , $currency->getPosition())
->set("IS_DEFAULT" , $currency->getByDefault());
->set("IS_DEFAULT" , $currency->getByDefault())
->set("CREATE_DATE" , $currency->getCreatedAt())
->set("UPDATE_DATE" , $currency->getUpdatedAt())
;
$loopResult->addRow($loopResultRow);
}

View File

@@ -519,6 +519,12 @@ class Product extends BaseI18nLoop
->set("IS_PROMO", $product->getVirtualColumn('main_product_is_promo'))
->set("IS_NEW", $product->getVirtualColumn('main_product_is_new'))
->set("POSITION", $product->getPosition())
->set("CREATE_DATE", $category->getCreatedAt())
->set("UPDATE_DATE", $category->getUpdatedAt())
->set("VERSION", $category->getVersion())
->set("VERSION_DATE", $category->getVersionCreatedAt())
->set("VERSION_AUTHOR", $category->getVersionCreatedBy())
;
$loopResult->addRow($loopResultRow);

View File

@@ -0,0 +1,144 @@
<?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\Smarty\Plugins;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\SecurityContext;
/**
* This class implements variour admin template utilities
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
class AdminUtilities extends AbstractSmartyPlugin
{
private $securityContext;
public function __construct(SecurityContext $securityContext)
{
$this->securityContext = $securityContext;
}
public function generatePositionChangeBlock($params, &$smarty) {
// The required permissions
$permission = $this->getParam($params, 'permission');
// The base position change path
$path = $this->getParam($params, 'path');
// The URL parameter the object ID is assigned
$url_parameter = $this->getParam($params, 'url_parameter');
// The current object position
$position = $this->getParam($params, 'position');
// The object ID
$id = $this->getParam($params, 'id');
// The in place dition class
$in_place_edit_class = $this->getParam($params, 'in_place_edit_class');
/*
<a href="{url path='/admin/configuration/currencies/positionUp' currency_id=$ID}"><i class="icon-arrow-up"></i></a>
<span class="currencyPositionChange" data-id="{$ID}">{$POSITION}</span>
<a href="{url path='/admin/configuration/currencies/positionDown' currency_id=$ID}"><i class="icon-arrow-down"></i></a>
*/
if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($permission))) {
return sprintf(
'<a href="%s"><i class="icon-arrow-up"></i></a><span class="%s" data-id="%s">%s</span><a href="%s"><i class="icon-arrow-down"></i></a>',
URL::absoluteUrl("$path/positionUp", array($url_parameter => $id)),
$in_place_edit_class,
$id,
$position,
URL::absoluteUrl("$path/positionDown", array($url_parameter => $id))
);
}
else {
return $position;
}
}
/**
* Generates the link of a sortable column header
*
* @param array $params
* @param unknown $smarty
* @return string no text is returned.
*/
public function generateSortableColumnHeader($params, &$smarty)
{
// The current order of the table
$current_order = $this->getParam($params, 'current_order');
// The column ascending order
$order = $this->getParam($params, 'order');
// The column descending order label
$reverse_order = $this->getParam($params, 'reverse_order');
// The order change path
$path = $this->getParam($params, 'path');
// The column label
$label = $this->getParam($params, 'label');
if ($current_order == $order) {
$icon = 'up';
$order_change = $reverse_order;
}
else if ($current_order == $reverse_order) {
$icon = 'down';
$order_change = $order;
}
else {
$order_change = $order;
}
if (! empty($icon))
$output = sprintf('<i class="icon icon-chevron-%s"></i> ', $icon);
else
$output = '';
return sprintf('%s<a href="%s">%s</a>', $output, URL::absoluteUrl($path, array('order' => $order_change)), $label);
}
/**
* Define the various smarty plugins handled by this class
*
* @return an array of smarty plugin descriptors
*/
public function getPluginDescriptors()
{
return array(
new SmartyPluginDescriptor('function', 'admin_sortable_header', $this, 'generateSortableColumnHeader'),
new SmartyPluginDescriptor('function', 'admin_position_block' , $this, 'generatePositionChangeBlock'),
);
}
}

View File

@@ -147,7 +147,7 @@ class UrlGenerator extends AbstractSmartyPlugin
{
return array(
"current" => "getCurrentUrl",
"return_to" => "getReturnToUrl",
"return_to" => "getReturnToUrl",
"index" => "getIndexUrl",
);
}
@@ -169,7 +169,9 @@ class UrlGenerator extends AbstractSmartyPlugin
protected function getCurrentUrl()
{
return URL::retrieveCurrent($this->request);
$retriever = URL::init()->retrieveCurrent($this->request);
return $retriever->rewrittenUrl === null ? $retriever->url : $retriever->rewrittenUrl ;
}
protected function getReturnToUrl()

View File

@@ -36,6 +36,7 @@ class SmartyParser extends Smarty implements ParserInterface
/**
* @param Request $request
* @param EventDispatcherInterface $dispatcher
* @param ParserContext $parserContext
* @param bool $template
* @param string $env
* @param bool $debug