|
|
|
@ -11,6 +11,10 @@ $current_course_tool = TOOL_GROUP; |
|
|
|
// Notice for unauthorized people. |
|
|
|
// Notice for unauthorized people. |
|
|
|
api_protect_course_script(true); |
|
|
|
api_protect_course_script(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (api_get_setting('allow_group_categories') == 'false') { |
|
|
|
|
|
|
|
api_not_allowed(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
|
|
|
|
|
|
|
|
if (!api_is_allowed_to_edit(false, true) || |
|
|
|
if (!api_is_allowed_to_edit(false, true) || |
|
|
|
@ -59,28 +63,23 @@ function check_groups_per_user($value) |
|
|
|
return true; |
|
|
|
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 { |
|
|
|
|
|
|
|
$nameTools = get_lang('AddCategory'); |
|
|
|
|
|
|
|
// Default values for new category |
|
|
|
|
|
|
|
$category = [ |
|
|
|
|
|
|
|
'groups_per_user' => 1, |
|
|
|
|
|
|
|
'doc_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'work_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'wiki_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'chat_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'calendar_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'announcements_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'forum_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'max_student' => 0, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$category = GroupManager::get_category($_GET['id']); |
|
|
|
$category = GroupManager::get_category($_GET['id']); |
|
|
|
$nameTools = get_lang('PropModify'); |
|
|
|
$nameTools = get_lang('EditGroupCategory').': '.$category['title']; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$nameTools = get_lang('AddCategory'); |
|
|
|
|
|
|
|
// Default values for new category |
|
|
|
|
|
|
|
$category = [ |
|
|
|
|
|
|
|
'groups_per_user' => 1, |
|
|
|
|
|
|
|
'doc_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'work_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'wiki_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'chat_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'calendar_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'announcements_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'forum_state' => GroupManager::TOOL_PRIVATE, |
|
|
|
|
|
|
|
'max_student' => 0, |
|
|
|
|
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
$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 |
|
|
|
// 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); |
|
|
|
$table_category = Database::get_course_table(TABLE_GROUP_CATEGORY); |
|
|
|
if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) { |
|
|
|
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 |
|
|
|
// Create a new category |
|
|
|
$action = 'add_category'; |
|
|
|
$action = 'add_category'; |
|
|
|
$form = new FormValidator('group_category'); |
|
|
|
$form = new FormValidator('group_category'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If categories allowed, show title & description field |
|
|
|
$form->addElement('header', $nameTools); |
|
|
|
if (api_get_setting('allow_group_categories') == 'true') { |
|
|
|
$form->addElement('html', '<div class="row"><div class="col-md-6">'); |
|
|
|
$form->addElement('header', $nameTools); |
|
|
|
$form->addText('title', get_lang('Title')); |
|
|
|
$form->addElement('html', '<div class="row"><div class="col-md-6">'); |
|
|
|
|
|
|
|
$form->addText('title', get_lang('Title')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Groups per user |
|
|
|
// Groups per user |
|
|
|
$possible_values = []; |
|
|
|
$possible_values = []; |
|
|
|
for ($i = 1; $i <= 10; $i++) { |
|
|
|
for ($i = 1; $i <= 10; $i++) { |
|
|
|
$possible_values[$i] = $i; |
|
|
|
$possible_values[$i] = $i; |
|
|
|
} |
|
|
|
} |
|
|
|
$possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All'); |
|
|
|
$possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All'); |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
$form->createElement('select', 'groups_per_user', null, $possible_values), |
|
|
|
$form->createElement('select', 'groups_per_user', null, $possible_values), |
|
|
|
$form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartAfterNumber')), |
|
|
|
$form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartAfterNumber')), |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form->addGroup($group, 'limit_group', get_lang('QtyOfUserCanSubscribe_PartBeforeNumber'), null, false); |
|
|
|
$form->addGroup($group, 'limit_group', get_lang('QtyOfUserCanSubscribe_PartBeforeNumber'), null, false); |
|
|
|
$form->addRule('limit_group', get_lang('MaxGroupsPerUserInvalid'), 'callback', 'check_groups_per_user'); |
|
|
|
$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('html', '<div class="col-md-6">'); |
|
|
|
// Description |
|
|
|
$form->addElement('textarea', 'description', get_lang('Description'), ['rows' => 6]); |
|
|
|
$form->addElement('textarea', 'description', get_lang('Description'), ['rows' => 6]); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$form->addElement('html', '<div class="col-md-12">'); |
|
|
|
} else { |
|
|
|
$form->addElement('header', ''); |
|
|
|
$form->addElement('hidden', 'title'); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$form->addElement('hidden', 'description'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('header', get_lang('DefaultSettingsForNewGroups')); |
|
|
|
|
|
|
|
$form->addElement('hidden', 'action'); |
|
|
|
|
|
|
|
$form->addElement('html', '<div class="col-md-6">'); |
|
|
|
$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 |
|
|
|
// Self registration |
|
|
|
$group = [ |
|
|
|
$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->createElement('checkbox', 'self_unreg_allowed', null, get_lang('GroupAllowStudentUnregistration'), 1), |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form->addGroup( |
|
|
|
$form->addGroup( |
|
|
|
@ -172,6 +189,15 @@ $form->addGroup( |
|
|
|
null, |
|
|
|
null, |
|
|
|
false |
|
|
|
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. |
|
|
|
// Documents settings. |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
@ -187,6 +213,14 @@ $form->addGroup( |
|
|
|
false |
|
|
|
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. |
|
|
|
// Work settings. |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
$form->createElement('radio', 'work_state', get_lang('GroupWork'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
$form->createElement('radio', 'work_state', get_lang('GroupWork'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
@ -201,6 +235,10 @@ $form->addGroup( |
|
|
|
false |
|
|
|
false |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '<div class="col-md-6">'); |
|
|
|
|
|
|
|
|
|
|
|
// Calendar settings. |
|
|
|
// Calendar settings. |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
$form->createElement('radio', 'calendar_state', get_lang('GroupCalendar'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
$form->createElement('radio', 'calendar_state', get_lang('GroupCalendar'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
@ -214,8 +252,12 @@ $form->addGroup( |
|
|
|
null, |
|
|
|
null, |
|
|
|
false |
|
|
|
false |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '<div class="col-md-12">'); |
|
|
|
|
|
|
|
$form->addElement('header', ''); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '<div class="col-md-6">'); |
|
|
|
$form->addElement('html', '<div class="col-md-6">'); |
|
|
|
|
|
|
|
|
|
|
|
// Announcements settings. |
|
|
|
// Announcements settings. |
|
|
|
@ -232,6 +274,10 @@ $form->addGroup( |
|
|
|
false |
|
|
|
false |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '<div class="col-md-6">'); |
|
|
|
|
|
|
|
|
|
|
|
// Forum settings. |
|
|
|
// Forum settings. |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
$form->createElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
$form->createElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
@ -246,6 +292,16 @@ $form->addGroup( |
|
|
|
false |
|
|
|
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. |
|
|
|
// Wiki settings. |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
$form->createElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
$form->createElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE), |
|
|
|
@ -259,6 +315,10 @@ $form->addGroup( |
|
|
|
null, |
|
|
|
null, |
|
|
|
false |
|
|
|
false |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('html', '<div class="col-md-6">'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Chat settings. |
|
|
|
// Chat settings. |
|
|
|
$group = [ |
|
|
|
$group = [ |
|
|
|
|