create lang object events
This commit is contained in:
@@ -931,6 +931,11 @@
|
||||
<requirement key="lang_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.languages.update" path="/admin/configuration/languages/save/{lang_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\LangController::processUpdateAction</default>
|
||||
<requirement key="lang_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
|
||||
@@ -67,4 +67,19 @@ class LangController extends BaseAdminController
|
||||
'lang_id' => $lang_id
|
||||
));
|
||||
}
|
||||
|
||||
public function processUpdateAction($lang_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
$langForm = new LangUpdateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($langForm);
|
||||
} catch(\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
141
core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php
Normal file
141
core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
76
core/lib/Thelia/Core/Event/Lang/LangEvent.php
Normal file
76
core/lib/Thelia/Core/Event/Lang/LangEvent.php
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
35
core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php
Normal file
35
core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user