2011-11-26 15:47:28 +00:00
|
|
|
<?php
|
|
|
|
namespace wcf\data\chat\room;
|
2011-11-26 16:37:46 +00:00
|
|
|
use \wcf\system\cache\CacheHandler;
|
2011-11-26 15:47:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a chat room.
|
|
|
|
*
|
|
|
|
* @author Tim Düsterhus
|
|
|
|
* @copyright 2010-2011 Tim Düsterhus
|
|
|
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
|
|
|
* @package timwolla.wcf.chat
|
|
|
|
* @subpackage data.chat.room
|
|
|
|
*/
|
2011-11-26 16:56:51 +00:00
|
|
|
class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController {
|
2011-11-26 15:47:28 +00:00
|
|
|
/**
|
|
|
|
* @see wcf\data\DatabaseObject::$databaseTableName
|
|
|
|
*/
|
|
|
|
protected static $databaseTableName = 'chat_room';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see wcf\data\DatabaseObject::$databaseTableIndexName
|
|
|
|
*/
|
|
|
|
protected static $databaseTableIndexName = 'roomID';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Caches rooms.
|
|
|
|
*
|
|
|
|
* @var array<wcf\data\chat\room\ChatRoom>
|
|
|
|
*/
|
|
|
|
protected static $cache = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the room cache.
|
|
|
|
*/
|
2011-11-26 16:37:46 +00:00
|
|
|
public static function getCache() {
|
|
|
|
if (self::$cache === null) {
|
|
|
|
CacheHandler::getInstance()->addResource(
|
|
|
|
'chatrooms',
|
|
|
|
WCF_DIR.'cache/cache.chatrooms.php',
|
|
|
|
'wcf\system\cache\builder\ChatRoomCacheBuilder'
|
|
|
|
);
|
|
|
|
self::$cache = CacheHandler::getInstance()->get('chatrooms');
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::$cache;
|
2011-11-26 15:47:28 +00:00
|
|
|
}
|
|
|
|
|
2011-11-27 19:15:22 +00:00
|
|
|
/**
|
|
|
|
* Clears the room cache.
|
|
|
|
*/
|
|
|
|
public static function clearCache() {
|
|
|
|
self::getCache();
|
|
|
|
CacheHandler::getInstance()->clearResource('chatrooms');
|
|
|
|
}
|
|
|
|
|
2011-11-26 16:56:51 +00:00
|
|
|
/**
|
|
|
|
* @see \wcf\data\chat\room\ChatRoom::getTitle();
|
|
|
|
*/
|
2011-12-09 22:42:16 +00:00
|
|
|
public function __toString() {
|
2011-12-05 19:25:18 +00:00
|
|
|
return $this->getTitle();
|
2011-11-26 16:56:51 +00:00
|
|
|
}
|
|
|
|
|
2011-11-26 15:47:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the name of this chat-room.
|
|
|
|
*
|
2011-11-26 16:56:51 +00:00
|
|
|
* @see \wcf\system\request\IRouteController
|
2011-11-26 15:47:28 +00:00
|
|
|
*/
|
2011-11-26 16:56:51 +00:00
|
|
|
public function getTitle() {
|
2011-11-26 15:47:28 +00:00
|
|
|
return $this->title;
|
|
|
|
}
|
2011-11-26 16:56:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the ID of this chat-room.
|
|
|
|
*
|
|
|
|
* @see \wcf\system\request\RRouteHandler
|
|
|
|
*/
|
|
|
|
public function getID() {
|
|
|
|
return $this->roomID;
|
|
|
|
}
|
2011-11-26 15:47:28 +00:00
|
|
|
}
|