View file modules/chat/index.php

File size: 1.12Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_chat';
if(!isset($user)) { go('/'); exit;}
$title = $lang->word('chat');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('chat'));
$chat_rooms_n = $db->query("SELECT * FROM `chat`")->rowCount();
if($chat_rooms_n == 0) 
{
	$tpl->div('menu', $lang->word('no_chat_rooms'));
} 
else {
	$chat_rooms_q = $db->query("SELECT * FROM `chat` ORDER by name");
	while($chat_rooms = $chat_rooms_q->fetch()) {
		$tpl->div('menu', img('room.png') .'<a href="/chat/room/'. $chat_rooms['id'] .'/">'. $chat_rooms['name'] .'</a> '.($user['level'] >= 6 ? '<a href="/chat/del_room/?room_id='. $chat_rooms['id'] .'">'. img('delete.png') .'</a>' : NULL) .'');
	}
}
$add_room = ''.(isset($user) && $user['level'] >= '6' ? NAV .'<a href="/chat/add_room/">'. $lang->word('add_room') .'</a><br/>' : NULL).'';
$tpl->div('block', $add_room . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>