Exemplo n.º 1
0
 public function updateEvent(Event $event, Reservation $reservation)
 {
     $event->setStart($reservation->getStartInTimestamp());
     $event->setEnd($reservation->getEndInTimestamp());
     $event->setTitle($this->translator->trans('reservation', [], 'reservation') . ' - ' . $reservation->getResource()->getName());
     $event->setIsEditable(false);
     return $event;
 }
Exemplo n.º 2
0
 /**
  * Set the event date.
  * Only use this method for events created or updated through AgendaType.
  *
  * @param Event $event
  */
 private function setEventDate(Event $event)
 {
     if ($event->isAllDay()) {
         // If it's a task we set the start date at the beginning of the day
         if ($event->isTask()) {
             $event->setStart(strtotime($event->getEndInDateTime()->format('Y-m-d') . ' 00:00:00'));
         } else {
             $event->setStart(strtotime($event->getStartInDateTime()->format('Y-m-d') . ' 00:00:00'));
         }
         $event->setEnd(strtotime($event->getEndInDateTime()->format('Y-m-d') . ' 24:00:00'));
     } else {
         // If it's a task, we subtract 30 min so that the event is not a simple line on the calendar
         if ($event->isTask()) {
             $event->setStart($event->getEndInTimestamp() - 30 * 60);
         } else {
             $event->setStart($event->getStartInTimestamp());
         }
         $event->setEnd($event->getEndInTimestamp());
     }
 }
 private function createAgendaEventDrop(DateTime $startDate, DateTime $endDate, $user, Dropzone $dropzone, $type = "drop")
 {
     /*
     $dateTS = new DateTime();
     $dateTS = $startDate;
     echo "TS : " . $dateTS;
     echo "TS = " . $dateTS->getTimestamp();
     */
     $event = new Event();
     $event->setStart($startDate);
     $event->setEnd($endDate);
     $event->setUser($user);
     $dropzoneName = $dropzone->getResourceNode()->getName();
     if ($type == 'drop') {
         $title = $this->get('translator')->trans('Deposit phase of the %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $desc = $this->get('translator')->trans('Evaluation %dropzonename% opening', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $event->setTitle($title);
         $event->setDescription($desc);
     } else {
         $title = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $desc = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $event->setTitle($title);
         $event->setDescription($desc);
     }
     $em = $this->getDoctrine()->getManager();
     $em->persist($event);
     $em->flush();
     return $event;
 }
Exemplo n.º 4
0
 private function createAgendaEventDrop($startDate, $endDate, $user, Dropzone $dropzone, $type = 'drop')
 {
     $event = new Event();
     $event->setStart($startDate->getTimeStamp());
     $event->setEnd($endDate->getTimeStamp());
     $event->setUser($user);
     $dropzoneName = $dropzone->getResourceNode()->getName();
     if ($type == 'drop') {
         $title = $this->get('translator')->trans('Deposit phase of the %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'icap_dropzone');
         $desc = $this->get('translator')->trans('Evaluation %dropzonename% opening', array('%dropzonename%' => $dropzoneName), 'icap_dropzone');
         $event->setTitle($title);
         $event->setDescription($desc);
     } else {
         $title = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'icap_dropzone');
         $desc = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'icap_dropzone');
         $event->setTitle($title);
         $event->setDescription($desc);
     }
     $em = $this->getDoctrine()->getManager();
     $em->persist($event);
     $em->flush();
     return $event;
 }
 private function createAgendaEventDrop(User $user, Dropzone $dropzone)
 {
     $translator = $this->container->get('translator');
     $em = $this->container->get('doctrine')->getEntityManager();
     $event = new Event();
     $event->setStart($dropzone->getStartAllowDrop());
     $event->setEnd($dropzone->getEndAllowDrop());
     $event->setUser($user);
     $dropzoneName = $dropzone->getResourceNode()->getName();
     $title = $translator->trans('Deposit phase of the %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
     $desc = $translator->trans('Evaluation %dropzonename% opening', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
     $event->setTitle($title);
     $event->setDescription($desc);
     $em->persist($event);
     $em->flush();
     return $event;
 }