@@ 16-34 (lines=19) @@ | ||
13 | $this->calendar = $factory->createCalendar('default', 'reader'); |
|
14 | } |
|
15 | ||
16 | public function createEvent(DtoEvent $dtoEvent) |
|
17 | { |
|
18 | $event = new \Google_Service_Calendar_Event(); |
|
19 | ||
20 | $event->setSummary($dtoEvent->getSummary()); |
|
21 | $event->setDescription($dtoEvent->getDescription()); |
|
22 | $event->setLocation($dtoEvent->getLocation()); |
|
23 | $event->setVisibility('public'); |
|
24 | ||
25 | $start = new \Google_Service_Calendar_EventDateTime(); |
|
26 | $start->setDateTime($dtoEvent->getStart()); |
|
27 | $event->setStart($start); |
|
28 | ||
29 | $end = new \Google_Service_Calendar_EventDateTime(); |
|
30 | $end->setDateTime($dtoEvent->getEnd()); |
|
31 | $event->setEnd($end); |
|
32 | ||
33 | return $this->calendar->events->insert('primary', $event); |
|
34 | } |
|
35 | ||
36 | public function getEventList($calendarId = 'primary') |
|
37 | { |
|
@@ 54-71 (lines=18) @@ | ||
51 | return $this->calendar->events->delete('primary', $id); |
|
52 | } |
|
53 | ||
54 | public function editEvent(DtoEvent $dtoEvent, $id) |
|
55 | { |
|
56 | $event = $this->getEventById($id); |
|
57 | $event->setSummary($dtoEvent->getSummary()); |
|
58 | $event->setDescription($dtoEvent->getDescription()); |
|
59 | $event->setLocation($dtoEvent->getLocation()); |
|
60 | $event->setVisibility('public'); |
|
61 | ||
62 | $start = new \Google_Service_Calendar_EventDateTime(); |
|
63 | $start->setDateTime($dtoEvent->getStart()); |
|
64 | $event->setStart($start); |
|
65 | ||
66 | $end = new \Google_Service_Calendar_EventDateTime(); |
|
67 | $end->setDateTime($dtoEvent->getEnd()); |
|
68 | $event->setEnd($end); |
|
69 | ||
70 | return $this->calendar->events->patch('primary', $id, $event); |
|
71 | } |
|
72 | ||
73 | public function clear() |
|
74 | { |