本文整理汇总了PHP中Kronolith::getUserEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::getUserEmail方法的具体用法?PHP Kronolith::getUserEmail怎么用?PHP Kronolith::getUserEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::getUserEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toKolab
/**
* Prepares this event to be saved to the backend.
*/
public function toKolab()
{
$event = array();
$event['uid'] = $this->uid;
$event['summary'] = $this->title;
$event['body'] = $this->description;
$event['location'] = $this->location;
$event['sensitivity'] = $this->private ? 'private' : 'public';
// Only set organizer if this is a new event
if ($this->_id == null) {
$organizer = array('display-name' => Kronolith::getUserName($this->creator), 'smtp-address' => Kronolith::getUserEmail($this->creator));
$event['organizer'] = $organizer;
}
if ($this->alarm != 0) {
$event['alarm'] = $this->alarm;
}
if ($this->methods !== null) {
$event['horde-alarm-methods'] = serialize($this->methods);
}
$event['start-date'] = $this->start->toDateTime();
$event['end-date'] = $this->end->toDateTime();
$event['_is_all_day'] = $this->isAllDay();
switch ($this->status) {
case Kronolith::STATUS_FREE:
case Kronolith::STATUS_CANCELLED:
$event['show-time-as'] = 'free';
break;
case Kronolith::STATUS_TENTATIVE:
$event['show-time-as'] = 'tentative';
break;
// No mapping for outofoffice
// No mapping for outofoffice
case Kronolith::STATUS_CONFIRMED:
default:
$event['show-time-as'] = 'busy';
}
// Recurrence
if ($this->recurs()) {
$event['recurrence'] = $this->recurrence->toKolab();
}
// Attendees
$event['attendee'] = array();
foreach ($this->attendees as $attendee) {
$new_attendee = array();
$new_attendee['display-name'] = $attendee->name;
// Attendee without an email address
if (strpos($attendee->email, '@') === false) {
$new_attendee['smtp-address'] = '';
} else {
$new_attendee['smtp-address'] = $attendee->email;
}
switch ($attendee->role) {
case Kronolith::PART_OPTIONAL:
$new_attendee['role'] = 'optional';
break;
case Kronolith::PART_NONE:
$new_attendee['role'] = 'resource';
break;
case Kronolith::PART_REQUIRED:
default:
$new_attendee['role'] = 'required';
break;
}
$new_attendee['request-response'] = 'false';
switch ($attendee->response) {
case Kronolith::RESPONSE_ACCEPTED:
$new_attendee['status'] = 'accepted';
break;
case Kronolith::RESPONSE_DECLINED:
$new_attendee['status'] = 'declined';
break;
case Kronolith::RESPONSE_TENTATIVE:
$new_attendee['status'] = 'tentative';
break;
case Kronolith::RESPONSE_NONE:
default:
$new_attendee['status'] = 'none';
break;
}
$event['attendee'][] = $new_attendee;
}
// Tags
if (!is_array($this->tags)) {
$this->tags = Kronolith::getTagger()->split($this->tags);
}
if ($this->tags) {
$event['categories'] = $this->tags;
}
return $event;
}
示例2: toASAppointment
/**
* Export this event as a MS ActiveSync Message
*
* @param array $options Options:
* - protocolversion: (float) The EAS version to support
* DEFAULT: 2.5
* - bodyprefs: (array) A BODYPREFERENCE array.
* DEFAULT: none (No body prefs enforced).
* - truncation: (integer) Truncate event body to this length
* DEFAULT: none (No truncation).
*
* @return Horde_ActiveSync_Message_Appointment
*/
public function toASAppointment(array $options = array())
{
global $prefs, $registry;
$message = new Horde_ActiveSync_Message_Appointment(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger'), 'protocolversion' => $options['protocolversion']));
if (!$this->isPrivate()) {
// Handle body/truncation
if (!empty($options['bodyprefs'])) {
if (Horde_String::length($this->description) > 0) {
$bp = $options['bodyprefs'];
$note = new Horde_ActiveSync_Message_AirSyncBaseBody();
// No HTML supported. Always use plaintext.
$note->type = Horde_ActiveSync::BODYPREF_TYPE_PLAIN;
if (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'];
} elseif (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_HTML])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_HTML]['truncationsize'];
$this->description = Horde_Text_Filter::filter($this->description, 'Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
} else {
$truncation = false;
}
if ($truncation && Horde_String::length($this->description) > $truncation) {
$note->data = Horde_String::substr($this->desciption, 0, $truncation);
$note->truncated = 1;
} else {
$note->data = $this->description;
}
$note->estimateddatasize = Horde_String::length($this->description);
$message->airsyncbasebody = $note;
}
} else {
$message->setBody($this->description);
}
$message->setLocation($this->location);
}
$message->setSubject($this->getTitle());
$message->setDatetime(array('start' => $this->start, 'end' => $this->end, 'allday' => $this->isAllDay()));
$message->setTimezone($this->start);
// Organizer
if (count($this->attendees)) {
if ($this->creator == $registry->getAuth()) {
$as_ident = $prefs->getValue('activesync_identity') == 'horde' ? $prefs->getValue('default_identity') : $prefs->getValue('activesync_identity');
$name = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($this->creator)->getValue('fullname', $as_ident);
$email = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($this->creator)->getValue('from_addr', $as_ident);
} else {
$name = Kronolith::getUserName($this->creator);
$email = Kronolith::getUserEmail($this->creator);
}
$message->setOrganizer(array('name' => $name, 'email' => $email));
}
// Privacy
$message->setSensitivity($this->private ? Horde_ActiveSync_Message_Appointment::SENSITIVITY_PRIVATE : Horde_ActiveSync_Message_Appointment::SENSITIVITY_NORMAL);
// Busy Status
switch ($this->status) {
case Kronolith::STATUS_CANCELLED:
$status = Horde_ActiveSync_Message_Appointment::BUSYSTATUS_FREE;
break;
case Kronolith::STATUS_CONFIRMED:
$status = Horde_ActiveSync_Message_Appointment::BUSYSTATUS_BUSY;
break;
case Kronolith::STATUS_TENTATIVE:
$status = Horde_ActiveSync_Message_Appointment::BUSYSTATUS_TENTATIVE;
case Kronolith::STATUS_FREE:
case Kronolith::STATUS_NONE:
$status = Horde_ActiveSync_Message_Appointment::BUSYSTATUS_FREE;
}
$message->setBusyStatus($status);
// DTStamp
$message->setDTStamp($_SERVER['REQUEST_TIME']);
// Recurrence
if ($this->recurs()) {
$message->setRecurrence($this->recurrence, $GLOBALS['prefs']->getValue('week_start_monday'));
/* Exceptions are tricky. Exceptions, even those that represent
* deleted instances of a recurring event, must be added. To do this
* we query the storage for all the events that represent exceptions
* (those with the baseid == $this->uid) and then remove the
* exceptionoriginaldate from the list of exceptions we know about.
* Any dates left in this list when we are done, must represent
* deleted instances of this recurring event.*/
if (!empty($this->recurrence) && ($exceptions = $this->recurrence->getExceptions())) {
$results = $this->boundExceptions();
foreach ($results as $exception) {
$e = new Horde_ActiveSync_Message_Exception(array('protocolversion' => $options['protocolversion']));
$e->setDateTime(array('start' => $exception->start, 'end' => $exception->end, 'allday' => $exception->isAllDay()));
// The start time of the *original* recurring event
$e->setExceptionStartTime($exception->exceptionoriginaldate);
$originaldate = $exception->exceptionoriginaldate->format('Ymd');
$key = array_search($originaldate, $exceptions);
//.........这里部分代码省略.........
示例3: toASAppointment
/**
* Export this event as a MS ActiveSync Message
*
* @param array $options Options:
* - protocolversion: (float) The EAS version to support
* DEFAULT: 2.5
* - bodyprefs: (array) A BODYPREFERENCE array.
* DEFAULT: none (No body prefs enforced).
* - truncation: (integer) Truncate event body to this length
* DEFAULT: none (No truncation).
*
* @return Horde_ActiveSync_Message_Appointment
*/
public function toASAppointment(array $options = array())
{
global $prefs, $registry;
// @todo This should be a required option.
if (empty($options['protocolversion'])) {
$options['protocolversion'] = 2.5;
}
$message = new Horde_ActiveSync_Message_Appointment(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger'), 'protocolversion' => $options['protocolversion']));
if (!$this->isPrivate()) {
// Handle body/truncation
if (!empty($options['bodyprefs'])) {
if (Horde_String::length($this->description) > 0) {
$bp = $options['bodyprefs'];
$note = new Horde_ActiveSync_Message_AirSyncBaseBody();
// No HTML supported. Always use plaintext.
$note->type = Horde_ActiveSync::BODYPREF_TYPE_PLAIN;
if (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'];
} elseif (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_HTML])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_HTML]['truncationsize'];
$this->description = Horde_Text_Filter::filter($this->description, 'Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
} else {
$truncation = false;
}
if ($truncation && Horde_String::length($this->description) > $truncation) {
$note->data = Horde_String::substr($this->description, 0, $truncation);
$note->truncated = 1;
} else {
$note->data = $this->description;
}
$note->estimateddatasize = Horde_String::length($this->description);
$message->airsyncbasebody = $note;
}
} else {
$message->setBody($this->description);
}
if ($options['protocolversion'] >= Horde_ActiveSync::VERSION_SIXTEEN && !empty($this->location)) {
$message->location = new Horde_ActiveSync_Message_AirSyncBaseLocation(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger'), 'protocolversion' => $options['protocolversion']));
// @todo - worth it to try to get full city/country etc...
// from geotagging service if available??
$message->location->displayname = $this->location;
} else {
$message->setLocation($this->location);
}
}
$message->setSubject($this->getTitle());
$message->alldayevent = $this->isAllDay();
$st = clone $this->start;
$et = clone $this->end;
if ($this->isAllDay()) {
// EAS requires all day to be from 12:00 to 12:00.
if ($this->start->hour != 0 || $this->start->min != 0 || $this->start->sec != 0) {
$st->hour = 0;
$st->min = 0;
$st->sec = 0;
}
// For end it's a bit trickier. If it's 11:59pm, bump it up to 12:00
// am of the next day. Otherwise, if it's not 12:00am, make it 12:00
// am of the same day. This *shouldn't* happen, but protect against
// issues with EAS just in case.
if ($this->end->hour != 0 || $this->end->min != 0 || $this->end->sec != 0) {
if ($this->end->hour == 23 && $this->end->min == 59) {
$et->mday++;
}
$et->hour = 0;
$et->min = 0;
$et->sec = 0;
}
}
$message->starttime = $st;
$message->endtime = $et;
$message->setTimezone($this->start);
// Organizer
$attendees = $this->attendees;
$skipOrganizer = null;
if ($this->organizer) {
$message->setOrganizer(array('email' => $this->organizer));
} elseif (count($attendees)) {
if ($this->creator == $registry->getAuth()) {
$as_ident = $prefs->getValue('activesync_identity') == 'horde' ? $prefs->getValue('default_identity') : $prefs->getValue('activesync_identity');
$name = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($this->creator)->getValue('fullname', $as_ident);
$email = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($this->creator)->getValue('from_addr', $as_ident);
} else {
$name = Kronolith::getUserName($this->creator);
$email = Kronolith::getUserEmail($this->creator);
}
$message->setOrganizer(array('name' => $name, 'email' => $email));
//.........这里部分代码省略.........