*/
// name of the language file that needs to be included
$language_file = array('registration','admin','userInfo');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
api_block_anonymous_users();
$this_section = SECTION_SOCIAL;
$tool_name = get_lang('Search');
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
Display :: display_header($tool_name);
//show the action menu
SocialManager::show_social_menu();
echo '
';
echo get_lang('Search');
echo '
';
$query = $_GET['q'];
echo UserManager::get_search_form($query);
//I'm searching something
if ($query != '') {
if (isset($query) && $query!='') {
//get users from tags
$users = UserManager::get_all_user_tags($query, 0, 0, 5);
$results = array();
if (is_array($users) && count($users)> 0) {
echo ''.get_lang('Users').'
';
foreach($users as $user) {
$picture = UserManager::get_picture_user($user['user_id'], $user['picture_uri'],80);
$url_open = '';
$url_close ='';
$img = $url_open.''.$url_close;
$user['firstname'] = $url_open.$user['firstname'].$url_close;
$results[] = array($img, $user['firstname'],$user['lastname'],$user['tag']);
}
} else {
echo get_lang('SorryNoResults');
}
Display::display_sortable_grid('search_users', array(), $results, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false ,true);
//get users from tags
$groups = GroupPortalManager::get_all_group_tags($query);
$results = array();
if (is_array($groups) && count($groups)>0) {
echo ''.get_lang('Groups').'
';
foreach($groups as $group) {
$picture = GroupPortalManager::get_picture_group($group['id'], $group['picture_uri'],80);
$img = '';
$tags = GroupPortalManager::get_group_tags($group['id']);
$group['name'] = ''.$group['name'].'';
$img = ''.$img.'';
$results[] = array($img, $group['name'],$group['description'],$tags);
}
}
Display::display_sortable_grid('search_users', array(), $results, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false, array(true,true,true,true,true));
}
} else {
//we should show something
}
Display :: display_footer();
?>