Kronolith::getUserEmail PHP 메소드

getUserEmail() 공개 정적인 메소드

Returns the email address, if available, of a user.
public static getUserEmail ( $uid )
    public static function getUserEmail($uid)
    {
        static $emails = array();
        if (!isset($emails[$uid])) {
            $ident = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($uid);
            $emails[$uid] = $ident->getValue('from_addr');
            if (empty($emails[$uid])) {
                $emails[$uid] = $uid;
            }
        }
        return $emails[$uid];
    }

Usage Example

예제 #1
0
파일: Kolab.php 프로젝트: horde/horde
 /**
  * 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;
 }
All Usage Examples Of Kronolith::getUserEmail