outputCalendar($client);
     } else {
         echo "Usage: php {$argv[0]} {$argv[1]} " . "<username> <password>\n";
     }
     break;
 case 'outputCalendarMagicCookie':
     if ($argc == 4) {
         outputCalendarMagicCookie($argv[2], $argv[3]);
     } else {
         echo "Usage: php {$argv[0]} {$argv[1]} " . "<username> <magicCookie>\n";
     }
     break;
 case 'outputCalendarByDateRange':
     if ($argc == 6) {
         $client = getClientLoginHttpClient($argv[2], $argv[3]);
         outputCalendarByDateRange($client, $argv[4], $argv[5]);
     } else {
         echo "Usage: php {$argv[0]} {$argv[1]} " . "<username> <password> <startDate> <endDate>\n";
     }
     break;
 case 'outputCalendarList':
     if ($argc == 4) {
         $client = getClientLoginHttpClient($argv[2], $argv[3]);
         outputCalendarList($client);
     } else {
         echo "Usage: php {$argv[0]} {$argv[1]} " . "<username> <password>\n";
     }
     break;
 case 'updateAtomEntry':
     if ($argc == 6) {
         $client = getClientLoginHttpClient($argv[2], $argv[3]);
Пример #2
0
require_once 'includes/classes/googlecalendar.class.php';
define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
//Default values
define('CALENDAR_DEF_COLOR', '#3399FF');
$gcalobj = new GoogleCalendar();
$qry = "SELECT * FROM %scalendar_google_sync WHERE userid=%d";
$row = queryDB($qry, array(TABLE_PREFIX, $_SESSION['member_id']), TRUE);
if (count($row) > 0) {
    $_SESSION['sessionToken'] = $row['token'];
    if ($gcalobj->isvalidtoken($_SESSION['sessionToken'])) {
        $client = $gcalobj->getAuthSubHttpClient();
        $query = "SELECT * FROM %scalendar_google_sync WHERE userid= %d";
        $rowval = queryDB($query, array(TABLE_PREFIX, $_SESSION['member_id']), TRUE);
        $prevval = $rowval['calids'];
        outputCalendarByDateRange($client, $_GET['start'], $_GET['end'], $prevval, $gcalobj);
    }
}
/**
 * Iterate through all the Google Calendars and create a JSON encoded array of events.
 *
 * @return array of events in JSON format
 */
function outputCalendarByDateRange($client, $startDate, $endDate, $idsofcal, $gcalobj)
{
    $gdataCal = new Zend_Gdata_Calendar($client);
    $rows = array();
    $idsofcal = explode(',', $idsofcal);
    $calFeed = $gdataCal->getCalendarListFeed();
    foreach ($idsofcal as $idofcal) {
        if ($idofcal != '') {