示例#1
0
 public function getClient()
 {
     $mode = getenv('HttpPlayback');
     if ($mode == false) {
         $mode = 'playback';
     }
     $auth = ['server' => 'server', 'user' => 'user', 'password' => 'password'];
     if (is_file(getcwd() . '/Resources/auth.json')) {
         $auth = json_decode(file_get_contents(getcwd() . '/Resources/auth.json'), true);
     }
     $client = new API();
     $client->buildClient($auth['server'], $auth['user'], $auth['password'], ['httpPlayback' => ['mode' => $mode, 'recordFileName' => self::class . '::' . $this->getName() . '.json']]);
     return $client->getCalendar('Test');
 }
示例#2
0
<?php

use jamesiarmes\PEWS\API;
$api = new API();
$api->buildClient('server', 'username', 'password');
$calendar = $api->getCalendar();
$start = new DateTime('8:00 AM');
$end = new DateTime('9:00 AM');
$response = $calendar->createCalendarItems(array('Subject' => 'Test', 'Start' => $start->format('c'), 'End' => $end->format('c')));
<?php

use jamesiarmes\PEWS\API;
$api = new API();
$api->buildClient('server', 'username', 'password');
//Get the default calendar
$calendar = $api->getCalendar();
//Get a calendar by the name 'Test'
$calendar = $api->getCalendar('Test');
//Change what calendar you're working with once you've picked it
$calendar->pickCalendar('Holidays');