function _drupalchat_chat in DrupalChat 7
Same name and namespace in other branches
- 6.2 drupalchat.module \_drupalchat_chat()
- 6 drupalchat.module \_drupalchat_chat()
- 7.2 drupalchat.module \_drupalchat_chat()
1 call to _drupalchat_chat()
- drupalchat_preprocess_drupalchat in ./
drupalchat.module - @todo Please document this function.
File
- ./
drupalchat.module, line 198 - Module code for DrupalChat.
Code
function _drupalchat_chat() {
global $user;
$chat = array();
$chat['name'] = 'chat';
$chat['header'] = t('Chat');
$buddylist = _drupalchat_buddylist($user->uid);
$buddylist_online = _drupalchat_buddylist_online($buddylist);
//JON COMMENTS
$chat['contents'] = '<div class="chat_options">';
//$chat['contents'] .= '<a class="options" href="#">' . t('Options') . '</a>';
$chat['contents'] .= '<a class="chat_loading" href="#"></a>';
$chat['contents'] .= '</div>';
$items = array();
foreach ($buddylist_online as $key => $value) {
if ($key != 'total') {
$items[] = array(
'data' => '<a class="' . $key . '" href="#">' . $value['name'] . '</a>',
'class' => array(
'status-' . $value['status'],
),
);
}
}
if ($items) {
$chat['contents'] .= theme('item_list', array(
'items' => $items,
));
}
else {
$chat['contents'] .= theme('item_list', array(
'items' => array(
array(
'data' => l(t('No users online'), 'user'),
'class' => array(
'link',
),
),
),
));
}
$chat['text'] = t('Chat') . ' (<span class="online-count">' . count($items) . '</span>)';
$theme = variable_get('drupalchat_theme', 'light');
$chat['icon'] = theme('image', array(
'path' => drupal_get_path('module', 'drupalchat') . '/themes/' . $theme . '/images/loading.gif',
'width' => NULL,
'height' => NULL,
'alt' => t('chat'),
'attributes' => array(
'class' => 'icon',
),
));
return theme('drupalchat_subpanel', array(
'subpanel' => $chat,
));
}