src/JuridicusBundle/Entity/ProtokollHtml.php line 12

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use JF\JuridicusBundle\Entity\Pruefung;
  6. /**
  7.  * ProtokollHtml
  8.  */
  9. class ProtokollHtml extends InitModeEntity
  10. {
  11.     const CLASSNAME __CLASS__;
  12.     
  13.     /**
  14.      * @var integer
  15.      */
  16.     private $id;
  17.     /**
  18.      * @var \DateTime
  19.      * @Assert\Type(\DateTimeInterface::class)
  20.      */
  21.     private $datum;
  22.     /**
  23.      * @var integer
  24.      * @Assert\Type(type="integer")
  25.      * @Assert\NotNull
  26.      * @Assert\Range(min="1", max="2")
  27.      */
  28.     private $examen;
  29.     /**
  30.      * @var string
  31.      * @Assert\Length(max="10")
  32.      * @Assert\NotNull
  33.      */
  34.     private $datum_format '';
  35.     /**
  36.      * @var string
  37.      * @Assert\NotBlank
  38.      */
  39.     private $html_code;
  40.     /**
  41.      * @var \DateTime
  42.      * @Assert\Type(\DateTimeInterface::class)
  43.      */
  44.     private $updated_at;
  45.     /**
  46.      * @var \JF\JuridicusBundle\Entity\Pruefer
  47.      * @Assert\NotBlank
  48.      * @Assert\Valid
  49.      */
  50.     private $pruefer;
  51.     /**
  52.      * Get id
  53.      *
  54.      * @return integer
  55.      */
  56.     public function getId()
  57.     {
  58.         return $this->id;
  59.     }
  60.     /**
  61.      * Set datum
  62.      *
  63.      * @param \DateTime $datum
  64.      * @return ProtokollHtml
  65.      */
  66.     public function setDatum($datum)
  67.     {
  68.         $this->datum $datum;
  69.         return $this;
  70.     }
  71.     /**
  72.      * Get datum
  73.      *
  74.      * @return \DateTime
  75.      */
  76.     public function getDatum()
  77.     {
  78.         return $this->datum;
  79.     }
  80.     /**
  81.      * Set datum_format
  82.      *
  83.      * @param string $datumFormat
  84.      * @return ProtokollHtml
  85.      */
  86.     public function setDatumFormat($datumFormat)
  87.     {
  88.         $this->datum_format = (string) $datumFormat;
  89.         return $this;
  90.     }
  91.     /**
  92.      *
  93.      * @return string
  94.      */
  95.     public function getFormattedDatum()
  96.     {
  97.         if ($this->datum) {
  98.             return $this->datum->format($this->datum_format);
  99.         }
  100.         return '';
  101.     }
  102.     /**
  103.      * Get datum_format
  104.      *
  105.      * @return string
  106.      */
  107.     public function getDatumFormat()
  108.     {
  109.         return $this->datum_format;
  110.     }
  111.     /**
  112.      * Set examen
  113.      *
  114.      * @param integer $examen
  115.      * @return ProtokollHtml
  116.      */
  117.     public function setExamen($examen)
  118.     {
  119.         $this->examen $examen;
  120.         return $this;
  121.     }
  122.     /**
  123.      * Get examen
  124.      *
  125.      * @return integer
  126.      */
  127.     public function getExamen()
  128.     {
  129.         return $this->examen;
  130.     }
  131.     /**
  132.      * Set html_code
  133.      *
  134.      * @param string $htmlCode
  135.      * @return ProtokollHtml
  136.      */
  137.     public function setHtmlCode($htmlCode)
  138.     {
  139.         $this->html_code $htmlCode;
  140.         return $this;
  141.     }
  142.     /**
  143.      * Get html_code
  144.      *
  145.      * @return string
  146.      */
  147.     public function getHtmlCode()
  148.     {
  149.         return $this->html_code;
  150.     }
  151.     /**
  152.      * Set updated_at
  153.      *
  154.      * @param \DateTime $updatedAt
  155.      * @return ProtokollHtml
  156.      */
  157.     public function setUpdatedAt($updatedAt)
  158.     {
  159.         $this->updated_at $updatedAt;
  160.         return $this;
  161.     }
  162.     /**
  163.      * Get updated_at
  164.      *
  165.      * @return \DateTime
  166.      */
  167.     public function getUpdatedAt()
  168.     {
  169.         return $this->updated_at;
  170.     }
  171.     /**
  172.      * Set pruefer [OWNING SIDE]
  173.      *
  174.      * @param \JF\JuridicusBundle\Entity\Pruefer $pruefer
  175.      * @return ProtokollHtml
  176.      */
  177.     public function setPruefer(\JF\JuridicusBundle\Entity\Pruefer $pruefer null)
  178.     {
  179.         $this->pruefer $pruefer;
  180.         return $this;
  181.     }
  182.     /**
  183.      * Get pruefer
  184.      *
  185.      * @return \JF\JuridicusBundle\Entity\Pruefer
  186.      */
  187.     public function getPruefer()
  188.     {
  189.         return $this->pruefer;
  190.     }
  191.     /**
  192.      *
  193.      */
  194.     public function getPruefungsamt()
  195.     {
  196.         if (empty($this->id))
  197.         {
  198.             return null;
  199.         }
  200.         foreach($this->getPruefer()->getPruefungsaemter() as $pa)
  201.         {
  202.             if ($pa->getExamen() == $this->examen)
  203.             {
  204.                 return $pa;
  205.             }
  206.         }
  207.         return null;
  208.     }
  209.     /**
  210.      * string representation of the entity
  211.      *
  212.      * @return string
  213.      */
  214.     public function __toString()
  215.     {
  216.         if ($this->id)
  217.         {
  218.             return sprintf('%s - %s.Examen'$this->getPruefer()->getFullText(), $this->examen);
  219.         }
  220.         return 'Neues HTML-Protokoll';
  221.     }
  222.     /**
  223.      * addToPdf
  224.      *
  225.      * @param \TCPDF $pdf
  226.      */
  227.     public function addToPdf\TCPDF $pdf )
  228.     {
  229.         $pdf->writeHTML($this->html_codetrue0true0);
  230.         $pdf->lastPage();
  231.     }
  232. }