Example #1
0
$csvContent[] = get_lang('Information');
$data = array(get_lang('Name') => $user['complete_name'], get_lang('Email') => $user['email'], get_lang('Phone') => $user['phone'], get_lang('OfficialCode') => $user['official_code'], get_lang('Online') => $user['user_is_online'] ? Display::return_icon('online.png') : Display::return_icon('offline.png'), get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'), null => sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id=' . $creatorId, $creatorInfo['username'], api_get_utc_datetime($registrationDate)));
$row = 1;
foreach ($data as $label => $item) {
    if (!empty($label)) {
        $label = $label . ': ';
    }
    $table->setCellContents($row, 0, $label . $item);
    $csvContent[] = array($label, strip_tags($item));
    $row++;
}
$userInformation = $table->toHtml();
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('Tracking'));
$csvContent[] = get_lang('Tracking');
$data = array(get_lang('FirstLogin') => Tracking::get_first_connection_date($user['user_id']), get_lang('LatestLogin') => Tracking::get_last_connection_date($user['user_id'], true));
$row = 1;
foreach ($data as $label => $item) {
    if (!empty($label)) {
        $label = $label . ': ';
    }
    $table->setCellContents($row, 0, $label . $item);
    $csvContent[] = array($label, strip_tags($item));
    $row++;
}
$trackingInformation = $table->toHtml();
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
Example #2
0
 $avg_student_progress = $avg_student_score = 0;
 $course_code = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
 if (CourseManager::is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
     $avg_student_progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, array(), $sessionId);
     //the score inside the Reporting table
     $avg_student_score = Tracking::get_avg_student_score($user_info['user_id'], $course_code, array(), $sessionId);
 }
 $avg_student_progress = round($avg_student_progress, 2);
 // time spent on the course
 $courseInfo = api_get_course_info($course_code);
 $time_spent_on_the_course = 0;
 if (!empty($courseInfo)) {
     $time_spent_on_the_course = api_time_to_hms(Tracking::get_time_spent_on_the_course($user_info['user_id'], $courseInfo['real_id'], $sessionId));
 }
 // get information about connections on the platform by student
 $first_connection_date = Tracking::get_first_connection_date($user_info['user_id']);
 if ($first_connection_date == '') {
     $first_connection_date = get_lang('NoConnexion');
 }
 $last_connection_date = Tracking::get_last_connection_date($user_info['user_id'], true);
 if ($last_connection_date == '') {
     $last_connection_date = get_lang('NoConnexion');
 }
 // cvs information
 $csv_content[] = array(get_lang('Information', ''));
 $csv_content[] = array(get_lang('Name', ''), get_lang('Email', ''), get_lang('Tel', ''));
 $csv_content[] = array($user_info['complete_name'], $user_info['email'], $user_info['phone']);
 $csv_content[] = array();
 // csv tracking
 $csv_content[] = array(get_lang('Tracking', ''));
 $csv_content[] = array(get_lang('FirstLoginInPlatform', ''), get_lang('LatestLoginInPlatform', ''), get_lang('TimeSpentInTheCourse', ''), get_lang('Progress', ''), get_lang('Score', ''));
