Improve user page see BT#6050

1.10.x
Julio Montoya 9 years ago
parent 00aee04ce7
commit 2bddbe22ff
  1. 70
      main/group/group.php
  2. 13
      main/group/group_category.php
  3. 13
      main/group/group_creation.php
  4. 15
      main/group/group_edit.php
  5. 5
      main/group/group_overview.php
  6. 8
      main/group/group_space.php
  7. 15
      main/group/member_settings.php
  8. 20
      main/group/settings.php
  9. 19
      main/group/tutor_settings.php
  10. 13
      main/inc/lib/groupmanager.lib.php
  11. 4
      main/user/class.php

@ -38,12 +38,6 @@ $(document).ready( function() {
$nameTools = get_lang('GroupManagement');
$course_id = api_get_course_int_id();
/* Header */
Display::display_header(get_lang('Groups'));
// Tool introduction
Display::display_introduction_section(TOOL_GROUP);
/*
* Self-registration and un-registration
*/
@ -54,41 +48,43 @@ $my_get_id1 = isset($_GET['id1']) ? Security::remove_XSS($_GET['id1']) : null;
$my_get_id2 = isset($_GET['id2']) ? Security::remove_XSS($_GET['id2']) : null;
$my_get_id = isset($_GET['id']) ? Security::remove_XSS($_GET['id']) : null;
$currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq();
if (isset($_GET['action']) && $is_allowed_in_course) {
switch ($_GET['action']) {
case 'set_visible':
if (api_is_allowed_to_edit()) {
GroupManager::setVisible($my_get_id);
Display:: display_confirmation_message(get_lang('ItemUpdated'));
Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
header("Location: $currentUrl");
exit;
}
break;
case 'set_invisible':
if (api_is_allowed_to_edit()) {
GroupManager::setInvisible($my_get_id);
Display:: display_confirmation_message(get_lang('ItemUpdated'));
Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
header("Location: $currentUrl");
exit;
}
break;
case 'self_reg':
if (GroupManager::is_self_registration_allowed($userId, $my_group_id)) {
GroupManager::subscribe_users($userId, $my_group_id);
Display :: display_confirmation_message(get_lang('GroupNowMember'));
Display::addFlash(Display::return_message(get_lang('GroupNowMember')));
header("Location: $currentUrl");
exit;
}
break;
case 'self_unreg':
if (GroupManager::is_self_unregistration_allowed($userId, $my_group_id)) {
GroupManager::unsubscribe_users($userId, $my_group_id);
Display :: display_confirmation_message(get_lang('StudentDeletesHimself'));
Display::addFlash(Display::return_message(get_lang('StudentDeletesHimself')));
header("Location: $currentUrl");
exit;
}
break;
case 'show_msg':
Display::display_confirmation_message($my_msg);
break;
case 'warning_message':
Display::display_warning_message($my_msg);
break;
case 'success_message':
Display::display_confirmation_message($my_msg);
break;
}
}
@ -104,19 +100,25 @@ if (api_is_allowed_to_edit(false, true)) {
case 'delete_selected':
if (is_array($_POST['group'])) {
GroupManager::delete_groups($my_group);
Display :: display_confirmation_message(get_lang('SelectedGroupsDeleted'));
Display::addFlash(Display::return_message(get_lang('SelectedGroupsDeleted')));
header("Location: $currentUrl");
exit;
}
break;
case 'empty_selected':
if (is_array($_POST['group'])) {
GroupManager :: unsubscribe_all_users($my_group);
Display :: display_confirmation_message(get_lang('SelectedGroupsEmptied'));
Display::addFlash(Display::return_message(get_lang('SelectedGroupsEmptied')));
header("Location: $currentUrl");
exit;
}
break;
case 'fill_selected':
if (is_array($_POST['group'])) {
GroupManager :: fill_groups($my_group);
Display :: display_confirmation_message(get_lang('SelectedGroupsFilled'));
Display::addFlash(Display::return_message(get_lang('SelectedGroupsFilled')));
header("Location: $currentUrl");
exit;
}
break;
}
@ -127,24 +129,38 @@ if (api_is_allowed_to_edit(false, true)) {
switch ($_GET['action']) {
case 'swap_cat_order':
GroupManager :: swap_category_order($my_get_id1, $my_get_id2);
Display :: display_confirmation_message(get_lang('CategoryOrderChanged'));
Display::addFlash(Display::return_message(get_lang('CategoryOrderChanged')));
header("Location: $currentUrl");
exit;
break;
case 'delete_one':
GroupManager :: delete_groups($my_get_id);
Display :: display_confirmation_message(get_lang('GroupDel'));
Display::addFlash(Display::return_message(get_lang('GroupDel')));
header("Location: $currentUrl");
exit;
break;
case 'fill_one':
GroupManager :: fill_groups($my_get_id);
Display :: display_confirmation_message(get_lang('GroupFilledGroups'));
Display::addFlash(Display::return_message(get_lang('GroupFilledGroups')));
header("Location: $currentUrl");
exit;
break;
case 'delete_category':
GroupManager :: delete_category($my_get_id);
Display :: display_confirmation_message(get_lang('CategoryDeleted'));
Display::addFlash(Display::return_message(get_lang('CategoryDeleted')));
header("Location: $currentUrl");
exit;
break;
}
}
}
/* Header */
Display::display_header(get_lang('Groups'));
// Tool introduction
Display::display_introduction_section(TOOL_GROUP);
echo '<div class="actions">';
if (api_is_allowed_to_edit(false, true)) {
@ -180,7 +196,7 @@ if (api_is_allowed_to_edit(false, true)) {
$group_cats = GroupManager::get_categories(api_get_course_id());
echo '</div>';
echo UserManager::getUserSubscriptionTab(4);
echo UserManager::getUserSubscriptionTab(3);
/* List all categories */
if (api_get_setting('allow_group_categories') == 'true') {

@ -218,6 +218,8 @@ $form->addElement('html', '<div class="col-md-12">');
// Submit
$form->addButtonSave(get_lang('PropModify'), 'submit');
$currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq();
// If form validates -> save data
if ($form->validate()) {
$values = $form->exportValues();
@ -248,9 +250,9 @@ if ($form->validate()) {
$max_member,
$values['groups_per_user']
);
$msg = urlencode(get_lang('GroupPropertiesModified'));
header('Location: group.php?action=show_msg&msg='.$msg.'&category='.$values['id']);
break;
Display::addFlash(Display::return_message(get_lang('GroupPropertiesModified')));
header("Location: ".$currentUrl."&category=".$values['id']);
exit;
case 'add_category':
GroupManager :: create_category(
$values['title'],
@ -267,8 +269,9 @@ if ($form->validate()) {
$max_member,
$values['groups_per_user']
);
$msg = urlencode(get_lang('CategoryCreated'));
header('Location: group.php?action=show_msg&msg='.$msg);
Display::addFlash(Display::return_message(get_lang('CategoryCreated')));
header("Location: ".$currentUrl);
exit;
break;
}
}

@ -10,6 +10,7 @@ $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
$currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq();
/* Create the groups */
@ -46,8 +47,8 @@ if (isset($_POST['action'])) {
$group['places']
);
}
$msg = urlencode(count($groups).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
header("Location: ".$currentUrl);
exit;
break;
case 'create_subgroups':
@ -55,14 +56,14 @@ if (isset($_POST['action'])) {
$_POST['base_group'],
$_POST['number_of_groups']
);
$msg = urlencode($_POST['number_of_groups'].' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
header("Location: ".$currentUrl);
exit;
break;
case 'create_class_groups':
$ids = GroupManager::create_class_groups($_POST['group_category']);
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
header("Location: ".$currentUrl);
exit;
break;
}

@ -282,9 +282,11 @@ if ($form->validate()) {
// Returning to the group area (note: this is inconsistent with the rest of chamilo)
$cat = GroupManager :: get_category_from_group($current_group['id']);
if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang('GroupTooMuchMembers'));
Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
header('Location: group.php?'.api_get_cidreq(true, false));
} else {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']);
Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
header('Location: group.php?'.api_get_cidreq(true, false).'&category='.$cat['id']);
}
exit;
}
@ -308,15 +310,6 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
Display :: display_header($nameTools, 'Group');
//@todo fix this
if (isset($_GET['show_message_warning'])) {
echo Display::display_warning_message($_GET['show_message_warning']);
}
if (isset($_GET['show_message_sucess'])) {
echo Display::display_normal_message($_GET['show_message_sucess']);
}
$form->setDefaults($defaults);
$form->display();

@ -86,7 +86,9 @@ if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') {
// Action links
echo '<div class="actions">';
echo '<a href="group_creation.php?'.api_get_cidreq().'">'.
Display::return_icon('new_group.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('add.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>';
echo GroupManager::getSearchForm();
if (api_get_setting('allow_group_categories') == 'true') {
echo '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
@ -114,7 +116,6 @@ echo '<div class="actions">';
echo '<a href="../user/user.php?'.api_get_cidreq().'">'.
Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICON_SIZE_MEDIUM).'</a>';
echo GroupManager::getSearchForm();
echo '</div>';
echo GroupManager::getOverview($courseId, $keyword);

@ -91,14 +91,6 @@ if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'
}
echo '&nbsp;</div>';
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'show_msg':
Display::display_normal_message(Security::remove_XSS($_GET['msg']));
break;
}
}
/* Main Display Area */
$edit_url = '';

