RequestHandlers

This commit is contained in:
Nicolas Le Goff
2011-12-15 19:50:57 +01:00
parent 1f93a6e17f
commit 05f42b05e3
3 changed files with 118 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\RequestHandler;
use Alchemy\Phrasea\Kernel;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Basket extends RequestHandlerAbstract
{
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\RequestHandler;
use Alchemy\Phrasea\Kernel;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
abstract class RequestHandlerAbstract
{
private $kernel;
public function __construct(Kernel $kernel)
{
$this->kernel = $kernel;
return $this;
}
public function getKernel()
{
return $this->kernel;
}
}

View File

@@ -0,0 +1,53 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\RequestHandler;
use Alchemy\Phrasea\Kernel;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class WorkZone extends RequestHandlerAbstract
{
const BASKETS = 'baskets';
const STORIES = 'stories';
const VALIDATIONS = 'validations';
public function getContent()
{
$em = $this->kernel->getEntityManager();
$current_user = $this->kernel->getAuthenticatedUser();
/* @var $repo_baskets \Repositories\BasketRepository */
$repo_baskets = $em->getRepository('Entities\Baskets');
/* @var $repo_stories \Repositories\StoryWorkzoneRepository */
$repo_stories = $em->getRepository('Entities\StoryWorkZone');
$ret = new \Doctrine\Common\Collections\ArrayCollection();
$baskets = $repo_baskets->findActiveByUser($current_user);
$validations = $repo_baskets->findActiveValidationByUser($current_user);
$ret->set(self::BASKETS, $baskets);
$ret->set(self::VALIDATIONS, $validations);
$ret->set(self::STORIES, $repo_stories->findByUser($current_user));
return $ret;
}
}