"group.php", "name" => get_lang("Groups"));
/*
-----------------------------------------------------------
Ensure all private groups // Juan Carlos Raņa Trabado
-----------------------------------------------------------
*/
$forums_of_groups = get_forums_of_group($current_group['id']);
$forum_state_public=0;
if (is_array($forums_of_groups)) {
foreach ($forums_of_groups as $key => $value) {
if($value['forum_group_public_private'] == 'public') {
$forum_state_public=1;
}
}
}
if ($current_group['doc_state']!=1 and $current_group['calendar_state']!=1 and $current_group['work_state']!=1 and $current_group['announcements_state']!=1 and $current_group['wiki_state']!=1 and $forum_state_public!=1) {
if (!api_is_allowed_to_edit() and !GroupManager :: is_user_in_group($_user['user_id'], $current_group['id'])) {
echo api_not_allowed($print_headers);
}
}
/*
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
Display::display_header($nameTools,"Group");
/*
-----------------------------------------------------------
Introduction section
(editable by course admin)
-----------------------------------------------------------
*/
Display::display_introduction_section(group_space_.$_SESSION['_gid']);
/*
-----------------------------------------------------------
Actions and Action links
-----------------------------------------------------------
*/
/*
* User wants to register in this group
*/
if (!empty($_GET['selfReg']) && GroupManager :: is_self_registration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
GroupManager :: subscribe_users($_SESSION['_user']['user_id'], $current_group['id']);
Display :: display_normal_message(get_lang('GroupNowMember'));
}
/*
* User wants to unregister from this group
*/
if (!empty($_GET['selfUnReg']) && GroupManager :: is_self_unregistration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
GroupManager :: unsubscribe_users($_SESSION['_user']['user_id'], $current_group['id']);
Display::display_normal_message(get_lang('StudentDeletesHimself'));
}
/*
* Edit the group
*/
if (api_is_allowed_to_edit(false,true) or GroupManager :: is_tutor($_user['user_id'])) {
isset($origin)?$my_origin = $origin:$my_origin='';
echo Display::return_icon('settings.gif', get_lang("EditGroup"))."".get_lang("EditGroup")."
";
}
/*
* Register to group
*/
if (GroupManager :: is_self_registration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
echo '
'.get_lang("StudentUnsubscribe").'
'; } if( isset($_GET['action'])) { switch( $_GET['action']) { case 'show_msg': Display::display_normal_message($_GET['msg']); break; } } /* ----------------------------------------------------------- Main Display Area ----------------------------------------------------------- */ $course_code = $_course['sysCode']; $is_course_member = CourseManager :: is_user_subscribed_in_real_or_linked_course($_SESSION['_user']['user_id'], $course_code); /* * Group title and comment */ api_display_tool_title($nameTools.' '.stripslashes($current_group['name'])); if (!empty($current_group['description'])) { echo ''.stripslashes($current_group['description']).''; } /* * Group Tools */ // If the user is subscribed to the group or the user is a tutor of the group then if (api_is_allowed_to_edit(false,true) OR GroupManager :: is_user_in_group($_SESSION['_user']['user_id'], $current_group['id'])) { $tools = ''; // link to the forum of this group $forums_of_groups = get_forums_of_group($current_group['id']); if (is_array($forums_of_groups)) { if ( $current_group['forum_state'] != TOOL_NOT_AVAILABLE ) { foreach ($forums_of_groups as $key => $value) { if ($value['forum_group_public_private'] == 'public' || (/*!empty($user_subscribe_to_current_group) && */ $value['forum_group_public_private'] == 'private') || !empty($user_is_tutor) || api_is_allowed_to_edit(false,true)) { $tools.= Display::return_icon('forum.gif', get_lang("GroupForum")) . ' '.get_lang("Forum").'
'.$tools.''; } } else { $tools = ''; // link to the forum of this group $forums_of_groups = get_forums_of_group($current_group['id']); if (is_array($forums_of_groups)) { if ( $current_group['forum_state'] == TOOL_PUBLIC ) { foreach ($forums_of_groups as $key => $value) { if ($value['forum_group_public_private'] == 'public' ) { $tools.= Display::return_icon('forum.gif', get_lang("GroupForum")) . ' '.$value['forum_title'].'
'.$tools.''; } } /* * list all the tutors of the current group */ $tutors = GroupManager::get_subscribed_tutors($current_group['id']); $tutor_info = ''; if (count($tutors) == 0) { $tutor_info = get_lang("GroupNoneMasc"); } else { isset($origin)?$my_origin = $origin:$my_origin=''; foreach($tutors as $index => $tutor) { $tutor_info .= ""; } } echo ''.get_lang("GroupTutors").':'; if (!empty($tutor_info)) { echo '
'.$tutor_info.''; } /* * list all the members of the current group */ echo ''.get_lang("GroupMembers").':'; $table = new SortableTable('group_users', 'get_number_of_group_users', 'get_group_user_data',2); $my_cidreq=isset($_GET['cidReq']) ? $_GET['cidReq'] : ''; $my_origin=isset($_GET['origin']) ? $_GET['origin'] : ''; $my_gidreq=isset($_GET['gidReq']) ? $_GET['gidReq'] : ''; $parameters = array('cidReq' => $my_cidreq, 'origin'=> $my_origin, 'gidReq' => $my_gidreq); $table->set_additional_parameters($parameters); $table->set_header(0, ''); $table->set_header(1, get_lang('LastName')); $table->set_header(2, get_lang('FirstName')); if (api_get_setting("show_email_addresses") == "true") { $table->set_header(3, get_lang('Email')); $table->set_column_filter(3, 'email_filter'); } else { if (api_is_allowed_to_edit()=="true") { $table->set_header(3, get_lang('Email')); $table->set_column_filter(3, 'email_filter'); } } $table->set_column_filter(0, 'user_icon_filter'); $table->display(); /** * Get the number of subscribed users to the group * * @return integer * * @author Patrick Cool