[svn r14117] More fixes to avoid SQL errors when handling a wrongly-removed-course

Returning null so the calling script (mySpace/index.php) knows when there has been a problem
skala
Yannick Warnier 17 years ago
parent 5ba502e2e2
commit 02b964fd20
  1. 23
      main/inc/lib/tracking.lib.php

@ -181,6 +181,8 @@ class Tracking {
// get the informations of the course
$a_course = CourseManager :: get_course_information($course_code);
if(!empty($a_course['db_name']))
{
// table definition
$tbl_course_lp_view = Database :: get_course_table(TABLE_LP_VIEW, $a_course['db_name']);
$tbl_course_lp_view_item = Database :: get_course_table(TABLE_LP_ITEM_VIEW, $a_course['db_name']);
@ -212,6 +214,11 @@ class Tracking {
return $avg_progress;
}
else
{
return null;
}
}
function get_avg_student_score($student_id, $course_code) {
@ -219,6 +226,8 @@ class Tracking {
$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$table_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$course = CourseManager :: get_course_information($course_code);
if(!empty($course['db_name']))
{
$lp_table = Database :: get_course_table(TABLE_LP_MAIN,$course['db_name']);
$lp_item_table = Database :: get_course_table(TABLE_LP_ITEM,$course['db_name']);
$lp_view_table = Database :: get_course_table(TABLE_LP_VIEW,$course['db_name']);
@ -311,6 +320,11 @@ class Tracking {
return $pourcentageScore;
}
else
{
return null;
}
}
/**
* gets the list of students followed by coach
@ -590,6 +604,8 @@ class Tracking {
// get the informations of the course
$a_course = CourseManager :: get_course_information($course_code);
if(!empty($a_course['db_name']))
{
// table definition
$tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $a_course['db_name']);
$sql = 'SELECT 1
@ -600,6 +616,11 @@ class Tracking {
$rs = api_sql_query($sql, __LINE__, __FILE__);
return mysql_num_rows($rs);
}
else
{
return null;
}
}
function count_student_messages($student_id, $course_code) {
require_once (api_get_path(LIBRARY_PATH) . 'course.lib.php');
@ -624,7 +645,7 @@ class Tracking {
}
else
{
return 0;
return null;
}
}

Loading…
Cancel
Save