';
//this include the social menu div
if ($group_id != 0 ) {
SocialManager::show_social_menu('messages_list',$group_id);
} else {
$show_menu = 'groups';
if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
$show_menu = $_GET['view'];
}
SocialManager::show_social_menu($show_menu);
}
echo '
';
if ($group_id != 0 ) {
$group_info = GroupPortalManager::get_group_data($group_id);
//Loading group information
if (isset($_GET['status']) && $_GET['status']=='sent') {
Display::display_confirmation_message(get_lang('MessageHasBeenSent'), false);
}
if ($user_leave_message) {
Display::display_confirmation_message(get_lang('UserIsNotSubscribedToThisGroup'), false);
}
if ($user_added_group_message) {
Display::display_confirmation_message(get_lang('UserIsSubscribedToThisGroup'), false);
}
// details about the current group
echo '
';
echo '
';
$picture = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,'medium_');
$big_image = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],'','big_');
if (basename($picture['file']) != 'unknown_group.png') {
echo '
';
} else {
echo '
';
}
echo '
';
echo '
';
//Group's title
echo '
';
//Group's description
echo '
'.$group_info['description'].'
';
echo '
';
//Privacy
echo '
';
echo ''.get_lang('Privacy').' : ';
if ($group_info['visibility']== GROUP_PERMISSION_OPEN) {
echo get_lang('ThisIsAnOpenGroup');
} elseif ($group_info['visibility']== GROUP_PERMISSION_CLOSED) {
echo get_lang('ThisIsACloseGroup');
}
echo '
';
if (!empty($relation_group_title)) {
echo '
';
echo ''.get_lang('StatusInThisGroup').' : ';
echo $relation_group_title;
echo '
';
}
//Group's tags
if (!empty($tags)) {
echo '
'.get_lang('Tags').' : '.$tags.'
';
}
echo '
';
echo '
';
echo '
';
//-- Show message groups
echo '
'; // end layout messages
} else {
// My groups -----
$results = GroupPortalManager::get_groups_by_user(api_get_user_id(), 0);
$grid_my_groups = array();
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('admin_star.png', get_lang('Admin'), array('style'=>'vertical-align:middle'));
} elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
$name .= Display::return_icon('moderator_star.png', get_lang('Moderator'), array('style'=>'vertical-align:middle'));
}
$count_users_group = count(GroupPortalManager::get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
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'].'
'.$name.'
('.$count_users_group.')
'.$url_close.Display::return_icon('linegroups.jpg','').'
';
$item_2 = '';
$item_3 = '';
if ($result['description'] != '') {
$item_2 = '
'.get_lang('GroupDescription').'
';
$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);
}
}
// Newest groups --------
$results = GroupPortalManager::get_groups_by_age(4,false);
$grid_newest_groups = array();
foreach ($results as $result) {
$id = $result['id'];
$url_open = '
';
$url_close = '';
$count_users_group = count(GroupPortalManager::get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$count_users_group = $count_users_group.' '.get_lang('Members');
}
$name = api_strtoupper(cut($result['name'],30,true));
$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'].'
'.$name.'
('.$count_users_group.')
'.$url_close.Display::return_icon('linegroups.jpg','').'
';
if ($result['description'] != '') {
$item_2 = '
'.get_lang('GroupDescription').'
';
$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_newest_groups[]= array($grid_item_1,$grid_item_2);
}
// Pop groups -----
$results = GroupPortalManager::get_groups_by_popularity(4,false);
$grid_pop_groups = array();
foreach ($results as $result) {
$id = $result['id'];
$url_open = '
';
$url_close = '';
$count_users_group = count(GroupPortalManager::get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$count_users_group = $count_users_group.' '.get_lang('Members');
}
$name = api_strtoupper(cut($result['name'],30,true));
$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'].'
'.$name.'
('.$count_users_group.')
'.$url_close.Display::return_icon('linegroups.jpg').'
';
if ($result['description'] != '') {
$item_2 = '
'.get_lang('GroupDescription').'
';
$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_pop_groups[]= array($grid_item_1,$grid_item_2);
}
// display groups (newest, mygroups, pop)
echo '
';
if (isset($_GET['view']) && in_array($_GET['view'],$allowed_views)) {
$view_group = $_GET['view'];
switch ($view_group) {
case 'mygroups' :
echo '
'.api_strtoupper(get_lang('MyGroups')).'
';
if (count($grid_my_groups) > 0) {
Display::display_sortable_grid('mygroups', array(), $grid_my_groups, array('hide_navigation'=>true, 'per_page' => 2), $query_vars, false, array(true, true, true,false));
}
break;
case 'newest' :
if (count($grid_newest_groups) > 0) {
echo '
'.api_strtoupper(get_lang('Newest')).'
';
Display::display_sortable_grid('newest', array(), $grid_newest_groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
}
break;
default :
if (count($grid_pop_groups) > 0) {
echo '
'.api_strtoupper(get_lang('Popular')).'
';
Display::display_sortable_grid('popular', array(), $grid_pop_groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,true,true));
}
break;
}
} else {
echo '
'.api_strtoupper(get_lang('MyGroups')).'
';
if (count($grid_my_groups) > 0) {
Display::display_sortable_grid('mygroups', array(), $grid_my_groups, array('hide_navigation'=>true, 'per_page' => 2), $query_vars, false, array(true, true, true,false));
}
if (count($grid_newest_groups) > 0) {
echo '
'.api_strtoupper(get_lang('Newest')).'
';
Display::display_sortable_grid('newest', array(), $grid_newest_groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
}
if (count($grid_pop_groups) > 0) {
echo '
'.api_strtoupper(get_lang('Popular')).'
';
Display::display_sortable_grid('popular', array(), $grid_pop_groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,true,true));
}
}
echo '
';
}
echo '
'; } else { echo '
'; } echo '
'.$group_info['name'].'
'; //Group's description echo ''.$name.'
'.$url_close.Display::return_icon('linegroups.jpg','').'('.$count_users_group.')
'.$name.'
'.$url_close.Display::return_icon('linegroups.jpg','').'('.$count_users_group.')
'.$name.'
'.$url_close.Display::return_icon('linegroups.jpg').'('.$count_users_group.')