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


PHP Chat类代码示例

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


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

示例1: onLogoutSuccess

 /**
  * @param Request $request
  * @return null|RedirectResponse
  */
 public function onLogoutSuccess(Request $request)
 {
     // Chamilo logout
     $request->getSession()->remove('_locale');
     $request->getSession()->remove('_locale_user');
     if (api_is_global_chat_enabled()) {
         $chat = new \Chat();
         $chat->setUserStatus(0);
     }
     $userId = $this->storage->getToken()->getUser()->getId();
     $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql = "SELECT login_id, login_date\n                FROM {$tbl_track_login}\n                WHERE login_user_id = {$userId}\n                ORDER BY login_date DESC\n                LIMIT 0,1";
     $row = Database::query($sql);
     $loginId = null;
     if (Database::num_rows($row) > 0) {
         $loginId = Database::result($row, 0, "login_id");
     }
     $loginAs = $this->checker->isGranted('ROLE_PREVIOUS_ADMIN');
     if (!$loginAs) {
         $current_date = api_get_utc_datetime();
         $sql = "UPDATE {$tbl_track_login}\n                    SET logout_date='" . $current_date . "'\n        \t\t    WHERE login_id='{$loginId}'";
         Database::query($sql);
     }
     $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
     $query = "DELETE FROM " . $online_table . " WHERE login_user_id = {$userId}";
     Database::query($query);
     require_once api_get_path(SYS_PATH) . 'main/chat/chat_functions.lib.php';
     exit_of_chat($userId);
     $login = $this->router->generate('home');
     $response = new RedirectResponse($login);
     return $response;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:36,代码来源:LogoutSuccessHandler.php

示例2: getSpecific

 public function getSpecific()
 {
     $username = Input::get('username');
     $chat = new Chat();
     $result = $chat->getChat($username);
     return json_encode($result);
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:7,代码来源:ChatController.php

示例3: render_chat

	function render_chat($league_id){
		require_once(APPPATH.'controllers/chat.php'); 
	    $chat =  new Chat();
	    $chat->index($league_id);

		
	}
开发者ID:bmfelix,项目名称:draftlounge,代码行数:7,代码来源:leagues.php

示例4: getChatMessages

 /**
  * @param \Chat\Bundle\CommonBundle\Entity\Chat $chat
  * @param array $hashList
  * @return array
  */
 public function getChatMessages(Chat $chat, $hashList = array())
 {
     $messages = $this->_em->getConnection()->fetchAll('
         SELECT 
             cm.id,
             cm.hash,
             cm.content,
             cm.createAt,
             m.username,
             m.textColor,
             m.backgroundColor
         FROM
             `chat_message` cm
         LEFT JOIN
             `chat_member` m ON m.id = cm.member_id
         WHERE
             cm.`chat_id` = :chat_id
             AND cm.hash NOT IN (' . implode(',', $hashList) . ')
         ORDER BY
             cm.create_at ASC
     ', array('chat_id' => $chat->getId()));
     foreach ($messages as $key => $value) {
         $createAt = new \DateTime($value['create_at']);
         $value['create_at'] = $createAt->format('m.d.y g:i a');
         $messages[$key] = $value;
     }
     return $messages;
 }
开发者ID:alexeybob,项目名称:QuickChat,代码行数:33,代码来源:ChatRepository.php

示例5: get_ticket

 public function get_ticket()
 {
     //获取 component_verify_ticket 每十分钟微信服务本服务器请求一次
     $wechat = new Chat($this->config);
     $data = $wechat->request();
     // 	print_r($data);die;
     if (isset($data['InfoType'])) {
         if ($data['InfoType'] == 'component_verify_ticket') {
             if (isset($data['ComponentVerifyTicket']) && $data['ComponentVerifyTicket']) {
                 if ($config = D('Config')->where("`name`='wx_componentverifyticket'")->find()) {
                     D('Config')->where("`name`='wx_componentverifyticket'")->data(array('value' => $data['ComponentVerifyTicket']))->save();
                 } else {
                     D('Config')->data(array('name' => 'wx_componentverifyticket', 'value' => $data['ComponentVerifyTicket'], 'type' => 'type=text', 'gid' => 0, 'tab_id' => 0))->add();
                 }
                 S(C('now_city') . 'config', null);
                 exit('success');
             }
         } elseif ($data['InfoType'] == 'unauthorized') {
             if (isset($data['AuthorizerAppid']) && $data['AuthorizerAppid']) {
                 D('Weixin_bind')->where("`authorizer_appid`='{$data['AuthorizerAppid']}'")->delete();
                 exit('success');
             }
         }
     }
 }
开发者ID:belerweb,项目名称:pigcms,代码行数:25,代码来源:ChatAction.class.php

示例6: onDisconnected

 function onDisconnected()
 {
     // We reset the Chat view
     $c = new Chat();
     $c->ajaxGet();
     $this->refreshRooms();
     Notification::append(null, $this->__('chatrooms.disconnected'));
 }
开发者ID:Anon215,项目名称:movim,代码行数:8,代码来源:Rooms.php

示例7: save

 function save($id = FALSE)
 {
     if ($_POST) {
         $chat = new Chat($id);
         $_POST['user_id'] = $this->session->userdata('id');
         $chat->from_array($_POST);
         $chat->save();
         set_notify('success', lang('save_data_complete'));
     }
     redirect('chats/admin/chats');
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:11,代码来源:chats.php

示例8: logout

 /**
  * @return void  Directly redirects the user or leaves him where he is, but doesn't return anything
  * @param int $userId
  * @param bool $logout_redirect
  * @author Fernando P. García <fernando@develcuy.com>
  */
 public static function logout($user_id = null, $logout_redirect = false)
 {
     global $extAuthSource;
     // Database table definition
     $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $user_id = intval($user_id);
     // Changing global chat status to offline
     if (api_is_global_chat_enabled()) {
         $chat = new Chat();
         $chat->set_user_status(0);
     }
     // selecting the last login of the user
     $sql_last_connection = "SELECT login_id, login_date FROM {$tbl_track_login}\n                              WHERE login_user_id='{$user_id}' ORDER BY login_date DESC LIMIT 0,1";
     $q_last_connection = Database::query($sql_last_connection);
     $i_id_last_connection = null;
     if (Database::num_rows($q_last_connection) > 0) {
         $i_id_last_connection = Database::result($q_last_connection, 0, "login_id");
     }
     if (!isset($_SESSION['login_as']) && !empty($i_id_last_connection)) {
         $current_date = api_get_utc_datetime();
         $s_sql_update_logout_date = "UPDATE {$tbl_track_login} SET logout_date='" . $current_date . "' WHERE login_id = '{$i_id_last_connection}'";
         Database::query($s_sql_update_logout_date);
     }
     Online::loginDelete($user_id);
     //from inc/lib/online.inc.php - removes the "online" status
     //the following code enables the use of an external logout function.
     //example: define a $extAuthSource['ldap']['logout']="file.php" in configuration.php
     // then a function called ldap_logout() inside that file
     // (using *authent_name*_logout as the function name) and the following code
     // will find and execute it
     $uinfo = api_get_user_info($user_id);
     if (isset($uinfo['auth_source']) && $uinfo['auth_source'] != PLATFORM_AUTH_SOURCE && is_array($extAuthSource)) {
         if (is_array($extAuthSource[$uinfo['auth_source']])) {
             $subarray = $extAuthSource[$uinfo['auth_source']];
             if (!empty($subarray['logout']) && file_exists($subarray['logout'])) {
                 require_once $subarray['logout'];
                 $logout_function = $uinfo['auth_source'] . '_logout';
                 if (function_exists($logout_function)) {
                     $logout_function($uinfo);
                 }
             }
         }
     }
     require_once api_get_path(SYS_PATH) . 'main/chat/chat_functions.lib.php';
     exit_of_chat($user_id);
     if ($logout_redirect) {
         header("Location: index.php");
         exit;
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:59,代码来源:online.inc.php

示例9: editorFileManager

 /**
  * @Route("/editor/filemanager", name="editor_filemanager")
  * @Method({"GET"})
  */
 public function editorFileManager(Request $request)
 {
     \Chat::setDisableChat();
     $courseId = $request->get('course_id');
     $sessionId = $request->get('session_id');
     return $this->render('@ChamiloCore/default/javascript/editor/ckeditor/elfinder.html.twig', ['course_id' => $courseId, 'session_id' => $sessionId]);
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:11,代码来源:FrontController.php

示例10: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Chat::create([]);
     }
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:7,代码来源:ChatsTableSeeder.php

示例11: sc_chat_shortcode_offline

/**
 * Chat offline shortcode
 *
 * @access public
 * @return string
 */
function sc_chat_shortcode_offline($atts, $content = '')
{
    // Check if all OPs offline
    if (!Chat::check_if_any_op_online()) {
        return $content;
    }
}
开发者ID:k2jysy,项目名称:mergeshop,代码行数:13,代码来源:fn.init.php

示例12: getInstance

 /**
  * 单例方法
  */
 public static function getInstance()
 {
     if (!self::$server instanceof Chat) {
         self::$server = new self();
     }
     return self::$server;
 }
开发者ID:xw716825,项目名称:work,代码行数:10,代码来源:Chat.php

示例13: setIsSystem

 public function setIsSystem($isSystem = ChatMessageManager::IS_SYSTEM_YES)
 {
     if (!in_array($isSystem, Chat::getConstsArray('IS_SYSTEM'))) {
         throw new InvalidArgumentException("Invalid \$isSystem specified");
     }
     $this->qb->andWhere($this->qb->expr()->equal(new Field("is_system", "chat_msg"), $isSystem));
     return $this;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:8,代码来源:ChatMessageFilter.class.php

示例14: loadModelById

 public function loadModelById($id)
 {
     $model = Chat::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     } else {
         return $model;
     }
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:9,代码来源:ChatController.php

示例15: getChatByID

 public static function getChatByID($chatID)
 {
     include 'connect.php';
     $sql = "SELECT * FROM chats WHERE id = {$chatID}";
     //echo $sql;
     $result = mysql_query($sql);
     $row = mysql_fetch_array($result);
     mysql_close();
     if ($row) {
         $chat = new Chat();
         $chat->setChatID($row['id']);
         $chat->setUser1($row['user1']);
         $chat->setUser2($row['user2']);
         return $chat;
     } else {
         return false;
     }
 }
开发者ID:snamper,项目名称:Discover,代码行数:18,代码来源:classChat.php


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