| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- <?php
- namespace AppBundle\Entity\Booking;
- use AppBundle\Annotation\ExportSplitFields;
- use AppBundle\Entity\AccessAndFunction\Access;
- use AppBundle\Entity\Product\Equipment;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- use AppBundle\Entity\Person\Person;
- /**
- *
- * Convocation d'un Access (élève) à un Examen
- *
- * @Iri("http://schema.org/ExamenConvocation")
- */
- #[ORM\Entity]
- class ExamenConvocation
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'report_card', 'presence_attendance', 'examen_details', 'planning_detail', 'examen_informations_edit'])]
- private $id;
- /**
- * @var Examen
- */
- #[ORM\ManyToOne(targetEntity: 'Examen', inversedBy: 'convocation')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'report_card_examenconvocations'])]
- private $examen;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'examenConvocations')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'presence_attendance_convocation', 'examen_details_convocation', 'planning_detail_convocation', 'examenconvocation_list', 'examen_informations_edit_convocation', 'examenconvocation_list'])]
- private $student;
- /**
- * @var ArrayCollection<Equipment>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Product\Equipment')]
- #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'examenconvocation_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'equipment_id', referencedColumnName: 'id')]
- #[Groups(['examenconvocation_equipment', 'examenconvocation_list', 'examen_informations_edit_convocation'])]
- private $equipments;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'examen_informations_edit_convocation'])]
- private $info;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 255, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'examen_informations_edit_convocation'])]
- private $level;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'time', nullable: true)]
- #[Assert\Time]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'examen_details_convocation', 'examen_informations_edit_convocation'])]
- private $time;
- /**
- * @var float
- */
- #[ORM\Column(type: 'float', nullable: true)]
- #[Assert\Type(type: 'float')]
- #[Assert\GreaterThanOrEqual(value: 0)]
- #[Assert\LessThanOrEqual(value: 100, message: 'lessThanOrEqual20')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'report_card_examenconvocations', 'examen_informations_edit_convocation'])]
- private $note;
- /**
- * @var string
- */
- #[Groups(['examenconvocation', 'examenconvocation_list'])]
- private $noteTemplate;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 255, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'report_card_examenconvocations', 'examen_informations_edit_convocation'])]
- private $mention;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'report_card_examenconvocations', 'examen_informations_edit_convocation'])]
- private $appreciation;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 255)]
- #[Assert\Type(type: 'string')]
- #[Assert\NotNull]
- #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\ExamenConvocationStatusEnum', 'toArray'])]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'examen_informations_edit_convocation'])]
- private $status;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => false])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['examenconvocation', 'examenconvocation_list', 'examen_informations_edit_convocation'])]
- private $isConvocated = false;
- /**
- * @var string
- */
- #[Groups(['examenconvocation_list', 'report_card_examenconvocations'])]
- private $cycleYearLevelStudentTemplate;
- public function __construct()
- {
- $this->equipments = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Sets examen.
- *
- * @param Examen $examen
- *
- * @return $this
- */
- public function setExamen(Examen $examen)
- {
- $this->examen = $examen;
- return $this;
- }
- /**
- * Gets examen.
- *
- * @return Examen
- */
- public function getExamen()
- {
- return $this->examen;
- }
- /**
- * Sets student.
- *
- * @param Access $student
- *
- * @return $this
- */
- public function setStudent(Access $student)
- {
- $this->student = $student;
- return $this;
- }
- /**
- * Gets student.
- *
- * @return Access
- */
- public function getStudent()
- {
- return $this->student;
- }
- /**
- * Sets info.
- *
- * @param string $info
- *
- * @return $this
- */
- public function setInfo($info)
- {
- $this->info = $info;
- return $this;
- }
- /**
- * Gets info.
- *
- * @return string
- */
- public function getInfo()
- {
- return $this->info;
- }
- /**
- * Sets level.
- *
- * @param string $level
- *
- * @return $this
- */
- public function setLevel($level)
- {
- $this->level = $level;
- return $this;
- }
- /**
- * Gets level.
- *
- * @return string
- */
- public function getLevel()
- {
- return $this->level;
- }
- /**
- * Sets time.
- *
- * @param \DateTime $time
- *
- * @return $this
- */
- public function setTime(\DateTime $time = null)
- {
- $this->time = $time;
- return $this;
- }
- /**
- * Gets time.
- *
- * @return \DateTime
- */
- public function getTime()
- {
- return $this->time ? $this->time->format('H:i') : $this->time;
- }
- /**
- * Sets note.
- *
- * @param float $note
- *
- * @return $this
- */
- public function setNote($note)
- {
- $this->note = (!is_null($note)) ? floatval($note) : $note;
- return $this;
- }
- /**
- * Gets note.
- *
- * @return float
- */
- public function getNote()
- {
- return $this->note;
- }
- /**
- * Sets mention.
- *
- * @param string $mention
- *
- * @return $this
- */
- public function setMention($mention)
- {
- $this->mention = $mention;
- return $this;
- }
- /**
- * Gets mention.
- *
- * @return string
- */
- public function getMention()
- {
- return $this->mention;
- }
- /**
- * Sets appreciation.
- *
- * @param string $appreciation
- *
- * @return $this
- */
- public function setAppreciation($appreciation)
- {
- $this->appreciation = $appreciation;
- return $this;
- }
- /**
- * Gets appreciation.
- *
- * @return string
- */
- public function getAppreciation()
- {
- return $this->appreciation;
- }
- /**
- * Sets status.
- *
- * @param string $status
- *
- * @return $this
- */
- public function setStatus($status)
- {
- $this->status = $status;
- return $this;
- }
- /**
- * Gets status.
- *
- * @return string
- */
- public function getStatus()
- {
- return $this->status;
- }
- /**
- * Add equipment
- *
- * @param \AppBundle\Entity\Product\Equipment $equipment
- *
- * @return ExamenConvocation
- */
- public function addEquipment(\AppBundle\Entity\Product\Equipment $equipment)
- {
- $this->equipments[] = $equipment;
- return $this;
- }
- /**
- * Remove equipment
- *
- * @param \AppBundle\Entity\Product\Equipment $equipment
- */
- public function removeEquipment(\AppBundle\Entity\Product\Equipment $equipment)
- {
- $this->equipments->removeElement($equipment);
- }
- /**
- * Get equipments
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getEquipments()
- {
- return $this->equipments;
- }
- /**
- * Sets isConvocated.
- *
- * @param bool $isConvocated
- *
- * @return $this
- */
- public function setIsConvocated($isConvocated)
- {
- $this->isConvocated = $isConvocated;
- return $this;
- }
- /**
- * Gets isConvocated.
- *
- * @return bool
- */
- public function getIsConvocated()
- {
- return $this->isConvocated;
- }
- /**
- * @return float
- */
- public function getNoteTemplate()
- {
- return (!is_null($this->getNote())) ? floatval($this->getNote() / 5) : $this->getNote();
- }
- /**
- * Gets full label.
- *
- * @return array
- */
- public function getCycleYearLevelStudentTemplate()
- {
- $cycleYearLevelStudent = '';
- foreach($this->getExamen()->getEducationCurriculum() as $educationCurriculum){
- foreach($this->getStudent()->getEducationStudent() as $educationStudent){
- if(!is_null($educationCurriculum) && !is_null($educationStudent->getEducationCurriculum()) && $educationCurriculum->getId() === $educationStudent->getEducationCurriculum()->getId()){
- $cycleYearLevelStudent = $educationCurriculum->getCycleYearLevelTemplate();
- break;
- }
- }
- }
- return $cycleYearLevelStudent;
- }
- }
|