src/Entity/Educational/Discipline.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Educational;
  3. use App\Model\ColorableTrait;
  4. use App\Model\PublishableTrait;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. /**
  10.  *
  11.  * @ORM\Table(name="admin_discipline")
  12.  * @ORM\Entity(repositoryClass="App\Repository\Educational\DisciplineRepository")
  13.  */
  14. class Discipline
  15. {
  16.     const ID_MATHEMATIQUES = 3;
  17.     const ID_PHYSIQUE_CHIMIE = 6;
  18.     const ID_SCIENCES = 10;
  19.     const ID_SVT = 5;
  20.     const ID_SI = 8;
  21.     const ID_PHILOSOPHIE = 1;
  22.     const ID_FRANCAIS = 4;
  23.     const ID_LITTERATURE = 12;
  24.     const ID_HISTOIRE_GEOGRAPHIE = 9;
  25.     const ID_SES = 2;
  26.     const ID_ANGLAIS = 7;
  27.     const ID_ESPAGNOL = 13;
  28.     const ID_ALLEMAND = 14;
  29.     const ID_SCIENCES_PO = 17;
  30.     const ID_FLE = 20;
  31.     const ID_PFEG = 21;
  32.     const ID_ENSEIGNEMENT_MORAL_ET_CIVIQUE = 22;
  33.     const ID_GEOPOLITIQUE_ET_SCIENCES_POLITIQUES = 23;
  34.     const ID_HUMANITES_LITTERATURE_ET_PHILOSOPHIE = 24;
  35.     const ID_NUMERIQUE_ET_SCIENCES_INFORMATIQUES = 25;
  36.     const ID_SNT = 26;
  37.     const ID_REVISIONS_E3C = 27;
  38.     const ID_REVISIONS_ORAL_FRANCAIS = 28;
  39.     const ID_MATHEMATIQUES_EXPERTES = 29;
  40.     const ID_MATHEMATIQUES_COMPLEMENTAIRES = 30;
  41.     const ID_REVISIONS_EC2 = 31;
  42.     const ID_REVISIONS_EC3 = 32;
  43.     const ID_SUJETS_CONTROLE_CONTINU = 33;
  44.     const ID_APPRENDRE_A_APPRENDRE = 34;
  45.     const ID_GRAND_ORAL = 35;
  46.     const SLUG_MATHEMATIQUES                        = 'mathematiques';
  47.     const SLUG_FRANCAIS                             = 'francais';
  48.     const SLUG_ANGLAIS                              = 'anglais';
  49.     const SLUG_HISTOIRE_GEOGRAPHIE                  = 'histoire-geographie';
  50.     const SLUG_PHILOSOPHIE                          = 'philosophie';
  51.     const SLUG_PHYSIQUE_CHIMIE                      = 'physique-chimie';
  52.     const SLUG_SCIENCES                             = 'sciences';
  53.     const SLUG_SVT                                  = 'svt';
  54.     const SLUG_SI                                   = 'sciences-de-l-ingenieur';
  55.     const SLUG_LITTERATURE                          = 'litterature';
  56.     const SLUG_SES                                  = 'ses';
  57.     const SLUG_ESPAGNOL                             = 'espagnol';
  58.     const SLUG_ALLEMAND                             = 'allemand';
  59.     const SLUG_SCIENCES_PO                          = 'sciences-po';
  60.     const SLUG_FLE                                  = 'fle';
  61.     const SLUG_PFEG                                 = 'pfeg';
  62.     const SLUG_ENSEIGNEMENT_MORAL_ET_CIVIQUE        = 'enseignement-moral-et-civique';
  63.     const SLUG_GEOPOLITIQUE_ET_SCIENCES_POLITIQUES  = 'geopolitique-et-sciences-politiques';
  64.     const SLUG_HUMANITES_LITTERATURE_ET_PHILOSOPHIE = 'humanites-litterature-et-philosophie';
  65.     const SLUG_NUMERIQUE_ET_SCIENCES_INFORMATIQUES  = 'numerique-et-sciences-informatiques';
  66.     const SLUG_SNT                                  = 'snt';
  67.     const SLUG_REVISIONS_E3C                        = 'revisions-e3c';
  68.     const SLUG_REVISIONS_EC2                        = 'revisions-ec2';
  69.     const SLUG_REVISIONS_EC3                        = 'revisions-ec3';
  70.     const SLUG_REVISIONS_ORAL_FRANCAIS              = 'revisions-oral-francais';
  71.     const SLUG_MATHEMATIQUES_EXPERTES               = 'mathematiques_expertes';
  72.     const SLUG_MATHEMATIQUES_COMPLEMENTAIRES        = 'mathematiques_complementaires';
  73.     const SLUG_SUJETS_CONTROLE_CONTINU              = 'sujets-controle-continu';
  74.     const SLUG_APPRENDRE_A_APPRENDRE                = 'apprendre_a_apprendre';
  75.     const SLUG_GRAND_ORAL                           = 'grand_oral';
  76.     use PublishableTrait;
  77.     use ColorableTrait;
  78.     /**
  79.      * @var integer $id
  80.      *
  81.      * @ORM\Column(name="id", type="integer")
  82.      * @ORM\Id
  83.      * @ORM\GeneratedValue(strategy="AUTO")
  84.      */
  85.     private $id;
  86.     /**
  87.      * @var string $title
  88.      *
  89.      * @ORM\Column(name="title", type="string", length=255)
  90.      * @Assert\NotBlank()
  91.      */
  92.     private $title;
  93.     /**
  94.      * @var string $title
  95.      *
  96.      * @ORM\Column(name="lesson_title", type="string", length=255,nullable=true)
  97.      *
  98.      */
  99.     private $lessonTitle;
  100.     /**
  101.      * @var string $title
  102.      * @ORM\Column(name="slug", type="string", length=255)
  103.      * @Gedmo\Slug(fields={"title"})
  104.      *
  105.      */
  106.     private $slug;
  107.     /**
  108.      * @var string $title
  109.      * @ORM\Column(name="slug_lesson", type="string", length=255)
  110.      *
  111.      */
  112.     private $slugLesson;
  113.     /**
  114.      * @var
  115.      * @ORM\Column(name="front", type="boolean")
  116.      */
  117.     private $front;
  118.     /**
  119.      * @var integer
  120.      * @ORM\Column(name="sort_order",type="integer")
  121.      */
  122.     private $order;
  123.     /**
  124.      * @var boolean
  125.      * @ORM\Column(name="speciality",type="boolean")
  126.      */
  127.     private $speciality;
  128.     /**
  129.      * @var boolean
  130.      * @ORM\Column(type="boolean",options={"default":0})
  131.      */
  132.     private $exam;
  133.     /**
  134.      * @var string $title
  135.      *
  136.      * @ORM\Column( type="string", length=255,nullable=true)
  137.      *
  138.      */
  139.     private $mainColor;
  140.     /**
  141.      * @var string $title
  142.      *
  143.      * @ORM\Column(type="string", name="`version_exam`", length=255,nullable=true)
  144.      *
  145.      */
  146.     private $version;
  147.     /**
  148.      * @var string $title
  149.      *
  150.      * @ORM\Column(type="string", length=255,nullable=true)
  151.      *
  152.      */
  153.     private $gradientColor;
  154.     /********************** Association **************/
  155.     /**
  156.      * @ORM\OneToMany(targetEntity="Domain",mappedBy="discipline")
  157.      *
  158.      */
  159.     private $domains;
  160.     /**
  161.      *
  162.      * @ORM\ManyToMany(targetEntity="App\Entity\Users\Teacher",mappedBy="disciplines")
  163.      *
  164.      */
  165.     private $teachers;
  166.     /*********************** FIN ********************/
  167.     public function __construct()
  168.     {
  169.         $this->domains   = new ArrayCollection();
  170.         $this->published = false;
  171.         $this->front     = true;
  172.         $this->speciality = false;
  173.     }
  174.     /**
  175.      * @return int
  176.      */
  177.     public function getId()
  178.     {
  179.         return $this->id;
  180.     }
  181.     /**
  182.      * @return string
  183.      */
  184.     public function getTitle()
  185.     {
  186.         return $this->title;
  187.     }
  188.     /**
  189.      * @param string $title
  190.      */
  191.     public function setTitle($title)
  192.     {
  193.         $this->title = $title;
  194.     }
  195.     /**
  196.      * @return string
  197.      */
  198.     public function getSlug()
  199.     {
  200.         return $this->slug;
  201.     }
  202.     /**
  203.      * @param string $slug
  204.      */
  205.     public function setSlug($slug)
  206.     {
  207.         $this->slug = $slug;
  208.     }
  209.     /**
  210.      * @return mixed
  211.      */
  212.     public function getDomains()
  213.     {
  214.         return $this->domains;
  215.     }
  216.     /**
  217.      * @param mixed $domains
  218.      */
  219.     public function addDomains($domains)
  220.     {
  221.         $this->domains[] = $domains;
  222.     }
  223.     public function getDomain()
  224.     {
  225.     }
  226.     public function __toString()
  227.     {
  228.         return $this->title;
  229.     }
  230.     /**
  231.      * @return mixed
  232.      */
  233.     public function getFront()
  234.     {
  235.         return $this->front;
  236.     }
  237.     /**
  238.      * @param mixed $front
  239.      */
  240.     public function setFront($front)
  241.     {
  242.         $this->front = $front;
  243.     }
  244.     /**
  245.      * @return int
  246.      */
  247.     public function getOrder()
  248.     {
  249.         return $this->order;
  250.     }
  251.     /**
  252.      * @param int $order
  253.      */
  254.     public function setOrder($order)
  255.     {
  256.         $this->order = $order;
  257.     }
  258.     /**
  259.      * @return boolean
  260.      */
  261.     public function isSpeciality()
  262.     {
  263.         return $this->speciality;
  264.     }
  265.     /**
  266.      * @param boolean $speciality
  267.      */
  268.     public function setSpeciality($speciality)
  269.     {
  270.         $this->speciality = $speciality;
  271.     }
  272.     /**
  273.      * Get speciality
  274.      *
  275.      * @return boolean 
  276.      */
  277.     public function getSpeciality()
  278.     {
  279.         return $this->speciality;
  280.     }
  281.     /**
  282.      *
  283.      * Return html color discipline slug
  284.      * @return array
  285.      */
  286.     public static function getHtmlColor()
  287.     {
  288.         return [
  289.             self::SLUG_MATHEMATIQUES => ['main' => '#FFEF513A', 'gradient' => '#FFFF8F7E'],
  290.             self::SLUG_FRANCAIS => ['main' => '#FFF36E88', 'gradient' => '#FFFF9CAF'],
  291.             self::SLUG_ANGLAIS => ['main' => '#FF47C4B5', 'gradient' => '#FF12D9C2'],
  292.             self::SLUG_HISTOIRE_GEOGRAPHIE => ['main' => '#FFFFA924', 'gradient' => '#FFFFC63B'],
  293.             self::SLUG_PHILOSOPHIE => ['main' => '#FF69ADE9', 'gradient' => '#FF4696E8'],
  294.             self::SLUG_PHYSIQUE_CHIMIE => ['main' => '#FF716AE1', 'gradient' => '#FF8E88FF'],
  295.             self::SLUG_SCIENCES => ['main' => '#FF66C36A', 'gradient' => '#FF6AD490'],
  296.             self::SLUG_SVT => ['main' => '#FF66C36A', 'gradient' => '#FF6AD490'],
  297.             self::SLUG_SI => ['main' => '#FF9DC864', 'gradient' => '#FF8ABB4A'],
  298.             self::SLUG_LITTERATURE => ['main' => '#FF69ADE9', 'gradient' => '#FF4696E8'],
  299.             self::SLUG_SES => ['main' => '#FFFF9F61', 'gradient' => '#FFFF854A'],
  300.             self::SLUG_ESPAGNOL => ['main' => '#FFC94A60', 'gradient' => '#FFE67160'],
  301.             self::SLUG_ALLEMAND => ['main' => '#FFFFD225', 'gradient' => '#FFFFE04C'],
  302.             self::SLUG_SCIENCES_PO => ['main' => '#FFBCC6D0', 'gradient' => '#FF90ADCA'],
  303.             self::SLUG_FLE => ['main' => '#FFCF3D8A', 'gradient' => '#FFEB497F'],
  304.             self::SLUG_PFEG => ['main' => '#FF6D69E9', 'gradient' => '#FF5066E0'],
  305.             self::SLUG_ENSEIGNEMENT_MORAL_ET_CIVIQUE => ['main' => '#FFB22B', 'gradient' => '#FFB22B'],
  306.             self::SLUG_GEOPOLITIQUE_ET_SCIENCES_POLITIQUES => ['main' => '#FFF7A474', 'gradient' => '#FFF7A474'],
  307.             self::SLUG_HUMANITES_LITTERATURE_ET_PHILOSOPHIE => ['main' => '#FFC76BA8', 'gradient' => '#FFC76BA8'],
  308.             self::SLUG_NUMERIQUE_ET_SCIENCES_INFORMATIQUES => ['main' => '#FFFD6642', 'gradient' => '#FFFD6642'],
  309.             self::SLUG_SNT => ['main' => '#1DAAAF', 'gradient' => '#1DAAAF'],
  310.             self::SLUG_REVISIONS_E3C => ['main' => '#FF2CD6A0', 'gradient' => '#FF6AE2BC'],
  311.             self::SLUG_REVISIONS_ORAL_FRANCAIS => ['main' => '#C42F67', 'gradient' => '#C42F67'],
  312.             self::SLUG_MATHEMATIQUES_EXPERTES => ['main' => '#FFEF513A', 'gradient' => '#FFFF8F7E'],
  313.             self::SLUG_MATHEMATIQUES_COMPLEMENTAIRES => ['main' => '#FFEF513A', 'gradient' => '#FFFF8F7E'],
  314.         ];
  315.     }
  316.     /**
  317.      * Add domains
  318.      *
  319.      * @param \Bo\DomainBundle\Entity\Domain $domains
  320.      * @return Discipline
  321.      */
  322.     public function addDomain($domains)
  323.     {
  324.         $this->domains[] = $domains;
  325.         return $this;
  326.     }
  327.     /**
  328.      * Remove domains
  329.      *
  330.      * @param \Bo\DomainBundle\Entity\Domain $domains
  331.      */
  332.     public function removeDomain($domains)
  333.     {
  334.         $this->domains->removeElement($domains);
  335.     }
  336.     /**
  337.      * Add teachers
  338.      *
  339.      * @param \Bo\UserBundle\Entity\Teacher $teachers
  340.      * @return Discipline
  341.      */
  342.     public function addTeacher($teachers)
  343.     {
  344.         $this->teachers[] = $teachers;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Remove teachers
  349.      *
  350.      * @param \Bo\UserBundle\Entity\Teacher $teachers
  351.      */
  352.     public function removeTeacher($teachers)
  353.     {
  354.         $this->teachers->removeElement($teachers);
  355.     }
  356.     /**
  357.      * Get teachers
  358.      *
  359.      * @return \Doctrine\Common\Collections\Collection 
  360.      */
  361.     public function getTeachers()
  362.     {
  363.         return $this->teachers;
  364.     }
  365.     public function isExam(): bool
  366.     {
  367.         return $this->exam;
  368.     }
  369.     public function setExam(bool $exam): void
  370.     {
  371.         $this->exam = $exam;
  372.     }
  373.     public function getLessonTitle(): ?string
  374.     {
  375.         return $this->lessonTitle;
  376.     }
  377.     public function setLessonTitle(string $lessonTitle): void
  378.     {
  379.         $this->lessonTitle = $lessonTitle;
  380.     }
  381.     public function getSlugLesson(): string
  382.     {
  383.         return $this->slugLesson;
  384.     }
  385.     public function setSlugLesson(string $slugLesson): void
  386.     {
  387.         $this->slugLesson = $slugLesson;
  388.     }
  389.     public function getVersion(): string
  390.     {
  391.         return $this->version;
  392.     }
  393.     public function setVersion(string $version): void
  394.     {
  395.         $this->version = $version;
  396.     }
  397. }