2014-07-20 12:26:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Event;
|
|
|
|
|
|
|
|
use Core\Listener;
|
|
|
|
use Model\Project;
|
|
|
|
|
|
|
|
/**
|
2014-10-22 19:59:09 +02:00
|
|
|
* Project modification date listener
|
2014-07-20 12:26:15 +02:00
|
|
|
*
|
2014-10-22 19:59:09 +02:00
|
|
|
* Update the last modified field for a project
|
|
|
|
*
|
|
|
|
* @package event
|
2014-07-20 12:26:15 +02:00
|
|
|
* @author Frederic Guillot
|
|
|
|
*/
|
2014-10-22 19:59:09 +02:00
|
|
|
class ProjectModificationDate implements Listener
|
2014-07-20 12:26:15 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Project model
|
|
|
|
*
|
|
|
|
* @accesss private
|
|
|
|
* @var \Model\Project
|
|
|
|
*/
|
|
|
|
private $project;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @param \Model\Project $project Project model instance
|
|
|
|
*/
|
|
|
|
public function __construct(Project $project)
|
|
|
|
{
|
|
|
|
$this->project = $project;
|
|
|
|
}
|
|
|
|
|
2014-10-22 19:59:09 +02:00
|
|
|
/**
|
|
|
|
* Return class information
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return get_called_class();
|
|
|
|
}
|
|
|
|
|
2014-07-20 12:26:15 +02:00
|
|
|
/**
|
|
|
|
* Execute the action
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @param array $data Event data dictionary
|
|
|
|
* @return bool True if the action was executed or false when not executed
|
|
|
|
*/
|
|
|
|
public function execute(array $data)
|
|
|
|
{
|
|
|
|
if (isset($data['project_id'])) {
|
2014-10-22 19:59:09 +02:00
|
|
|
return $this->project->updateModificationDate($data['project_id']);
|
2014-07-20 12:26:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|