1 | <?php |
||
5 | class GoogleCalendarManager |
||
6 | { |
||
7 | private $client; |
||
8 | |||
9 | private $calendar; |
||
10 | |||
11 | public function __construct() |
||
12 | { |
||
13 | $this->client = new \Google_Client(); |
||
14 | $this->client->setApplicationName('seattle'); |
||
15 | $this->client->setScopes([\Google_Service_Calendar::CALENDAR]); |
||
16 | $this->client->setAuthConfig(__DIR__.'/../../../app/config/credentials/credentials.json'); |
||
17 | |||
18 | $this->calendar = new \Google_Service_Calendar($this->client); |
||
19 | |||
20 | $scope = new \Google_Service_Calendar_AclRuleScope(); |
||
21 | $scope->setType('default'); |
||
22 | |||
23 | $rule = new \Google_Service_Calendar_AclRule(); |
||
24 | $rule->setRole('reader'); |
||
25 | $rule->setScope($scope); |
||
26 | |||
27 | $this->calendar->acl->insert('primary', $rule); |
||
28 | } |
||
29 | |||
30 | public function newEvent() |
||
49 | |||
50 | public function getEventList($calendarId = 'primary') |
||
57 | |||
58 | public function getEventById($id) |
||
62 | |||
63 | public function deleteEvent($id) |
||
67 | |||
68 | public function editEvent($id) |
||
74 | |||
75 | public function clear() |
||
83 | } |
||
84 |