当前位置: 首页>>代码示例>>PHP>>正文


PHP Room::updateUserLastActivity方法代码示例

本文整理汇总了PHP中Room::updateUserLastActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::updateUserLastActivity方法的具体用法?PHP Room::updateUserLastActivity怎么用?PHP Room::updateUserLastActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room::updateUserLastActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 public function main()
 {
     $room = intval($_POST['room']);
     $game = intval($_POST['game']);
     $loggedUser = LoggedUser::whoIsLogged();
     $lastActivity = Room::getUserLastActivityInRoom($loggedUser['id'], $room);
     Room::updateUserLastActivity($loggedUser['id'], $room);
     MySmarty::assign('messages', Chat::getMessages($room, $loggedUser['id'], 0, $game));
     echo MySmarty::fetch('message-box.tpl');
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:10,代码来源:RefreshChat.php

示例2: intval

$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);
$GLOBALS['smarty']->assign('messages', $messages);
$GLOBALS['smarty']->assign('users', Room::getUsers($room));
$GLOBALS['smarty']->assign('emoticonDir', EMOTICONS_DIR);
$GLOBALS['smarty']->assign('emoticons', $emoticons);
$GLOBALS['smarty']->assign('content', $GLOBALS['smarty']->fetch('room.tpl'));
$GLOBALS['smarty']->assign('bodyAdded', 'onload="JavaScript:timedRefresh(10000, ' . $room . ');"');
echo $GLOBALS['smarty']->fetch('content.tpl');
开发者ID:Tomeno,项目名称:lulcobang,代码行数:31,代码来源:room.php

示例3: setup

 protected function setup()
 {
     $roomAlias = Utils::get('identifier');
     $roomRepository = new RoomRepository();
     $room = $roomRepository->getOneByAlias($roomAlias);
     $loggedUser = LoggedUser::whoIsLogged();
     if ($room) {
         $gameRepository = new GameRepository();
         // $gameRepository->addAdditionalWhere(array('column' => 'status', 'value' => Game::GAME_STATUS_ENDED, 'xxx' => '!='));
         $gameRepository->addOrderBy(array('id' => 'DESC'));
         $game = $gameRepository->getOneByRoom($room['id']);
         if (Utils::post()) {
             $message = addslashes(trim(Utils::post('message')));
             if ($message != '') {
                 if (strpos($message, '.') === 0) {
                     $response = Command::setup('command=' . substr($message, 1), $game);
                 } else {
                     $response = Command::setup('command=say&text=' . $message . '&room=' . $room['id'] . '&game=' . $game['id'], $game);
                 }
                 Room::updateUserLastActivity($loggedUser['id'], $room['id']);
             } elseif (Utils::post('create')) {
                 $response = Command::setup('command=create', $game);
             } elseif (Utils::post('join')) {
                 $response = Command::setup('command=join', $game);
             } elseif (Utils::post('add_ai_player')) {
                 $response = Command::setup('command=add_ai_player', $game);
             } elseif (Utils::post('start')) {
                 $response = Command::setup('command=init', $game);
             } elseif (Utils::post('choose_character')) {
                 $response = Command::setup('command=choose_character&selectedCharacter=' . Utils::post('character'), $game);
             } elseif (Utils::post('choose_cards')) {
                 $commandParams = array();
                 $commandParams['command'] = 'choose_cards';
                 $commandParams['selectedCards'] = array();
                 if (Utils::post('card')) {
                     $commandParams['selectedCards'] = implode(',', Utils::post('card'));
                 }
                 $params = array();
                 foreach ($commandParams as $key => $value) {
                     $params[] = $key . '=' . $value;
                 }
                 $commandString = implode('&', $params);
                 $response = Command::setup($commandString, $game);
             }
             Utils::redirect(Utils::getActualUrl(), FALSE);
             // TODO tu by sa mohol spravit redirect asi lebo respons bude v db
             MySmarty::assign('response', $response);
         }
         $gameBox = new GameBox();
         $gameBox->setRoom($room);
         if ($game !== NULL) {
             $gameBox->setGame($game);
         }
         MySmarty::assign('gameBox', $gameBox->render());
         $chatBox = new ChatBox();
         $chatBox->setRoom($room);
         if ($game !== NULL) {
             $chatBox->setGame($game);
         }
         MySmarty::assign('chatBox', $chatBox->render());
     } else {
         // TODO 404 room not found
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:64,代码来源:RoomDetailBox.php


注:本文中的Room::updateUserLastActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。