*/ // 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).'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' =>'profile.php','name' => get_lang('Social')); //jquery thickbox already called from main/inc/header.inc.php $htmlHeadXtra[] = ''; Display :: display_header($tool_name); echo '
'; echo '
'; //show the action menu SocialManager::show_social_menu('search'); echo '
'; 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); $groups = GroupPortalManager::get_all_group_tags($query); if (empty($users) && empty($groups)) { echo get_lang('SorryNoResults'); } $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; $user['lastname'] = $url_open.$user['lastname'].$url_close; $results[] = array($img, $user['firstname'],$user['lastname'], $user['tag']); } echo ''; } //get users from tags if (is_array($results) && count($results) > 0) { foreach ($results as $result) { $id = $result['id']; $url_open = ''; $url_close = ''; $name = api_strtoupper(cut($result['name'],25,true)); if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) { $name .= Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style'=>'vertical-align:middle')); } elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) { $name .= Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle')); } $count_users_group = count(GroupPortalManager::get_all_users_by_group($id)); if ($count_users_group == 1 ) { $count_users_group = $count_users_group.' '.get_lang('Member'); } else { $count_users_group = $count_users_group.' '.get_lang('Members'); } $picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80); $result['picture_uri'] = ''; $grid_item_1 = Display::return_icon('boxmygroups.jpg'); $item_1 = '
'.$url_open.$result['picture_uri'].''.$url_close.Display::return_icon('linegroups.jpg').'
'; if ($result['description'] != '') { $item_2 = '
'; $item_3 = '
'.cut($result['description'],100,true).'
'; } else { $item_2 = '
'; $item_3 = '
'; } $item_4 = '
'.$url_open.get_lang('SeeMore').$url_close.'
'; $grid_item_2 = $item_1.$item_2.$item_3.$item_4; $grid_my_groups[]= array($grid_item_1,$grid_item_2); } } $grid_groups = array(); if (is_array($groups) && count($groups)>0) { echo '

'.get_lang('Groups').'

'; foreach($groups as $group) { $id = $group['id']; $url_open = ''; $url_close = ''; $name = api_strtoupper(cut($group['name'],25,true)); $count_users_group = count(GroupPortalManager::get_all_users_by_group($id)); if ($count_users_group == 1 ) { $count_users_group = $count_users_group.' '.get_lang('Member'); } else { $count_users_group = $count_users_group.' '.get_lang('Members'); } $picture = GroupPortalManager::get_picture_group($group['id'], $group['picture_uri'],80); $tags = GroupPortalManager::get_group_tags($group['id']); $group['picture_uri'] = ''; $grid_item_1 = Display::return_icon('boxmygroups.jpg',get_lang('Groups')); $item_1 = '
'.$url_open.$group['picture_uri'].''.$url_close.Display::return_icon('linegroups.jpg').'
'; if ($group['description'] != '') { $item_2 = '
'; $item_3 = '
'.cut($group['description'],100,true).'
'; } else { $item_2 = '
'; $item_3 = '
'; } $item_4 = '
'.$tags.'
'; $item_5 = '
'.$url_open.get_lang('SeeMore').$url_close.'
'; $grid_item_2 = $item_1.$item_2.$item_3.$item_4.$item_5; $grid_groups[]= array($grid_item_1,$grid_item_2); } } echo ''; } } else { //we should show something } echo '
'; echo '
'; Display :: display_footer(); ?>