本文整理汇总了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);
}
示例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;
}
示例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;
}