create folder events
This commit is contained in:
@@ -204,6 +204,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\FolderController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.categories.save" path="/admin/folders/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the Coupon controller (process Coupon browsing) -->
|
||||
|
||||
<route id="admin.coupon.list" path="/admin/coupon/">
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\FolderUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\FolderModificationForm;
|
||||
use Thelia\Model\FolderQuery;
|
||||
@@ -67,7 +68,7 @@ class FolderController extends AbstractCrudController
|
||||
*/
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
// TODO: Implement getUpdateForm() method.
|
||||
return new FolderModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +112,20 @@ class FolderController extends AbstractCrudController
|
||||
*/
|
||||
protected function getUpdateEvent($formData)
|
||||
{
|
||||
// TODO: Implement getUpdateEvent() method.
|
||||
$updateEvent = new FolderUpdateEvent($formData['id']);
|
||||
|
||||
$updateEvent
|
||||
->setLocale($formData['locale'])
|
||||
->setTitle($formData['title'])
|
||||
->setChapo($formData['chapo'])
|
||||
->setDescription($formData['description'])
|
||||
->setPostscriptum($formData['postscriptum'])
|
||||
->setVisible($formData['visible'])
|
||||
->setUrl($formData['url'])
|
||||
->setParent($formData['parent'])
|
||||
;
|
||||
|
||||
return $updateEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
120
core/lib/Thelia/Core/Event/FolderCreateEvent.php
Normal file
120
core/lib/Thelia/Core/Event/FolderCreateEvent.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?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;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderCreateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderCreateEvent extends FolderEvent {
|
||||
protected $title;
|
||||
protected $parent;
|
||||
protected $locale;
|
||||
protected $visible;
|
||||
|
||||
/**
|
||||
* @param mixed $locale
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $parent
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $title
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $visible
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
{
|
||||
$this->visible = $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVisible()
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
68
core/lib/Thelia/Core/Event/FolderEvent.php
Normal file
68
core/lib/Thelia/Core/Event/FolderEvent.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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 Thelia\Model\Folder;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderEvent extends ActionEvent {
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Folder
|
||||
*/
|
||||
protected $folder;
|
||||
|
||||
function __construct(Folder $folder = null)
|
||||
{
|
||||
$this->folder = $folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Folder $folder
|
||||
*/
|
||||
public function setFolder(Folder $folder)
|
||||
{
|
||||
$this->folder = $folder;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Folder
|
||||
*/
|
||||
public function getFolder()
|
||||
{
|
||||
return $this->folder;
|
||||
}
|
||||
|
||||
public function hasFolder()
|
||||
{
|
||||
return null !== $this->folder;
|
||||
}
|
||||
|
||||
}
|
||||
136
core/lib/Thelia/Core/Event/FolderUpdateEvent.php
Normal file
136
core/lib/Thelia/Core/Event/FolderUpdateEvent.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?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;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderUpdateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderUpdateEvent extends FolderCreateEvent {
|
||||
protected $folder_id;
|
||||
|
||||
protected $chapo;
|
||||
protected $description;
|
||||
protected $postscriptum;
|
||||
|
||||
protected $url;
|
||||
|
||||
function __construct($folder_id)
|
||||
{
|
||||
$this->folder_id = $folder_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $chapo
|
||||
*/
|
||||
public function setChapo($chapo)
|
||||
{
|
||||
$this->chapo = $chapo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChapo()
|
||||
{
|
||||
return $this->chapo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $folder_id
|
||||
*/
|
||||
public function setFolderId($folder_id)
|
||||
{
|
||||
$this->folder_id = $folder_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFolderId()
|
||||
{
|
||||
return $this->folder_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $postscriptum
|
||||
*/
|
||||
public function setPostscriptum($postscriptum)
|
||||
{
|
||||
$this->postscriptum = $postscriptum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPostscriptum()
|
||||
{
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $url
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user