mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Adding PageMenuItem for chat
This commit is contained in:
parent
c92e1079c3
commit
5c72cd52be
28
file/lib/system/menu/page/ChatPageMenuItemProvider.class.php
Normal file
28
file/lib/system/menu/page/ChatPageMenuItemProvider.class.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace wcf\system\menu\page;
|
||||
|
||||
/**
|
||||
* PageMenuItemProvider for chat.
|
||||
*
|
||||
* @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 system.menu.page
|
||||
*/
|
||||
class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider {
|
||||
/**
|
||||
* Hides the button when there is no valid room
|
||||
*
|
||||
* @see wcf\system\menu\page\PageMenuItemProvider::isVisible()
|
||||
*/
|
||||
public function isVisible() {
|
||||
try {
|
||||
\wcf\data\chat\room\ChatRoom::getCache()->seek(0);
|
||||
return true;
|
||||
}
|
||||
catch (\OutOfBoundsException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
10
pagemenu.xml
Normal file
10
pagemenu.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/pagemnu.xsd">
|
||||
<import>
|
||||
<pagemenuitem name="wcf.header.menu.chat">
|
||||
<link>index.php/Chat</link>
|
||||
<position>header</position>
|
||||
<classname>wcf\system\menu\page\ChatPageMenuItemProvider</classname>
|
||||
</pagemenuitem>
|
||||
</import>
|
||||
</data>
|
Loading…
Reference in New Issue
Block a user