Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getCalendarEvents($organizationId, $userId, $calendarId, $start, $end, $connections, $extraFields = [])
 {
     if (!$this->calendarConfig->isSystemCalendarEnabled() || !$this->securityFacade->isGranted('oro_system_calendar_view')) {
         return [];
     }
     //@TODO: temporary return all system calendars until BAP-6566 implemented
     ///** @var CalendarEventRepository $repo */
     //$repo = $this->doctrineHelper->getEntityRepository('OroCalendarBundle:CalendarEvent');
     //$qb = $repo->getSystemEventListByTimeIntervalQueryBuilder(
     //    $calendarId,
     //    $start,
     //    $end,
     //    []
     //);
     $extraFields = $this->filterSupportedFields($extraFields, 'Oro\\Bundle\\CalendarBundle\\Entity\\CalendarEvent');
     /** @var CalendarEventRepository $repo */
     $repo = $this->doctrineHelper->getEntityRepository('OroCalendarBundle:CalendarEvent');
     $qb = $repo->getSystemEventListByTimeIntervalQueryBuilder($start, $end, [], $extraFields)->andWhere('c.organization = :organizationId')->setParameter('organizationId', $organizationId);
     $invisibleIds = [];
     foreach ($connections as $id => $visible) {
         if (!$visible) {
             $invisibleIds[] = $id;
         }
     }
     if ($invisibleIds) {
         $qb->andWhere('c.id NOT IN (:invisibleIds)')->setParameter('invisibleIds', $invisibleIds);
     }
     return $this->calendarEventNormalizer->getCalendarEvents($calendarId, $qb->getQuery());
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getCalendarEvents($organizationId, $userId, $calendarId, $start, $end, $connections, $extraFields = [])
 {
     /** @var CalendarEventRepository $repo */
     $repo = $this->doctrineHelper->getEntityRepository('OroCalendarBundle:CalendarEvent');
     $qb = $repo->getUserEventListByTimeIntervalQueryBuilder($start, $end, [], $extraFields);
     $visibleIds = [];
     foreach ($connections as $id => $visible) {
         if ($visible) {
             $visibleIds[] = $id;
         }
     }
     if (!empty($visibleIds)) {
         $qb->andWhere('c.id IN (:visibleIds)')->setParameter('visibleIds', $visibleIds);
     } else {
         $qb->andWhere('1 = 0');
     }
     return $this->calendarEventNormalizer->getCalendarEvents($calendarId, $qb->getQuery());
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getCalendarEvents($organizationId, $userId, $calendarId, $start, $end, $connections, $extraFields = [])
 {
     if (!$this->calendarConfig->isPublicCalendarEnabled()) {
         return [];
     }
     /** @var CalendarEventRepository $repo */
     $repo = $this->doctrineHelper->getEntityRepository('OroCalendarBundle:CalendarEvent');
     $extraFields = $this->filterSupportedFields($extraFields, 'Oro\\Bundle\\CalendarBundle\\Entity\\CalendarEvent');
     $qb = $repo->getPublicEventListByTimeIntervalQueryBuilder($start, $end, [], $extraFields);
     $invisibleIds = [];
     foreach ($connections as $id => $visible) {
         if (!$visible) {
             $invisibleIds[] = $id;
         }
     }
     if (!empty($invisibleIds)) {
         $qb->andWhere('c.id NOT IN (:invisibleIds)')->setParameter('invisibleIds', $invisibleIds);
     }
     return $this->calendarEventNormalizer->getCalendarEvents($calendarId, $qb->getQuery());
 }
 /**
  * @param ReminderManager $reminderManager
  * @param SecurityFacade  $securityFacade
  */
 public function __construct(ReminderManager $reminderManager, SecurityFacade $securityFacade)
 {
     parent::__construct($reminderManager);
     $this->securityFacade = $securityFacade;
 }
 /**
  * @param ReminderManager $reminderManager
  * @param SecurityFacade  $securityFacade
  * @param DoctrineHelper  $doctrineHelper
  */
 public function __construct(ReminderManager $reminderManager, SecurityFacade $securityFacade, DoctrineHelper $doctrineHelper)
 {
     parent::__construct($reminderManager);
     $this->securityFacade = $securityFacade;
     $this->doctrineHelper = $doctrineHelper;
 }