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


PHP Chat::getMessages方法代码示例

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


在下文中一共展示了Chat::getMessages方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:14,代码来源:ChatBox.php

示例3: 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

示例4: Chat

<?php

require 'chat.php';
date_default_timezone_set('Asia/Manila');
session_start();
$chatApp = new Chat();
$action = $chatApp->escapeString($_POST['action']);
if ($action == '670b6594b0d31fe3cb808084a4c9c0cb') {
    $chatApp->setQuery("SELECT * FROM logs ORDER BY Date_Time_Added");
    while ($row = $chatApp->getMessages('array')) {
        if ($row['Type'] == 'Chat') {
            if ($row['Username'] == $_SESSION['user_id']) {
                echo '<div class="me"><div class="name">You</div><div class="content">' . $row['Message'] . '</div><span class="arrow"></span><div class="time">' . date('F d, Y (h:i A)', strtotime($row['Date_Time_Added'])) . '</div></div>';
            } else {
                echo '<div class="other"><div class="name">' . $row['Username'] . '</div><div class="content">' . $row['Message'] . '</div><div class="time">' . date('F d, Y (h:i A)', strtotime($row['Date_Time_Added'])) . '</div></div>';
            }
        } else {
            if ($row['Type'] == 'System Log') {
                echo '<div class="system"><div class="content">' . $row['Username'] . ' ' . $row['Message'] . '</div><div class="time">' . date('F d, Y (h:i A)', strtotime($row['Date_Time_Added'])) . '</div></div>';
            }
        }
    }
} else {
    if ($action == '5dd205015951f9f81e5b95c86457130a') {
        $username = $chatApp->escapeString($_POST['username']);
        $message = $chatApp->escapeString($_POST['message']);
        $datetime = date('Y-m-d H:i:s');
        $chatApp->setQuery("INSERT INTO logs (Username, Date_Time_Added, Message, Type) VALUES ('{$username}', '{$datetime}', '{$message}', 'Chat')");
        if ($chatApp->getMessagesCount() == 1) {
            echo true;
        } else {
开发者ID:KarlJarren0308,项目名称:CollegeOfLawElectionSystem,代码行数:31,代码来源:logs.php

示例5: foreach

                    </div>
                </div>
                <?php 
} else {
    ?>
                <div class="chatContainer">
                <div class="chatHeader">
                    <h3>Welcome, <?php 
    echo $_SESSION['username'];
    ?>
</h3>
                    <a href="logout.php" class="btn btn-custom btn-info">Logout</a>
                </div>
                <div class="chatMessage" id="chatMessage">
                <?php 
    foreach ($oChat->getMessages() as $v) {
        ?>
                    <p class="cm"><b><?php 
        echo $v['Username'];
        ?>
 </b>says:<br><?php 
        echo $v['Message'];
        ?>
</p>
                <?php 
    }
    ?>
                </div>
                    <div class="chatBottom">
                        <textarea class="addMessage" id="addMessage" placeholder="Type your message"></textarea>
                    </div>
开发者ID:atonevbg,项目名称:chat,代码行数:31,代码来源:index.php

示例6: Chat

<?php

include './classes/chat.php';
$oChat = new Chat();
$aMessages = $oChat->getMessages();
foreach ($aMessages as $v) {
    ?>
    <p class="cm"><b><?php 
    echo $v['Username'];
    ?>
 </b>says:<br><?php 
    echo $v['Message'];
    ?>
</p>

<?php 
}
开发者ID:atonevbg,项目名称:chat,代码行数:17,代码来源:showMessage.php


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