本文整理汇总了PHP中display_name函数的典型用法代码示例。如果您正苦于以下问题:PHP display_name函数的具体用法?PHP display_name怎么用?PHP display_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requestfriendship_submit
function requestfriendship_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id, $goto;
$loggedinid = $USER->get('id');
$user = get_record('usr', 'id', $id);
// friend db record
$f = new StdClass();
$f->ctime = db_format_timestamp(time());
// notification info
$n = new StdClass();
$n->url = profile_url($USER, false);
$n->users = array($user->id);
$n->fromuser = $loggedinid;
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->strings = new stdClass();
$n->strings->urltext = (object) array('key' => 'Requests');
$f->owner = $id;
$f->requester = $loggedinid;
$f->message = $values['message'];
insert_record('usr_friend_request', $f);
$n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
if (isset($values['message']) && !empty($values['message'])) {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessageexplanation', 'group', $displayname) . $values['message'];
} else {
$n->message = get_string_from_language($lang, 'requestedfriendlistinboxmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('addfriendrequest', array('requester' => $loggedinid, 'owner' => $id));
$SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
redirect($goto);
}
示例2: assign_smarty_vars
public function assign_smarty_vars()
{
$this->smarty->assign('artefacttype', 'internal');
$this->smarty->assign('artefactplugin', 'internal');
$this->smarty->assign('title', display_name($this->get('exporter')->get('user'), $this->get('exporter')->get('user')));
// If this ID is changed, you'll have to change it in author.tpl too
$this->smarty->assign('id', 'portfolio:artefactinternal');
$this->smarty->assign('leaptype', $this->get_leap_type());
$persondata = array();
$spacialdata = array();
foreach ($this->artefacts as $a) {
if (!($data = $this->data_mapping($a))) {
if ($a->get('artefacttype') == 'introduction') {
$this->smarty->assign('contenttype', 'html');
$this->smarty->assign('content', clean_html($a->get('title')));
}
continue;
}
$value = $a->render_self(array());
$value = $value['html'];
// TODO fix this when we non-js stuff
$data = array_merge(array('value' => $value, 'artefacttype' => $a->get('artefacttype'), 'artefactplugin' => 'internal'), $data);
if (array_key_exists('spacial', $data)) {
$spacialdata[] = (object) $data;
} else {
$data = array_merge($data, array('label' => get_string($a->get('artefacttype'), 'artefact.internal')));
$persondata[] = (object) $data;
}
}
if ($extras = $this->exporter->get('extrapersondata')) {
$persondata = array_merge($persondata, $extras);
}
$this->smarty->assign('persondata', $persondata);
$this->smarty->assign('spacialdata', $spacialdata);
}
示例3: notify_user
public static function notify_user($user, $data)
{
$lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
$separator = str_repeat('-', 72);
$sitename = get_config('sitename');
$subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
if (!empty($data->subject)) {
$subject .= ': ' . $data->subject;
}
$messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
$messagebody .= $separator . "\n\n";
$messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
if ($data->activityname == 'usermessage') {
// Do not include the message body in user messages when they are sent by email
// because it encourages people to reply to the email.
$messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
} else {
$messagebody .= $data->message;
if (!empty($data->url)) {
$messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
}
}
if (isset($data->unsubscribeurl) && isset($data->unsubscribename)) {
$messagebody .= "\n\n" . get_string_from_language($lang, 'unsubscribemessage', 'notification.email', $data->unsubscribename, $data->unsubscribeurl);
}
$messagebody .= "\n\n{$separator}";
$prefurl = get_config('wwwroot') . 'account/activity/preferences/';
$messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
email_user($user, null, $subject, $messagebody, null, !empty($data->customheaders) ? $data->customheaders : null);
}
示例4: Dwoo_Plugin_display_name
/**
* Dwoo {display_name} function plugin
*
* Type: function<br>
* Date: June 22, 2006<br>
* Purpose: Display a user's name according to mahara rules
* @author Catalyst IT Ltd
* @version 1.0
*/
function Dwoo_Plugin_display_name(Dwoo $dwoo, $user, $userto = null, $nameonly = false, $realname = false)
{
if (!$user) {
return '';
}
return hsc(display_name($user, $userto, $nameonly, $realname));
}
示例5: notify_user
public static function notify_user($user, $data)
{
$messagehtml = null;
if (!empty($data->overridemessagecontents)) {
$subject = $data->subject;
if (!empty($data->emailmessage)) {
$messagebody = $data->emailmessage;
} else {
if (!empty($user->emailmessage)) {
$messagebody = $user->emailmessage;
} else {
$messagebody = $data->message;
}
}
if (!empty($data->htmlmessage)) {
$messagehtml = $data->htmlmessage;
} else {
if (!empty($user->htmlmessage)) {
$messagehtml = $user->htmlmessage;
}
}
} else {
$lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
$separator = str_repeat('-', 72);
$sitename = get_config('sitename');
$subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
if (!empty($data->subject)) {
$subject .= ': ' . $data->subject;
}
$messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
$messagebody .= $separator . "\n\n";
$messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
if ($data->url && stripos($data->url, 'http://') !== 0 && stripos($data->url, 'https://') !== 0) {
$data->url = get_config('wwwroot') . $data->url;
}
if ($data->activityname == 'usermessage') {
// Do not include the message body in user messages when they are sent by email
// because it encourages people to reply to the email.
$messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
} else {
$messagebody .= $data->message;
if (!empty($data->url)) {
$messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
}
}
$messagebody .= "\n\n{$separator}";
$prefurl = get_config('wwwroot') . 'account/activity/preferences/index.php';
$messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
}
// Bug 738263: Put the user's email address in the Reply-to field; email_user() will put the site address in 'From:'
$userfrom = null;
if (!empty($data->fromuser) && !$data->hideemail) {
$user_data = get_record('usr', 'id', $data->fromuser);
if (empty($data->customheaders)) {
$data->customheaders = array();
}
$data->customheaders[] = "Reply-to: {$user_data->email}";
}
email_user($user, $userfrom, $subject, $messagebody, $messagehtml, !empty($data->customheaders) ? $data->customheaders : null);
}
示例6: getRecordDataById
public static function getRecordDataById($type, $id)
{
$sql = 'SELECT c.id, c.name, c.ctime, c.description, cv.view AS viewid, c.owner
FROM {collectio}n c
LEFT OUTER JOIN {collection_view} cv ON cv.collection = c.id
WHERE id = ? ORDER BY cv.displayorder asc LIMIT 1;';
$record = get_record_sql($sql, array($id));
if (!$record) {
return false;
}
$record->name = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->name));
$record->description = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->description));
// Created by
if (intval($record->owner) > 0) {
$record->createdby = get_record('usr', 'id', $record->owner);
$record->createdbyname = display_name($record->createdby);
}
// Get all views included in that collection
$sql = 'SELECT v.id, v.title
FROM {view} v
LEFT OUTER JOIN {collection_view} cv ON cv.view = v.id
WHERE cv.collection = ?';
$views = recordset_to_array(get_recordset_sql($sql, array($id)));
if ($views) {
$record_views = array();
foreach ($views as $view) {
if (isset($view->id)) {
$record_views[$view->id] = $view->title;
}
}
$record->views = $record_views;
}
return $record;
}
示例7: smarty_function_display_name
/**
* Smarty {display_name} function plugin
*
* Type: function<br>
* Name: str<br>
* Date: June 22, 2006<br>
* Purpose: Display a user's name according to mahara rules
* @author Catalyst IT Ltd
* @version 1.0
* @param array
* @param Smarty
* @return Internationalized string
*/
function smarty_function_display_name($params, &$smarty)
{
static $dictionary;
if (!isset($params['user']) || !is_object($params['user'])) {
return '';
}
return display_name($params['user']);
}
示例8: override_instance_title
public static function override_instance_title(BlockInstance $instance)
{
global $USER;
$ownerid = $instance->get_view()->get('owner');
if ($ownerid === null || $ownerid == $USER->get('id')) {
return get_string('title', 'blocktype.myviews');
}
return get_string('otherusertitle', 'blocktype.myviews', display_name($ownerid, null, true));
}
示例9: assign_smarty_vars
public function assign_smarty_vars()
{
$user = $this->get('exporter')->get('user');
$userid = $user->get('id');
$updated = get_record_sql('select ' . db_format_tsfield('max(mtime)', 'mtime') . ' from {artefact} a join {artefact_installed_type} t on a.artefacttype = t.name where t.plugin = \'internal\'');
$this->smarty->assign('artefacttype', 'internal');
$this->smarty->assign('artefactplugin', 'internal');
$this->smarty->assign('title', display_name($user, $user));
$this->smarty->assign('updated', PluginExportLeap::format_rfc3339_date($updated->mtime));
// If this ID is changed, you'll have to change it in author.tpl too
$this->smarty->assign('id', 'portfolio:artefactinternal');
$this->smarty->assign('leaptype', $this->get_leap_type());
$persondata = array();
$spacialdata = array();
usort($this->artefacts, array($this, 'artefact_sort'));
foreach ($this->artefacts as $a) {
if (!($data = $this->data_mapping($a))) {
if ($a->get('artefacttype') == 'introduction') {
$this->smarty->assign('contenttype', 'html');
$this->smarty->assign('content', clean_html($a->get('title')));
}
continue;
}
$value = $a->render_self(array());
$value = $value['html'];
// TODO fix this when we non-js stuff
$data = array_merge(array('value' => $value, 'artefacttype' => $a->get('artefacttype'), 'artefactplugin' => 'internal'), $data);
if (array_key_exists('spacial', $data)) {
$spacialdata[] = (object) $data;
} else {
$label = get_string($a->get('artefacttype'), 'artefact.internal');
if ($a->get('artefacttype') == 'socialprofile') {
$label = $a->get('description');
}
$data = array_merge($data, array('label' => $label));
$persondata[] = (object) $data;
}
}
if ($extras = $this->exporter->get('extrapersondata')) {
$persondata = array_merge($persondata, $extras);
}
$this->smarty->assign('persondata', $persondata);
$this->smarty->assign('spacialdata', $spacialdata);
// Grab profile icons and link to them, making sure the default is first
if ($icons = get_column_sql("SELECT id\n FROM {artefact}\n WHERE artefacttype = 'profileicon'\n AND \"owner\" = ?\n ORDER BY id = (\n SELECT profileicon FROM {usr} WHERE id = ?\n ) DESC, id", array($userid, $userid))) {
foreach ($icons as $icon) {
$icon = artefact_instance_from_id($icon);
$this->add_artefact_link($icon, 'related');
}
$this->smarty->assign('links', $this->links);
}
if (!($categories = $this->get_categories())) {
$categories = array();
}
$this->smarty->assign('categories', $categories);
}
示例10: getRecordDataById
public static function getRecordDataById($type, $id)
{
$record = get_record('usr', 'id', $id);
if (!$record || $record->deleted) {
return false;
}
$record->display_name = display_name($record);
$record->introduction = get_field('artefact', 'title', 'owner', $id, 'artefacttype', 'introduction');
return $record;
}
示例11: addmembers_submit
function addmembers_submit(Pieform $form, $values)
{
global $SESSION, $group, $USER;
if (empty($values['users'])) {
redirect(get_config('wwwroot') . 'group/suggest.php?id=' . GROUP);
}
require_once 'activity.php';
$groupurl = group_homepage_url($group, false);
activity_occurred('maharamessage', array('users' => $values['users'], 'subject' => '', 'message' => '', 'strings' => (object) array('subject' => (object) array('key' => 'suggestgroupnotificationsubject', 'section' => 'group', 'args' => array(display_name($USER))), 'message' => (object) array('key' => 'suggestgroupnotificationmessage', 'section' => 'group', 'args' => array(display_name($USER), hsc($group->name), get_config('sitename')))), 'url' => $groupurl, 'urltext' => hsc($group->name)));
$SESSION->add_ok_msg(get_string('recommendationssent', 'group', count($values['users'])));
redirect(get_config('wwwroot') . $groupurl);
}
示例12: pieform_render_viewacl_getvaluebytype
function pieform_render_viewacl_getvaluebytype($type, $id)
{
switch ($type) {
case 'user':
$user = get_record('usr', 'id', $id);
return display_name($user);
break;
case 'group':
return get_field('group', 'name', 'id', $id);
break;
}
return "{$type}: {$id}";
}
示例13: invitetogroup_submit
function invitetogroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $group, $user;
$data = new StdClass();
$data->group = $group->id;
$data->member = $user->id;
$data->ctime = db_format_timestamp(time());
$data->role = $values['role'];
insert_record('group_member_invite', $data);
$lang = get_user_language($user->id);
require_once 'activity.php';
activity_occurred('maharamessage', array('users' => array($user->id), 'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($USER, $user), $group->name), 'url' => get_config('wwwroot') . 'group/view.php?id=' . $group->id));
$SESSION->add_ok_msg(get_string('userinvited', 'group'));
redirect('/user/view.php?id=' . $user->id);
}
示例14: do_masquerade
/**
* Notify user (if configured), do the masquerading and emit event. Called when
* no (further) interaction with the admin is needed before the loginas.
*
* @param string $why The masquerading reason (if given) or null.
*/
function do_masquerade($why = null)
{
global $USER, $SESSION;
$id = param_integer('id');
$who = display_name($USER, $id);
$when = format_date(time());
if (get_config('masqueradingnotified')) {
$msg = (object) array('subject' => get_string('masqueradenotificationsubject', 'admin'), 'message' => $why === null ? get_string('masqueradenotificationnoreason', 'admin', $who, $when) : get_string('masqueradenotificationreason', 'admin', $who, $when, $why), 'users' => array($id), 'url' => profile_url($USER, false), 'urltext' => $who);
activity_occurred('maharamessage', $msg);
$SESSION->add_info_msg(get_string('masqueradenotificationdone', 'admin'));
}
$USER->change_identity_to($id);
// Permissions checking is done in here
handle_event('loginas', array('who' => $who, 'when' => $when, 'reason' => $why));
redirect(get_config('wwwroot'));
}
示例15: pieform_element_userlist
/**
* Provides a basic text field input.
*
* @todo this is just lies ...
* @param array $element The element to render
* @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
function pieform_element_userlist(Pieform $form, $element)
{
$smarty = smarty_core();
$smarty->left_delimiter = '{{';
$smarty->right_delimiter = '}}';
$value = $form->get_value($element);
if (!is_array($value) && isset($element['defaultvalue']) && is_array($element['defaultvalue'])) {
$value = $element['defaultvalue'];
}
if (is_array($value) && count($value)) {
$orderby = isset($element['searchparams']['orderby']) && $element['searchparams']['orderby'] == 'lastname' ? 'lastname,firstname,id' : 'firstname,lastname,id';
$members = get_records_select_assoc('usr', 'id IN (' . join(',', array_map('intval', $value)) . ')', null, $orderby, 'id,username,firstname,lastname,preferredname,staff');
foreach ($members as &$member) {
$member = display_name($member);
}
$smarty->assign('options', $members);
$smarty->assign('value', join(',', $value));
}
$smarty->assign('name', $element['name']);
if (!empty($element['lefttitle'])) {
$smarty->assign('lefttitle', $element['lefttitle']);
}
if (!empty($element['righttitle'])) {
$smarty->assign('righttitle', $element['righttitle']);
}
if (!empty($element['leftarrowlabel'])) {
$smarty->assign('leftarrowlabel', $element['leftarrowlabel']);
}
if (!empty($element['rightarrowlabel'])) {
$smarty->assign('rightarrowlabel', $element['rightarrowlabel']);
}
if (!empty($element['group'])) {
$smarty->assign('group', $element['group']);
$smarty->assign('includeadmins', !isset($element['includeadmins']) || $element['includeadmins'] ? 1 : 0);
}
if (empty($element['searchscript'])) {
$element['searchscript'] = 'json/usersearch.php';
}
$smarty->assign('searchscript', $element['searchscript']);
if (empty($element['searchparams'])) {
$element['searchparams'] = array('query' => '', 'limit' => 100);
}
$smarty->assign('searchparams', json_encode($element['searchparams']));
$smarty->assign('onlyshowingfirst', json_encode(get_string('onlyshowingfirst', 'admin')));
$smarty->assign('resultsof', json_encode(get_string('resultsof', 'admin')));
return $smarty->fetch('form/userlist.tpl');
}