本文整理汇总了PHP中Zend_Gdata_Calendar类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar类的具体用法?PHP Zend_Gdata_Calendar怎么用?PHP Zend_Gdata_Calendar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Gdata_Calendar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testNormalWebContentShouldHaveNoExtensionElements
public function testNormalWebContentShouldHaveNoExtensionElements()
{
$this->webContent->url = "http://nowhere.invalid/";
$this->webContent->height = "100";
$this->webContent->width = "200";
$this->assertEquals($this->webContent->url, "http://nowhere.invalid/");
$this->assertEquals($this->webContent->height, "100");
$this->assertEquals($this->webContent->width, "200");
$this->assertEquals(count($this->webContent->extensionElements), 0);
$newWebContent = new Zend_Gdata_Calendar_Extension_WebContent();
$newWebContent->transferFromXML($this->webContent->saveXML());
$this->assertEquals(count($newWebContent->extensionElements), 0);
$newWebContent->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newWebContent->extensionElements), 1);
$this->assertEquals($newWebContent->url, "http://nowhere.invalid/");
$this->assertEquals($newWebContent->height, "100");
$this->assertEquals($newWebContent->width, "200");
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newWebContent2 = $cal->newWebContent();
$newWebContent2->transferFromXML($newWebContent->saveXML());
$this->assertEquals(count($newWebContent2->extensionElements), 1);
$this->assertEquals($newWebContent2->url, "http://nowhere.invalid/");
$this->assertEquals($newWebContent2->height, "100");
$this->assertEquals($newWebContent2->width, "200");
}
开发者ID:shojibflamon,项目名称:Bar-Code-example,代码行数:26,代码来源:WebContentTest.php
示例2: getFeeds
function getFeeds($startdate, $enddate)
{
global $dayinseconds;
$feeds = array();
$calendars = array('[email protected]', 'en.usa%[email protected]', 'communityhigh.net_cqt4f59nci2gvtftuqseal396o%40group.calendar.google.com', 'communityhigh.net_5d3b9b97gj76hqmk9ir4s2usm8%40group.calendar.google.com');
foreach ($calendars as $user) {
/* @var $service Zend_Gdata_Calendar */
$service = new Zend_Gdata_Calendar();
/* @var $query Zend_Gdata_Calendar_EventQuery */
$query = $service->newEventQuery();
$query->setUser($user);
$query->setOrderby('starttime');
$query->setSortOrder('ascending');
$query->setMaxResults(100000);
//get days events: event: name, description
$query->setStartMin(date(DATE_RFC3339, $startdate));
$query->setStartMax(date(DATE_RFC3339, $enddate + 6 * $dayinseconds));
try {
$feeds[] = $service->getCalendarEventFeed($query);
//foreach($eventFeed as $event)
// var_dump($event->when);
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getMessage();
}
}
return $feeds;
}
开发者ID:safiayonker,项目名称:custom-planner,代码行数:27,代码来源:functions.php
示例3: outputCalendarList
/**
* Outputs an HTML unordered list (ul), with each list item representing a
* calendar in the authenticated user's calendar list.
*
* @param Zend_Http_Client $client The authenticated client object
* @return void
*/
function outputCalendarList($client)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$calFeed = $gdataCal->getCalendarListFeed();
echo "<h1>" . $calFeed->title->text . "</h1>\n";
echo "<ul>\n";
foreach ($calFeed as $calendar) {
echo "\t<li>" . $calendar->title->text . "</li>\n";
}
echo "</ul>\n";
}
开发者ID:ramyarangan,项目名称:CS50Organizations,代码行数:18,代码来源:calendarSetup.php
示例4: addEvent
function addEvent($title = 'Новый заказ', $desc = 'Описание заказа', $where = 'интернет-магазин', $startDate, $endDate, $sms_reminder)
{
try {
set_include_path('.' . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/modules/gcalendar/' . PATH_SEPARATOR . get_include_path());
include_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_HttpClient');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$client = Zend_Gdata_ClientLogin::getHttpClient($this->_user, $this->_pass, "cl");
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();
$newEvent->title = $gdataCal->newTitle($title);
$newEvent->where = array($gdataCal->newWhere($where));
$newEvent->content = $gdataCal->newContent($desc);
$when = $gdataCal->newWhen();
$when->startTime = $startDate;
$when->endTime = $endDate;
if (intval($sms_reminder)) {
$reminder = $gdataCal->newReminder();
$reminder->method = "sms";
$reminder->minutes = "0";
$when->reminders = array($reminder);
}
$newEvent->when = array($when);
$createdEvent = $gdataCal->insertEvent($newEvent);
return $createdEvent->id->text;
} catch (Exception $ex) {
// Report the exception to the user
}
}
开发者ID:sonicse,项目名称:gcalendar_prestashop,代码行数:32,代码来源:GCalendarEvent.php
示例5: setPlanning
public function setPlanning($startDate, $endDate, $title, $content)
{
// Parameters for ClientAuth authentication
ProjectConfiguration::registerZend();
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = sfConfig::get('app_gmail_user');
$pass = sfConfig::get('app_gmail_pwd');
// Create an authenticated HTTP client
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
// Create an instance of the Calendar service
$service = new Zend_Gdata_Calendar($client);
// Create a new entry using the calendar service's magic factory method
$event = $service->newEventEntry();
// Populate the event with the desired information
// Note that each attribute is crated as an instance of a matching class
$event->title = $service->newTitle($title);
$event->where = array($service->newWhere("Paris, France"));
$event->content = $service->newContent($content);
// Set the date using RFC 3339 format.
$tzOffset = "+02";
$when = $service->newWhen();
//$when->startTime = "{$start_date}.000{$tzOffset}:00";
//$when->endTime = "{$end_date}.000{$tzOffset}:00";
$when->startTime = "{$startDate}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}:00.000{$tzOffset}:00";
$event->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the server is returned
$newEvent = $service->insertEvent($event);
}
开发者ID:sfinx13,项目名称:appsmartproject,代码行数:33,代码来源:MobilyrentLocationTable.class.php
示例6: testNormalQuickAddShouldHaveNoExtensionElements
public function testNormalQuickAddShouldHaveNoExtensionElements()
{
$this->quickAdd->value = false;
$this->assertEquals($this->quickAdd->value, false);
$this->assertEquals(count($this->quickAdd->extensionElements), 0);
$newQuickAdd = new Zend_Gdata_Calendar_Extension_QuickAdd();
$newQuickAdd->transferFromXML($this->quickAdd->saveXML());
$this->assertEquals(count($newQuickAdd->extensionElements), 0);
$newQuickAdd->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newQuickAdd->extensionElements), 1);
$this->assertEquals($newQuickAdd->value, false);
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newQuickAdd2 = $cal->newQuickAdd();
$newQuickAdd2->transferFromXML($newQuickAdd->saveXML());
$this->assertEquals(count($newQuickAdd2->extensionElements), 1);
$this->assertEquals($newQuickAdd2->value, false);
}
开发者ID:omusico,项目名称:sugar_work,代码行数:18,代码来源:QuickAddTest.php
示例7: testNormalSendEventNotificationsShouldHaveNoExtensionElements
public function testNormalSendEventNotificationsShouldHaveNoExtensionElements()
{
$this->sendEventNotifications->value = true;
$this->assertEquals($this->sendEventNotifications->value, true);
$this->assertEquals(count($this->sendEventNotifications->extensionElements), 0);
$newSendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications();
$newSendEventNotifications->transferFromXML($this->sendEventNotifications->saveXML());
$this->assertEquals(count($newSendEventNotifications->extensionElements), 0);
$newSendEventNotifications->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newSendEventNotifications->extensionElements), 1);
$this->assertEquals($newSendEventNotifications->value, true);
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newSendEventNotifications2 = $cal->newSendEventNotifications();
$newSendEventNotifications2->transferFromXML($newSendEventNotifications->saveXML());
$this->assertEquals(count($newSendEventNotifications2->extensionElements), 1);
$this->assertEquals($newSendEventNotifications2->value, true);
}
开发者ID:omusico,项目名称:sugar_work,代码行数:18,代码来源:SendEventNotificationsTest.php
示例8: testNormalColorShouldHaveNoExtensionElements
public function testNormalColorShouldHaveNoExtensionElements()
{
$this->color->value = '#abcdef';
$this->assertEquals($this->color->value, '#abcdef');
$this->assertEquals(count($this->color->extensionElements), 0);
$newColor = new Zend_Gdata_Calendar_Extension_Color();
$newColor->transferFromXML($this->color->saveXML());
$this->assertEquals(count($newColor->extensionElements), 0);
$newColor->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newColor->extensionElements), 1);
$this->assertEquals($newColor->value, '#abcdef');
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newColor2 = $cal->newColor();
$newColor2->transferFromXML($newColor->saveXML());
$this->assertEquals(count($newColor2->extensionElements), 1);
$this->assertEquals($newColor2->value, '#abcdef');
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:18,代码来源:ColorTest.php
示例9: testNormalTimezoneShouldHaveNoExtensionElements
public function testNormalTimezoneShouldHaveNoExtensionElements()
{
$this->timezone->value = "America/Chicago";
$this->assertEquals($this->timezone->value, "America/Chicago");
$this->assertEquals(count($this->timezone->extensionElements), 0);
$newTimezone = new Zend_Gdata_Calendar_Extension_Timezone();
$newTimezone->transferFromXML($this->timezone->saveXML());
$this->assertEquals(count($newTimezone->extensionElements), 0);
$newTimezone->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newTimezone->extensionElements), 1);
$this->assertEquals($newTimezone->value, "America/Chicago");
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newTimezone2 = $cal->newTimezone();
$newTimezone2->transferFromXML($newTimezone->saveXML());
$this->assertEquals(count($newTimezone2->extensionElements), 1);
$this->assertEquals($newTimezone2->value, "America/Chicago");
}
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:18,代码来源:TimezoneTest.php
示例10: testNormalAccessLevelShouldHaveNoExtensionElements
public function testNormalAccessLevelShouldHaveNoExtensionElements()
{
$this->accessLevel->value = 'freebusy';
$this->assertEquals($this->accessLevel->value, 'freebusy');
$this->assertEquals(count($this->accessLevel->extensionElements), 0);
$newAccessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel();
$newAccessLevel->transferFromXML($this->accessLevel->saveXML());
$this->assertEquals(count($newAccessLevel->extensionElements), 0);
$newAccessLevel->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newAccessLevel->extensionElements), 1);
$this->assertEquals($newAccessLevel->value, 'freebusy');
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newAccessLevel2 = $cal->newAccessLevel();
$newAccessLevel2->transferFromXML($newAccessLevel->saveXML());
$this->assertEquals(count($newAccessLevel2->extensionElements), 1);
$this->assertEquals($newAccessLevel2->value, 'freebusy');
}
开发者ID:jsnshrmn,项目名称:Suma,代码行数:18,代码来源:AccessLevelTest.php
示例11: testNormalLinkShouldHaveNoExtensionElements
public function testNormalLinkShouldHaveNoExtensionElements()
{
$this->link->rel = "http://nowhere.invalid/";
$this->link->title = "Somewhere";
$this->link->href = "http://somewhere.invalid/";
$this->link->type = "text/plain";
$this->link->webContent = new Zend_Gdata_Calendar_Extension_WebContent("a", "1", "2");
$this->assertEquals($this->link->rel, "http://nowhere.invalid/");
$this->assertEquals($this->link->title, "Somewhere");
$this->assertEquals($this->link->href, "http://somewhere.invalid/");
$this->assertEquals($this->link->type, "text/plain");
$this->assertEquals($this->link->webcontent->url, "a");
$this->assertEquals($this->link->webcontent->height, "1");
$this->assertEquals($this->link->webcontent->width, "2");
$this->assertEquals(count($this->link->extensionElements), 0);
$newLink = new Zend_Gdata_Calendar_Extension_Link();
$newLink->transferFromXML($this->link->saveXML());
$this->assertEquals(count($newLink->extensionElements), 0);
$newLink->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newLink->extensionElements), 1);
$this->assertEquals($this->link->rel, "http://nowhere.invalid/");
$this->assertEquals($this->link->title, "Somewhere");
$this->assertEquals($this->link->href, "http://somewhere.invalid/");
$this->assertEquals($this->link->type, "text/plain");
$this->assertEquals($this->link->webcontent->url, "a");
$this->assertEquals($this->link->webcontent->height, "1");
$this->assertEquals($this->link->webcontent->width, "2");
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newLink2 = $cal->newLink();
$newLink2->transferFromXML($newLink->saveXML());
$this->assertEquals(count($newLink2->extensionElements), 1);
$this->assertEquals($this->link->rel, "http://nowhere.invalid/");
$this->assertEquals($this->link->title, "Somewhere");
$this->assertEquals($this->link->href, "http://somewhere.invalid/");
$this->assertEquals($this->link->type, "text/plain");
$this->assertEquals($this->link->webcontent->url, "a");
$this->assertEquals($this->link->webcontent->height, "1");
$this->assertEquals($this->link->webcontent->width, "2");
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:40,代码来源:LinkTest.php
示例12: createEvent
/**
* Creates an event on the authenticated user's default calendar with the
* specified event details.
*
* @param Zend_Http_Client $client The authenticated client object
* @param string $title The event title
* @param string $desc The detailed description of the event
* @param string $where
* @param string $startDate The start date of the event in YYYY-MM-DD format
* @param string $startTime The start time of the event in HH:MM 24hr format
* @param string $endDate The end date of the event in YYYY-MM-DD format
* @param string $endTime The end time of the event in HH:MM 24hr format
* @param string $tzOffset The offset from GMT/UTC in [+-]DD format (eg -08)
* @return string The ID URL for the event.
*/
function createEvent($client, $title = 'Tennis with Beth', $desc = 'Meet for a quick lesson', $where = 'On the courts', $startDate = '2008-01-20', $startTime = '10:00', $endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08')
{
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$newEntry->where = array($gc->newWhere($where));
$newEntry->content = $gc->newContent($desc);
$newEntry->content->type = 'text';
$when = $gc->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$newEntry->when = array($when);
$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
}
开发者ID:RamonCidL,项目名称:Carrilanas,代码行数:30,代码来源:CarreraConInscripciones.php
示例13: createEvent
function createEvent($client, $title = 'Tennis with Beth', $desc = 'Meet for a quick lesson', $startDate = '2012-01-20', $endDate = '2012-01-20')
{
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();
$newEvent->title = $gdataCal->newTitle($title);
//$newEvent->where = array($gdataCal->newWhere($where));
$newEvent->content = $gdataCal->newContent("{$desc}");
$when = $gdataCal->newWhen();
$when->startTime = "{$startDate}";
$when->endTime = "{$endDate}";
$newEvent->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the server is returned
$createdEvent = $gdataCal->insertEvent($newEvent);
return $createdEvent->id->text;
}
开发者ID:rasomu,项目名称:chuza,代码行数:16,代码来源:publish_calendar.php
示例14: updateEvent
function updateEvent($recordid, $eventOld, $Data, $tzOffset = '+00:00')
{
set_include_path($this->root_directory . "modules/Calendar4You/");
$startDate = $Data["date_start"];
$endDate = $Data["due_date"];
$startTime = $Data["time_start"];
$endTime = $Data["time_end"];
$GCalClass = new Zend_Gdata_Calendar($this->gClient);
$eventOld->title = $GCalClass->newTitle(trim($Data["subject"]));
$eventOld->where = array($GCalClass->newWhere(trim($Data["location"])));
$eventOld->content = $GCalClass->newContent($Data["description"]);
$when = $GCalClass->newWhen();
$when->startTime = $startDate . 'T' . $this->removeLastColon($startTime) . ':00.000' . $tzOffset;
$when->endTime = $endDate . 'T' . $this->removeLastColon($endTime) . ':00.000' . $tzOffset;
$eventOld->when = array($when);
$whos = $this->getInvitedUsersEmails($GCalClass, $recordid);
if (count($whos) > 0) {
$eventOld->setWho($whos);
}
try {
$eventOld->save();
$status = true;
} catch (Zend_Gdata_App_Exception $e) {
$status = null;
}
set_include_path($this->root_directory);
return $status;
}
开发者ID:mslokhat,项目名称:corebos,代码行数:28,代码来源:GoogleSync4You.php
示例15: isset
// various copy includes
require_once "../../config.gen.inc.php";
require_once "data/data.inc.php";
// records stats
require_once "../page_builder/page_header.php";
// sets up google calendar classes
require_once "lib/google_calendar.init.php";
// libs
require_once "lib/calendar.lib.php";
require_once "lib/textformat.lib.php";
$search_terms = $_REQUEST['filter'];
$search_options = SearchOptions::get_options();
$timeframe = isset($_REQUEST['timeframe']) ? $_REQUEST['timeframe'] : 0;
$dates = SearchOptions::search_dates($timeframe);
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
// predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($username . '@gmail.com', $password, $service);
$gdataCal = new Zend_Gdata_Calendar($client);
$query = $gdataCal->newEventQuery();
$query->setUser($calendars['all']['user']);
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortorder('a');
$query->setStartMin($dates['start']);
$query->setStartMax($dates['end']);
$query->setmaxresults('50');
$query->setQuery($search_terms);
$eventFeed = $gdataCal->getCalendarEventFeed($query);
require "templates/{$prefix}/search.html";
$page->output();
开发者ID:brownell,项目名称:get311,代码行数:31,代码来源:search.php
示例16: define
/* */
/* Author: Anurup Raveendran, Herat Gandhi */
/* This program is free software. You can redistribute it and/or*/
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation. */
/****************************************************************/
/**
* This file is used to reflect changes from ATutor to Google Calendar.
*/
$_user_location = 'public';
require_once 'includes/classes/googlecalendar.class.php';
define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
$gcalobj = new GoogleCalendar();
$client = $gcalobj->getAuthSubHttpClient();
$gdata_cal = new Zend_Gdata_Calendar($client);
$event_url = $_GET['id'];
$command = $_GET['cmd'];
try {
//Get the event object from its id.
$event = $gdata_cal->getCalendarEventEntry($event_url);
if (strcmp($command, 'delete') == 0) {
//If event is deleted then call delete method.
$event->delete();
} else {
if (strcmp($command, 'update') == 0) {
//Update event attributes and then save it in Google Calendar.
$event->title = $gdata_cal->newTitle($_GET['title']);
$when = $gdata_cal->newWhen();
$when->startTime = $_GET['start'];
$when->endTime = $_GET['end'];
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:google_calendar_update.php
示例17: createEvent
/**
* Creates an event on the authenticated users default calendar with the
* specified event details.
*
* @return string The id URL for the event.
*/
public function createEvent(TA_Model_Resource_Db_Table_Row_Abstract $values)
{
$values = $this->_modifyValues($values);
$gc = new Zend_Gdata_Calendar($this->_client);
$newEntry = $gc->newEventEntry();
// set event properties
$newEntry->title = $gc->newTitle(trim($values['title']));
$newEntry->where = array($gc->newWhere($values['location']));
$newEntry->content = $gc->newContent($values['description']);
$newEntry->content->type = 'text';
$when = $gc->newWhen();
$start = date_create($values['start']);
$end = date_create($values['end']);
$when->startTime = date_format($start, 'Y-m-d\\TH:i:s.000P');
$when->endTime = date_format($end, 'Y-m-d\\TH:i:s.000P');
$newEntry->when = array($when);
$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
}
开发者ID:GEANT,项目名称:CORE,代码行数:25,代码来源:GoogleTest.php
示例18: gCalendar
/**
* Get the user notes from Google calendar (Gdata Zend functions are necessary)
*/
public function gCalendar() {
// Security check
$this->throwForbiddenUnless(SecurityUtil::checkPermission('IWagendas::', '::', ACCESS_READ));
// get user uid
$user = (UserUtil::getVar('uid') == '') ? '-1' : UserUtil::getVar('uid');
$usability = ModUtil::func('IWagendas', 'user', 'getGdataFunctionsUsability');
if ($usability !== true) {
throw new Zikula_Exception_Forbidden();
}
//Load required classes
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_HttpClient');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
//@var string Location of AuthSub key file. include_path is used to find this
$_authSubKeyFile = null; // Example value for secure use: 'mykey.pem'
//@var string Passphrase for AuthSub key file.
$_authSubKeyFilePassphrase = null;
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$userSettings = ModUtil::func('IWagendas', 'user', 'getUserGCalendarSettings');
if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($userSettings['gUserName'], base64_decode($userSettings['gUserPass']), $service);
} catch (exception $e) {
$authSubUrl = ModUtil::func('IWagendas', 'user', 'getAuthSubUrl');
return System::redirect(ModUtil::url('IWwebbox', 'user', 'main', array('url' => str_replace('&', '*', str_replace('?', '**', $authSubUrl)))));
}
} else
$client = ModUtil::func('IWagendas', 'user', 'getAuthSubHttpClient');
try {
$gdataCal = new Zend_Gdata_Calendar($client);
} catch (exception $e) {
LogUtil::registerError($this->__('Connection with Google failed. Imposible to synchronize the agenda'));
return false;
}
//get user calendars
try {
$calFeed = $gdataCal->getCalendarListFeed();
} catch (exception $e) {
LogUtil::registerError($this->__('Connection with Google failed. Imposible to synchronize the agenda'));
return false;
}
$gCalendarsIdsArray = array();
foreach ($calFeed as $calendar) {
$gCalendarsIdsArray[] = $calendar->id;
}
// Get all existing google calendars stored in database. We need them to know if the received google calendars exists or not
$gAgendas = ModUtil::apiFunc('IWagendas', 'user', 'getAllAgendas', array('gAgendas' => 1,
'gCalendarsIdsArray' => $gCalendarsIdsArray));
$gCalendarsIdsArray = array();
foreach ($gAgendas as $g) {
$gIds[$g['gCalendarId']] = $g;
}
$existingCalendar = array();
// Create or edit the calendars if it were necessary
foreach ($calFeed as $calendar) {
//sincronize calendars
$id = $calendar->id;
$resp = '$' . $user . '$';
$accessLevel = '$' . substr($calendar->accessLevel->value, 0, 4) . '|' . $user . '$';
$color = '$' . $calendar->color->value . '|' . $user . '$';
// Create a calendar array based on the calendar id
$existingCalendar["$id"] = 1;
if (!array_key_exists("$id", $gIds)) {
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$agenda = ModUtil::apiFunc('IWagendas', 'admin', 'create', array('nom_agenda' => $calendar->title,
'descriu' => $calendar->summary->text,
'c1' => $this->__('What'),
'c2' => $this->__('End'),
'c3' => $this->__('Where'),
'c4' => $this->__('Content'),
'c5' => $this->__('Author'),
'tc1' => 1,
'tc2' => 1,
'tc3' => 1,
'tc4' => 2,
'tc5' => 1,
'activa' => 1,
'adjunts' => 0,
'protegida' => 1,
'gColor' => '$' . $color,
'color' => '',
'gCalendarId' => $id,
'gAccessLevel' => '$' . $accessLevel,
'resp' => '$' . $resp,
'sv' => $sv));
// add new agenda into the array in case the agenda is created recently
$gIds["$id"] = $agenda;
} else {
if ($gIds["$id"]['nom_agenda'] != $calendar->title ||
$gIds["$id"]['descriu'] != $calendar->summary->text ||
strpos($gIds["$id"]['gColor'], $color) === false ||
strpos($gIds["$id"]['resp'], $resp) === false ||
strpos($gIds["$id"]['gAccessLevel'], $accessLevel) === false) {
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:User.php
示例19: deleteEventByUrl
/**
* Deletes the event specified by calling the Zend_Gdata::delete()
* method. The URL is typically in the format of:
* http://www.google.com/calendar/feeds/default/private/full/<eventId>
*
* @param Zend_Http_Client $client The authenticated client object
* @param string $url The url for the event to be deleted
* @return void
*/
function deleteEventByUrl(Zend_Http_Client $client, $url)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$gdataCal->delete($url);
}
开发者ID:jon9872,项目名称:zend-framework,代码行数:14,代码来源:Calendar-expanded.php
示例20: outputCalendarList
/**
* Display list of calendars in the sidemenu with
* checkbox ahead of each calendar's title.
*
* @param Zend client object
*
* @return void
*/
public function outputCalendarList($client)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$calFeed = $gdataCal->getCalendarListFeed();
//Get calendar list from database
$query = "SELECT * FROM %scalendar_google_sync WHERE userid=%d";
$rowval = queryDB($query, array(TABLE_PREFIX, $_SESSION['member_id']), TRUE);
$prevval = $rowval['calids'];
$selectd = '';
$i = 1;
//Iterate through each calendar id
foreach ($calFeed as $calendar) {
//set state according to database and if changed then update database
if (strpos($prevval, $calendar->id->text . ',') === false) {
$selectd = '';
} else {
$selectd = "checked='checked'";
}
echo "\t <div class='fc-square fc-inline-block'\n style='background-color:" . $calendar->color->value . "' ></div>\n <input id='gcal" . $i . "' type='checkbox' name ='calid' value='" . $calendar->id->text . "' " . $selectd . " onclick='if(this.checked) \$.get(\"mods/_standard/calendar/google_calendar_db_sync.php\",\n { calid: this.value, mode: \"add\" },function (data){ refreshevents(); } );\n else \$.get(\"mods/_standard/calendar/google_calendar_db_sync.php\",\n { calid: this.value, mode: \"remove\" },function (data){ refreshevents(); } );'\n />\n <label for='gcal" . $i . "'>" . $calendar->title->text . "</label><br/>";
$i++;
}
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:30,代码来源:googlecalendar.class.php
注:本文中的Zend_Gdata_Calendar类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论