Merge branch 'master' into tax

This commit is contained in:
Etienne Roudeix
2013-10-23 16:32:10 +02:00
25 changed files with 1469 additions and 128 deletions

View File

@@ -0,0 +1,141 @@
<?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\Lang;
/**
* Class LangCreateEvent
* @package Thelia\Core\Event\Lang
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LangCreateEvent extends LangEvent
{
protected $title;
protected $code;
protected $locale;
protected $date_format;
protected $time_format;
/**
* @param mixed $code
*
* @return $this
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
/**
* @return mixed
*/
public function getCode()
{
return $this->code;
}
/**
* @param mixed $date_format
*
* @return $this
*/
public function setDateFormat($date_format)
{
$this->date_format = $date_format;
return $this;
}
/**
* @return mixed
*/
public function getDateFormat()
{
return $this->date_format;
}
/**
* @param mixed $locale
*
* @return $this
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* @return mixed
*/
public function getLocale()
{
return $this->locale;
}
/**
* @param mixed $time_format
*
* @return $this
*/
public function setTimeFormat($time_format)
{
$this->time_format = $time_format;
return $this;
}
/**
* @return mixed
*/
public function getTimeFormat()
{
return $this->time_format;
}
/**
* @param mixed $title
*
* @return $this
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
}

View File

@@ -0,0 +1,64 @@
<?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\Lang;
use Thelia\Core\Event\ActionEvent;
/**
* Class LangDefaultBehaviorEvent
* @package Thelia\Core\Event\Lang
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LangDefaultBehaviorEvent extends ActionEvent
{
/**
* @var int default behavior status
*/
protected $defaultBehavior;
function __construct($defaultBehavior)
{
$this->defaultBehavior = $defaultBehavior;
}
/**
* @param int $defaultBehavior
*/
public function setDefaultBehavior($defaultBehavior)
{
$this->defaultBehavior = $defaultBehavior;
}
/**
* @return int
*/
public function getDefaultBehavior()
{
return $this->defaultBehavior;
}
}

View File

@@ -0,0 +1,67 @@
<?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\Lang;
/**
* Class LangDeleteEvent
* @package Thelia\Core\Event\Lang
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LangDeleteEvent extends LangEvent
{
/**
* @var int
*/
protected $lang_id;
/**
* @param int $lang_id
*/
function __construct($lang_id)
{
$this->lang_id = $lang_id;
}
/**
* @param int $lang_id
*
* @return $this
*/
public function setLangId($lang_id)
{
$this->lang_id = $lang_id;
return $this;
}
/**
* @return int
*/
public function getLangId()
{
return $this->lang_id;
}
}

View File

@@ -0,0 +1,76 @@
<?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\Lang;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Lang;
/**
* Class LangEvent
* @package Thelia\Core\Event\Lang
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LangEvent extends ActionEvent
{
/**
* @var \Thelia\Model\Lang
*/
protected $lang;
function __construct(Lang $lang = null)
{
$this->lang = $lang;
}
/**
* @param \Thelia\Model\Lang $lang
*/
public function setLang(Lang $lang)
{
$this->lang = $lang;
}
/**
* @return \Thelia\Model\Lang
*/
public function getLang()
{
return $this->lang;
}
/**
*
* check if lang object is present
*
* @return bool
*/
public function hasLang()
{
return null !== $this->lang;
}
}

View File

@@ -0,0 +1,69 @@
<?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\Lang;
/**
* Class LangToggleDefaultEvent
* @package Thelia\Core\Event\Lang
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LangToggleDefaultEvent extends LangEvent
{
/**
* @var int
*/
protected $lang_id;
/**
* @param int $lang_id
*/
function __construct($lang_id)
{
$this->lang_id = $lang_id;
}
/**
* @param int $lang_id
*
* @return $this
*/
public function setLangId($lang_id)
{
$this->lang_id = $lang_id;
return $this;
}
/**
* @return int
*/
public function getLangId()
{
return $this->lang_id;
}
}

View File

@@ -0,0 +1,69 @@
<?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\Lang;
/**
* Class LangUpdateEvent
* @package Thelia\Core\Event\Lang
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LangUpdateEvent extends LangCreateEvent
{
/**
* @var int lang id
*/
protected $id;
/**
* @param int $id
*/
function __construct($id)
{
$this->id = $id;
}
/**
* @param int $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
}

View File

@@ -694,4 +694,23 @@ final class TheliaEvents
* sent for subscribing to the newsletter
*/
const NEWSLETTER_SUBSCRIBE = 'thelia.newsletter.subscribe';
/************ LANG MANAGEMENT ****************************/
const LANG_UPDATE = 'action.lang.update';
const LANG_CREATE = 'action.lang.create';
const LANG_DELETE = 'action.lang.delete';
const LANG_DEFAULTBEHAVIOR = 'action.lang.defaultBehavior';
const LANG_TOGGLEDEFAULT = 'action.lang.toggleDefault';
const BEFORE_UPDATELANG = 'action.lang.beforeUpdate';
const AFTER_UPDATELANG = 'action.lang.afterUpdate';
const BEFORE_CREATELANG = 'action.lang.beforeCreate';
const AFTER_CREATELANG = 'action.lang.afterCreate';
const BEFORE_DELETELANG = 'action.lang.beforeDelete';
const AFTER_DELETELANG = 'action.lang.afterDelete';
}

View File

@@ -99,7 +99,8 @@ class Lang extends BaseLoop
->set("LOCALE", $result->getLocale())
->set("URL", $result->getUrl())
->set("IS_DEFAULT", $result->getByDefault())
->set("URL", $result->getUrl())
->set("DATE_FORMAT", $result->getDateFormat())
->set("TIME_FORMAT", $result->getTimeFormat())
->set("POSITION", $result->getPosition())
;