Minor - format code

pull/2525/head
jmontoyaa 8 years ago
parent f0e07b5d0a
commit e6d2098bdb
  1. 4
      main/group/group.php
  2. 2
      main/inc/lib/course.lib.php
  3. 10
      main/inc/lib/groupmanager.lib.php

@ -105,7 +105,7 @@ if (api_is_allowed_to_edit(false, true)) {
if (is_array($_POST['group'])) { if (is_array($_POST['group'])) {
foreach ($_POST['group'] as $myGroupId) { foreach ($_POST['group'] as $myGroupId) {
$groupInfo = GroupManager::get_group_properties($myGroupId); $groupInfo = GroupManager::get_group_properties($myGroupId);
GroupManager::delete_groups($groupInfo); GroupManager::deleteGroup($groupInfo);
} }
Display::addFlash(Display::return_message(get_lang('SelectedGroupsDeleted'))); Display::addFlash(Display::return_message(get_lang('SelectedGroupsDeleted')));
@ -150,7 +150,7 @@ if (api_is_allowed_to_edit(false, true)) {
break; break;
case 'delete_one': case 'delete_one':
$groupInfo = GroupManager::get_group_properties($my_get_id); $groupInfo = GroupManager::get_group_properties($my_get_id);
GroupManager::delete_groups($groupInfo); GroupManager::deleteGroup($groupInfo);
Display::addFlash(Display::return_message(get_lang('GroupDel'))); Display::addFlash(Display::return_message(get_lang('GroupDel')));
header("Location: $currentUrl"); header("Location: $currentUrl");
exit; exit;

@ -2228,7 +2228,7 @@ class CourseManager
$groups = GroupManager::get_groups($courseId); $groups = GroupManager::get_groups($courseId);
if (!empty($groups)) { if (!empty($groups)) {
foreach ($groups as $group) { foreach ($groups as $group) {
GroupManager::delete_groups($group, $course['code']); GroupManager::deleteGroup($group, $course['code']);
} }
} }

@ -428,12 +428,16 @@ class GroupManager
* *
* @return int - number of groups deleted * @return int - number of groups deleted
*/ */
public static function delete_groups($groupInfo, $course_code = null) public static function deleteGroup($groupInfo, $course_code = null)
{ {
if (empty($groupInfo['iid'])) { if (empty($groupInfo['iid'])) {
return false; return false;
} }
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
if (empty($course_info)) {
return false;
}
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
// Database table definitions // Database table definitions
@ -874,7 +878,7 @@ class GroupManager
while ($group = Database::fetch_object($res)) { while ($group = Database::fetch_object($res)) {
// Delete all groups in category // Delete all groups in category
/*$groupInfo = self::get_group_properties($group->iid, true); /*$groupInfo = self::get_group_properties($group->iid, true);
self::delete_groups($groupInfo, $course_code); self::deleteGroup($groupInfo, $course_code);
*/ */
// Set the category to NULL to avoid losing groups in sessions. // Set the category to NULL to avoid losing groups in sessions.
$sql = "UPDATE $table_group SET category_id = NULL WHERE iid = ".$group->iid; $sql = "UPDATE $table_group SET category_id = NULL WHERE iid = ".$group->iid;
@ -2689,7 +2693,7 @@ class GroupManager
$groups = self::get_groups(); $groups = self::get_groups();
foreach ($groups as $group) { foreach ($groups as $group) {
if (!in_array($group['iid'], $elementsFound['groups'])) { if (!in_array($group['iid'], $elementsFound['groups'])) {
self::delete_groups($group); self::deleteGroup($group);
$group['group'] = $group['name']; $group['group'] = $group['name'];
$result['deleted']['group'][] = $group; $result['deleted']['group'][] = $group;
} }

Loading…
Cancel
Save