$timestamp_login_date, 'logout' => $timestamp_logout_date); } return $connections; } /** * TODO: Not used, to b deleted? * Enter description here... * @param int $user_id * @param string $course_code * @param date $year * @param date $month * @param date $day * @return unknown */ function get_connections_to_course_by_time($user_id, $course_code, $year = '', $month = '', $day = '') { // Database table definitions $tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_main = Database :: get_main_table(TABLE_MAIN_COURSE); $sql_query = 'SELECT visual_code as course_code FROM '.$tbl_main.' c WHERE code="'.Database :: escape_string($course_code).'";'; $result = Database::query($sql_query); $row_query = Database::fetch_array($result,'ASSOC'); $course_true = isset($row_query['course_code']) ? $row_query['course_code']: $course_code; $sql = 'SELECT login_course_date, logout_course_date FROM ' . $tbl_track_course . ' WHERE user_id = ' . intval($user_id) . ' AND course_code="' . Database::escape_string($course_true) . '" ORDER BY login_course_date DESC'; $rs = Database::query($sql); $connections = array(); while ($row = Database::fetch_array($rs)) { $login_date = $row['login_course_date']; $logout_date = $row['logout_course_date']; $timestamp_login_date = strtotime($login_date); $timestamp_logout_date = strtotime($logout_date); $connections[] = array('login' => $timestamp_login_date, 'logout' => $timestamp_logout_date); } return $connections; } /** * Creates a small table in the last column of the table with the user overview * * @param integer $user_id the id of the user * @param array $url_params additonal url parameters * @param array $row the row information (the other columns) * @return string html code */ function course_info_tracking_filter($user_id, $url_params, $row) { // the table header $return .= '
'.get_lang('Course').' | '; $return .= ''.get_lang('AvgTimeSpentInTheCourse').' | '; $return .= ''.get_lang('AvgStudentsProgress').' | '; $return .= ''.get_lang('AvgCourseScore').' | '; $return .= ''.get_lang('AvgExercisesScore').' | '; $return .= ''.get_lang('AvgMessages').' | '; $return .= ''.get_lang('AvgAssignments').' | '; $return .= ''.get_lang('TotalExercisesScoreObtained').' | '; $return .= ''.get_lang('TotalExercisesScorePossible').' | '; $return .= ''.get_lang('TotalExercisesAnswered').' | '; $return .= ''.get_lang('TotalExercisesScorePercentage').' | '; $return .= ''.get_lang('FirstLogin').' | '; $return .= ''.get_lang('LatestLogin').' | '; $return .= '
---|---|---|---|---|---|---|---|---|---|---|---|---|
'.cut($row[0], 20, true).' | '; // time spent in the course $return .= ''.api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_id, $row[0])).' | ';
// student progress in course
$return .= ' '.round(Tracking :: get_avg_student_progress($user_id, $row[0]), 2).' | ';
// student score
$avg_score = Tracking :: get_avg_student_score($user_id, $row[0]);
if (is_numeric($avg_score)) {
$avg_score = round($avg_score,2);
} else {
$$avg_score = '-';
}
$return .= ' '.$avg_score.' | ';
// student tes score
//$return .= ' '.round(Tracking :: get_avg_student_exercise_score ($user_id, $row[0]),2).'% | ';
// student messages
$return .= ' '.Tracking :: count_student_messages($user_id, $row[0]).' | ';
// student assignments
$return .= ' '.Tracking :: count_student_assignments($user_id, $row[0]).' | ';
// student exercises results (obtained score, maximum score, number of exercises answered, score percentage)
$exercises_results = MySpace::exercises_results($user_id, $row[0]);
$return .= ' '.(is_null($exercises_results['percentage']) ? '' : $exercises_results['score_obtained'].'/'.$exercises_results['score_possible'].' ( '.$exercises_results['percentage'].'% )').' | ';
//$return .= ' '.$exercises_results['score_possible'].' | ';
$return .= ' '.$exercises_results['questions_answered'].' | ';
//$return .= ' '.$exercises_results['percentage'].'% | ';
// first connection
//$return .= ' '.Tracking :: get_first_connection_date_on_the_course ($user_id, $row[0]).' | '; // last connection $return .= ''.Tracking :: get_last_connection_date_on_the_course ($user_id, $row[0]).' | ';
$return .= '
'.get_lang('Course').' | '; $t_head .= ''.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).' | '; $t_head .= ''.cut(get_lang('AvgStudentsProgress'), 6, true).' | '; $t_head .= ''.cut(get_lang('AvgCourseScore'), 6, true).' | '; //$t_head .= ''.get_lang('AvgExercisesScore').' | ';
$t_head .= ' '.cut(get_lang('AvgMessages'), 6, true).' | '; $t_head .= ''.cut(get_lang('AvgAssignments'), 6, true).' | '; $t_head .= ''.get_lang('TotalExercisesScoreObtained').' | '; //$t_head .= ''.get_lang('TotalExercisesScorePossible').' | ';
$t_head .= ' '.cut(get_lang('TotalExercisesAnswered'), 6, true).' | '; //$t_head .= ''.get_lang('TotalExercisesScorePercentage').' | ';
//$t_head .= ' '.get_lang('FirstLogin').' | ';
$t_head .= ' '.get_lang('LatestLogin').' | '; $t_head .= '
---|