*/ /** * Initialization */ // name of the language file that needs to be included $language_file = array('registration', 'admin', 'userInfo'); $cidReset = true; require_once '../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; require_once api_get_path(LIBRARY_PATH).'magpierss/rss_fetch.inc'; $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php'; api_block_anonymous_users(); $htmlHeadXtra[] = ''; if (api_get_setting('allow_social_tool') != 'true') { api_not_allowed(); } $this_section = SECTION_SOCIAL; $tool_name = get_lang('Search'); $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $query = isset($_GET['q']) ? $_GET['q'] : null; $query_vars = array('q' => $query); $social_left_content = SocialManager::show_social_menu('search'); $social_right_content = '
'.UserManager::get_search_form($query).'
'; // I'm searching something if ($query != '') { $itemPerPage = 9; $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1; $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true); $from = intval(($page - 1) * $itemPerPage); // Get users from tags $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage); $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1; // Groups $fromGroups = intval(($pageGroup - 1) * $itemPerPage); $totalGroups = GroupPortalManager::get_all_group_tags($_GET['q'], 0, $itemPerPage, true); $groups = GroupPortalManager::get_all_group_tags($_GET['q'], $fromGroups, $itemPerPage); if (empty($users) && empty($groups)) { $social_right_content .= get_lang('SorryNoResults'); } $results = '
'; if (is_array($users) && count($users) > 0) { $results .= Display::page_subheader(get_lang('Users')); $results .= '
'; $social_right_content .= $results; } $visibility = array(true, true, true, true, true); $social_right_content .= Display::return_sortable_grid( 'users', null, null, array('hide_navigation' => false, 'per_page' => $itemPerPage), $query_vars, false, $visibility, true, array(), $totalUsers ); $grid_groups = array(); if (is_array($groups) && count($groups) > 0) { $social_right_content .= '
'; $social_right_content .= Display::page_subheader(get_lang('Groups')); $social_right_content .= '
'; } $visibility = array(true, true, true, true, true); $social_right_content .= Display::return_sortable_grid( 'groups', null, $grid_groups, array('hide_navigation' => false, 'per_page' => $itemPerPage), $query_vars, false, $visibility, true, array(), $totalGroups ); } $social_right_content .= MessageManager::generate_message_form('send_message'); $social_right_content .= MessageManager::generate_invitation_form('send_invitation'); $tpl = new Template($tool_name); $tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('layout/social_layout.tpl'); $tpl->display($social_layout);