当前位置: 首页>>代码示例>>PHP>>正文


PHP Formatter::fullName方法代码示例

本文整理汇总了PHP中Formatter::fullName方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::fullName方法的具体用法?PHP Formatter::fullName怎么用?PHP Formatter::fullName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Formatter的用法示例。


在下文中一共展示了Formatter::fullName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAssigneeNames

 /**
  * Generates a display-friendly list of assignees
  * 
  * @param mixed $value If specified, use as the assignment instead of the
  *  current model's assignment field.
  */
 public function getAssigneeNames($value = false)
 {
     $assignment = !$value ? $this->owner->getAttribute($this->getAssignmentAttr()) : $value;
     $assignees = !is_array($assignment) ? explode(', ', $assignment) : $assignment;
     $groupIds = array_filter($assignees, 'ctype_digit');
     $userNames = array_diff($assignees, $groupIds);
     $userNameParam = AuxLib::bindArray($userNames);
     $userFullNames = !empty($userNames) ? array_map(function ($u) {
         return Formatter::fullName($u['firstName'], $u['lastName']);
     }, Yii::app()->db->createCommand()->select('firstName,lastName')->from(User::model()->tableName())->where('username IN ' . AuxLib::arrToStrList(array_keys($userNameParam)), $userNameParam)->queryAll()) : array();
     $groupIdParam = AuxLib::bindArray($groupIds);
     $groupNames = !empty($groupIds) ? Yii::app()->db->createCommand()->select('name')->from(Groups::model()->tableName())->where('id IN ' . AuxLib::arrToStrList(array_keys($groupIdParam)), $groupIdParam)->queryColumn() : array();
     return array_merge($userFullNames, $groupNames);
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:20,代码来源:X2PermissionsBehavior.php

示例2: getFullName

 /**
  * Returns the full name of the user.
  */
 public function getFullName()
 {
     if (!isset($this->_fullName)) {
         $this->_fullName = Formatter::fullName($this->firstName, $this->lastName);
     }
     return $this->_fullName;
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:10,代码来源:User.php

示例3: getEditableUserCalendarNames

 public static function getEditableUserCalendarNames()
 {
     $users = User::model()->findAll(array('select' => 'id, username, firstName, lastName', 'index' => 'id'));
     $names = array('Anyone' => 'Anyone');
     // array mapping username to user's full name for user calendars we can edit
     if (Yii::app()->params->isAdmin) {
         foreach ($users as $user) {
             $first = $user->firstName;
             $last = $user->lastName;
             $fullname = Formatter::fullName($first, $last);
             $username = $user->username;
             $names[$username] = $fullname;
         }
     } else {
         $permissions = X2CalendarPermissions::model()->findAll(array('select' => 'user_id, other_user_id, edit', 'condition' => 'other_user_id=:user_id', 'params' => array(':user_id' => Yii::app()->user->id), 'index' => 'user_id'));
         /* x2tempstart */
         // safeguard to prevent invalid permissions from being used
         // TODO: write migration script to delete old invalid permissions
         $permissions = array_filter($permissions, function ($permission) use($users) {
             return in_array($permission->user_id, array_keys($users));
         });
         /* x2tempend */
         $checked = array();
         // user's who have there permission set up. Other user's will have default permissions
         foreach ($permissions as $permission) {
             // loop through user's that have set there permissions
             if ($permission->edit) {
                 // user gives us permission to view there calendar?
                 $user = $users[$permission->user_id];
                 $first = $user->firstName;
                 $last = $user->lastName;
                 $fullname = Formatter::fullName($first, $last);
                 $username = $user->username;
                 $names[$username] = $fullname;
             }
             $checked[] = $permission->user_id;
         }
         // user's who have not set permissions default to not letting everyone edit there calendar
         // let current user edit there own calendar
         $user = $users[Yii::app()->user->id];
         $first = $user->firstName;
         $last = $user->lastName;
         $fullname = Formatter::fullName($first, $last);
         $username = $user->username;
         $names[$username] = $fullname;
     }
     return $names;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:48,代码来源:X2CalendarPermissions.php


注:本文中的Formatter::fullName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。