Display classes not in a course -ref #5619

skala
Hubert Borderiou 13 years ago
parent 3e7ab1b5a6
commit f28350720c
  1. 12
      main/inc/ajax/model.ajax.php
  2. 6
      main/inc/lib/usergroup.lib.php

@ -130,11 +130,6 @@ switch ($action) {
case 'get_hotpotatoes_exercise_results': case 'get_hotpotatoes_exercise_results':
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$hotpot_path = $_REQUEST['path']; $hotpot_path = $_REQUEST['path'];
if (isset($_GET['filter_by_user']) && !empty($_GET['filter_by_user'])) {
$filter_user = intval($_GET['filter_by_user']);
$where_condition .= " AND thp.exe_user_id = '$filter_user'";
}
$count = get_count_exam_hotpotatoes_results($hotpot_path); $count = get_count_exam_hotpotatoes_results($hotpot_path);
break; break;
case 'get_sessions': case 'get_sessions':
@ -260,10 +255,7 @@ switch ($action) {
//used inside get_exam_results_data() //used inside get_exam_results_data()
$documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document"; $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
$columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions'); $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
if (!$is_allowedToEdit) { $result = get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $where_condition); //get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition);
$columns = array('exe_date', 'score', 'actions');
}
$result = get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path,'', $where_condition); //get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition);
break; break;
case 'get_sessions': case 'get_sessions':
$columns = array('name', 'nbr_courses', 'nbr_users', 'category_name', 'date_start','date_end', 'coach_name', 'session_active', 'visibility'); $columns = array('name', 'nbr_courses', 'nbr_users', 'category_name', 'date_start','date_end', 'coach_name', 'session_active', 'visibility');
@ -417,7 +409,7 @@ switch ($action) {
$options = array('order'=>"name $sord", 'LIMIT'=> "$start , $limit"); $options = array('order'=>"name $sord", 'LIMIT'=> "$start , $limit");
switch ($type) { switch ($type) {
case 'not_registered': case 'not_registered':
$options['where'] = array(" usergroup.course_id IS NULL" => ' '); $options['where'] = array(" course_id != ? " => $course_id);
$result = $obj->get_usergroup_not_in_course($options); $result = $obj->get_usergroup_not_in_course($options);
break; break;
case 'registered': case 'registered':

@ -93,9 +93,9 @@ class UserGroup extends Model {
} }
public function get_usergroup_not_in_course($options = array()) { public function get_usergroup_not_in_course($options = array()) {
$sql = "SELECT DISTINCT u.* FROM {$this->usergroup_rel_course_table} usergroup $sql = "SELECT * FROM {$this->usergroup_rel_course_table} urc
RIGHT JOIN {$this->table} u JOIN {$this->table} u
ON (u.id = usergroup.usergroup_id) ON (u.id = urc.usergroup_id)
"; ";
$conditions = Database::parse_conditions($options); $conditions = Database::parse_conditions($options);
$sql .= $conditions; $sql .= $conditions;

Loading…
Cancel
Save