mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Fix CS
This commit is contained in:
@@ -19,369 +19,353 @@ namespace Entities;
|
||||
*/
|
||||
class ValidationSession
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* @var string $name
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var string $name
|
||||
*/
|
||||
protected $name;
|
||||
/**
|
||||
* @var text $description
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var text $description
|
||||
*/
|
||||
protected $description;
|
||||
/**
|
||||
* @var boolean $archived
|
||||
*/
|
||||
protected $archived;
|
||||
|
||||
/**
|
||||
* @var boolean $archived
|
||||
*/
|
||||
protected $archived;
|
||||
/**
|
||||
* @var datetime $created
|
||||
*/
|
||||
protected $created;
|
||||
|
||||
/**
|
||||
* @var datetime $created
|
||||
*/
|
||||
protected $created;
|
||||
/**
|
||||
* @var datetime $updated
|
||||
*/
|
||||
protected $updated;
|
||||
|
||||
/**
|
||||
* @var datetime $updated
|
||||
*/
|
||||
protected $updated;
|
||||
/**
|
||||
* @var datetime $expires
|
||||
*/
|
||||
protected $expires;
|
||||
|
||||
/**
|
||||
* @var datetime $expires
|
||||
*/
|
||||
protected $expires;
|
||||
/**
|
||||
* @var datetime $reminded
|
||||
*/
|
||||
protected $reminded;
|
||||
|
||||
/**
|
||||
* @var datetime $reminded
|
||||
*/
|
||||
protected $reminded;
|
||||
/**
|
||||
* @var Entities\Basket
|
||||
*/
|
||||
protected $basket;
|
||||
|
||||
/**
|
||||
* @var Entities\Basket
|
||||
*/
|
||||
protected $basket;
|
||||
/**
|
||||
* @var Entities\ValidationParticipant
|
||||
*/
|
||||
protected $participants;
|
||||
|
||||
/**
|
||||
* @var Entities\ValidationParticipant
|
||||
*/
|
||||
protected $participants;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->participants = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param text $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set archived
|
||||
*
|
||||
* @param boolean $archived
|
||||
*/
|
||||
public function setArchived($archived)
|
||||
{
|
||||
$this->archived = $archived;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get archived
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getArchived()
|
||||
{
|
||||
return $this->archived;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created
|
||||
*
|
||||
* @param datetime $created
|
||||
*/
|
||||
public function setCreated($created)
|
||||
{
|
||||
$this->created = $created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set updated
|
||||
*
|
||||
* @param datetime $updated
|
||||
*/
|
||||
public function setUpdated($updated)
|
||||
{
|
||||
$this->updated = $updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updated
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set expires
|
||||
*
|
||||
* @param datetime $expires
|
||||
*/
|
||||
public function setExpires($expires)
|
||||
{
|
||||
$this->expires = $expires;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get expires
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getExpires()
|
||||
{
|
||||
return $this->expires;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reminded
|
||||
*
|
||||
* @param datetime $reminded
|
||||
*/
|
||||
public function setReminded($reminded)
|
||||
{
|
||||
$this->reminded = $reminded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reminded
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getReminded()
|
||||
{
|
||||
return $this->reminded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set basket
|
||||
*
|
||||
* @param Entities\Basket $basket
|
||||
*/
|
||||
public function setBasket(\Entities\Basket $basket)
|
||||
{
|
||||
$this->basket = $basket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get basket
|
||||
*
|
||||
* @return Entities\Basket
|
||||
*/
|
||||
public function getBasket()
|
||||
{
|
||||
return $this->basket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add participants
|
||||
*
|
||||
* @param Entities\ValidationParticipant $participants
|
||||
*/
|
||||
public function addValidationParticipant(\Entities\ValidationParticipant $participants)
|
||||
{
|
||||
$this->participants[] = $participants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get participants
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getParticipants()
|
||||
{
|
||||
return $this->participants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a participant
|
||||
*
|
||||
* @return Entities\ValidationParticipant
|
||||
*/
|
||||
public function getParticipant(\User_Adapter $user)
|
||||
{
|
||||
foreach ($this->getParticipants() as $participant)
|
||||
public function __construct()
|
||||
{
|
||||
if ($participant->getUser()->get_id() == $user->get_id())
|
||||
{
|
||||
return $participant;
|
||||
}
|
||||
$this->participants = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
throw new \Exception_NotFound('Particpant not found' . $user->get_email());
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $initiator
|
||||
*/
|
||||
protected $initiator;
|
||||
|
||||
/**
|
||||
* @var integer $initiator_id
|
||||
*/
|
||||
protected $initiator_id;
|
||||
|
||||
/**
|
||||
* Set initiator_id
|
||||
*
|
||||
* @param integer $initiatorId
|
||||
*/
|
||||
public function setInitiatorId($initiatorId)
|
||||
{
|
||||
$this->initiator_id = $initiatorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get initiator_id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getInitiatorId()
|
||||
{
|
||||
return $this->initiator_id;
|
||||
}
|
||||
|
||||
public function isInitiator(\User_Adapter $user)
|
||||
{
|
||||
return $this->getInitiatorId() == $user->get_id();
|
||||
}
|
||||
|
||||
public function setInitiator(\User_Adapter $user)
|
||||
{
|
||||
$this->initiator_id = $user->get_id();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getInitiator()
|
||||
{
|
||||
if ($this->initiator_id)
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return \User_Adapter::getInstance($this->initiator_id, \appbox::get_instance(\bootstrap::getCore()));
|
||||
}
|
||||
}
|
||||
|
||||
public function isFinished()
|
||||
{
|
||||
if (is_null($this->getExpires()))
|
||||
{
|
||||
return null;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
$date_obj = new \DateTime();
|
||||
|
||||
return $date_obj > $this->getExpires();
|
||||
}
|
||||
|
||||
public function getValidationString(\User_Adapter $user)
|
||||
{
|
||||
|
||||
if ($this->isInitiator($user))
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if ($this->isFinished())
|
||||
{
|
||||
return sprintf(
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param text $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set archived
|
||||
*
|
||||
* @param boolean $archived
|
||||
*/
|
||||
public function setArchived($archived)
|
||||
{
|
||||
$this->archived = $archived;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get archived
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getArchived()
|
||||
{
|
||||
return $this->archived;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created
|
||||
*
|
||||
* @param datetime $created
|
||||
*/
|
||||
public function setCreated($created)
|
||||
{
|
||||
$this->created = $created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set updated
|
||||
*
|
||||
* @param datetime $updated
|
||||
*/
|
||||
public function setUpdated($updated)
|
||||
{
|
||||
$this->updated = $updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updated
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set expires
|
||||
*
|
||||
* @param datetime $expires
|
||||
*/
|
||||
public function setExpires($expires)
|
||||
{
|
||||
$this->expires = $expires;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get expires
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getExpires()
|
||||
{
|
||||
return $this->expires;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reminded
|
||||
*
|
||||
* @param datetime $reminded
|
||||
*/
|
||||
public function setReminded($reminded)
|
||||
{
|
||||
$this->reminded = $reminded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reminded
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getReminded()
|
||||
{
|
||||
return $this->reminded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set basket
|
||||
*
|
||||
* @param Entities\Basket $basket
|
||||
*/
|
||||
public function setBasket(\Entities\Basket $basket)
|
||||
{
|
||||
$this->basket = $basket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get basket
|
||||
*
|
||||
* @return Entities\Basket
|
||||
*/
|
||||
public function getBasket()
|
||||
{
|
||||
return $this->basket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add participants
|
||||
*
|
||||
* @param Entities\ValidationParticipant $participants
|
||||
*/
|
||||
public function addValidationParticipant(\Entities\ValidationParticipant $participants)
|
||||
{
|
||||
$this->participants[] = $participants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get participants
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getParticipants()
|
||||
{
|
||||
return $this->participants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a participant
|
||||
*
|
||||
* @return Entities\ValidationParticipant
|
||||
*/
|
||||
public function getParticipant(\User_Adapter $user)
|
||||
{
|
||||
foreach ($this->getParticipants() as $participant) {
|
||||
if ($participant->getUser()->get_id() == $user->get_id()) {
|
||||
return $participant;
|
||||
}
|
||||
}
|
||||
|
||||
throw new \Exception_NotFound('Particpant not found' . $user->get_email());
|
||||
}
|
||||
/**
|
||||
* @var integer $initiator
|
||||
*/
|
||||
protected $initiator;
|
||||
|
||||
/**
|
||||
* @var integer $initiator_id
|
||||
*/
|
||||
protected $initiator_id;
|
||||
|
||||
/**
|
||||
* Set initiator_id
|
||||
*
|
||||
* @param integer $initiatorId
|
||||
*/
|
||||
public function setInitiatorId($initiatorId)
|
||||
{
|
||||
$this->initiator_id = $initiatorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get initiator_id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getInitiatorId()
|
||||
{
|
||||
return $this->initiator_id;
|
||||
}
|
||||
|
||||
public function isInitiator(\User_Adapter $user)
|
||||
{
|
||||
return $this->getInitiatorId() == $user->get_id();
|
||||
}
|
||||
|
||||
public function setInitiator(\User_Adapter $user)
|
||||
{
|
||||
$this->initiator_id = $user->get_id();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getInitiator()
|
||||
{
|
||||
if ($this->initiator_id) {
|
||||
return \User_Adapter::getInstance($this->initiator_id, \appbox::get_instance(\bootstrap::getCore()));
|
||||
}
|
||||
}
|
||||
|
||||
public function isFinished()
|
||||
{
|
||||
if (is_null($this->getExpires())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$date_obj = new \DateTime();
|
||||
|
||||
return $date_obj > $this->getExpires();
|
||||
}
|
||||
|
||||
public function getValidationString(\User_Adapter $user)
|
||||
{
|
||||
|
||||
if ($this->isInitiator($user)) {
|
||||
if ($this->isFinished()) {
|
||||
return sprintf(
|
||||
_('Vous aviez envoye cette demande a %d utilisateurs')
|
||||
, (count($this->getParticipants()) - 1)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sprintf(
|
||||
);
|
||||
} else {
|
||||
return sprintf(
|
||||
_('Vous avez envoye cette demande a %d utilisateurs')
|
||||
, (count($this->getParticipants()) - 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->getParticipant($user)->getCanSeeOthers())
|
||||
{
|
||||
return sprintf(
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($this->getParticipant($user)->getCanSeeOthers()) {
|
||||
return sprintf(
|
||||
_('Processus de validation recu de %s et concernant %d utilisateurs')
|
||||
, $this->getInitiator()->get_display_name()
|
||||
, (count($this->getParticipants()) - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return sprintf(
|
||||
} else {
|
||||
return sprintf(
|
||||
_('Processus de validation recu de %s')
|
||||
, $this->getInitiator()->get_display_name()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user