fix folder name

This commit is contained in:
2021-03-18 13:37:13 +01:00
parent a2f6773f5a
commit eaa0ad925f
1578 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,295 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
/**
* Class Event
*
* @package Chill\EventBundle\Entity
* @ORM\Entity(repositoryClass="Chill\EventBundle\Repository\EventRepository")
* @ORM\Table(name="chill_event_event")
* @ORM\HasLifecycleCallbacks()
*/
class Event implements HasCenterInterface, HasScopeInterface
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @ORM\Column(type="string", length=150)
*/
private $name;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
*/
private $date;
/**
*
* @var Center
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
*/
private $center;
/**
*
* @var EventType
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
*/
private $type;
/**
*
* @var Scope
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private $circle;
/**
* @var Participation
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Participation",
* mappedBy="event")
*/
private $participations;
/**
*
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private $moderator;
/**
* Event constructor.
*/
public function __construct()
{
$this->participations = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set label
*
* @param string $label
* @return Event
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
/**
* Get label
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set date
*
* @param \DateTime $date
* @return Event
*/
public function setDate(\DateTime $date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* @param Center $center
* @return $this
*/
public function setCenter(Center $center)
{
$this->center = $center;
return $this;
}
/**
* @return EventType
*/
public function getType()
{
return $this->type;
}
/**
* @param EventType $type
* @return $this
*/
public function setType(EventType $type)
{
$this->type = $type;
return $this;
}
/**
* @return Center
*/
public function getCenter()
{
return $this->center;
}
/**
* @return Scope
*/
public function getCircle()
{
return $this->circle;
}
/**
* @param Scope $circle
* @return $this
*/
public function setCircle(\Chill\MainBundle\Entity\Scope $circle)
{
$this->circle = $circle;
return $this;
}
/**
* @deprecated
* @return Scope
*/
public function getScope()
{
return $this->getCircle();
}
/**
* Add participation
*
* @param Participation $participation
* @return Event
*/
public function addParticipation(Participation $participation)
{
$this->participations[] = $participation;
return $this;
}
/**
* Remove participation
*
* @param Participation $participation
*/
public function removeParticipation(Participation $participation)
{
$this->participations->removeElement($participation);
}
/**
* @return \ArrayIterator|\Traversable|Collection
*/
public function getParticipations()
{
return $this->getParticipationsOrdered();
}
/**
* Sort Collection of Participations
*
* @return \ArrayIterator|\Traversable
*/
public function getParticipationsOrdered() {
$iterator = $this->participations->getIterator();
$iterator->uasort(function($first, $second)
{
return strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName());
});
return $iterator;
}
/**
* @return int
*/
public function getModerator()
{
return $this->moderator;
}
/**
* @param int $moderator
* @return Event
*/
public function setModerator($moderator)
{
$this->moderator = $moderator;
return $this;
}
}

View File

@@ -0,0 +1,205 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Class EventType
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Table(name="chill_event_event_type")
* @ORM\HasLifecycleCallbacks()
*/
class EventType
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Role",
* mappedBy="type")
*/
private $roles;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Status",
* mappedBy="type")
*/
private $statuses;
/**
* Constructor
*/
public function __construct()
{
$this->roles = new ArrayCollection();
$this->statuses = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set label
*
* @param array $label
* @return EventType
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
/**
* Get label
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* Set active
*
* @param boolean $active
* @return EventType
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Add role
*
* @param Role $role
* @return EventType
*/
public function addRole(Role $role)
{
$this->roles[] = $role;
return $this;
}
/**
* Remove role
*
* @param Role $role
*/
public function removeRole(Role $role)
{
$this->roles->removeElement($role);
}
/**
* Get roles
*
* @return Collection
*/
public function getRoles()
{
return $this->roles;
}
/**
* Add status
*
* @param Status $status
* @return EventType
*/
public function addStatus(Status $status)
{
$this->statuses[] = $status;
return $this;
}
/**
* Remove status
*
* @param Status $status
*/
public function removeStatus(Status $status)
{
$this->statuses->removeElement($status);
}
/**
* Get statuses
*
* @return Collection
*/
public function getStatuses()
{
return $this->statuses;
}
}

View File

