本文整理汇总了PHP中Zend_Gdata_Calendar::getCalendarEventEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar::getCalendarEventEntry方法的具体用法?PHP Zend_Gdata_Calendar::getCalendarEventEntry怎么用?PHP Zend_Gdata_Calendar::getCalendarEventEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Calendar
的用法示例。
在下文中一共展示了Zend_Gdata_Calendar::getCalendarEventEntry方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEvent
/**
* Returns an entry object representing the event with the specified ID.
*
* @param Zend_Http_Client $client The authenticated client object
* @param string $eventId The event ID string
* @return Zend_Gdata_Calendar_EventEntry|null if the event is found, null if it's not
*/
function getEvent(Zend_Http_Client $client, $eventId)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$query = $gdataCal->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setEvent($eventId);
try {
$eventEntry = $gdataCal->getCalendarEventEntry($query);
return $eventEntry;
} catch (Zend_Gdata_App_Exception $e) {
return null;
}
}
示例2: deleteNote
//.........这里部分代码省略.........
}
}
$deleted = '';
if ($note['daid'] == $daid) {
if ($daid == 0) {
// Check if user is trying to delete an ouw note
if ($note['usuari'] != UserUtil::getVar('uid')) {
return $this->__('You are not allowed to administrate the agendas');
}
// Only in personal agendas the notes are deleted from database
if (ModUtil::apiFunc('IWagendas', 'user', 'delete', array('aid' => $aid))) {
// Success
$deleted = $aid;
}
// Check if it has got attached file and if it is needed in other notes
if ($note['fitxer'] != '') {
$n_fitxers = ModUtil::apiFunc('IWagendas', 'user', 'n_fitxers', array('fitxer' => $note['fitxer']));
if ($n_fitxers == 0 && file_exists(ModUtil::getVar('IWmain', 'documentRoot') . '/' . ModUtil::getVar('IWagendas', 'urladjunts') . '/' . $note['fitxer'])) {
$folder = ModUtil::getVar('IWagendas', 'urladjunts');
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$delete = ModUtil::func('IWmain', 'user', 'deleteFile', array('sv' => $sv,
'folder' => $folder,
'fileName' => $note['fitxer']));
}
}
} else {
// in this case the note is deleted wend it expires
// with the value deleted = 1 users can see the label deleted in personal agendas but the note is not
// visible in shared agenda
if (strpos($agenda['gAccessLevel'], '$owne|' . $uid . '$') !== false || $agenda['gAccessLevel'] == '') {
$deletedByUser = ($note['deletedByUser'] == '') ? '$' : $note['deletedByUser'];
$deletedByUser .= ( strpos($agenda['gAccessLevel'], '$owne|' . $uid . '$') !== false) ? '$' . $uid . '$' : $deletedByUser;
$items = array('deleted' => 1,
'deletedByUser' => $deletedByUser,
'protegida' => 0);
$lid = ModUtil::apiFunc('IWagendas', 'user', 'editNote', array('aid' => $aid,
'daid' => $daid,
'items' => $items));
if ($lid != false)
$deleted = $aid; //success
} else {
return $this->__('You are not allowed to administrate the agendas');
}
}
} else {
$deletedShared = ($note['gCalendarEventId'] != '' && strpos($agenda['gAccessLevel'], '$owne|' . $uid . '$') !== false) ? 1 : 0;
$deletedByUser = ($note['deletedByUser'] == '') ? '$' : $note['deletedByUser'];
$deletedByUser .= '$' . $uid . '$';
$items = array('deletedByUser' => $deletedByUser,
'deleted' => $deletedShared,
'protegida' => 0);
$lid = ModUtil::apiFunc('IWagendas', 'user', 'editNote', array('aid' => $aid,
'daid' => $daid,
'items' => $items));
if ($lid != false)
$deleted = $aid; // success
}
//delete the gCalendar notes
$usability = ModUtil::func('IWagendas', 'user', 'getGdataFunctionsUsability');
if ($usability === true && $note['gCalendarEventId'] != '' && strpos($agenda['gAccessLevel'], '$owne|' . $uid . '$') !== false) {
$userSettings = ModUtil::func('IWagendas', 'user', 'getUserGCalendarSettings');
// 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;
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');
$gdataCal = new Zend_Gdata_Calendar($client);
try {
$event = $gdataCal->getCalendarEventEntry($note['gCalendarEventId']);
} catch (Zend_Gdata_App_Exception $e) {
$error = true;
}
if (!$error) {
try {
$event->delete();
} catch (Zend_Gdata_App_Exception $e) {
return $this->__('You are not allowed to administrate the agendas');
}
} else {
//LogUtil::registerError(_AGENDESERRORDELETINGGCALENDARNOTE);
}
}
return $aid;
}
示例3: catch
require_once "data/data.inc.php";
// records stats
require_once "../page_builder/page_header.php";
// libs
require_once "lib/google_calendar.init.php";
require_once "lib/calendar.lib.php";
require_once "lib/textformat.lib.php";
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
// predefined service name for calendar
// the method of building a query based on newEventQuery() just didn't seem to want to work. this did though.
$client = Zend_Gdata_ClientLogin::getHttpClient($username . '@gmail.com', $password, $service);
$gdataCal = new Zend_Gdata_Calendar($client);
$error = false;
try {
$url = 'http://www.google.com/calendar/feeds/' . $calendars[$_REQUEST['cal']]['user'] . '/private/full/_' . $_REQUEST['id'];
$event = $gdataCal->getCalendarEventEntry($url);
} catch (Exception $e) {
$error = true;
}
if ($error == true) {
// need to create an error handler class
echo "<div class='error'>Error for details" . $url . "</div>" . $e;
exit;
} else {
$when = $event->getWhen();
$startTime = $when[0]->startTime;
$endTime = $when[0]->endTime;
$date_str = strftime('%A, %B %e, %Y', strtotime($startTime));
$date_str_for_storage = strftime('%D', strtotime($startTime));
$date_str_for_compare = strftime('%Y%m%d', strtotime($startTime));
if (!(strlen($startTime) == 10)) {
示例4: GoogleCalendar
/****************************************************************/
/**
* 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'];
$event->when = array($when);
$event->save();
}
}
exit;
示例5: catch
function delete_event_calendar_extern($event){
ajx_current("empty");
if($event->getExtCalId() > 0){
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_Calendar');
$users = ExternalCalendarUsers::findByContactId();
$calendar = ExternalCalendars::findById($event->getExtCalId());
$user = $users->getAuthUser();
$pass = $users->getAuthPass();
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
try
{
$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);
$event_id = 'http://www.google.com/calendar/feeds/'.$calendar->getCalendarUser().'/private/full/'.$event->getSpecialID();
$gcal = new Zend_Gdata_Calendar($client);
$edit_event = $gcal->getCalendarEventEntry($event_id);
$edit_event->delete();
}
catch(Exception $e)
{
flash_error($e->getMessage());
ajx_current("empty");
}
}
}
示例6: getEventByUrl
function getEventByUrl($eventEditUrl)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$query = $gdataCal->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setEvent($eventId);
try {
$eventEntry = $gdataCal->getCalendarEventEntry($query);
return $eventEntry;
} catch (Zend_Gdata_App_Exception $e) {
var_dump($e);
return false;
}
}
示例7: transformToTargetRecord
/**
* Tarsform Vtiger Records to Google Records
* @param <array> $vtEvents
* @return <array> tranformed vtiger Records
*/
public function transformToTargetRecord($vtEvents)
{
$records = array();
foreach ($vtEvents as $vtEvent) {
$gcalendar = new Zend_Gdata_Calendar($this->apiInstance);
if ($vtEvent->getMode() == WSAPP_SyncRecordModel::WSAPP_UPDATE_MODE || $vtEvent->getMode() == WSAPP_SyncRecordModel::WSAPP_DELETE_MODE) {
try {
$newEntry = $gcalendar->getCalendarEventEntry($vtEvent->get('_id'));
} catch (Exception $e) {
continue;
}
} else {
$newEntry = $gcalendar->newEventEntry();
}
$newEntry->title = $gcalendar->newTitle($vtEvent->get('subject'));
$newEntry->where = array($gcalendar->newWhere($vtEvent->get('location')));
$newEntry->content = $gcalendar->newContent($vtEvent->get('description'));
$newEntry->content->type = 'text';
$oldtz = date_default_timezone_get();
date_default_timezone_set('GMT');
$startDate = $vtEvent->get('date_start');
$startTime = $vtEvent->get('time_start');
$endDate = $vtEvent->get('due_date');
$endTime = $vtEvent->get('time_end');
if (empty($endTime)) {
$endTime = "00:00";
}
$when = $gcalendar->newWhen();
$when->startTime = date('c', strtotime("{$startDate} {$startTime}"));
if (!empty($endDate)) {
$when->endTime = date('c', strtotime("{$endDate} {$endTime}"));
}
date_default_timezone_set($oldtz);
$newEntry->when = array($when);
$recordModel = Google_Calendar_Model::getInstanceFromValues(array('entity' => $newEntry));
$recordModel->setType($this->getSynchronizeController()->getSourceType())->setMode($vtEvent->getMode())->setSyncIdentificationKey($vtEvent->get('_syncidentificationkey'));
$recordModel = $this->performBasicTransformations($vtEvent, $recordModel);
$recordModel = $this->performBasicTransformationsToTargetRecords($recordModel, $vtEvent);
$records[] = $recordModel;
}
return $records;
}