|
|
|
|
@ -13,7 +13,6 @@ |
|
|
|
|
define('SESSION_LINK_TARGET','_self'); |
|
|
|
|
|
|
|
|
|
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php'; |
|
|
|
|
//require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; moved to autoload |
|
|
|
|
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -258,7 +257,8 @@ class Tracking |
|
|
|
|
* @param integer $user_id |
|
|
|
|
* @param string $course_code |
|
|
|
|
* @param int Session id (optional) |
|
|
|
|
* @return timestamp Time in seconds |
|
|
|
|
* |
|
|
|
|
* @return int Time in seconds |
|
|
|
|
*/ |
|
|
|
|
public static function get_time_spent_on_the_course($user_id, $course_code, $session_id = 0) |
|
|
|
|
{ |
|
|
|
|
@ -394,8 +394,12 @@ class Tracking |
|
|
|
|
* @param int Session id (optional, default=0) |
|
|
|
|
* @return string|bool Date with format long without day or false if there is no date |
|
|
|
|
*/ |
|
|
|
|
public static function get_first_connection_date_on_the_course($student_id, $course_code, $session_id = 0, $convert_date = true) |
|
|
|
|
{ |
|
|
|
|
public static function get_first_connection_date_on_the_course( |
|
|
|
|
$student_id, |
|
|
|
|
$course_code, |
|
|
|
|
$session_id = 0, |
|
|
|
|
$convert_date = true |
|
|
|
|
) { |
|
|
|
|
// protect data |
|
|
|
|
$student_id = intval($student_id); |
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
@ -427,8 +431,12 @@ class Tracking |
|
|
|
|
* @param int Session id (optional, default=0) |
|
|
|
|
* @return string|bool Date with format long without day or false if there is no date |
|
|
|
|
*/ |
|
|
|
|
public static function get_last_connection_date_on_the_course($student_id, $course_code, $session_id = 0, $convert_date = true) |
|
|
|
|
{ |
|
|
|
|
public static function get_last_connection_date_on_the_course( |
|
|
|
|
$student_id, |
|
|
|
|
$course_code, |
|
|
|
|
$session_id = 0, |
|
|
|
|
$convert_date = true |
|
|
|
|
) { |
|
|
|
|
// protect data |
|
|
|
|
$student_id = intval($student_id); |
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
@ -485,7 +493,6 @@ class Tracking |
|
|
|
|
*/ |
|
|
|
|
public static function get_course_connections_count($course_code, $session_id = 0, $start = 0, $stop = null) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if ($start < 0) { |
|
|
|
|
$start = 0; |
|
|
|
|
} |
|
|
|
|
@ -637,15 +644,22 @@ class Tracking |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get count student's exercise COMPLETED attempts |
|
|
|
|
* @param int Student id |
|
|
|
|
* @param int tudent id |
|
|
|
|
* @param string Course code |
|
|
|
|
* @param int Exercise id |
|
|
|
|
* @param int Learning path id (optional), for showing attempts inside a learning path $lp_id and $lp_item_id params are required. |
|
|
|
|
* @param int Learning path item id (optional), for showing attempts inside a learning path $lp_id and $lp_item_id params are required. |
|
|
|
|
* |
|
|
|
|
* @return int count of attempts |
|
|
|
|
*/ |
|
|
|
|
public static function count_student_exercise_attempts($student_id, $course_code, $exercise_id, $lp_id = 0, $lp_item_id = 0, $session_id = 0) |
|
|
|
|
{ |
|
|
|
|
public static function count_student_exercise_attempts( |
|
|
|
|
$student_id, |
|
|
|
|
$course_code, |
|
|
|
|
$exercise_id, |
|
|
|
|
$lp_id = 0, |
|
|
|
|
$lp_item_id = 0, |
|
|
|
|
$session_id = 0 |
|
|
|
|
) { |
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
$student_id = intval($student_id); |
|
|
|
|
$exercise_id = intval($exercise_id); |
|
|
|
|
@ -679,7 +693,7 @@ class Tracking |
|
|
|
|
* @param int session id |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
static function get_exercise_student_progress($exercise_list, $user_id, $course_code, $session_id) |
|
|
|
|
public static function get_exercise_student_progress($exercise_list, $user_id, $course_code, $session_id) |
|
|
|
|
{ |
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
$user_id = intval($user_id); |
|
|
|
|
@ -716,7 +730,8 @@ class Tracking |
|
|
|
|
* @param int $session_id |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
static function get_exercise_student_average_best_attempt($exercise_list, $user_id, $course_code, $session_id) { |
|
|
|
|
public static function get_exercise_student_average_best_attempt($exercise_list, $user_id, $course_code, $session_id) |
|
|
|
|
{ |
|
|
|
|
$result = 0; |
|
|
|
|
if (!empty($exercise_list)) { |
|
|
|
|
foreach ($exercise_list as $exercise_data) { |
|
|
|
|
@ -3488,7 +3503,7 @@ class Tracking |
|
|
|
|
class TrackingCourseLog |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
function count_item_resources() |
|
|
|
|
public static function count_item_resources() |
|
|
|
|
{ |
|
|
|
|
global $session_id; |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
@ -3496,8 +3511,12 @@ class TrackingCourseLog |
|
|
|
|
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
|
|
|
$table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT count(tool) AS total_number_of_items FROM $table_item_property track_resource, $table_user user" . |
|
|
|
|
" WHERE track_resource.c_id = $course_id AND track_resource.insert_user_id = user.user_id AND id_session = $session_id "; |
|
|
|
|
$sql = "SELECT count(tool) AS total_number_of_items |
|
|
|
|
FROM $table_item_property track_resource, $table_user user |
|
|
|
|
WHERE |
|
|
|
|
track_resource.c_id = $course_id AND |
|
|
|
|
track_resource.insert_user_id = user.user_id AND |
|
|
|
|
id_session = $session_id "; |
|
|
|
|
|
|
|
|
|
if (isset($_GET['keyword'])) { |
|
|
|
|
$keyword = Database::escape_string(trim($_GET['keyword'])); |
|
|
|
|
@ -3507,10 +3526,18 @@ class TrackingCourseLog |
|
|
|
|
$sql .= " AND tool IN ('document', 'learnpath', 'quiz', 'glossary', 'link', 'course_description', 'announcement', 'thematic', 'thematic_advance', 'thematic_plan')"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
$obj = Database::fetch_object($res); |
|
|
|
|
|
|
|
|
|
return $obj->total_number_of_items; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function get_item_resources_data($from, $number_of_items, $column, $direction) |
|
|
|
|
/** |
|
|
|
|
* @param $from |
|
|
|
|
* @param $number_of_items |
|
|
|
|
* @param $column |
|
|
|
|
* @param $direction |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
public static function get_item_resources_data($from, $number_of_items, $column, $direction) |
|
|
|
|
{ |
|
|
|
|
global $dateTimeFormatLong, $session_id; |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
@ -3518,7 +3545,6 @@ class TrackingCourseLog |
|
|
|
|
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
|
|
|
$table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
|
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT |
|
|
|
|
@ -3530,7 +3556,8 @@ class TrackingCourseLog |
|
|
|
|
visibility as col6, |
|
|
|
|
user.user_id as user_id |
|
|
|
|
FROM $table_item_property track_resource, $table_user user |
|
|
|
|
WHERE track_resource.c_id = $course_id AND |
|
|
|
|
WHERE |
|
|
|
|
track_resource.c_id = $course_id AND |
|
|
|
|
track_resource.insert_user_id = user.user_id AND |
|
|
|
|
id_session = $session_id "; |
|
|
|
|
|
|
|
|
|
@ -3708,7 +3735,8 @@ class TrackingCourseLog |
|
|
|
|
return $resources; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function get_tool_name_table($tool) { |
|
|
|
|
public static function get_tool_name_table($tool) |
|
|
|
|
{ |
|
|
|
|
switch ($tool) { |
|
|
|
|
case 'document': |
|
|
|
|
$table_name = TABLE_DOCUMENT; |
|
|
|
|
@ -3767,7 +3795,7 @@ class TrackingCourseLog |
|
|
|
|
return array('table_name' => $table_name,'link_tool' => $link_tool,'id_tool' => $id_tool); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static function display_additional_profile_fields() |
|
|
|
|
public static function display_additional_profile_fields() |
|
|
|
|
{ |
|
|
|
|
// getting all the extra profile fields that are defined by the platform administrator |
|
|
|
|
$extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
|
|
|
@ -3819,7 +3847,7 @@ class TrackingCourseLog |
|
|
|
|
* @since October 2009 |
|
|
|
|
* @version 1.8.7 |
|
|
|
|
*/ |
|
|
|
|
function get_addtional_profile_information_of_field($field_id) |
|
|
|
|
public function get_addtional_profile_information_of_field($field_id) |
|
|
|
|
{ |
|
|
|
|
// Database table definition |
|
|
|
|
$table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
@ -3849,7 +3877,7 @@ class TrackingCourseLog |
|
|
|
|
* @since Nov 2009 |
|
|
|
|
* @version 1.8.6.2 |
|
|
|
|
*/ |
|
|
|
|
function get_addtional_profile_information_of_field_by_user($field_id, $users) |
|
|
|
|
public function get_addtional_profile_information_of_field_by_user($field_id, $users) |
|
|
|
|
{ |
|
|
|
|
// Database table definition |
|
|
|
|
$table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
@ -3902,18 +3930,18 @@ class TrackingCourseLog |
|
|
|
|
* count the number of students in this course (used for SortableTable) |
|
|
|
|
* Deprecated |
|
|
|
|
*/ |
|
|
|
|
function count_student_in_course() |
|
|
|
|
public function count_student_in_course() |
|
|
|
|
{ |
|
|
|
|
global $nbStudents; |
|
|
|
|
return $nbStudents; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function sort_users($a, $b) |
|
|
|
|
public function sort_users($a, $b) |
|
|
|
|
{ |
|
|
|
|
return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function sort_users_desc($a, $b) |
|
|
|
|
public function sort_users_desc($a, $b) |
|
|
|
|
{ |
|
|
|
|
return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
|
|
|
} |
|
|
|
|
@ -3922,7 +3950,7 @@ class TrackingCourseLog |
|
|
|
|
* Get number of users for sortable with pagination |
|
|
|
|
* @return int |
|
|
|
|
*/ |
|
|
|
|
static function get_number_of_users() |
|
|
|
|
public static function get_number_of_users() |
|
|
|
|
{ |
|
|
|
|
global $user_ids; |
|
|
|
|
return count($user_ids); |
|
|
|
|
@ -3936,7 +3964,7 @@ class TrackingCourseLog |
|
|
|
|
* @param $direction |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
static function get_user_data($from, $number_of_items, $column, $direction) |
|
|
|
|
public static function get_user_data($from, $number_of_items, $column, $direction) |
|
|
|
|
{ |
|
|
|
|
global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id, $_configuration; |
|
|
|
|
|
|
|
|
|
@ -4120,7 +4148,7 @@ class TrackingUserLog |
|
|
|
|
/** |
|
|
|
|
* Displays the number of logins every month for a specific user in a specific course. |
|
|
|
|
*/ |
|
|
|
|
function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
|
|
|
|
public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
|
|
|
|
{ |
|
|
|
|
$MonthsLong = $GLOBALS['MonthsLong']; |
|
|
|
|
|
|
|
|
|
@ -4200,7 +4228,7 @@ class TrackingUserLog |
|
|
|
|
* Displays the exercise results for a specific user in a specific course. |
|
|
|
|
* @todo remove globals |
|
|
|
|
*/ |
|
|
|
|
function display_exercise_tracking_info($view, $user_id, $course_id) |
|
|
|
|
public function display_exercise_tracking_info($view, $user_id, $course_id) |
|
|
|
|
{ |
|
|
|
|
global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
|
|
|
if(substr($view,1,1) == '1') |
|
|
|
|
@ -4302,7 +4330,7 @@ class TrackingUserLog |
|
|
|
|
* Displays the student publications for a specific user in a specific course. |
|
|
|
|
* @todo remove globals |
|
|
|
|
*/ |
|
|
|
|
function display_student_publications_tracking_info($view, $user_id, $course_id) |
|
|
|
|
public function display_student_publications_tracking_info($view, $user_id, $course_id) |
|
|
|
|
{ |
|
|
|
|
global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK, $dateTimeFormatLong, $_course; |
|
|
|
|
if (substr($view,2,1) == '1') { |
|
|
|
|
@ -4368,10 +4396,10 @@ class TrackingUserLog |
|
|
|
|
* Displays the links followed for a specific user in a specific course. |
|
|
|
|
* @todo remove globals |
|
|
|
|
*/ |
|
|
|
|
function display_links_tracking_info($view, $user_id, $course_id) |
|
|
|
|
public function display_links_tracking_info($view, $user_id, $course_id) |
|
|
|
|
{ |
|
|
|
|
global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
|
|
|
if(substr($view,3,1) == '1') { |
|
|
|
|
if (substr($view,3,1) == '1') { |
|
|
|
|
$new_view = substr_replace($view,'0',3,1); |
|
|
|
|
echo " |
|
|
|
|
<tr> |
|
|
|
|
@ -4428,7 +4456,7 @@ class TrackingUserLog |
|
|
|
|
* @param int Session id (optional, default = 0) |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
static function display_document_tracking_info($view, $user_id, $course_id, $session_id = 0) { |
|
|
|
|
public static function display_document_tracking_info($view, $user_id, $course_id, $session_id = 0) { |
|
|
|
|
|
|
|
|
|
// protect data |
|
|
|
|
$user_id = intval($user_id); |
|
|
|
|
@ -4436,8 +4464,7 @@ class TrackingUserLog |
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
|
|
|
|
|
$downloads_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
|
|
|
if(substr($view,4,1) == '1') |
|
|
|
|
{ |
|
|
|
|
if(substr($view,4,1) == '1') { |
|
|
|
|
$new_view = substr_replace($view,'0',4,1); |
|
|
|
|
echo " |
|
|
|
|
<tr> |
|
|
|
|
@ -4497,7 +4524,7 @@ class TrackingUserLog |
|
|
|
|
* @return string IP address (or false on error) |
|
|
|
|
* @assert (0,0) === false |
|
|
|
|
*/ |
|
|
|
|
static function get_ip_from_user_event($user_id, $event_date, $return_as_link = false, $body_replace = null) { |
|
|
|
|
public static function get_ip_from_user_event($user_id, $event_date, $return_as_link = false, $body_replace = null) { |
|
|
|
|
if (empty($user_id) or empty($event_date)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
@ -4526,7 +4553,7 @@ class TrackingUserLogCSV |
|
|
|
|
/** |
|
|
|
|
* Displays the number of logins every month for a specific user in a specific course. |
|
|
|
|
*/ |
|
|
|
|
function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
|
|
|
|
public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
|
|
|
|
{ |
|
|
|
|
$MonthsLong = $GLOBALS['MonthsLong']; |
|
|
|
|
$track_access_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
|
|
|
@ -4572,7 +4599,7 @@ class TrackingUserLogCSV |
|
|
|
|
* Displays the exercise results for a specific user in a specific course. |
|
|
|
|
* @todo remove globals |
|
|
|
|
*/ |
|
|
|
|
function display_exercise_tracking_info($view, $user_id, $course_id) |
|
|
|
|
public function display_exercise_tracking_info($view, $user_id, $course_id) |
|
|
|
|
{ |
|
|
|
|
global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
|
|
|
if (substr($view,1,1) == '1') { |
|
|
|
|
@ -4639,7 +4666,7 @@ class TrackingUserLogCSV |
|
|
|
|
* Displays the student publications for a specific user in a specific course. |
|
|
|
|
* @todo remove globals |
|
|
|
|
*/ |
|
|
|
|
function display_student_publications_tracking_info($view, $user_id, $course_id) |
|
|
|
|
public function display_student_publications_tracking_info($view, $user_id, $course_id) |
|
|
|
|
{ |
|
|
|
|
global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK, $dateTimeFormatLong, $_course; |
|
|
|
|
if (substr($view,2,1) == '1') { |
|
|
|
|
@ -4676,9 +4703,10 @@ class TrackingUserLogCSV |
|
|
|
|
* Displays the links followed for a specific user in a specific course. |
|
|
|
|
* @todo remove globals |
|
|
|
|
*/ |
|
|
|
|
function display_links_tracking_info($view, $user_id, $course_id) |
|
|
|
|
public function display_links_tracking_info($view, $user_id, $course_id) |
|
|
|
|
{ |
|
|
|
|
global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
|
|
|
$line = null; |
|
|
|
|
if (substr($view,3,1) == '1') { |
|
|
|
|
$new_view = substr_replace($view,'0',3,1); |
|
|
|
|
$title[1]=get_lang('LinksDetails'); |
|
|
|
|
@ -4711,7 +4739,7 @@ class TrackingUserLogCSV |
|
|
|
|
* @param int Session id (optional, default = 0) |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
function display_document_tracking_info($view, $user_id, $course_id, $session_id = 0) |
|
|
|
|
public function display_document_tracking_info($view, $user_id, $course_id, $session_id = 0) |
|
|
|
|
{ |
|
|
|
|
// protect data |
|
|
|
|
$user_id = intval($user_id); |
|
|
|
|
|