Beispiel #1
0
function widget_chatroom_list($arr)
{
    $r = Zotlabs\Lib\Chatroom::roomlist(App::$profile['profile_uid']);
    if ($r) {
        return replace_macros(get_markup_template('chatroomlist.tpl'), array('$header' => t('Chatrooms'), '$baseurl' => z_root(), '$nickname' => App::$profile['channel_address'], '$items' => $r, '$overview' => t('Overview')));
    }
}
/**
 * @brief
 *
 * @param App $a
 * @param boolean $is_owner default false
 * @param string $nickname default null
 * @return void|string
 */
function profile_tabs($a, $is_owner = false, $nickname = null)
{
    // Don't provide any profile tabs if we're running as the sys channel
    if (App::$is_sys) {
        return;
    }
    $channel = App::get_channel();
    if (is_null($nickname)) {
        $nickname = $channel['channel_address'];
    }
    $uid = App::$profile['profile_uid'] ? App::$profile['profile_uid'] : local_channel();
    if ($uid == local_channel()) {
        $cal_link = '';
    } else {
        $cal_link = '/cal/' . $nickname;
    }
    if (get_pconfig($uid, 'system', 'noprofiletabs')) {
        return;
    }
    if (x($_GET, 'tab')) {
        $tab = notags(trim($_GET['tab']));
    }
    $url = z_root() . '/channel/' . $nickname;
    $pr = z_root() . '/profile/' . $nickname;
    $tabs = array(array('label' => t('Channel'), 'url' => $url, 'sel' => argv(0) == 'channel' ? 'active' : '', 'title' => t('Status Messages and Posts'), 'id' => 'status-tab'));
    $p = get_all_perms($uid, get_observer_hash());
    if ($p['view_profile']) {
        $tabs[] = array('label' => t('About'), 'url' => $pr, 'sel' => argv(0) == 'profile' ? 'active' : '', 'title' => t('Profile Details'), 'id' => 'profile-tab');
    }
    if ($p['view_storage']) {
        $tabs[] = array('label' => t('Photos'), 'url' => z_root() . '/photos/' . $nickname, 'sel' => argv(0) == 'photos' ? 'active' : '', 'title' => t('Photo Albums'), 'id' => 'photo-tab');
        $tabs[] = array('label' => t('Files'), 'url' => z_root() . '/cloud/' . $nickname, 'sel' => argv(0) == 'cloud' || argv(0) == 'sharedwithme' ? 'active' : '', 'title' => t('Files and Storage'), 'id' => 'files-tab');
    }
    if ($p['view_stream'] && $cal_link) {
        $tabs[] = array('label' => t('Events'), 'url' => z_root() . $cal_link, 'sel' => argv(0) == 'cal' || argv(0) == 'events' ? 'active' : '', 'title' => t('Events'), 'id' => 'event-tab');
    }
    if ($p['chat'] && feature_enabled($uid, 'ajaxchat')) {
        $has_chats = Zotlabs\Lib\Chatroom::list_count($uid);
        if ($has_chats) {
            $tabs[] = array('label' => t('Chatrooms'), 'url' => z_root() . '/chat/' . $nickname, 'sel' => argv(0) == 'chat' ? 'active' : '', 'title' => t('Chatrooms'), 'id' => 'chat-tab');
        }
    }
    require_once 'include/menu.php';
    $has_bookmarks = menu_list_count(local_channel(), '', MENU_BOOKMARK) + menu_list_count(local_channel(), '', MENU_SYSTEM | MENU_BOOKMARK);
    if ($is_owner && $has_bookmarks) {
        $tabs[] = array('label' => t('Bookmarks'), 'url' => z_root() . '/bookmarks', 'sel' => argv(0) == 'bookmarks' ? 'active' : '', 'title' => t('Saved Bookmarks'), 'id' => 'bookmarks-tab');
    }
    if ($p['write_pages'] && feature_enabled($uid, 'webpages')) {
        $tabs[] = array('label' => t('Webpages'), 'url' => z_root() . '/webpages/' . $nickname, 'sel' => argv(0) == 'webpages' ? 'active' : '', 'title' => t('Manage Webpages'), 'id' => 'webpages-tab');
    }
    if (feature_enabled($uid, 'wiki') && !UNO) {
        $tabs[] = array('label' => t('Wiki'), 'url' => z_root() . '/wiki/' . $nickname, 'sel' => argv(0) == 'wiki' ? 'active' : '', 'title' => t('Wiki'), 'id' => 'wiki-tab');
    }
    $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $tab ? $tab : false, 'tabs' => $tabs);
    call_hooks('profile_tabs', $arr);
    $tpl = get_markup_template('common_tabs.tpl');
    return replace_macros($tpl, array('$tabs' => $arr['tabs']));
}