chatroom list widget backend

This commit is contained in:
friendica 2014-01-29 01:52:23 -08:00
parent 9261a170eb
commit 9f54675702
2 changed files with 18 additions and 0 deletions

View File

@ -115,3 +115,12 @@ function chatroom_leave($observer_xchan,$room_id,$status) {
} }
return true; return true;
} }
function chatroom_list($uid) {
$r = q("select cr_name, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d order by cr_name group by cp_id",
intval($uid)
);
return $r;
}

View File

@ -576,3 +576,12 @@ function widget_menu_preview($arr) {
require_once('include/menu.php'); require_once('include/menu.php');
return menu_render(get_app()->data['menu_item']); return menu_render(get_app()->data['menu_item']);
} }
function widget_chatroom_list($arr) {
require_once("include/chat.php");
$r = chatroom_list(local_user());
return replace_macros(get_markup_template('chatroomlist.tpl'),array(
'$header' => t('Chat Rooms'),
'$items' => $r,
));
}