@ -196,9 +196,11 @@ if ($form->validate()) {
count($_POST['group_members']) > $max_member &&
$max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT
) {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang('GroupTooMuchMembers'));
Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
header('Location: group.php?'.api_get_cidreq(true, false));
} else {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']);
Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
header('Location: group.php?'.api_get_cidreq(true, false).'&category='.$cat['id']);
}
exit;
}
@ -226,15 +228,6 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
Display::display_header($nameTools, 'Group');
//@todo fix this
if (isset($_GET['show_message_warning'])) {
echo Display::display_warning_message($_GET['show_message_warning']);
}
if (isset($_GET['show_message_sucess'])) {
echo Display::display_normal_message($_GET['show_message_sucess']);
}
$form->setDefaults($defaults);
echo GroupManager::getSettingBar('member');

@ -172,10 +172,15 @@ if ($form->validate()) {
$self_unregistration_allowed,
$categoryId
);
if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang('GroupTooMuchMembers'));
if (isset($_POST['group_members']) &&
count($_POST['group_members']) > $max_member &&
$max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT
) {
Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
header('Location: group.php?'.api_get_cidreq(true, false));
} else {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']);
Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
header('Location: group.php?'.api_get_cidreq(true, false).'&category='.$cat['id']);
}
exit;
}
@ -202,15 +207,6 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
Display :: display_header($nameTools, 'Group');
//@todo fix this
if (isset($_GET['show_message_warning'])) {
echo Display::display_warning_message($_GET['show_message_warning']);
}
if (isset($_GET['show_message_sucess'])) {
echo Display::display_normal_message($_GET['show_message_sucess']);
}
$form->setDefaults($defaults);
echo GroupManager::getSettingBar('settings');
echo '<div class="row">';

