src/Notaris/AdminBundle/Entity/News.php line 24

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: lisavandaele
  5.  * Date: 30/01/15
  6.  * Time: 12:53
  7.  */
  8. namespace Notaris\AdminBundle\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Eko\FeedBundle\Field\Item\GroupItemField;
  11. use Eko\FeedBundle\Field\Item\ItemField;
  12. use Eko\FeedBundle\Field\Item\MediaItemField;
  13. use Gedmo\Mapping\Annotation as Gedmo;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. use Eko\FeedBundle\Item\Writer\RoutedItemInterface;  //RSS
  16. /**
  17.  * @ORM\Entity(repositoryClass="NewsRepository")
  18.  * @ORM\Table(name="news")
  19.  */
  20. class News implements RoutedItemInterface{
  21.     /**
  22.      * @var integer
  23.      *
  24.      * @ORM\Column(name="id", type="integer")
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="AUTO")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @Gedmo\Timestampable(on="create")
  31.      * @ORM\Column(name="created", type="datetime")
  32.      */
  33.     private $created;
  34.     /**
  35.      * @ORM\Column(name="updated", type="datetime")
  36.      * @Gedmo\Timestampable(on="update")
  37.      */
  38.     private $updated;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
  41.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
  42.      */
  43.     private $user;
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="title", type="string", length=255)
  48.      */
  49.     private $title;
  50.     /**
  51.      * @var string
  52.      *
  53.      * @ORM\Column(name="subtitle", type="string", length=255)
  54.      */
  55.     private $subtitle;
  56.     /**
  57.      * @ORM\Column(type="text", name="introduction")
  58.      */
  59.     private $introduction;
  60.     /**
  61.      * @ORM\Column(type="text", name="text")
  62.      */
  63.     private $text;
  64.     /**
  65.      * @ORM\OneToOne(targetEntity="Asset")
  66.      * @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
  67.      */
  68.     protected $asset;
  69.     /**
  70.      * @var string
  71.      *
  72.      * @ORM\Column(name="source", type="string", length=255)
  73.      */
  74.     private $source;
  75.     /**
  76.      * @var string
  77.      *
  78.      * @ORM\Column(name="author", type="string", length=255)
  79.      */
  80.     private $author;
  81.     /**
  82.      * @ORM\Column(type="boolean", name="is_active")
  83.      * @Assert\Type("boolean")
  84.      */
  85.     private $isActive;
  86.     /**
  87.      * @ORM\Column(name="pub_date", type="datetime")
  88.      */
  89.     private $publicationDate;
  90.     /**
  91.      * @ORM\Column(type="boolean", name="home")
  92.      * @Assert\Type("boolean")
  93.      */
  94.     private $home;
  95.     /**
  96.      * @ORM\Column(type="boolean", name="in_newsletter")
  97.      * @Assert\Type("boolean")
  98.      */
  99.     private $inNewsletter;
  100.     /**
  101.      * @ORM\Column(type="boolean", name="in_kabinetsmail")
  102.      * @Assert\Type("boolean")
  103.      */
  104.     private $inKabinetsMail;
  105.     /**
  106.      * @ORM\Column(name="newsletter_sended", type="datetime", nullable=true)
  107.      */
  108.     private $newsletterSended;
  109.     /**
  110.      * @ORM\ManyToMany(targetEntity="Subsite")
  111.      * @ORM\JoinTable(name="news_subsite")
  112.      */
  113.     protected $subsites;
  114.     /**
  115.      * @ORM\ManyToMany(targetEntity="IzimiCategory")
  116.      * @ORM\JoinTable(name="news_original_izimi_category")
  117.      */
  118.     protected $categories;
  119.     /**
  120.      * @ORM\Column(type="boolean", name="is_izimi")
  121.      * @Assert\Type("boolean")
  122.      */
  123.     private $isIzimi;
  124.     /**
  125.      * @ORM\Column(type="boolean", name="spotlight")
  126.      * @Assert\Type("boolean")
  127.      */
  128.     private $spotlight;
  129.     /**
  130.      * @ORM\OneToOne(targetEntity="Meta", cascade={"remove"})
  131.      * @ORM\JoinColumn(name="meta_id", referencedColumnName="id")
  132.      */
  133.     protected $meta;
  134.     /**
  135.      * @var string
  136.      *
  137.      * @ORM\Column(name="locale", type="string", length=5)
  138.      */
  139.     private $locale;
  140.     /**
  141.      * @ORM\Column(type="boolean", name="is_pers")
  142.      * @Assert\Type("boolean")
  143.      */
  144.     private $isPers;
  145.     /**
  146.      * @Gedmo\Slug(fields={"title"})
  147.      * @ORM\Column(length=128, unique=true)
  148.      */
  149.     private $slug;
  150.     /**
  151.      * @ORM\OneToOne(targetEntity="Faq", mappedBy="news", cascade={"persist"})
  152.      */
  153.     private $faq;
  154.     /**
  155.      * @ORM\OneToOne(targetEntity="Video", mappedBy="news", cascade={"persist"})
  156.      */
  157.     private $video;
  158.     /**
  159.      * @ORM\OneToOne(targetEntity="Brochure", mappedBy="news", cascade={"persist"})
  160.      */
  161.     private $brochure;
  162.     /**
  163.      * @ORM\ManyToMany(targetEntity="Tag", inversedBy="newsitems")
  164.      * @ORM\JoinTable(name="tag_news")
  165.      */
  166.     protected $tags;
  167.     /**
  168.      * @ORM\Column(type="boolean", name="is_reduced", nullable=true)
  169.      * @Assert\Type("boolean")
  170.      */
  171.     private $isReduced;
  172.     /**
  173.      * @var integer
  174.      *
  175.      * @ORM\Column(type="integer", name="count_clicked")
  176.      */
  177.     private $countClicked = 0;
  178.     /**
  179.      * @ORM\OneToOne(targetEntity="Asset")
  180.      * @ORM\JoinColumn(name="first_paragraph_asset_id", referencedColumnName="id")
  181.      */
  182.     protected $firstParagraphAsset;
  183.     /**
  184.      * @ORM\OneToMany(targetEntity="NewsParagraph", mappedBy="news")
  185.      */
  186.     private $paragraphs;
  187.     /**
  188.      * Constructor
  189.      */
  190.     public function __construct()
  191.     {
  192.         $this->subsites = new \Doctrine\Common\Collections\ArrayCollection();
  193.         $this->inKabinetsMail = false;
  194.         $this->isIzimi = false;
  195.     }
  196.     /**
  197.      * Get id
  198.      *
  199.      * @return integer
  200.      */
  201.     public function getId()
  202.     {
  203.         return $this->id;
  204.     }
  205.     /**
  206.      * Set created
  207.      *
  208.      * @param \DateTime $created
  209.      * @return News
  210.      */
  211.     public function setCreated($created)
  212.     {
  213.         $this->created = $created;
  214.         return $this;
  215.     }
  216.     /**
  217.      * Get created
  218.      *
  219.      * @return \DateTime
  220.      */
  221.     public function getCreated()
  222.     {
  223.         return $this->created;
  224.     }
  225.     /**
  226.      * Set updated
  227.      *
  228.      * @param \DateTime $updated
  229.      * @return News
  230.      */
  231.     public function setUpdated($updated)
  232.     {
  233.         $this->updated = $updated;
  234.         return $this;
  235.     }
  236.     /**
  237.      * Get updated
  238.      *
  239.      * @return \DateTime
  240.      */
  241.     public function getUpdated()
  242.     {
  243.         return $this->updated;
  244.     }
  245.     /**
  246.      * Set title
  247.      *
  248.      * @param string $title
  249.      * @return News
  250.      */
  251.     public function setTitle($title)
  252.     {
  253.         $this->title = $title;
  254.         return $this;
  255.     }
  256.     /**
  257.      * Get title
  258.      *
  259.      * @return string
  260.      */
  261.     public function getTitle()
  262.     {
  263.         return $this->title;
  264.     }
  265.     /**
  266.      * Set subtitle
  267.      *
  268.      * @param string $subtitle
  269.      * @return News
  270.      */
  271.     public function setSubtitle($subtitle)
  272.     {
  273.         $this->subtitle = $subtitle;
  274.         return $this;
  275.     }
  276.     /**
  277.      * Get subtitle
  278.      *
  279.      * @return string
  280.      */
  281.     public function getSubtitle()
  282.     {
  283.         return $this->subtitle;
  284.     }
  285.     /**
  286.      * Set introduction
  287.      *
  288.      * @param string $introduction
  289.      * @return News
  290.      */
  291.     public function setIntroduction($introduction)
  292.     {
  293.         $this->introduction = $introduction;
  294.         return $this;
  295.     }
  296.     /**
  297.      * Get introduction
  298.      *
  299.      * @return string
  300.      */
  301.     public function getIntroduction()
  302.     {
  303.         return $this->introduction;
  304.     }
  305.     /**
  306.      * Set source
  307.      *
  308.      * @param string $source
  309.      * @return News
  310.      */
  311.     public function setSource($source)
  312.     {
  313.         $this->source = $source;
  314.         return $this;
  315.     }
  316.     /**
  317.      * Get source
  318.      *
  319.      * @return string
  320.      */
  321.     public function getSource()
  322.     {
  323.         return $this->source;
  324.     }
  325.     /**
  326.      * Set author
  327.      *
  328.      * @param string $author
  329.      * @return News
  330.      */
  331.     public function setAuthor($author)
  332.     {
  333.         $this->author = $author;
  334.         return $this;
  335.     }
  336.     /**
  337.      * Get author
  338.      *
  339.      * @return string
  340.      */
  341.     public function getAuthor()
  342.     {
  343.         return $this->author;
  344.     }
  345.     /**
  346.      * Set publicationDate
  347.      *
  348.      * @param \DateTime $publicationDate
  349.      * @return News
  350.      */
  351.     public function setPublicationDate($publicationDate)
  352.     {
  353.         $this->publicationDate = $publicationDate;
  354.         return $this;
  355.     }
  356.     /**
  357.      * Get publicationDate
  358.      *
  359.      * @return \DateTime
  360.      */
  361.     public function getPublicationDate()
  362.     {
  363.         return $this->publicationDate;
  364.     }
  365.     /**
  366.      * Set home
  367.      *
  368.      * @param boolean $home
  369.      * @return News
  370.      */
  371.     public function setHome($home)
  372.     {
  373.         $this->home = $home;
  374.         return $this;
  375.     }
  376.     /**
  377.      * Get home
  378.      *
  379.      * @return boolean
  380.      */
  381.     public function getHome()
  382.     {
  383.         return $this->home;
  384.     }
  385.     /**
  386.      * Set inNewsletter
  387.      *
  388.      * @param boolean $inNewsletter
  389.      * @return News
  390.      */
  391.     public function setInNewsletter($inNewsletter)
  392.     {
  393.         $this->inNewsletter = $inNewsletter;
  394.         return $this;
  395.     }
  396.     /**
  397.      * Get inNewsletter
  398.      *
  399.      * @return boolean
  400.      */
  401.     public function getInNewsletter()
  402.     {
  403.         return $this->inNewsletter;
  404.     }
  405.     /**
  406.      * Set spotlight
  407.      *
  408.      * @param boolean $spotlight
  409.      * @return News
  410.      */
  411.     public function setSpotlight($spotlight)
  412.     {
  413.         $this->spotlight = $spotlight;
  414.         return $this;
  415.     }
  416.     /**
  417.      * Get spotlight
  418.      *
  419.      * @return boolean
  420.      */
  421.     public function getSpotlight()
  422.     {
  423.         return $this->spotlight;
  424.     }
  425.     /**
  426.      * Set locale
  427.      *
  428.      * @param string $locale
  429.      * @return News
  430.      */
  431.     public function setLocale($locale)
  432.     {
  433.         $this->locale = $locale;
  434.         return $this;
  435.     }
  436.     /**
  437.      * Get locale
  438.      *
  439.      * @return string
  440.      */
  441.     public function getLocale()
  442.     {
  443.         return $this->locale;
  444.     }
  445.     /**
  446.      * Set isPers
  447.      *
  448.      * @param boolean $isPers
  449.      * @return News
  450.      */
  451.     public function setIsPers($isPers)
  452.     {
  453.         $this->isPers = $isPers;
  454.         return $this;
  455.     }
  456.     /**
  457.      * Get isPers
  458.      *
  459.      * @return boolean
  460.      */
  461.     public function getIsPers()
  462.     {
  463.         return $this->isPers;
  464.     }
  465.     /**
  466.      * Set slug
  467.      *
  468.      * @param string $slug
  469.      * @return News
  470.      */
  471.     public function setSlug($slug)
  472.     {
  473.         $this->slug = $slug;
  474.         return $this;
  475.     }
  476.     /**
  477.      * Get slug
  478.      *
  479.      * @return string
  480.      */
  481.     public function getSlug()
  482.     {
  483.         return $this->slug;
  484.     }
  485.     /**
  486.      * Set isReduced
  487.      *
  488.      * @param boolean $isReduced
  489.      * @return News
  490.      */
  491.     public function setIsReduced($isReduced)
  492.     {
  493.         $this->isReduced = $isReduced;
  494.         return $this;
  495.     }
  496.     /**
  497.      * Get isReduced
  498.      *
  499.      * @return boolean
  500.      */
  501.     public function getIsReduced()
  502.     {
  503.         return $this->isReduced;
  504.     }
  505.     /**
  506.      * Set user
  507.      *
  508.      * @param \Notaris\AdminBundle\Entity\User $user
  509.      * @return News
  510.      */
  511.     public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
  512.     {
  513.         $this->user = $user;
  514.         return $this;
  515.     }
  516.     /**
  517.      * Get user
  518.      *
  519.      * @return \Notaris\AdminBundle\Entity\User
  520.      */
  521.     public function getUser()
  522.     {
  523.         return $this->user;
  524.     }
  525.     /**
  526.      * Add subsites
  527.      *
  528.      * @param \Notaris\AdminBundle\Entity\Subsite $subsites
  529.      * @return News
  530.      */
  531.     public function addSubsite(\Notaris\AdminBundle\Entity\Subsite $subsites)
  532.     {
  533.         $this->subsites[] = $subsites;
  534.         return $this;
  535.     }
  536.     /**
  537.      * Remove subsites
  538.      *
  539.      * @param \Notaris\AdminBundle\Entity\Subsite $subsites
  540.      */
  541.     public function removeSubsite(\Notaris\AdminBundle\Entity\Subsite $subsites)
  542.     {
  543.         $this->subsites->removeElement($subsites);
  544.     }
  545.     /**
  546.      * Get subsites
  547.      *
  548.      * @return \Doctrine\Common\Collections\Collection
  549.      */
  550.     public function getSubsites()
  551.     {
  552.         return $this->subsites;
  553.     }
  554.     /**
  555.      * Set video
  556.      *
  557.      * @param \Notaris\AdminBundle\Entity\Video $video
  558.      * @return News
  559.      */
  560.     public function setVideo(\Notaris\AdminBundle\Entity\Video $video = null)
  561.     {
  562.         $this->video = $video;
  563.         return $this;
  564.     }
  565.     /**
  566.      * Get video
  567.      *
  568.      * @return \Notaris\AdminBundle\Entity\Video
  569.      */
  570.     public function getVideo()
  571.     {
  572.         return $this->video;
  573.     }
  574.     /**
  575.      * Add tags
  576.      *
  577.      * @param \Notaris\AdminBundle\Entity\Tag $tags
  578.      * @return News
  579.      */
  580.     public function addTag(\Notaris\AdminBundle\Entity\Tag $tags)
  581.     {
  582.         $this->tags[] = $tags;
  583.         return $this;
  584.     }
  585.     /**
  586.      * Remove tags
  587.      *
  588.      * @param \Notaris\AdminBundle\Entity\Tag $tags
  589.      */
  590.     public function removeTag(\Notaris\AdminBundle\Entity\Tag $tags)
  591.     {
  592.         $this->tags->removeElement($tags);
  593.     }
  594.     /**
  595.      * Get tags
  596.      *
  597.      * @return \Doctrine\Common\Collections\Collection
  598.      */
  599.     public function getTags()
  600.     {
  601.         return $this->tags;
  602.     }
  603.     /**
  604.      * Set meta
  605.      *
  606.      * @param \Notaris\AdminBundle\Entity\Meta $meta
  607.      * @return News
  608.      */
  609.     public function setMeta(\Notaris\AdminBundle\Entity\Meta $meta = null)
  610.     {
  611.         $this->meta = $meta;
  612.         return $this;
  613.     }
  614.     /**
  615.      * Get meta
  616.      *
  617.      * @return \Notaris\AdminBundle\Entity\Meta
  618.      */
  619.     public function getMeta()
  620.     {
  621.         return $this->meta;
  622.     }
  623.     /**
  624.      * Set isActive
  625.      *
  626.      * @param boolean $isActive
  627.      * @return News
  628.      */
  629.     public function setIsActive($isActive)
  630.     {
  631.         $this->isActive = $isActive;
  632.         return $this;
  633.     }
  634.     /**
  635.      * Get isActive
  636.      *
  637.      * @return boolean
  638.      */
  639.     public function getIsActive()
  640.     {
  641.         return $this->isActive;
  642.     }
  643.     /**
  644.      * Set brochure
  645.      *
  646.      * @param \Notaris\AdminBundle\Entity\Brochure $brochure
  647.      * @return News
  648.      */
  649.     public function setBrochure(\Notaris\AdminBundle\Entity\Brochure $brochure = null)
  650.     {
  651.         $this->brochure = $brochure;
  652.         return $this;
  653.     }
  654.     /**
  655.      * Get brochure
  656.      *
  657.      * @return \Notaris\AdminBundle\Entity\Brochure
  658.      */
  659.     public function getBrochure()
  660.     {
  661.         return $this->brochure;
  662.     }
  663.     /**
  664.      * Set asset
  665.      *
  666.      * @param \Notaris\AdminBundle\Entity\Asset $asset
  667.      * @return News
  668.      */
  669.     public function setAsset(\Notaris\AdminBundle\Entity\Asset $asset = null)
  670.     {
  671.         $this->asset = $asset;
  672.         return $this;
  673.     }
  674.     /**
  675.      * Get asset
  676.      *
  677.      * @return \Notaris\AdminBundle\Entity\Asset
  678.      */
  679.     public function getAsset()
  680.     {
  681.         return $this->asset;
  682.     }
  683.     /**
  684.      * Set text
  685.      *
  686.      * @param string $text
  687.      * @return News
  688.      */
  689.     public function setText($text)
  690.     {
  691.         $this->text = $text;
  692.         return $this;
  693.     }
  694.     /**
  695.      * Get text
  696.      *
  697.      * @return string
  698.      */
  699.     public function getText()
  700.     {
  701.         return $this->text;
  702.     }
  703.     /**
  704.      * Set countClicked
  705.      *
  706.      * @param integer $countClicked
  707.      * @return News
  708.      */
  709.     public function setCountClicked($countClicked)
  710.     {
  711.         $this->countClicked = $countClicked;
  712.         return $this;
  713.     }
  714.     /**
  715.      * Get countClicked
  716.      *
  717.      * @return integer
  718.      */
  719.     public function getCountClicked()
  720.     {
  721.         return $this->countClicked;
  722.     }
  723.     /**
  724.      * Set newsletterSended
  725.      *
  726.      * @param \DateTime $newsletterSended
  727.      * @return News
  728.      */
  729.     public function setNewsletterSended($newsletterSended)
  730.     {
  731.         $this->newsletterSended = $newsletterSended;
  732.         return $this;
  733.     }
  734.     /**
  735.      * Get newsletterSended
  736.      *
  737.      * @return \DateTime
  738.      */
  739.     public function getNewsletterSended()
  740.     {
  741.         return $this->newsletterSended;
  742.     }
  743.     /**
  744.      * Set faq
  745.      *
  746.      * @param \Notaris\AdminBundle\Entity\Faq $faq
  747.      * @return News
  748.      */
  749.     public function setFaq(\Notaris\AdminBundle\Entity\Faq $faq = null)
  750.     {
  751.         $this->faq = $faq;
  752.         return $this;
  753.     }
  754.     /**
  755.      * Get faq
  756.      *
  757.      * @return \Notaris\AdminBundle\Entity\Faq
  758.      */
  759.     public function getFaq()
  760.     {
  761.         return $this->faq;
  762.     }
  763.     /**
  764.      * @return string
  765.      */
  766.     public function __toString(){
  767.         return $this->getTitle();
  768.     }
  769.     /**
  770.      * Set inKabinetsMail
  771.      *
  772.      * @param boolean $inKabinetsMail
  773.      *
  774.      * @return News
  775.      */
  776.     public function setInKabinetsMail($inKabinetsMail)
  777.     {
  778.         $this->inKabinetsMail = $inKabinetsMail;
  779.         return $this;
  780.     }
  781.     /**
  782.      * Get inKabinetsMail
  783.      *
  784.      * @return boolean
  785.      */
  786.     public function getInKabinetsMail()
  787.     {
  788.         return $this->inKabinetsMail;
  789.     }
  790.     /**
  791.      * Set firstParagraphAsset
  792.      *
  793.      * @param \Notaris\AdminBundle\Entity\Asset $firstParagraphAsset
  794.      * @return News
  795.      */
  796.     public function setFirstParagraphAsset(\Notaris\AdminBundle\Entity\Asset $firstParagraphAsset = null)
  797.     {
  798.         $this->firstParagraphAsset = $firstParagraphAsset;
  799.         return $this;
  800.     }
  801.     /**
  802.      * Get firstParagraphAsset
  803.      *
  804.      * @return \Notaris\AdminBundle\Entity\Asset
  805.      */
  806.     public function getFirstParagraphAsset()
  807.     {
  808.         return $this->firstParagraphAsset;
  809.     }
  810.     /**
  811.      * Add paragraph
  812.      *
  813.      * @param \Notaris\AdminBundle\Entity\NewsParagraph $paragraph
  814.      *
  815.      * @return Article
  816.      */
  817.     public function addParagraph(\Notaris\AdminBundle\Entity\NewsParagraph $paragraph)
  818.     {
  819.         $this->paragraphs[] = $paragraph;
  820.         return $this;
  821.     }
  822.     /**
  823.      * Remove paragraph
  824.      *
  825.      * @param \Notaris\AdminBundle\Entity\NewsParagraph $paragraph
  826.      */
  827.     public function removeParagraph(\Notaris\AdminBundle\Entity\NewsParagraph $paragraph)
  828.     {
  829.         $this->paragraphs->removeElement($paragraph);
  830.     }
  831.     /**
  832.      * Get paragraphs
  833.      *
  834.      * @return \Doctrine\Common\Collections\Collection
  835.      */
  836.     public function getParagraphs()
  837.     {
  838.         return $this->paragraphs;
  839.     }
  840.     //RSS methods
  841.     public function getFeedItemTitle()
  842.     {
  843.         return $this->title;
  844.     }
  845.     public function getFeedItemDescription()
  846.     {
  847.         $description = '';
  848.         if($this->subtitle){
  849.             $description = '<h4>'.$this->subtitle.'</h4>';
  850.         }
  851.         if($this->introduction){
  852.             $description = '<p>'.$this->introduction.'</p>';
  853.         }
  854.         //images
  855.         if($this->asset and sizeof($this->asset->getAssetImages()) > 0 ){
  856.             foreach ($this->asset->getAssetImages() as $assetImage){
  857.                 if($assetImage->getImage()){
  858.                     $image = $assetImage->getImage();
  859.                     $domain = 'https://www.notaris.be/';
  860.                     if($image->getLocale() != 'nl'){
  861.                         $domain = 'https://www.notaire.be/';
  862.                     }
  863.                     $description .= '<p><img src='.$domain .'uploads/' . $image->getLocale() . $image->getFilename(). ' alt="'.$image->getCaption().'"/></p>';
  864.                 }
  865.             }
  866.         }
  867.         $description .= $this->text;
  868.         //video
  869.         if($this->asset and sizeof($this->asset->getAssetVideoPaths()) > 0 ){
  870. //            $description .= '<div>';
  871.             foreach ($this->asset->getAssetVideoPaths() as $assetImage){
  872.                 if($assetImage->getVideoPath()){
  873.                     $video = $assetImage->getVideoPath();
  874.                     $domain = 'http://notaris.be/';
  875.                     if($video->getLocale() != 'nl'){
  876.                         $domain = 'https://www.notaire.be/';
  877.                     }
  878.                     if($video->getPath() != '') {
  879.                         $description .= '<video width="610" height="347" controls><source src="'.$domain . 'video/' . $video->getLocale() . '/' . $video->getPath().'"></video>';
  880.                     }elseif($video->getYoutube() != ''){
  881.                         $description .= '<iframe frameborder="0" allowfullscreen="1" title="YouTube video player" width="490" height="280" src="//www.youtube-nocookie.com/embed/'.$video->getYoutube().'?enablejsapi=1&widgetid=1" kwframeid="2"></iframe>';
  882.                     }
  883.                 }
  884.             }
  885. //            $description .= '</div>';
  886.         }
  887.         //links
  888.         if($this->asset and sizeof($this->asset->getAssetLinks()) > 0 ){
  889.             $description .='<ul>';
  890.             foreach ($this->asset->getAssetLinks() as $assetImage){
  891.                 if($assetImage->getLink()){
  892.                     $link = $assetImage->getLink();
  893.                     $title = $link->getTitle();
  894.                     $url = $link->getUrl();
  895.                     $description .= '<li><a href='.$url.'>'.$title.'</a></li>';
  896.                 }
  897.             }
  898.             $description .='</ul>';
  899.         }
  900.         //bijlagen
  901.         if($this->asset and sizeof($this->asset->getAssetAttachments()) > 0 ){
  902.             $description .='<ul>';
  903.             foreach ($this->asset->getAssetAttachments() as $assetImage){
  904.                 if($assetImage->getAttachment()){
  905.                     $attachment = $assetImage->getAttachment();
  906.                     $domain = 'https://www.notaris.be/';
  907.                     if($attachment->getLocale() != 'nl'){
  908.                         $domain = 'https://www.notaire.be/';
  909.                     }
  910.                     $description .= '<li><a href='.$domain .'uploads/' . $attachment->getLocale() . $attachment->getFilename().'>'.$attachment->getOriginalFilename().'</a></li>';
  911.                 }
  912.             }
  913.             $description .='</ul>';
  914.         }
  915.         //bron + auteur
  916.          if($this->getSource()){
  917.             $bron = 'Bron';
  918.             if($this->getLocale() != 'nl'){
  919.                 $bron = 'Source';
  920.             }
  921.             $description .= '<p>'.$bron.':'. $this->getSource().'</p>';
  922.          }
  923.          if($this->getAuthor()){
  924.              $auteur = 'Auteur';
  925.              $description .= '<p>'.$auteur.':'. $this->getAuthor().'</p>';
  926.          }
  927.         return  $description;
  928.     }
  929.     public function getFeedItemIntroduction()
  930.     {
  931.         return  $this->introduction;
  932.     }
  933.     public function getFeedItemSubtitle()
  934.     {
  935.         return  $this->subtitle;
  936.     }
  937.     public function getFeedItemPubDate()
  938.     {
  939.         return $this->getPublicationDate();
  940.     }
  941.     public function getFeedItemRouteName()
  942.     {
  943.         return 'notaris_frontend_news_detail';
  944.     }
  945.     public function getFeedItemRouteParameters()
  946.     {
  947.         return array('slug' => $this->slug);
  948.     }
  949.     public function getFeedItemUrlAnchor()
  950.     {
  951.         return '';
  952.     }
  953.     /**
  954.      * Add category
  955.      *
  956.      * @param \Notaris\AdminBundle\Entity\IzimiCategory $category
  957.      *
  958.      * @return News
  959.      */
  960.     public function addCategory(\Notaris\AdminBundle\Entity\IzimiCategory $category)
  961.     {
  962.         $this->categories[] = $category;
  963.         return $this;
  964.     }
  965.     /**
  966.      * Remove category
  967.      *
  968.      * @param \Notaris\AdminBundle\Entity\IzimiCategory $category
  969.      */
  970.     public function removeCategory(\Notaris\AdminBundle\Entity\IzimiCategory $category)
  971.     {
  972.         $this->categories->removeElement($category);
  973.     }
  974.     /**
  975.      * Get categories
  976.      *
  977.      * @return \Doctrine\Common\Collections\Collection
  978.      */
  979.     public function getCategories()
  980.     {
  981.         return $this->categories;
  982.     }
  983.     /**
  984.      * Set isIzimi
  985.      *
  986.      * @param boolean $isIzimi
  987.      * @return News
  988.      */
  989.     public function setIsIzimi(bool $isIzimi)
  990.     {
  991.         $this->isIzimi = $isIzimi;
  992.         return $this;
  993.     }
  994.     /**
  995.      * Get isIzimi
  996.      *
  997.      * @return boolean
  998.      */
  999.     public function getIsIzimi()
  1000.     {
  1001.         return $this->isIzimi;
  1002.     }
  1003.     /**
  1004.      * Returns a custom media field
  1005.      *
  1006.      * @return string
  1007.      */
  1008.     public function getFeedMediaItem()
  1009.     {
  1010.         $mediaItems = array();
  1011.         if($this->asset and sizeof($this->asset->getAssetImages()) > 0 ){
  1012.             foreach ($this->asset->getAssetImages() as $assetImage){
  1013.                 if($assetImage->getImage()){
  1014.                     $image = $assetImage->getImage();
  1015.                     $domain = 'https://www.notaris.be/';
  1016.                     if($image->getLocale() != 'nl'){
  1017.                         $domain = 'https://www.notaire.be/';
  1018.                     }
  1019.                     $mediaItems[] = array(
  1020.                         'type'   => 'image/jpeg',
  1021.                         'length' => 500,
  1022.                         'value'  => $domain .'uploads/' . $image->getLocale() . $image->getFilename()
  1023.                     );
  1024.                 }
  1025.             }
  1026.         }
  1027.         return $mediaItems;
  1028.     }
  1029.     /**
  1030.      * Returns a custom media field
  1031.      *
  1032.      * @return string
  1033.      */
  1034.     public function getFeedAttachmentMediaItem()
  1035.     {
  1036.         $mediaItems = array();
  1037.         if($this->asset and sizeof($this->asset->getAssetAttachments()) > 0 ){
  1038.             foreach ($this->asset->getAssetAttachments() as $assetImage){
  1039.                 if($assetImage->getAttachment()){
  1040.                     $attachment = $assetImage->getAttachment();
  1041.                     $domain = 'https://www.notaris.be/';
  1042.                     if($attachment->getLocale() != 'nl'){
  1043.                         $domain = 'https://www.notaire.be/';
  1044.                     }
  1045.                     $mediaItems[] = array(
  1046.                         'type'   => $attachment->getFileType(),
  1047.                         'length' => 500,
  1048.                         'value'  => $domain .'uploads/' . $attachment->getLocale() . $attachment->getFilename()
  1049.                     );
  1050.                 }
  1051.             }
  1052.         }
  1053.         return $mediaItems;
  1054.     }
  1055.     /**
  1056.      * Returns a custom media field
  1057.      *
  1058.      * @return string
  1059.      */
  1060.     public function getFeedVideoMediaItem()
  1061.     {
  1062.         $mediaItems = array();
  1063.         if($this->asset and sizeof($this->asset->getAssetVideoPaths()) > 0 ){
  1064.             foreach ($this->asset->getAssetVideoPaths() as $assetImage){
  1065.                 if($assetImage->getVideoPath()){
  1066.                     $video = $assetImage->getVideoPath();
  1067.                     $domain = 'https://www.notaris.be/';
  1068.                     if($video->getLocale() != 'nl'){
  1069.                         $domain = 'https://www.notaire.be/';
  1070.                     }
  1071.                     if($video->getPath() != '') {
  1072.                         $mediaItems[] = array(
  1073.                             'type' => 'video/mp4',
  1074.                             'length' => 500,
  1075.                             'value' => $domain . 'video/' . $video->getLocale() . '/' . $video->getPath()
  1076.                         );
  1077.                     }
  1078.                 }
  1079.             }
  1080.         }
  1081.         return $mediaItems;
  1082.     }
  1083.     /**
  1084.      * Returns a custom media field
  1085.      *
  1086.      * @return string
  1087.      */
  1088.     public function getLinkItems()
  1089.     {
  1090.         $items = array();
  1091.         if($this->asset and sizeof($this->asset->getAssetLinks()) > 0 ){
  1092.             foreach ($this->asset->getAssetLinks() as $assetImage){
  1093.                 if($assetImage->getLink()){
  1094.                     $link = $assetImage->getLink();
  1095.                     $title = $link->getTitle();
  1096.                     $url = $link->getUrl();
  1097.                     $items[] =
  1098.                         new GroupItemField('link', array(
  1099.                         new ItemField('url', $url),
  1100.                         new ItemField('title', $title),
  1101.                     ));
  1102.                 }
  1103.             }
  1104.         }
  1105.         return new GroupItemField('links', array($items));
  1106. //        return array($items);
  1107.     }
  1108. }