Created
May 27, 2020 18:51
-
-
Save ltanase77/3a75725745a38fe6ec03ae3a3ecd85ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
$client = new Google_Client(); | |
//$client->useApplicationDefaultCredentials(); | |
$client->setAuthConfig(path/to/credentials_file); | |
$client->setApplicationName([appName]); | |
$client->addScope(Google_Service_Calendar::CALENDAR); | |
$client->setAccessType("offline"); | |
$query = $this->files->get_file_by($file, "file_number"); | |
if (is_array($query)) { | |
$service = new Google_Service_Calendar($client); | |
$event = new Google_Service_Calendar_Event(array( | |
'summary' => 'Termen instanță', | |
'location' => $query[0]['court'], | |
'description' => 'Termen în dosarul ' . $query[0]['file_number'], | |
'start' => array( | |
'dateTime' => $query[0]['last_hearing'] . 'T08:30:00', | |
'timeZone' => 'Europe/Bucharest', | |
), | |
'end' => array( | |
'dateTime' => $query[0]['last_hearing'] . 'T12:00:00', | |
'timeZone' => 'Europe/Bucharest', | |
), | |
)); | |
$calendarId = 'primary'; | |
$result = $service->events->insert($calendarId, $event); | |
print_r ($result); | |
} | |
} catch (Exception $e) { | |
//log_message('error', $e['message']); | |
echo $e; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment