本文整理汇总了PHP中Zend_Gdata_Calendar::newReminder方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar::newReminder方法的具体用法?PHP Zend_Gdata_Calendar::newReminder怎么用?PHP Zend_Gdata_Calendar::newReminder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Calendar
的用法示例。
在下文中一共展示了Zend_Gdata_Calendar::newReminder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
}
}
示例2: setReminder
/**
* Adds a reminder to the event specified as a parameter.
*
* @param Zend_Http_Client $client The authenticated client object
* @param string $eventId The event ID string
* @param integer $minutes Minutes before event to set reminder
* @return Zend_Gdata_Calendar_EventEntry|null The updated entry
*/
function setReminder(Zend_Http_Client $client, $eventId, $minutes = 15)
{
$gc = new Zend_Gdata_Calendar($client);
$method = "alert";
if ($event = getEvent($client, $eventId)) {
$times = $event->when;
foreach ($times as $when) {
$reminder = $gc->newReminder();
$reminder->setMinutes($minutes);
$reminder->setMethod($method);
$when->reminder = array($reminder);
}
$eventNew = $event->save();
return $eventNew;
} else {
return null;
}
}
示例3: updateEvent
static function updateEvent(&$newEvent, $bean, $user)
{
$client = self::getClient($user);
if ($client != false) {
$gdataCal = new Zend_Gdata_Calendar($client);
global $timedate;
$date_time_start = $bean->date_start . ' ' . $bean->time_start;
if (toTimestamp($date_time_start) < mktime(0, 0, 0, 1, 1, 2001)) {
//$date_time_start = DateTime::get_time_start($timedate->to_db_date($bean->date_start,false),$bean->time_start.":00");
//$date_time_start = $date_time_start->get_mysql_date().' '.$date_time_start->get_mysql_time();
$date_time_start = date($timedate->get_db_date_time_format(), strtotime($bean->date_start));
}
//$date_time_start = $timedate->handle_offset($date_time_start, $timedate->get_db_date_time_format(), true);
$time = toTimestamp($date_time_start);
$duration = $bean->duration_hours * 60 * 60 + $bean->duration_minutes * 60;
$when = $gdataCal->newWhen();
$when->startTime = strftime("%Y-%m-%dT%H:%M:%S.000+00:00", $time);
$when->endTime = strftime("%Y-%m-%dT%H:%M:%S.000+00:00", $time + $duration);
// Tasks
if (isset($bean->date_due) === true) {
$date_time_end = $bean->date_due . ' ' . $bean->time_due;
if (toTimestamp($date_time_start) < mktime(0, 0, 0, 1, 1, 2001)) {
$date_time_end = date($timedate->get_db_date_time_format(), strtotime($bean->date_due));
}
$time = toTimestamp($date_time_end);
$when->endTime = strftime("%Y-%m-%dT%H:%M:%S.000+00:00", $time);
}
// Tasks
if ($bean->reminder_time < 0) {
$when->reminders = array();
} else {
$mins = (int) ($bean->reminder_time / 60);
// reminder_time are seconds
if ($mins < 5) {
$mins = 5;
}
$reminder = $gdataCal->newReminder();
//$reminder->method = "sms";
$reminder->minutes = $mins;
$when->reminders = array($reminder);
}
$newEvent->when = array($when);
/** Conditionals **/
if ($bean->module_dir == "Meetings") {
$newEvent->where = array($gdataCal->newWhere($bean->location));
$newEvent->title = $gdataCal->newTitle("Встреча: " . $bean->name);
} elseif ($bean->module_dir == "Calls") {
$newEvent->title = $gdataCal->newTitle("Звонок: " . $bean->name);
} elseif ($bean->module_dir == "Tasks") {
$newEvent->title = $gdataCal->newTitle("Задача: " . $bean->name);
}
$newEvent->content = $gdataCal->newContent($bean->description);
}
}
示例4: send_sms
function send_sms($param_google_username, $param_google_password, $param_title, $param_content)
{
/**
* @Include Zend_Loader
*/
require_once 'Zend/Loader.php';
/**
* @Load Zend_Gdata
*/
Zend_Loader::loadClass('Zend_Gdata');
/**
* @Load Zend_Gdata_AuthSub
*/
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
/**
* @Load Zend_Gdata_ClientLogin
*/
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
/**
* @Load Zend_Gdata_HttpClient
*/
Zend_Loader::loadClass('Zend_Gdata_HttpClient');
/**
* @Load Zend_Gdata_Calendar
*/
Zend_Loader::loadClass('Zend_Gdata_Calendar');
// Parameters for ClientAuth authentication
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = $param_google_username;
$pass = $param_google_password;
// 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($param_title);
//$event->where = array($service->newWhere("Mountain View, California"));
$event->content = $service->newContent($param_content);
// Set the date using RFC 3339 format.
$startDate = date("Y-m-d");
//"2009-01-15";
$startTime = date("H:i", strtotime("+3 minutes"));
$endDate = date("Y-m-d");
$endTime = date("H:i", strtotime("+6 minutes"));
$tzOffset = "+08";
$when = $service->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
// Create a new reminder object. It should be set to send an email
// to the user 10 minutes beforehand.
$reminder = $service->newReminder();
$reminder->method = "sms";
$reminder->minutes = "2";
$when->reminders = array($reminder);
$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
if ($newEvent = $service->insertEvent($event)) {
return true;
} else {
return false;
}
}