@@ -0,0 +1,346 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\HasCenterInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Class Participation
*
* @package Chill\EventBundle\Entity
* @ORM\Entity(
* repositoryClass="Chill\EventBundle\Repository\ParticipationRepository")
* @ORM\Table(name="chill_event_participation")
* @ORM\HasLifecycleCallbacks()
*/
class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAccess
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
*/
private $lastUpdate;
/**
* @var Event
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\Event",
* inversedBy="participations")
*/
private $event;
/**
* @var Person
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private $person;
/**
* @var Role
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Role")
*/
private $role;
/**
* @var Status
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status")
*/
private $status;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set lastUpdate
*
* @param \DateTime $lastUpdate
* @return Participation
*/
protected function update()
{
$this->lastUpdate = new \DateTime('now');
return $this;
}
/**
* Get lastUpdate
*
* @return \DateTime
*/
public function getLastUpdate()
{
return $this->lastUpdate;
}
/**
* Set event
*
* @param Event $event
* @return Participation
*/
public function setEvent(Event $event = null)
{
if ($this->event !== $event) {
$this->update();
}
$this->event = $event;
return $this;
}
/**
* Get event
*
* @return Event
*/
public function getEvent()
{
return $this->event;
}
/**
* Set person
*
* @param Person $person
* @return Participation
*/
public function setPerson(Person $person = null)
{
if ($person !== $this->person) {
$this->update();
}
$this->person = $person;
return $this;
}
/**
* Get person
*
* @return Person
*/
public function getPerson()
{
return $this->person;
}
/**
* Set role
*
* @param Role $role
* @return Participation
*/
public function setRole(Role $role = null)
{
if ($role !== $this->role) {
$this->update();
}
$this->role = $role;
return $this;
}
/**
* Get role
*
* @return Role
*/
public function getRole()
{
return $this->role;
}
/**
* Set status
*
* @param Status $status
* @return Participation
*/
public function setStatus(Status $status = null)
{
if ($this->status !== $status) {
$this->update();
}
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return Status
*/
public function getStatus()
{
return $this->status;
}
/**
* @return Center
*/
public function getCenter()
{
if ($this->getEvent() === NULL) {
throw new \RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCenter();
}
/**
* @return Scope
*/
public function getScope()
{
if ($this->getEvent() === NULL) {
throw new \RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCircle();
}
/**
* Check that :
*
* - the role can be associated with this event type
* - the status can be associated with this event type
*
* @param ExecutionContextInterface $context
*/
public function isConsistent(ExecutionContextInterface $context)
{
if ($this->getEvent() === NULL || $this->getRole() === NULL || $this->getStatus() === NULL) {
return;
}
if ($this->getRole()->getType()->getId() !==
$this->getEvent()->getType()->getId()) {
$context->buildViolation('The role is not allowed with this event type')
->atPath('role')
->addViolation();
}
if ($this->getStatus()->getType()->getId() !==
$this->getEvent()->getType()->getId()) {
$context->buildViolation('The status is not allowed with this event type')
->atPath('status')
->addViolation();
}
}
/**
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
{
return in_array($offset, array(
'person', 'role', 'status', 'event'
));
}
/**
* @param mixed $offset
* @return Event|Role|Status|Person|mixed
*/
public function offsetGet($offset)
{
switch ($offset) {
case 'person':
return $this->getPerson();
break;
case 'role':
return $this->getRole();
break;
case 'status':
return $this->getStatus();
break;
case 'event':
return $this->getEvent();
break;
}
}
/**
* @param mixed $offset
* @param mixed $value
* @return Participation|void
*/
public function offsetSet($offset, $value)
{
switch($offset) {
case 'person':
return $this->setPerson($value);
break;
case 'role':
return $this->setRole($value);
break;
case 'status':
return $this->setStatus($value);
break;
case 'event':
return $this->setEvent($value);
break;
}
}
/**
* @param mixed $offset
*/
public function offsetUnset($offset)
{
$this->offsetSet($offset, null);
}
}

View File

@@ -0,0 +1,145 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Role
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Table(name="chill_event_role")
* @ORM\HasLifecycleCallbacks()
*/
class Role
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var EventType
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\EventType",
* inversedBy="roles")
*/
private $type;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set label
*
* @param array $label
* @return Role
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
/**
* Get label
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* Set active
*
* @param boolean $active
* @return Role
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Set type
*
* @param EventType $type
* @return Role
*/
public function setType(EventType $type = null)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return EventType
*/
public function getType()
{
return $this->type;
}
}

View File

@@ -0,0 +1,146 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Status
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Table(name="chill_event_status")
* @ORM\HasLifecycleCallbacks()
*/
class Status
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var EventType
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\EventType",
* inversedBy="statuses")
*/
private $type;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set label
*
* @param array $name
* @return Status
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get label
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* Set active
*
* @param boolean $active
* @return Status
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Set type
*
* @param EventType $type
* @return Status
*/
public function setType(EventType $type = null)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return EventType
*/
public function getType()
{
return $this->type;
}
}