Fixing work counter see BT#8958

1.9.x
Julio Montoya 11 years ago
parent 28ee28b38f
commit f32cacb292
  1. 5
      main/inc/lib/course.lib.php
  2. 36
      main/work/work.lib.php

@ -1381,7 +1381,7 @@ class CourseManager
}
$where[] = ' course_rel_user.course_code IS NOT NULL ';
if (isset($filter_by_status) && $filter_by_status != '') {
if (isset($filter_by_status) && is_numeric($filter_by_status)) {
$filter_by_status = intval($filter_by_status);
$filter_by_status_condition = " course_rel_user.status = $filter_by_status AND ";
}
@ -1429,7 +1429,6 @@ class CourseManager
}
$sql .= ' '.$order_by.' '.$limit;
$rs = Database::query($sql);
$users = array();
@ -2866,7 +2865,6 @@ class CourseManager
$rowcfv = Database::fetch_array($rescfv);
if ($rowcfv['field_value'] != $fvalues) {
$sqlu = "UPDATE $t_cfv SET field_value = '$fvalues', tms = FROM_UNIXTIME($tms) WHERE id = ".$rowcfv['id'];
//error_log('UM::update_extra_field_value: '.$sqlu);
$resu = Database::query($sqlu);
return ($resu ? true : false);
}
@ -2874,7 +2872,6 @@ class CourseManager
} else {
$sqli = "INSERT INTO $t_cfv (course_code,field_id,field_value,tms) " .
"VALUES ('$course_code',".$rowcf['id'].",'$fvalues',FROM_UNIXTIME($tms))";
//error_log('UM::update_extra_field_value: '.$sqli);
$resi = Database::query($sqli);
return ($resi ? true : false);
}

@ -2887,12 +2887,16 @@ function getStudentSubscribedToWork(
if (empty($groupId)) {
$courseInfo = api_get_course_info_by_id($courseId);
$status = STUDENT;
if (!empty($sessionId)) {
$status = 0;
}
$usersInCourse = CourseManager::get_user_list_from_course_code(
$courseInfo['code'],
$sessionId,
null,
null,
0,
$status,
$getCount
);
} else {
@ -3364,10 +3368,22 @@ function sendAlertToTeacher($workId, $courseInfo, $session_id)
// Lets predefine some variables. Be sure to change the from address!
if (empty($session_id)) {
//Teachers
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), null, null, null, COURSEMANAGER);
$user_list = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
null,
null,
null,
COURSEMANAGER
);
} else {
//Coaches
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id, null, null, 2);
// Coaches
$user_list = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
$session_id,
null,
null,
2
);
}
$subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$courseInfo['name']." ";
@ -4153,7 +4169,16 @@ function showStudentList($workId)
function getWorkUserList($courseCode, $sessionId, $groupId, $start, $limit, $sidx, $sord, $getCount = false)
{
if (!empty($groupId)) {
$userList = GroupManager::get_users($groupId, false, $start, $limit, $getCount, null, $sidx, $sord);
$userList = GroupManager::get_users(
$groupId,
false,
$start,
$limit,
$getCount,
null,
$sidx,
$sord
);
} else {
$limitString = null;
if (!empty($start) && !empty($limit)) {
@ -4187,6 +4212,7 @@ function getWorkUserList($courseCode, $sessionId, $groupId, $start, $limit, $sid
$getCount
);
}
if ($getCount == false) {
$userList = array_keys($userList);
}

Loading…
Cancel
Save