deblan.tv/vendor/trinity/src/Trinity/Bundle/DashBoardBundle/Zone/Zone.php
2015-03-02 21:57:49 +01:00

113 lines
1.9 KiB
PHP

<?php
namespace Trinity\Bundle\DashBoardBundle\Zone;
use Trinity\Bundle\DashBoardBundle\Item\Item;
use Trinity\Bundle\SecurityBundle\AccessControl\AccessControlInterface;
class Zone
{
protected $id = null;
protected $name = null;
protected $template = null;
protected $user = null;
protected $items = array();
public function __construct($id, $name, $template = 'TrinityDashBoardBundle:Default:defaultZone.html.twig')
{
$this->id = $id;
$this->name = $name;
$this->template = $template;
}
public function setUser($user)
{
$this->user = $user;
return $this;
}
public function getUser()
{
return $this->user;
}
public function setName($name)
{
$this->name = $name;
return $this;
}
public function getName()
{
return $this->name;
}
public function setTemplate($template)
{
$this->template = $template;
return $this;
}
public function getTemplate()
{
return $this->template;
}
public function setItems($items)
{
$this->items = $items;
return $this;
}
public function getItems()
{
return $this->items;
}
public function addItem(Item $item)
{
$this->items[] = $item;
return $this;
}
public function hasItem()
{
return !empty($this->items);
}
public function hasItems()
{
return $this->hasItem();
}
public function addItemIfGranted(Item $item, AccessControlInterface $accessControlInterface)
{
if ($accessControlInterface->isGranted()) {
$this->items[] = $item;
}
return $this;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getId()
{
return $this->id;
}
}