本文整理汇总了PHP中getUserName函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserName函数的具体用法?PHP getUserName怎么用?PHP getUserName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plist
/**
* 测试计划列表
*/
public function plist()
{
//如果caseid不为空,则直接id查询,其他查询条件不生效
$planId = $this->_get('plan_id');
if (!empty($planId)) {
$condition['id'] = trim($planId);
} else {
$desc = $this->_get('plan_desc');
if (!empty($desc)) {
$condition['desc'] = array('like', '%' . $desc . '%');
}
$owner = $this->_get('owner');
if (!empty($owner)) {
$condition['userId'] = getUserIdByName(trim($owner));
}
}
$new = $this->merge($condition);
$page = $this->getPaging('Plan', $new);
$paging = $page->show();
$this->assign('paging', $paging);
$plans = D('Plan')->where($new)->order('updateTime desc')->limit($page->firstRow . ',' . $page->listRows)->select();
//添加username作为返回信息
foreach ($plans as $plan) {
$plan['caseCount'] = count(explode(",", $plan['caseIds']));
$plan['username'] = getUserName($plan['userId']);
$data[] = $plan;
}
$this->assign('plans', $data);
$this->display();
}
示例2: getContact
function getContact($idContact)
{
//Realiza el query en la base de datos
$mysqli = makeSqlConnection();
$sql = "SELECT * FROM contacts a LEFT JOIN contacts_cstm ac ON a.id = ac.id_c WHERE id = '{$idContact}'";
$res = $mysqli->query($sql);
$rows = array();
while ($r = mysqli_fetch_assoc($res)) {
$obj = (object) $r;
$obj->email_address = getEmail($idContact);
$obj->idAccount = getAccountId($idContact);
$obj->nameAccount = getAccountName($obj->idAccount);
$obj->reports_to_name = getContactName($obj->reports_to_id);
$obj->created_by_name = getUserName($obj->created_by);
$obj->modified_user_name = getUserName($obj->modified_user_id);
$obj->assigned_user_name = getUserName($obj->user_id_c);
$obj->nameCampaign = getCampaignName($obj->campaign_id);
$a = (array) $obj;
$rows[] = $a;
}
if (empty($rows)) {
return '{"results" :[]}';
} else {
//Convierte el arreglo en json y lo retorna
$temp = json_encode(utf8ize($rows));
return '{"results" :' . $temp . '}';
}
}
示例3: replaceRelatedUser
public function replaceRelatedUser()
{
$related_user = unserialize($_SESSION['_widget_related_user']);
if (empty($related_user)) {
echo '0';
} else {
$html = '';
$limit = min(intval($_POST['limit']), count($related_user));
for ($i = 1; $i <= $limit; $i++) {
$shifted_user = array_shift($related_user);
$html .= '<li id="related_user_' . $shifted_user['uid'] . '">';
$html .= '<div class="userPic">';
$html .= '<a title="" href="' . U("home/Space/index", array("uid" => $shifted_user['uid'])) . '">';
$html .= '<img src="' . getUserFace($shifted_user['uid'], 'm') . '" card="1">';
$html .= '</a>';
$html .= '</div>';
$html .= '<div class="interest_info">';
$html .= '<p><a href="' . U("home/Space/index", array("uid" => $shifted_user['uid'])) . '">' . getUserName($shifted_user['uid']) . '</a></p>';
$html .= '<p><a href="javascript:void(0);" class="guanzhu" onclick="subscribe(' . $shifted_user['uid'] . ')">加关注</a></p>';
$html .= '<p class="cGray2">' . $shifted_user['reason'] . '</p>';
$html .= '</div>';
$html .= '</li>';
}
$_SESSION['_widget_related_user'] = serialize($related_user);
echo $html;
}
}
示例4: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
$this->datas['##notinfocom.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.notinfocom.entity##'] = __('Entity');
$events = $this->getAllEvents();
$this->datas['##lang.notinfocom.title##'] = $events[$event];
$this->datas['##lang.notinfocom.name##'] = __('Name');
$this->datas['##lang.notinfocom.urlname##'] = __('URL');
$this->datas['##lang.notinfocom.computertype##'] = __('Type');
$this->datas['##lang.notinfocom.operatingsystem##'] = __('Operating system');
$this->datas['##lang.notinfocom.state##'] = __('Status');
$this->datas['##lang.notinfocom.location##'] = __('Location');
$this->datas['##lang.notinfocom.urluser##'] = __('URL');
$this->datas['##lang.notinfocom.urlgroup##'] = __('URL');
$this->datas['##lang.notinfocom.user##'] = __('User');
$this->datas['##lang.notinfocom.group##'] = __('Group');
foreach ($options['notinfocoms'] as $id => $notinfocom) {
$tmp = array();
$tmp['##notinfocom.urlname##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=computer_" . $notinfocom['id']);
$tmp['##notinfocom.name##'] = $notinfocom['name'];
$tmp['##notinfocom.computertype##'] = Dropdown::getDropdownName("glpi_computertypes", $notinfocom['computertypes_id']);
$tmp['##notinfocom.operatingsystem##'] = Dropdown::getDropdownName("glpi_operatingsystems", $notinfocom['operatingsystems_id']);
$tmp['##notinfocom.state##'] = Dropdown::getDropdownName("glpi_states", $notinfocom['states_id']);
$tmp['##notinfocom.location##'] = Dropdown::getDropdownName("glpi_locations", $notinfocom['locations_id']);
$tmp['##notinfocom.urluser##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=user_" . $notinfocom['users_id']);
$tmp['##notinfocom.urlgroup##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=group_" . $notinfocom['groups_id']);
$tmp['##notinfocom.user##'] = getUserName($notinfocom['users_id']);
$tmp['##notinfocom.group##'] = Dropdown::getDropdownName("glpi_groups", $notinfocom['groups_id']);
$tmp['##notinfocom.contact##'] = $notinfocom['contact'];
$this->datas['notinfocoms'][] = $tmp;
}
}
示例5: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, KnowbaseItem $item)
{
global $DB;
$ID = $item->getField('id');
if (!Session::haveRight('knowbase', 'r') || !Session::haveRight('faq', 'r')) {
return false;
}
$knowbaseitemcategories_id = $item->getField('knowbaseitemcategories_id');
$fullcategoryname = Html::clean(getTreeValueCompleteName("glpi_knowbaseitemcategories", $knowbaseitemcategories_id));
$question = Html::clean(Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($item->getField('name'), ENT_QUOTES, "UTF-8")));
$answer = Html::clean(Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($item->getField('answer'), ENT_QUOTES, "UTF-8")));
$pdf->setColumnsSize(100);
if (Toolbox::strlen($fullcategoryname) > 0) {
$pdf->displayTitle('<b>' . __('Category name') . '</b>');
$pdf->displayLine($fullcategoryname);
}
if (Toolbox::strlen($question) > 0) {
$pdf->displayTitle('<b>' . __('Subject') . '</b>');
$pdf->displayText('', $question, 5);
} else {
$pdf->displayTitle('<b>' . __('No question found', 'pdf') . '</b>');
}
if (Toolbox::strlen($answer) > 0) {
$pdf->displayTitle('<b>' . __('Content') . '</b>');
$pdf->displayText('', $answer, 5);
} else {
$pdf->displayTitle('<b>' . __('No answer found') . '</b>');
}
$pdf->setColumnsSize(50, 15, 15, 10, 10);
$pdf->displayTitle(__('Writer'), __('Creation date'), __('Last update'), __('FAQ'), _n('View', 'Views', 2));
$pdf->displayLine(getUserName($item->fields["users_id"]), Html::convDateTime($item->fields["date"]), Html::convDateTime($item->fields["date_mod"]), Dropdown::getYesNo($item->fields["is_faq"]), $item->fields["view"]);
$pdf->displaySpace();
}
示例6: doFollowRelatedUser
public function doFollowRelatedUser()
{
$_POST['uid'] = intval($_POST['uid']);
if (0 == $_POST['uid']) {
echo 0;
} else {
D('Follow', 'weibo')->dofollow($this->mid, $_POST['uid']);
$related_user = unserialize($_SESSION['related_user']);
if (empty($related_user)) {
echo '';
return;
} else {
$shifted_user = array_shift($related_user);
$_SESSION['related_user'] = serialize($related_user);
$html = '';
$html .= '<li id="related_user_' . $shifted_user . '">';
$html .= '<span class="userPic"><a title="" href="' . U("home/Space/index", array("uid" => $shifted_user)) . '">';
$html .= '<img src="' . getUserFace($shifted_user, 's') . '" card="1">';
$html .= '</a></span>';
$html .= '<div class="name"><a href="' . U("home/Space/index", array("uid" => $shifted_user)) . '">' . getUserName($shifted_user) . '</a></div>';
$html .= '<div><a href="javascript:void(0);" class="cGray2" onclick="subscribe(' . $shifted_user . ');">加关注</a></div>';
$html .= '</li>';
echo $html;
}
}
}
示例7: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
if ($event == 'AlertNotValidatedTypology') {
$this->datas['##typology.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.typology.entity##'] = __('Entity');
$this->datas['##typology.action##'] = __('Elements not match with the typology', 'typology');
$this->datas['##lang.typology.name##'] = PluginTypologyTypology::getTypeName(1);
$this->datas['##lang.typology.itemtype##'] = __('Type');
$this->datas['##lang.typology.items_id##'] = __('Name');
$this->datas['##lang.typology.error##'] = __('Error');
$this->datas['##lang.typology.url##'] = __('Link to the typology', 'typology');
$this->datas['##lang.typology.itemurl##'] = __('Link to the element', 'typology');
$this->datas['##lang.typology.itemuser##'] = __('User');
$this->datas['##lang.typology.itemlocation##'] = __('Location');
foreach ($options['items'] as $id => $item) {
$tmp = array();
$tmp['##typology.name##'] = $item['name'];
$itemtype = new $item['itemtype']();
$itemtype->getFromDB($item["items_id"]);
$tmp['##typology.itemtype##'] = $itemtype->getTypeName();
$tmp['##typology.items_id##'] = $itemtype->getName();
$tmp['##typology.error##'] = PluginTypologyTypology_Item::displayErrors($item['error'], false);
$tmp['##typology.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_typology_" . $item['plugin_typology_typologies_id']);
$tmp['##typology.itemurl##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=" . Toolbox::strtolower($item['itemtype']) . "_" . $item["items_id"]);
$tmp['##typology.itemuser##'] = getUserName($itemtype->fields["users_id"]);
$tmp['##typology.itemlocation##'] = Dropdown::getDropdownName("glpi_locations", $itemtype->fields['locations_id']);
$this->datas['typologyitems'][] = $tmp;
}
}
}
示例8: insert
function insert()
{
//Fantasy新加上的这句判断,为了在home页添加好友用
if ($_POST['id'] != '') {
$friendId = $_POST['id'];
} else {
$friendId = $this->uid;
}
$userId = $this->mid;
$dao = D('UserFriend');
$result1 = $dao->addFriend($friendId, $userId);
$result2 = $dao->addFriend($userId, $friendId);
if ($result1 > 0 && $result2 > 0) {
//记录动态,发送通知
/* add_user_feed */
$feedTitle = "和 <a href=\"/Space/index/id/{$friendId}\">" . getUserName($friendId) . "</a> 成为好友";
$this->addUserFeed($userId, 'add', 'friend', $friendId, $feedTitle);
/* /add_user_feed */
/* add_user_feed */
$feedTitle = "和 <a href=\"/Space/index/id/{$userId}\">" . getUserName($userId) . "</a> 成为好友";
$this->addUserFeed($friendId, 'add', 'friend', $userId, $feedTitle);
/* /add_user_feed */
$this->addUserAlert($friendId, "makeFriend");
//$this->success("你们已经成为好朋友!");
//echo true;
$this->myAjaxRetrun(true);
} else {
//$this->error("添加好友失败!");
//echo false;
$this->myAjaxRetrun(false);
}
}
示例9: renderGroupPosts
function renderGroupPosts($groupPosts, $db)
{
echo '<div class="scrollContainer">';
foreach ($groupPosts as $a) {
?>
<div class="post">
<h4><a href="/?page=viewProfile&id=<?php
echo $a['userId'];
?>
"><?php
echo getUserName($a['userId'], $db);
?>
</a></h4>
<p><?php
echo $a['content'];
?>
</p>
<a class="timestamp"><?php
echo $a['timestamp'];
?>
</a>
<?php
if ($a['admin'] == 1) {
echo "<span class='postTag'>Announcement<span>";
}
?>
</div> <?php
}
echo '</div>';
}
示例10: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
{
global $CFG_GLPI, $DB;
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Approvals for the ticket') . "</b>");
if (!Session::haveRight('validate_request', 1) && !Session::haveRight('validate_incident', 1) && !Session::haveRight('create_incident_validation', 1) && !Session::haveRight('create_request_validation', 1)) {
return false;
}
$ID = $ticket->getField('id');
$query = "SELECT *\n FROM `glpi_ticketvalidations`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'\n ORDER BY submission_date DESC";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayTitle(_x('item', 'State'), __('Request date'), __('Approval requester'), __('Approval date'), __('Approver'));
while ($row = $DB->fetch_assoc($result)) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayLine(TicketValidation::getStatus($row['status']), Html::convDateTime($row["submission_date"]), getUserName($row["users_id"]), Html::convDateTime($row["validation_date"]), getUserName($row["users_id_validate"]));
$tmp = trim($row["comment_submission"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Request comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
if ($row["validation_date"]) {
$tmp = trim($row["comment_validation"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Approval comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
}
}
} else {
$pdf->displayLine(__('No item found'));
}
$pdf->displaySpace();
}
示例11: doaddcomment
function doaddcomment($uid, $post, $api = false)
{
$data['uid'] = $uid;
$data['reply_comment_id'] = intval($post['reply_comment_id']);
$data['weibo_id'] = intval($post['weibo_id']);
$data['content'] = $post['content'];
$data['ctime'] = time();
$miniInfo = D('Weibo')->where('weibo_id=' . $data['weibo_id'])->find();
if ($data['reply_comment_id']) {
$replyInfo = $this->where('comment_id=' . $data['reply_comment_id'])->find();
$data['reply_uid'] = $replyInfo['uid'];
} else {
$data['reply_uid'] = $miniInfo['uid'];
$notify['reply_type'] = 'weibo';
}
if ($comment_id = $this->addcomment($data)) {
//微博回复积分操作
if ($data['uid'] != $data['reply_uid']) {
X('Credit')->setUserCredit($data['uid'], 'reply_weibo')->setUserCredit($data['reply_uid'], 'replied_weibo');
}
$data['comment'] = $miniInfo['comment'] + 1;
$return['data'] = $data;
$return['html'] = '<div class="position_list" id="comment_list_c_' . $comment_id . '"> <a href="' . U('home/space/index', array('uid' => $this->mid)) . '" class="pic">
<img class="pic30" src="' . getUserFace($uid, 's') . '" /></a>
<p class="list_c"><a href="#">' . getUserName($uid) . '</a> ' . getUserGroupIcon($uid) . ' : ' . formatComment($data['content'], true) . ' (刚刚)</p>
<div class="alR clear"><a href="javascript:void(0)" onclick="ui.confirm(this,\'确认要删除此评论?\')" callback="delComment(' . $comment_id . ')">删除</a> <a href="javascript:void(0)" onclick="reply(\'' . getUserName($uid) . '\',' . $data['weibo_id'] . ')">回复</a></div>
</div>';
if ($post['transpond'] != 0) {
if ($miniInfo['transpond_id'] != 0) {
$transpondData['content'] = $data['content'] . " //@" . getUserName($miniInfo['uid']) . ":" . $miniInfo['content'];
$transpondData['transpond_id'] = $miniInfo['transpond_id'];
$transpondInfo = M('weibo')->where('weibo_id=' . $miniInfo['transpond_id'])->find();
$transpondData['transpond_uid'] = $transpondInfo['uid'];
} else {
$transpondData['content'] = $data['content'];
$transpondData['transpond_id'] = $miniInfo['weibo_id'];
$transpondData['transpond_uid'] = $miniInfo['uid'];
}
$id = D('Weibo', 'weibo')->doSaveWeibo($uid, $transpondData, $post['from']);
if ($id) {
//当转发的微博uid 与 回复人的uid不一致时发布@到我
if ($transpondData['transpond_uid'] != $data['reply_uid']) {
D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid']);
} else {
D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid'], false);
}
}
}
//添加统计
Model('UserCount')->addCount($data['reply_uid'], 'comment');
if ($api) {
return true;
} else {
return json_encode($return);
}
} else {
return '0';
}
}
示例12: _following
public function _following($param)
{
$uid = $param['uid'];
$data['uname'] = getUserName($uid);
$data['list'] = D('Follow', 'weibo')->getList($uid, "following", 0, null, 6);
$this->assign($data);
$this->display('following');
}
示例13: prepareComment
function prepareComment($msg, $timestamp, $uid, $cid, $event_id)
{
$date = formatDate($timestamp);
// $time = formatDate($timestamp);
$name = getUserName($uid);
$msg = formatMsg($msg);
$delbtn = deleteBtnComment($cid, $uid, $event_id);
return "<div class='eventComment'>\n <span style='font-size:50%;'>\n <span>{$date}</span>\n \n |\n \n <span style='font-size:75%;'>\n {$name}</span>\n </span>\n <span>\n {$delbtn}\n </span>\n <br />\n <span class='eventCommentText'>\n " . strip_tags($msg) . "\n </span>\n </div>\n ";
}
示例14: writeLog
function writeLog($gid, $uid, $content, $type = 'topic')
{
$map['gid'] = $gid;
$map['uid'] = $uid;
$map['type'] = $type;
$map['content'] = "<a href='__TS__/space/{$uid}'>" . getUserName($uid) . "</a> " . $content;
$map['ctime'] = time();
$this->add($map);
}
示例15: writeLog
function writeLog($gid, $uid, $content, $type = 'topic')
{
$map['gid'] = $gid;
$map['uid'] = $uid;
$map['type'] = $type;
$map['content'] = getUserSpace($uid, 'fn', '_blank', '@' . getUserName($uid)) . ' ' . $content;
$map['ctime'] = time();
$this->add($map);
}