Kronolith::getUserName PHP Method

getUserName() public static method

Returns the real name, if available, of a user.
public static getUserName ( $uid )
    public static function getUserName($uid)
    {
        static $names = array();
        if (!isset($names[$uid])) {
            $ident = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($uid);
            $ident->setDefault($ident->getDefault());
            $names[$uid] = $ident->getValue('fullname');
            if (empty($names[$uid])) {
                $names[$uid] = $uid;
            }
        }
        return $names[$uid];
    }

Usage Example

Ejemplo n.º 1
0
 public function html($active = true)
 {
     if (!$this->_event) {
         echo '<h3>' . _("Event not found") . '</h3>';
         exit;
     }
     if (is_string($this->_event)) {
         echo '<h3>' . $this->_event . '</h3>';
         exit;
     }
     global $conf, $prefs;
     $this->_event->loadHistory();
     $creatorId = $this->_event->creator;
     $description = $this->_event->description;
     $location = $this->_event->location;
     $eventurl = $this->_event->url;
     $private = $this->_event->isPrivate();
     $owner = Kronolith::getUserName($creatorId);
     $status = Kronolith::statusToString($this->_event->status);
     $attendees = $this->_event->attendees;
     $resources = $this->_event->getResources();
     if ($datetime = Horde_Util::getFormData('datetime')) {
         $datetime = new Horde_Date($datetime);
         $month = $datetime->month;
         $year = $datetime->year;
     } else {
         $month = (int) Horde_Util::getFormData('month', date('n'));
         $year = (int) Horde_Util::getFormData('year', date('Y'));
     }
     $dateFormat = $prefs->getValue('date_format');
     $timeFormat = $prefs->getValue('twentyFour') ? 'G:i' : 'g:ia';
     // Tags
     $tags = implode(', ', $this->_event->tags);
     echo '<div id="Event"' . ($active ? '' : ' style="display:none"') . '>';
     require KRONOLITH_TEMPLATES . '/view/view.inc';
     echo '</div>';
     if ($active && $GLOBALS['browser']->hasFeature('dom')) {
         /* We check for read permissions, because we can always save a
          * copy if we can read the event. */
         if ($this->_event->hasPermission(Horde_Perms::READ) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
             $edit = new Kronolith_View_EditEvent($this->_event);
             $edit->html(false);
         }
         if ($this->_event->hasPermission(Horde_Perms::DELETE)) {
             $delete = new Kronolith_View_DeleteEvent($this->_event);
             $delete->html(false);
         }
     }
 }
All Usage Examples Of Kronolith::getUserName