本文整理汇总了PHP中Room::addUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::addUser方法的具体用法?PHP Room::addUser怎么用?PHP Room::addUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::addUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
protected function setup()
{
$loggedUser = LoggedUser::whoIsLogged();
if ($this->room !== NULL) {
Room::addUser($loggedUser['id'], $this->room['id']);
$messages = Chat::getMessages($this->room['id'], $loggedUser['id'], 0, $this->game['id']);
MySmarty::assign('loggedUser', $loggedUser);
MySmarty::assign('messages', $messages);
MySmarty::assign('users', Room::getUsers($this->room['id']));
MySmarty::assign('emoticonDir', EMOTICONS_DIR);
MySmarty::assign('emoticons', Emoticons::getEmoticons());
MySmarty::assign('room', $this->room);
}
}
示例2: intval
<?php
require_once 'include.php';
$loggedUser = User::whoIsLogged();
if ($loggedUser === null) {
Utils::redirect('login.php');
}
$actualUrl = Utils::getActualUrl();
$room = intval($_GET['id']);
if (!$room) {
Utils::redirect('rooms.php');
}
Room::addUser($loggedUser['id'], $room);
$gameRepository = new GameRepository();
$game = $gameRepository->getOneByRoom($room);
if ($game) {
$GLOBALS['smarty']->assign('game', $game);
}
if ($_POST && trim($_POST['message'])) {
if (strpos($_POST['message'], '.') === 0) {
$commandResult = Command::execute($_POST['message'], $game);
} else {
Chat::addMessage(trim($_POST['message']), $room);
}
Room::updateUserLastActivity($loggedUser['id'], $room);
Utils::redirect($actualUrl);
}
$messages = Chat::getMessages($room, $loggedUser['id']);
$emoticons = Emoticons::getEmoticons();
$GLOBALS['smarty']->assign('loggedUser', $loggedUser);
$GLOBALS['smarty']->assign('room', $room);