Minor - improve UI BT#10769

pull/2500/head
jmontoyaa 8 years ago
parent b1ab4d4a1c
commit 3bd3216d00
  1. 148
      main/group/group_category.php
  2. 76
      main/group/settings.php

@ -11,6 +11,10 @@ $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
if (api_get_setting('allow_group_categories') == 'false') {
api_not_allowed(true);
}
$sessionId = api_get_session_id();
if (!api_is_allowed_to_edit(false, true) ||
@ -59,11 +63,10 @@ function check_groups_per_user($value)
return true;
}
if (api_get_setting('allow_group_categories') === 'true') {
if (isset($_GET['id'])) {
if (isset($_GET['id'])) {
$category = GroupManager::get_category($_GET['id']);
$nameTools = get_lang('EditGroupCategory').': '.$category['title'];
} else {
} else {
$nameTools = get_lang('AddCategory');
// Default values for new category
$category = [
@ -77,10 +80,6 @@ if (api_get_setting('allow_group_categories') === 'true') {
'forum_state' => GroupManager::TOOL_PRIVATE,
'max_student' => 0,
];
}
} else {
$category = GroupManager::get_category($_GET['id']);
$nameTools = get_lang('PropModify');
}
$htmlHeadXtra[] = '<script>
@ -108,61 +107,79 @@ if (isset($_GET['id'])) {
// Checks if the field was created in the table Category. It creates it if is neccesary
$table_category = Database::get_course_table(TABLE_GROUP_CATEGORY);
if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) {
Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id");
$sql = "ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1'
WHERE c_id = $course_id";
Database::query($sql);
}
// Create a new category
$action = 'add_category';
$form = new FormValidator('group_category');
}
// If categories allowed, show title & description field
if (api_get_setting('allow_group_categories') == 'true') {
$form->addElement('header', $nameTools);
$form->addElement('html', '<div class="row"><div class="col-md-6">');
$form->addText('title', get_lang('Title'));
$form->addElement('header', $nameTools);
$form->addElement('html', '<div class="row"><div class="col-md-6">');
$form->addText('title', get_lang('Title'));
// Groups per user
$possible_values = [];
for ($i = 1; $i <= 10; $i++) {
// Groups per user
$possible_values = [];
for ($i = 1; $i <= 10; $i++) {
$possible_values[$i] = $i;
}
$possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All');
$group = [
}
$possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All');
$group = [
$form->createElement('select', 'groups_per_user', null, $possible_values),
$form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartAfterNumber')),
];
$form->addGroup($group, 'limit_group', get_lang('QtyOfUserCanSubscribe_PartBeforeNumber'), null, false);
$form->addRule('limit_group', get_lang('MaxGroupsPerUserInvalid'), 'callback', 'check_groups_per_user');
];
$form->addGroup($group, 'limit_group', get_lang('QtyOfUserCanSubscribe_PartBeforeNumber'), null, false);
$form->addRule('limit_group', get_lang('MaxGroupsPerUserInvalid'), 'callback', 'check_groups_per_user');
// Members per group
$group = [
$form->createElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'), GroupManager::MEMBER_PER_GROUP_NO_LIMIT),
$form->createElement('radio', 'max_member_no_limit', null, get_lang('MaximumOfParticipants'), 1, ['id' => 'max_member_selected']),
$form->createElement('text', 'max_member', null, ['class' => 'span1', 'id' => 'max_member']),
$form->createElement('static', null, null, ' '.get_lang('GroupPlacesThis')),
];
$form->addGroup($group, 'max_member_group', get_lang('GroupLimit'), null, false);
$form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callback', 'check_max_number_of_members');
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
$form->addElement('textarea', 'description', get_lang('Description'), ['rows' => 6]);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Description
$form->addElement('textarea', 'description', get_lang('Description'), ['rows' => 6]);
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
} else {
$form->addElement('hidden', 'title');
$form->addElement('hidden', 'description');
}
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('header', get_lang('DefaultSettingsForNewGroups'));
$form->addElement('hidden', 'action');
$form->addElement('html', '<div class="col-md-6">');
// Members per group
$group = [
$form->createElement(
'radio',
'max_member_no_limit',
get_lang('GroupLimit'),
get_lang('NoLimit'),
GroupManager::MEMBER_PER_GROUP_NO_LIMIT
),
$form->createElement(
'radio',
'max_member_no_limit',
null,
get_lang('MaximumOfParticipants'),
1,
['id' => 'max_member_selected']
),
$form->createElement('text', 'max_member', null, ['class' => 'span1', 'id' => 'max_member']),
$form->createElement('static', null, null, ' '.get_lang('GroupPlacesThis')),
];
$form->addGroup($group, 'max_member_group', get_lang('GroupLimit'), null, false);
$form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callback', 'check_max_number_of_members');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Self registration
$group = [
$form->createElement('checkbox', 'self_reg_allowed', get_lang('GroupSelfRegistration'), get_lang('GroupAllowStudentRegistration'), 1),
$form->createElement(
'checkbox',
'self_reg_allowed',
get_lang('GroupSelfRegistration'),
get_lang('GroupAllowStudentRegistration'),
1
),
$form->createElement('checkbox', 'self_unreg_allowed', null, get_lang('GroupAllowStudentUnregistration'), 1),
];
$form->addGroup(
@ -172,6 +189,15 @@ $form->addGroup(
null,
false
);
$form->addElement('html', '</div>');
$form->addElement('hidden', 'action');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', get_lang('DefaultSettingsForNewGroups'));
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Documents settings.
$group = [
@ -187,6 +213,14 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Work settings.
$group = [
$form->createElement('radio', 'work_state', get_lang('GroupWork'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -201,6 +235,10 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Calendar settings.
$group = [
$form->createElement('radio', 'calendar_state', get_lang('GroupCalendar'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -214,8 +252,12 @@ $form->addGroup(
null,
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Announcements settings.
@ -232,6 +274,10 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Forum settings.
$group = [
$form->createElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -246,6 +292,16 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Wiki settings.
$group = [
$form->createElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -259,6 +315,10 @@ $form->addGroup(
null,
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Chat settings.
$group = [

@ -52,6 +52,18 @@ if (api_get_setting('allow_group_categories') == 'true') {
} else {
$form->addHidden('category_id', 0);
}
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
$form->addElement('textarea', 'description', get_lang('Description'));
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Members per group
$group = [
@ -63,15 +75,7 @@ $group = [
$form->addGroup($group, 'max_member_group', get_lang('GroupLimit'), null, false);
$form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callback', 'check_max_number_of_members');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Description
$form->addElement('textarea', 'description', get_lang('Description'));
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', get_lang('DefaultSettingsForNewGroups'));
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
@ -89,6 +93,16 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', get_lang('DefaultSettingsForNewGroups'));
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Documents settings
$group = [
$form->createElement('radio', 'doc_state', get_lang('GroupDocument'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -105,6 +119,8 @@ $form->addGroup(
$allowDocumentGroupAccess = api_get_configuration_value('group_document_access');
if ($allowDocumentGroupAccess) {
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
$group = [
$form->createElement(
'radio',
@ -138,6 +154,13 @@ if ($allowDocumentGroupAccess) {
null,
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
}
// Work settings
@ -152,6 +175,14 @@ $group = [
$form->createElement('radio', 'work_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC),
$form->createElement('radio', 'work_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE),
];
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
$form->addGroup(
$group,
'',
@ -166,6 +197,10 @@ $group = [
$form->createElement('radio', 'calendar_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC),
$form->createElement('radio', 'calendar_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE),
];
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
$form->addGroup(
$group,
'',
@ -175,6 +210,11 @@ $form->addGroup(
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Announcements settings
@ -183,6 +223,7 @@ $group = [
$form->createElement('radio', 'announcements_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC),
$form->createElement('radio', 'announcements_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE),
];
$form->addGroup(
$group,
'',
@ -191,6 +232,12 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Forum settings
$group = [
$form->createElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -205,6 +252,16 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-12">');
$form->addElement('header', '');
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Wiki settings
$group = [
$form->createElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
@ -219,6 +276,9 @@ $form->addGroup(
false
);
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-6">');
// Chat settings
$group = [
$form->createElement('radio', 'chat_state', get_lang('Chat'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),

Loading…
Cancel
Save