本文整理汇总了PHP中DataManager::getUserById方法的典型用法代码示例。如果您正苦于以下问题:PHP DataManager::getUserById方法的具体用法?PHP DataManager::getUserById怎么用?PHP DataManager::getUserById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::getUserById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAuthenticatedUser
public static function getAuthenticatedUser()
{
return self::isAuthenticated() ? DataManager::getUserById($_SESSION['user']) : null;
}
示例2: isset
DataManager::getChannelByName($_SESSION['channel']);
?>
">
<div class = "panel-heading">
<h4 class="channelName"><?php
echo isset($_SESSION['channel']) && $_SESSION['channel'] ? $_SESSION['channel'] : "Default";
?>
</h4></div>
<div class = "panel-body panel-height">
<ul class = "media-list messageContainer">
<?php
$channel = DataManager::getChannelByName($_SESSION['channel']);
$messages = DataManager::getPostsByChannel($channel->getID());
//Util::stable_uasort($messages, 'Util::MessageCmp');
foreach ($messages as $message) {
$author = DataManager::getUserById($message->getAuthor());
$status = DataManager::getPostStatus($message->getId());
if ($status != Status::PRIOR && $status != Status::DELETED) {
Viewtility::viewMessage($message, $status);
}
/*
if ($currUser) {
if ($status == Status::UNREAD && $author->getUsername() != $currUser->getUsername()) {
DataManager::changePostStatus($message->getID(), Status::READ);
$message->setRead();
}
}
*/
}
?>
示例3: foreach
?>
<div class="row">
<h4 class="page-header" style="margin: 10px 20px; padding-bottom: 0;">
<a href="?view=channel&id=<?php
echo $channel->getId();
?>
">
<?php
echo $channel->getName();
?>
</a>
</h4>
<?php
foreach ($posts as $post) {
$user = DataManager::getUserById($post->getUserId());
?>
<div class='col-lg-8'>
<div class='panel panel-primary'>
<div class='panel-heading'>
<h3 class='panel-title'>
<?php
echo $post->getTitle();
?>
<span class='align-right'>
<?php
echo $user->getFirstName() . " " . $user->getLastName() . ", " . $post->getDatetime();
?>
</span>
</h3>
</div>
示例4: jsonSerialize
/**
* Specify data which should be serialized to JSON
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
*/
function jsonSerialize()
{
$user = DataManager::getUserById($this->userId);
return ['id' => $this->getId(), 'title' => $this->title, 'text' => $this->text, 'user' => $user, 'threadId' => $this->channelId, "datetime" => $this->datetime, 'isFavorite' => intval($this->favorite), 'isUnread' => intval($this->unread)];
}
示例5: viewMessage
public static function viewMessage($message, $status)
{
?>
<li class = 'media'>
<div class = 'media-body <?php
echo $status == Status::UNREAD ? 'mark' : ' ';
?>
'>
<p class='lead'><?php
echo $message->getTitle();
?>
<p>
<?php
echo $message->getContent();
?>
<br>
<div>
<small class = 'text-muted'>
<a class = 'pull-left' href = '#'>
<span class = 'glyphicon glyphicon-user'>
<?php
$author = DataManager::getUserById($message->getAuthor());
echo $author->getUsername();
?>
</span>
</a>
<?php
$id = $message->getID();
switch ($status) {
case Status::UNREAD:
?>
<a href = '#' id = "<?php
echo $id;
?>
" class = 'glyphicon glyphicon-star-empty custom-star' onclick='setPrior(<?php
echo $id;
?>
)'></a>
<a href = '#' id = "<?php
echo $id;
?>
" class = 'glyphicon glyphicon-remove customRemoveActive' onclick='removeMessage(<?php
echo $id;
?>
)'></a>
<?php
break;
case Status::READ:
?>
<a href = '#' id = '<?php
echo $id;
?>
' class = 'glyphicon glyphicon-star-empty custom-star' onclick='setPrior(<?php
echo $id;
?>
)'></a>
<a href = '#' id = "<?php
echo $id;
?>
" class = 'glyphicon glyphicon-remove customRemoveActive' onclick='removeMessage(<?php
echo $id;
?>
)'></a>
<?php
break;
case Status::ANSWERED:
?>
<a href = '#' id = '<?php
echo $id;
?>
' class = 'glyphicon glyphicon-star-empty custom-star' onclick='setPrior(<?php
echo $id;
?>
)'></a>
<?php
break;
case Status::PRIOR:
?>
<a href = '#' id = '<?php
echo $id;
?>
' class = 'glyphicon glyphicon-star custom-star' onclick='resetPrior(<?php
echo $id;
?>
)'></a>
<?php
break;
default:
case Status::DELETED:
break;
}
?>
</small>
</div>
</div>
<hr>
</li>
<?php
}