@ -168,10 +168,15 @@ if ($form->validate()) {
// Returning to the group area (note: this is inconsistent with the rest of chamilo)
$cat = GroupManager::get_category_from_group($current_group['id']);
if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang('GroupTooMuchMembers'));
if (isset($_POST['group_members']) &&
count($_POST['group_members']) > $max_member &&
$max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT
) {
Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
header('Location: group.php?'.api_get_cidreq(true, false));
} else {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']);
Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
header('Location: group.php?'.api_get_cidreq(true, false).'&category='.$cat['id']);
}
exit;
}
@ -188,14 +193,6 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
Display :: display_header($nameTools, 'Group');
//@todo fix this
if (isset($_GET['show_message_warning'])) {
echo Display::display_warning_message($_GET['show_message_warning']);
}
if (isset($_GET['show_message_sucess'])) {
echo Display::display_normal_message($_GET['show_message_sucess']);
}
$form->setDefaults($defaults);
echo GroupManager::getSettingBar('tutor');

@ -969,12 +969,15 @@ class GroupManager
$res = Database::query($sql);
$cat1 = Database::fetch_object($res);
$cat2 = Database::fetch_object($res);
$sql = "UPDATE $table_group_cat SET display_order=$cat2->display_order
if ($cat1 && $cat2) {
$sql = "UPDATE $table_group_cat SET display_order=$cat2->display_order
WHERE id = $cat1->id AND c_id = $course_id ";
Database::query($sql);
$sql = "UPDATE $table_group_cat SET display_order=$cat1->display_order
WHERE id = $cat2->id AND c_id = $course_id ";
Database::query($sql);
Database::query($sql);
$sql = "UPDATE $table_group_cat SET display_order=$cat1->display_order
WHERE id = $cat2->id AND c_id = $course_id ";
Database::query($sql);
}
}
/**

@ -20,7 +20,7 @@ $tool_name = get_lang("Classes");
$htmlHeadXtra[] = api_get_jqgrid_js();
// Extra entries in breadcrumb
$interbreadcrumb[] = array ("url" => "user.php", "name" => get_lang("ToolUser"));
$interbreadcrumb[] = array ("url" => "user.php?".api_get_cidreq(), "name" => get_lang("ToolUser"));
$type = isset($_GET['type']) ? Security::remove_XSS($_GET['type']) : 'registered';
$groupFilter = isset($_GET['group_filter']) ? intval($_GET['group_filter']) : 0;
@ -62,7 +62,7 @@ if (api_is_allowed_to_edit()) {
echo '</div>';
}
echo UserManager::getUserSubscriptionTab(5);
echo UserManager::getUserSubscriptionTab(4);
if (api_is_allowed_to_edit()) {
$action = isset($_GET['action']) ? $_GET['action'] : null;

Loading…
Cancel
Save