From a2d292f6a398597f14ce2c2783782ee43a9cd22a Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 22 Oct 2013 19:17:27 +0200 Subject: [PATCH] create lang object events --- .../Thelia/Config/Resources/routing/admin.xml | 5 + .../Controller/Admin/LangController.php | 15 ++ .../Core/Event/Lang/LangCreateEvent.php | 141 ++++++++++++++++++ core/lib/Thelia/Core/Event/Lang/LangEvent.php | 76 ++++++++++ .../Core/Event/Lang/LangUpdateEvent.php | 35 +++++ 5 files changed, 272 insertions(+) create mode 100644 core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php create mode 100644 core/lib/Thelia/Core/Event/Lang/LangEvent.php create mode 100644 core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index bea1428ed..aec9e1588 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -931,6 +931,11 @@ \d+ + + Thelia\Controller\Admin\LangController::processUpdateAction + \d+ + + diff --git a/core/lib/Thelia/Controller/Admin/LangController.php b/core/lib/Thelia/Controller/Admin/LangController.php index aec455b4a..dd6deeff9 100644 --- a/core/lib/Thelia/Controller/Admin/LangController.php +++ b/core/lib/Thelia/Controller/Admin/LangController.php @@ -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) { + + } + } } \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php b/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php new file mode 100644 index 000000000..43279b093 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php @@ -0,0 +1,141 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Lang; + + +/** + * Class LangCreateEvent + * @package Thelia\Core\Event\Lang + * @author Manuel Raynaud + */ +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; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Lang/LangEvent.php b/core/lib/Thelia/Core/Event/Lang/LangEvent.php new file mode 100644 index 000000000..f66b6428a --- /dev/null +++ b/core/lib/Thelia/Core/Event/Lang/LangEvent.php @@ -0,0 +1,76 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Lang; +use Thelia\Core\Event\ActionEvent; +use Thelia\Model\Lang; + + +/** + * Class LangEvent + * @package Thelia\Core\Event\Lang + * @author Manuel Raynaud + */ +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; + } + + + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php b/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php new file mode 100644 index 000000000..a520dd4c5 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php @@ -0,0 +1,35 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Lang; + + +/** + * Class LangUpdateEvent + * @package Thelia\Core\Event\Lang + * @author Manuel Raynaud + */ +class LangUpdateEvent extends LangCreateEvent +{ + +} \ No newline at end of file