Removing old virtual courses code in groups

skala
Julio Montoya 13 years ago
parent 2af7426028
commit f6f433e11e
  1. 32
      main/group/group_creation.php
  2. 30
      main/inc/lib/course.lib.php
  3. 419
      main/inc/lib/groupmanager.lib.php
  4. 6
      tests/main/inc/lib/groupmanager.lib.test.php

@ -50,11 +50,6 @@ if (isset ($_POST['action'])) {
$msg = urlencode(count($groups).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
break;
case 'create_virtual_groups':
$ids = GroupManager :: create_groups_from_virtual_courses();
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
break;
case 'create_subgroups':
GroupManager :: create_subgroups($_POST['base_group'], $_POST['number_of_groups']);
$msg = urlencode($_POST['number_of_groups'].' '.get_lang('GroupsAdded'));
@ -184,7 +179,7 @@ EOT;
$group_el[] = $form->createElement('text', 'group_'.$group_number.'_name');
if (api_get_setting('allow_group_categories') == 'true') {
$group_el[] = $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array('id' => 'category_'.$group_number));
}
}
$group_el[] = $form->createElement('text', 'group_'.$group_number.'_places', null, array('class' => 'span1', 'id' => 'places_'.$group_number));
if ($_POST['number_of_groups'] < 10000) {
@ -232,23 +227,6 @@ EOT;
} else {
echo get_lang('NoCategoriesDefined');
}
//echo '</blockquote>';
/*
* Show form to generate groups from virtual courses
*/
$virtual_courses = CourseManager :: get_virtual_courses_linked_to_real_course($_course['sysCode']);
if (count($virtual_courses) > 0) {
echo '<b>'.get_lang('CreateGroupsFromVirtualCourses').'</b>';
echo '<blockquote>';
echo get_lang('CreateGroupsFromVirtualCoursesInfo');
$create_virtual_groups_form = new FormValidator('create_virtual_groups');
$create_virtual_groups_form->addElement('hidden', 'action');
$create_virtual_groups_form->addElement('submit', 'submit', get_lang('Ok'));
$create_virtual_groups_form->setDefaults(array('action' => 'create_virtual_groups'));
$create_virtual_groups_form->display();
echo '</blockquote>';
}
/*
* Show form to generate subgroups
@ -262,7 +240,7 @@ EOT;
$base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')';
}
}
if (count($base_group_options) > 0) {
if (count($base_group_options) > 0) {
$create_subgroups_form = new FormValidator('create_subgroups');
$create_subgroups_form->addElement('header', get_lang('CreateSubgroups'));
$create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo'));
@ -277,7 +255,7 @@ EOT;
$defaults = array();
$defaults['action'] = 'create_subgroups';
$create_subgroups_form->setDefaults($defaults);
$create_subgroups_form->display();
$create_subgroups_form->display();
}
}
@ -285,7 +263,7 @@ EOT;
* Show form to generate groups from classes subscribed to the course
*/
$options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id());
$obj = new UserGroup();
$obj = new UserGroup();
$classes = $obj->get_usergroup_in_course($options);
if (count($classes) > 0) {
echo '<b>'.get_lang('GroupsFromClasses').'</b>';
@ -323,7 +301,7 @@ EOT;
$create_class_groups_form->display();
echo '</blockquote>';
}
}
/* FOOTER */

@ -1043,24 +1043,6 @@ class CourseManager {
return count(self::get_list_of_virtual_courses_for_specific_user_and_real_course($user_id, $real_course_code)) > 0;
}
/**
* Return an array of arrays, listing course info of all virtual course
* linked to the real course ID $real_course_code
*
* @param string The id of the real course which the virtual courses are linked to
* @return array List of courses details
* @deprecated virtual courses doesn't exist anymore
*/
public static function get_virtual_courses_linked_to_real_course($real_course_code) {
$sql_result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE)."
WHERE target_course_code = '".Database::get_main_table(TABLE_MAIN_COURSE)."'");
$result_array = array();
while ($result = Database::fetch_array($sql_result)) {
$result_array[] = $result;
}
return $result_array;
}
/**
* This function returns the course code of the real course
* to which a virtual course is linked.
@ -1681,8 +1663,6 @@ class CourseManager {
* @return array with user info
*/
public static function get_real_and_linked_user_list($course_code, $with_sessions = true, $session_id = 0) {
//get list of virtual courses
$virtual_course_list = self::get_virtual_courses_linked_to_real_course($course_code);
$complete_user_list = array();
//get users from real course
@ -1690,16 +1670,6 @@ class CourseManager {
foreach ($user_list as $this_user) {
$complete_user_list[] = $this_user;
}
//get users from linked courses
foreach ($virtual_course_list as $this_course) {
$course_code = $this_course['code'];
$user_list = self::get_user_list_from_course_code($course_code, $session_id);
foreach ($user_list as $this_user) {
$complete_user_list[] = $this_user;
}
}
return $complete_user_list;
}

File diff suppressed because it is too large Load Diff

@ -50,12 +50,6 @@ class TestGroupManager extends UnitTestCase {
//var_dump($res);
}
public function testCreateGroupsFromVirtualCourses(){
$res = GroupManager::create_groups_from_virtual_courses();
$this->assertTrue($res);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testCreateClassGroups(){
$category_id=2;

Loading…
Cancel
Save