Example #3
0
function get_users($from, $limit, $column, $direction)
{
    $active = isset($_GET['active']) ? $_GET['active'] : 1;
    $keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
    $sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null;
    $lastConnectionDate = null;
    if (!empty($sleepingDays)) {
        $lastConnectionDate = api_get_utc_datetime(strtotime($sleepingDays . ' days ago'));
    }
    $is_western_name_order = api_is_western_name_order();
    $coach_id = api_get_user_id();
    $drhLoaded = false;
    if (api_is_drh()) {
        $column = 'u.user_id';
        if (api_drh_can_access_all_session_content()) {
            $students = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id(), false, $from, $limit, $column, $direction, $keyword, $active, $lastConnectionDate, null, null, api_is_student_boss() ? null : STUDENT);
            $drhLoaded = true;
        }
    }
    if ($drhLoaded == false) {
        $students = UserManager::getUsersFollowedByUser(api_get_user_id(), api_is_student_boss() ? null : STUDENT, false, false, false, $from, $limit, $column, $direction, $active, $lastConnectionDate, api_is_student_boss() ? STUDENT_BOSS : COURSEMANAGER, $keyword);
    }
    $all_datas = array();
    foreach ($students as $student_data) {
        $student_id = $student_data['user_id'];
        if (isset($_GET['id_session'])) {
            $courses = Tracking::get_course_list_in_session_from_student($student_id, $_GET['id_session']);
        }
        $avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0;
        $nb_courses_student = 0;
        if (!empty($courses)) {
            foreach ($courses as $course_code) {
                $courseInfo = api_get_course_info($course_code);
                $courseId = $courseInfo['real_id'];
                if (CourseManager::is_user_subscribed_in_course($student_id, $course_code, true)) {
                    $avg_time_spent += Tracking::get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
                    $my_average = Tracking::get_avg_student_score($student_id, $course_code);
                    if (is_numeric($my_average)) {
                        $avg_student_score += $my_average;
                    }
                    $avg_student_progress += Tracking::get_avg_student_progress($student_id, $course_code);
                    $total_assignments += Tracking::count_student_assignments($student_id, $course_code);
                    $total_messages += Tracking::count_student_messages($student_id, $course_code);
                    $nb_courses_student++;
                }
            }
        }
        if ($nb_courses_student > 0) {
            $avg_time_spent = $avg_time_spent / $nb_courses_student;
            $avg_student_score = $avg_student_score / $nb_courses_student;
            $avg_student_progress = $avg_student_progress / $nb_courses_student;
        } else {
            $avg_time_spent = null;
            $avg_student_score = null;
            $avg_student_progress = null;
        }
        $row = array();
        if ($is_western_name_order) {
            $row[] = $student_data['firstname'];
            $row[] = $student_data['lastname'];
        } else {
            $row[] = $student_data['lastname'];
            $row[] = $student_data['firstname'];
        }
        $string_date = Tracking::get_last_connection_date($student_id, true);
        $first_date = Tracking::get_first_connection_date($student_id);
        $row[] = $first_date;
        $row[] = $string_date;
        if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
            $detailsLink = '<a href="myStudents.php?student=' . $student_id . '&id_coach=' . $coach_id . '&id_session=' . $_GET['id_session'] . '">
				          <img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
        } else {
            $detailsLink = '<a href="myStudents.php?student=' . $student_id . '">
				             <img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
        }
        $row[] = $detailsLink;
        $all_datas[] = $row;
    }
    return $all_datas;
}
Example #4
0
         $avg_student_progress = $avg_student_progress / $nb_courses_student;
     } else {
         $avg_time_spent = null;
         $avg_student_score = null;
         $avg_student_progress = null;
     }
     $row = array();
     if ($is_western_name_order) {
         $row[] = $student_data['firstname'];
         $row[] = $student_data['lastname'];
     } else {
         $row[] = $student_data['lastname'];
         $row[] = $student_data['firstname'];
     }
     $string_date = Tracking::get_last_connection_date($student_id, true);
     $first_date = Tracking::get_first_connection_date($student_id);
     $row[] = $first_date;
     $row[] = $string_date;
     if ($export_csv) {
         $row[count($row) - 1] = strip_tags($row[count($row) - 1]);
         $row[count($row) - 2] = strip_tags($row[count($row) - 2]);
         $csv_content[] = $row;
     }
     if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
         $row[] = '<a href="myStudents.php?student=' . $student_id . '&id_coach=' . $coach_id . '&id_session=' . $session_id . '"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
     } else {
         $row[] = '<a href="myStudents.php?student=' . $student_id . '"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
     }
     $all_datas[] = $row;
 }
 if ($tracking_direction == 'ASC') {