123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643 |
- <?php
- /* For licensing terms, see /license.txt */
- require_once '../inc/global.inc.php';
- $allow = api_get_configuration_value('extra');
- if (empty($allow)) {
- exit;
- }
- api_block_anonymous_users();
- $export_csv = isset($_GET['export']) && $_GET['export'] === 'csv' ? true : false;
- $course_code = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
- $_course = api_get_course_info();
- $coment = '';
- if (!api_is_allowed_to_create_course() &&
- !api_is_session_admin() &&
- !api_is_drh() &&
- !api_is_student_boss() &&
- !api_is_platform_admin()
- ) {
- // Check if the user is tutor of the course
- $user_course_status = CourseManager::get_tutor_in_course_status(
- api_get_user_id(),
- api_get_course_int_id()
- );
- // Francois Belisle Kezber...
- // If user is NOT a teacher -> student, but IS the teacher of the course... Won't have the global teacher status
- // and won't be tutor... So have to check is_course_teacher
- if (($user_course_status != 1) && !(CourseManager::is_course_teacher(api_get_user_id(), $course_code))) {
- api_not_allowed(true);
- }
- }
- $htmlHeadXtra[] = '<script>
- function show_image(image,width,height) {
- width = parseInt(width) + 20;
- height = parseInt(height) + 20;
- window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
- }
- </script>';
- $export = isset($_GET['export']) ? $_GET['export'] : false;
- $sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
- $origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
- $studentId = (int) $_GET['student'];
- $coachId = isset($_GET['id_coach']) ? (int) $_GET['id_coach'] : 0;
- // time spent on the course
- $courseInfo = api_get_course_info($course_code);
- if ($export) {
- ob_start();
- }
- $csv_content = [];
- $from_myspace = false;
- if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
- $from_myspace = true;
- $this_section = SECTION_TRACKING;
- } else {
- $this_section = SECTION_COURSES;
- }
- $nameTools = get_lang('Learner details');
- $em = Database::getManager();
- if (isset($_GET['details'])) {
- if ($origin === 'user_course') {
- if (empty($cidReq)) {
- $interbreadcrumb[] = [
- "url" => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'],
- 'name' => $courseInfo['title'],
- ];
- }
- $interbreadcrumb[] = [
- "url" => "../user/user.php?cidReq=".$course_code,
- "name" => get_lang('Users'),
- ];
- } else {
- if ($origin === 'tracking_course') {
- $interbreadcrumb[] = [
- "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(),
- "name" => get_lang('Reporting'),
- ];
- } else {
- if ($origin === 'resume_session') {
- $interbreadcrumb[] = [
- 'url' => "../session/session_list.php",
- "name" => get_lang('Session list'),
- ];
- $interbreadcrumb[] = [
- 'url' => "../session/resume_session.php?id_session=".$sessionId,
- "name" => get_lang('Session overview'),
- ];
- } else {
- $interbreadcrumb[] = [
- "url" => api_is_student_boss() ? "#" : "index.php",
- "name" => get_lang('Reporting'),
- ];
- if (!empty($coachId)) {
- $interbreadcrumb[] = [
- "url" => "student.php?id_coach=$coachId",
- "name" => get_lang('Learners of trainer'),
- ];
- $interbreadcrumb[] = [
- "url" => "myStudents.php?student=$studentId&id_coach=$coachId",
- "name" => get_lang("Learner details"),
- ];
- } else {
- $interbreadcrumb[] = [
- "url" => "student.php",
- "name" => get_lang("My learners"),
- ];
- $interbreadcrumb[] = [
- "url" => "myStudents.php?student=".$studentId,
- "name" => get_lang("Learner details"),
- ];
- }
- }
- }
- }
- $nameTools = get_lang("Learner details in course");
- } else {
- if ($origin == 'resume_session') {
- $interbreadcrumb[] = [
- 'url' => "../session/session_list.php",
- "name" => get_lang('Session list'),
- ];
- if (!empty($sessionId)) {
- $interbreadcrumb[] = [
- 'url' => "../session/resume_session.php?id_session=$sessionId",
- "name" => get_lang('Session overview'),
- ];
- }
- } else {
- $interbreadcrumb[] = [
- "url" => api_is_student_boss() ? "#" : "index.php",
- "name" => get_lang('Reporting'),
- ];
- if (!empty($coachId)) {
- if ($sessionId) {
- $interbreadcrumb[] = [
- "url" => "student.php?id_coach=$coachId&id_session=$sessionId",
- "name" => get_lang("Learners of trainer"),
- ];
- } else {
- $interbreadcrumb[] = [
- "url" => "student.php?id_coach=$coachId",
- "name" => get_lang("Learners of trainer"),
- ];
- }
- } else {
- $interbreadcrumb[] = [
- "url" => "student.php",
- "name" => get_lang("My learners"),
- ];
- }
- }
- }
- // Database Table Definitions
- //$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
- //$tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
- $tbl_user = Database:: get_main_table(TABLE_MAIN_USER);
- $tbl_session_user = Database:: get_main_table(TABLE_MAIN_SESSION_USER);
- $tbl_session = Database:: get_main_table(TABLE_MAIN_SESSION);
- $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_course = Database:: get_main_table(TABLE_MAIN_COURSE);
- $tbl_course_user = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
- $tbl_stats_access = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
- $tbl_stats_exercices = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
- $tbl_stats_exercices_attempts = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
- $tbl_personal_agenda = Database:: get_main_table(TABLE_PERSONAL_AGENDA);
- $tbl_course_lp_item = Database:: get_course_table(TABLE_LP_ITEM);
- $tbl_course_lp_view = 'lp_view';
- $tbl_course_lp_view_item = 'lp_item_view';
- $tbl_course_lp_item = 'lp_item';
- $tbl_course_lp = 'lp';
- $tbl_course_quiz = 'quiz';
- $course_quiz_question = 'quiz_question';
- $course_quiz_rel_question = 'quiz_rel_question';
- $course_quiz_answer = 'quiz_answer';
- $course_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
- $TABLECALHORAIRE = Database:: get_course_table(TABLE_CAL_HORAIRE);
- if (isset($_GET['user_id']) && $_GET['user_id'] != '') {
- $user_id = intval($_GET['user_id']);
- } else {
- $user_id = api_get_user_id();
- }
- // Action behaviour
- $action = isset($_GET['action']) ? $_GET['action'] : '';
- switch ($action) {
- case 'send_legal':
- $subject = get_lang('Legal conditions');
- $content = sprintf(
- get_lang('Please accept our legal conditions here: %s'),
- api_get_path(WEB_PATH)
- );
- MessageManager::send_message_simple($studentId, $subject, $content);
- Display::addFlash(Display::return_message(get_lang('Sent')));
- break;
- case 'delete_legal':
- $extraFieldValue = new ExtraFieldValue('user');
- $value = $extraFieldValue->get_values_by_handler_and_field_variable($studentId, 'legal_accept');
- $result = $extraFieldValue->delete($value['id']);
- if ($result) {
- Display::addFlash(Display::return_message(get_lang('Deleted')));
- }
- break;
- case 'reset_lp':
- $lp_id = isset($_GET['lp_id']) ? (int) $_GET['lp_id'] : '';
- if (api_is_allowed_to_edit() &&
- !empty($lp_id) &&
- !empty($studentId)
- ) {
- Event::delete_student_lp_events(
- $studentId,
- $lp_id,
- $courseInfo,
- $sessionId
- );
- // @todo delete the stats.track_e_exercises records.
- // First implement this http://support.chamilo.org/issues/1334
- $message = Display::return_message(
- get_lang('Learning path was reset for the learner'),
- 'success'
- );
- }
- break;
- default:
- break;
- }
- // user info
- $user_info = api_get_user_info($studentId);
- $courses_in_session = [];
- //See #4676
- $drh_can_access_all_courses = false;
- if (api_is_drh() || api_is_platform_admin() || api_is_student_boss()) {
- $drh_can_access_all_courses = true;
- }
- $courses = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
- $courses_in_session_by_coach = [];
- $sessions_coached_by_user = Tracking::get_sessions_coached_by_user(api_get_user_id());
- // RRHH or session admin
- if (api_is_session_admin() || api_is_drh()) {
- $courses = CourseManager::get_courses_followed_by_drh(api_get_user_id());
- $session_by_session_admin = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
- if (!empty($session_by_session_admin)) {
- foreach ($session_by_session_admin as $session_coached_by_user) {
- $courses_followed_by_coach = Tracking:: get_courses_list_from_session($session_coached_by_user['id']);
- $courses_in_session_by_coach[$session_coached_by_user['id']] = $courses_followed_by_coach;
- }
- }
- }
- // Teacher or admin
- if (!empty($sessions_coached_by_user)) {
- foreach ($sessions_coached_by_user as $session_coached_by_user) {
- $sid = (int) $session_coached_by_user['id'];
- $courses_followed_by_coach = Tracking::get_courses_followed_by_coach(api_get_user_id(), $sid);
- $courses_in_session_by_coach[$sid] = $courses_followed_by_coach;
- }
- }
- $sql = "SELECT c_id
- FROM $tbl_course_user
- WHERE
- relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
- user_id = ".intval($user_info['user_id']);
- $rs = Database::query($sql);
- while ($row = Database:: fetch_array($rs)) {
- if ($drh_can_access_all_courses) {
- $courses_in_session[0][] = $row['c_id'];
- } else {
- if (isset($courses[$row['c_id']])) {
- $courses_in_session[0][] = $row['c_id'];
- }
- }
- }
- // Get the list of sessions where the user is subscribed as student
- $sql = 'SELECT session_id, c_id
- FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
- WHERE user_id='.intval($user_info['user_id']);
- $rs = Database::query($sql);
- $tmp_sessions = [];
- while ($row = Database:: fetch_array($rs, 'ASSOC')) {
- $tmp_sessions[] = $row['session_id'];
- if ($drh_can_access_all_courses) {
- if (in_array($row['session_id'], $tmp_sessions)) {
- $courses_in_session[$row['session_id']][] = $row['c_id'];
- }
- } else {
- if (isset($courses_in_session_by_coach[$row['session_id']])) {
- if (in_array($row['session_id'], $tmp_sessions)) {
- $courses_in_session[$row['session_id']][] = $row['c_id'];
- }
- }
- }
- }
- $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
- api_get_user_id(),
- api_get_course_info()
- );
- if (api_is_drh() && !api_is_platform_admin()) {
- if (!empty($studentId)) {
- if (!api_drh_can_access_all_session_content()) {
- if (!($isDrhOfCourse)) {
- if (api_is_drh() &&
- !UserManager::is_user_followed_by_drh($studentId, api_get_user_id())
- ) {
- api_not_allowed(true);
- }
- }
- }
- }
- }
- Display::display_header($nameTools);
- if (isset($message)) {
- echo $message;
- }
- $token = Security::get_token();
- if (!empty($studentId)) {
- // Detail bar
- echo '<div class="actions">';
- echo '<a href="javascript: window.history.go(-1);">'.
- Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
- echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
- Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
- echo '<a href="'.api_get_self().'?'.Security:: remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'.
- Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a> ';
- echo '<a href="'.api_get_self().'?'.Security:: remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'.
- Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a> ';
- if (!empty($user_info['email'])) {
- $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
- Display:: return_icon('mail_send.png', get_lang('Send mail'), '', ICON_SIZE_MEDIUM).'</a>';
- } else {
- $send_mail = Display:: return_icon('mail_send_na.png', get_lang('Send mail'), '', ICON_SIZE_MEDIUM);
- }
- echo $send_mail;
- if (!empty($studentId) && !empty($course_code)) {
- // Only show link to connection details if course and student were defined in the URL
- echo '<a href="access_details.php?student='.$studentId.'&course='.$course_code.'&origin='.$origin.'&cidReq='.$course_code.'&id_session='.$sessionId.'">'.
- Display:: return_icon('statistics.png', get_lang('Access details'), '', ICON_SIZE_MEDIUM).'</a>';
- }
- if (api_can_login_as($studentId)) {
- echo '<a href="'.api_get_path(
- WEB_CODE_PATH
- ).'admin/user_list.php?action=login_as&user_id='.$studentId.'&sec_token='.$token.'">'.
- Display::return_icon('login_as.png', get_lang('Login as'), null, ICON_SIZE_MEDIUM).'</a> ';
- }
- echo Display::url(
- Display::return_icon('skill-badges.png', get_lang('Assign skill'), null, ICON_SIZE_MEDIUM),
- api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $studentId])
- );
- echo '</div>';
- // is the user online ?
- if (user_is_online($studentId)) {
- $online = get_lang('Yes');
- } else {
- $online = get_lang('No');
- }
- // get average of score and average of progress by student
- $avg_student_progress = $avg_student_score = 0;
- 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,
- [],
- $sessionId
- );
- // the score inside the Reporting table
- $avg_student_score = Tracking::get_avg_student_score(
- $user_info['user_id'],
- $course_code,
- [],
- $sessionId
- );
- }
- $avg_student_progress = round($avg_student_progress, 2);
- $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('No connection');
- }
- $last_connection_date = Tracking:: get_last_connection_date($user_info['user_id'], true);
- if ($last_connection_date == '') {
- $last_connection_date = get_lang('No connection');
- }
- // cvs information
- $csv_content[] = [
- get_lang('Information'),
- ];
- $csv_content[] = [
- get_lang('Name'),
- get_lang('e-mail'),
- get_lang('Tel'),
- ];
- $csv_content[] = [
- $user_info['complete_name'],
- $user_info['email'],
- $user_info['phone'],
- ];
- $csv_content[] = [];
- // csv tracking
- $csv_content[] = [
- get_lang('Reporting'),
- ];
- $csv_content[] = [
- get_lang('First login in platform'),
- get_lang('Latest login in platform'),
- get_lang('Time spent in the course'),
- get_lang('Progress'),
- get_lang('Score'),
- ];
- $csv_content[] = [
- strip_tags($first_connection_date),
- strip_tags($last_connection_date),
- $time_spent_on_the_course,
- $avg_student_progress.'%',
- $avg_student_score,
- ];
- $coachs_name = '';
- $session_name = '';
- $table_title = Display::return_icon(
- 'user.png',
- get_lang('User'),
- [],
- ICON_SIZE_SMALL
- ).$user_info['complete_name'];
- echo Display::page_subheader($table_title);
- $userPicture = UserManager::getUserPicture($user_info['user_id']);
- $userGroupManager = new UserGroup();
- $userGroups = $userGroupManager->getNameListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS); ?>
- <img src="<?php echo $userPicture; ?>">
- <div class="row">
- <div class="col-sm-6">
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th><?php echo get_lang('Information'); ?></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><?php echo get_lang('Name').' : '.$user_info['complete_name']; ?></td>
- </tr>
- <tr>
- <td><?php echo get_lang('e-mail').' : ';
- if (!empty($user_info['email'])) {
- echo '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>';
- } else {
- echo get_lang('Noe-mail');
- } ?>
- </td>
- </tr>
- <tr>
- <td> <?php echo get_lang('Tel').' : ';
- if (!empty($user_info['phone'])) {
- echo $user_info['phone'];
- } else {
- echo get_lang('No tel');
- } ?>
- </td>
- </tr>
- <tr>
- <td><?php echo get_lang('Code').' : ';
- if (!empty($user_info['official_code'])) {
- echo $user_info['official_code'];
- } else {
- echo get_lang('NoCode');
- } ?>
- </td>
- </tr>
- <tr>
- <td><?php echo get_lang('Online').' : '.$online; ?> </td>
- </tr>
- <?php
- // Display timezone if the user selected one and if the admin allows the use of user's timezone
- $timezone = null;
- $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'], 'timezone');
- $use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
- if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
- $timezone = $timezone_user['timezone'];
- }
- if ($timezone !== null) {
- ?>
- <tr>
- <td> <?php echo get_lang('Timezone').' : '.$timezone; ?> </td>
- </tr>
- <?php
- } ?>
- </tbody>
- </table>
- </div>
- <div class="col-sm-6">
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th colspan="2" class="text-center"><?php echo get_lang('Reporting'); ?></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td align="right"><?php echo get_lang('First login in platform'); ?></td>
- <td align="left"><?php echo $first_connection_date; ?></td>
- </tr>
- <tr>
- <td align="right"><?php echo get_lang('Latest login in platform'); ?></td>
- <td align="left"><?php echo $last_connection_date; ?></td>
- </tr>
- <?php if (isset($_GET['details']) && $_GET['details'] == 'true') {
- ?>
- <tr>
- <td align="right"><?php echo get_lang('Time spent in the course'); ?></td>
- <td align="left"><?php echo $time_spent_on_the_course; ?></td>
- </tr>
- <tr>
- <td align="right">
- <?php
- echo get_lang('Progress').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Average progress in courses'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </td>
- <td align="left"><?php echo $avg_student_progress.'%'; ?></td>
- </tr>
- <tr>
- <td align="right">
- <?php
- echo get_lang('Score').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Average of tests in Learning Paths'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </td>
- <td align="left"><?php
- if (is_numeric($avg_student_score)) {
- echo $avg_student_score.'%';
- } else {
- echo $avg_student_score;
- } ?>
- </td>
- </tr>
- <?php
- }
- if (api_get_setting('allow_terms_conditions') === 'true') {
- $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $studentId);
- if ($isBoss || api_is_platform_admin()) {
- $extraFieldValue = new ExtraFieldValue('user');
- $value = $extraFieldValue->get_values_by_handler_and_field_variable(
- $studentId,
- 'legal_accept'
- );
- $icon = Display::return_icon('accept_na.png');
- if (isset($value['value'])) {
- list($legalId, $legalLanguageId, $legalTime) = explode(':', $value['value']);
- $icon = Display::return_icon('accept.png').' '.api_get_local_time($legalTime);
- $icon .= ' '.Display::url(
- get_lang('Delete legal agreement'),
- api_get_self().'?action=delete_legal&student='.$studentId.'&course='.$course_code,
- ['class' => 'btn btn-danger btn-xs']
- );
- } else {
- $icon .= ' '.Display::url(
- get_lang('Send legal agreement'),
- api_get_self().'?action=send_legal&student='.$studentId.'&course='.$course_code,
- ['class' => 'btn btn-primary btn-xs']
- );
- }
- echo '<tr>
- <td align="right">';
- echo get_lang('Legal accepted').' </td> <td align="left">'.$icon;
- echo '</td></tr>';
- }
- } ?>
- </tbody>
- </table>
- <?php if (!empty($userGroups)) {
- ?>
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th><?php echo get_lang('Classes'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($userGroups as $class) {
- ?>
- <tr>
- <td><?php echo $class; ?></td>
- </tr>
- <?php
- } ?>
- </tbody>
- </table>
- <?php
- } ?>
- </div>
- </div>
- <?php
- if (empty($_GET['details'])) {
- $csv_content[] = [];
- $csv_content[] = [
- get_lang('Session'),
- get_lang('Course'),
- get_lang('Time'),
- get_lang('Progress'),
- get_lang('Score'),
- get_lang('Not attended'),
- get_lang('Evaluations'),
- ];
- $attendance = new Attendance();
- foreach ($courses_in_session as $sId => $courses) {
- $session_name = '';
- $access_start_date = '';
- $access_end_date = '';
- $date_session = '';
- $title = Display::return_icon('course.png', get_lang('Courses'), [], ICON_SIZE_SMALL).' '.get_lang('Courses');
- $session_info = api_get_session_info($sId);
- if ($session_info) {
- $session_name = $session_info['name'];
- if (!empty($session_info['access_start_date'])) {
- $access_start_date = api_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
- }
- if (!empty($session_info['access_end_date'])) {
- $access_end_date = api_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
- }
- if (!empty($access_start_date) && !empty($access_end_date)) {
- $date_session = get_lang('From').' '.$access_start_date.' '.get_lang('Until').' '.$access_end_date;
- }
- $title = Display::return_icon(
- 'session.png',
- get_lang('Session'),
- [],
- ICON_SIZE_SMALL
- ).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
- }
- // Courses
- echo '<h3>'.$title.'</h3>';
- echo '<div class="table-responsive">';
- echo '<table class="table table-striped table-hover courses-tracking">';
- echo '<thead>';
- echo '<tr>
- <th>'.get_lang('Course').'</th>
- <th>'.get_lang('Time').'</th>
- <th>'.get_lang('Progress').'</th>
- <th>'.get_lang('Score').'</th>
- <th>'.get_lang('Not attended').'</th>
- <th>'.get_lang('Evaluations').'</th>
- <th>'.get_lang('Details').'</th>
- </tr>';
- echo '</thead>';
- echo '<tbody>';
- if (!empty($courses)) {
- foreach ($courses as $courseId) {
- $courseInfoItem = api_get_course_info_by_id($courseId);
- $courseId = $courseInfoItem['real_id'];
- $courseCodeItem = $courseInfoItem['code'];
- if (CourseManager:: is_user_subscribed_in_course($studentId, $courseCodeItem, true)) {
- $time_spent_on_course = api_time_to_hms(
- Tracking:: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sId)
- );
- // get average of faults in attendances by student
- $results_faults_avg = $attendance->get_faults_average_by_course(
- $studentId,
- $courseCodeItem,
- $sId
- );
- if (!empty($results_faults_avg['total'])) {
- if (api_is_drh()) {
- $attendances_faults_avg =
- '<a title="'.get_lang('Go to attendances').'" href="'.api_get_path(
- WEB_CODE_PATH
- ).'attendance/index.php?cidReq='.$courseCodeItem.'&id_session='.$sId.'&student_id='.$studentId.'">'.
- $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
- } else {
- $attendances_faults_avg =
- $results_faults_avg['faults'].'/'.
- $results_faults_avg['total'].
- ' ('.$results_faults_avg['porcent'].'%)';
- }
- } else {
- $attendances_faults_avg = '0/0 (0%)';
- }
- // Get evaluations by student
- $cats = Category::load(null, null, $courseCodeItem, null, null, $sId);
- $scoretotal = [];
- if (isset($cats) && isset($cats[0])) {
- if (!empty($sId)) {
- $scoretotal = $cats[0]->calc_score($studentId, null, $courseCodeItem, $sId);
- } else {
- $scoretotal = $cats[0]->calc_score($studentId, null, $courseCodeItem);
- }
- }
- $scoretotal_display = '0/0 (0%)';
- if (!empty($scoretotal) && !empty($scoretotal[1])) {
- $scoretotal_display =
- round($scoretotal[0], 1).'/'.
- round($scoretotal[1], 1).
- ' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
- }
- $progress = Tracking::get_avg_student_progress(
- $user_info['user_id'],
- $courseCodeItem,
- null,
- $sId
- );
- $score = Tracking:: get_avg_student_score($user_info['user_id'], $courseCodeItem, [], $sId);
- $progress = empty($progress) ? '0%' : $progress.'%';
- $score = empty($score) ? '0%' : $score.'%';
- $csv_content[] = [
- $session_name,
- $courseInfoItem['title'],
- $time_spent_on_course,
- $progress,
- $score,
- $attendances_faults_avg,
- $scoretotal_display,
- ];
- echo '<tr>
- <td ><a href="'.$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'.
- $courseInfoItem['title'].'</a></td>
- <td >'.$time_spent_on_course.'</td>
- <td >'.$progress.'</td>
- <td >'.$score.'</td>
- <td >'.$attendances_faults_avg.'</td>
- <td >'.$scoretotal_display.'</td>';
- if (!empty($coachId)) {
- echo '<td width="10"><a href="'.api_get_self().
- '?student='.$user_info['user_id'].'&details=true&course='.$courseInfoItem['code'].'&id_coach='.$coachId.
- '&origin='.$origin.'&id_session='.$sId.'#infosStudent">
- '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a></td>';
- } else {
- echo '<td width="10"><a href="'.api_get_self(
- ).'?student='.$user_info['user_id'].'&details=true&course='.$courseInfoItem['code'].'&origin='.$origin.'&id_session='.$sId.'#infosStudent">
- '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a></td>';
- }
- echo '</tr>';
- }
- }
- } else {
- echo "<tr><td colspan='5'>".get_lang('This course could not be found')."</td></tr>";
- }
- echo '</tbody>';
- echo '</table>';
- echo '</div>';
- }
- } else {
- if ($user_info['status'] != INVITEE) {
- $csv_content[] = [];
- $csv_content[] = [str_replace(' ', '', $table_title)];
- $t_lp = Database:: get_course_table(TABLE_LP_MAIN);
- // csv export headers
- $csv_content[] = [];
- $csv_content[] = [
- get_lang('Courses'),
- get_lang('Time'),
- get_lang('Average score'),
- get_lang('Latest attemptAverage score'),
- get_lang('Progress'),
- get_lang('Latest login'),
- ];
- $query = $em
- ->createQuery(
- '
- SELECT lp FROM ChamiloCourseBundle:CLp lp
- WHERE lp.sessionId = :session AND lp.cId = :course
- ORDER BY lp.displayOrder ASC
- '
- );
- if (empty($sessionId)) {
- $query->setParameters(
- [
- 'session' => 0,
- 'course' => $courseInfo['real_id'],
- ]
- );
- } else {
- $query->setParameters(
- [
- 'session' => $sessionId,
- 'course' => $courseInfo['real_id'],
- ]
- );
- }
- $rs_lp = $query->getResult();
- if (count($rs_lp) > 0) {
- ?>
- <!-- LPs-->
- <div class="table-responsive">
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th><?php echo get_lang('Learning paths'); ?></th>
- <th>
- <?php
- echo get_lang('Time').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Total time in course'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </th>
- <th>
- <?php
- echo get_lang('Average score').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Average is calculated based on all test attempts'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </th>
- <th><?php
- echo get_lang('Latest attemptAverage score').' ';
- Display::display_icon(
- 'info3.gif',
- get_lang('Average is calculated based on the latest attempts'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </th>
- <th><?php
- echo get_lang('Progress').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('% of learning objects visited'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </th>
- <th><?php
- echo get_lang('Latest login').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Last time learner entered the course'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?>
- </th>
- <?php
- echo '<th>'.get_lang('Details').'</th>';
- if (api_is_allowed_to_edit()) {
- echo '<th>'.get_lang('Reset Learning path').'</th>';
- } ?>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 0;
- foreach ($rs_lp as $learnpath) {
- $lp_id = $learnpath->getId();
- $lp_name = $learnpath->getName();
- $any_result = false;
- // Get progress in lp
- $progress = Tracking::get_avg_student_progress(
- $studentId,
- $course_code,
- [$lp_id],
- $sessionId
- );
- if ($progress === null) {
- $progress = '0%';
- } else {
- $any_result = true;
- }
- // Get time in lp
- $total_time = Tracking::get_time_spent_in_lp(
- $studentId,
- $course_code,
- [$lp_id],
- $sessionId
- );
- if (!empty($total_time)) {
- $any_result = true;
- }
- // Get last connection time in lp
- $start_time = Tracking::get_last_connection_time_in_lp(
- $studentId,
- $course_code,
- $lp_id,
- $sessionId
- );
- if (!empty($start_time)) {
- $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
- } else {
- $start_time = '-';
- }
- if (!empty($total_time)) {
- $any_result = true;
- }
- // Quiz in lp
- $score = Tracking::get_avg_student_score(
- $studentId,
- $course_code,
- [$lp_id],
- $sessionId
- );
- // Latest exercise results in a LP
- $score_latest = Tracking:: get_avg_student_score(
- $studentId,
- $course_code,
- [$lp_id],
- $sessionId,
- false,
- true
- );
- if ($i % 2 == 0) {
- $css_class = "row_even";
- } else {
- $css_class = "row_odd";
- }
- $i++;
- // csv export content
- $csv_content[] = [
- api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
- api_time_to_hms($total_time),
- $score.'%',
- $score_latest.'%',
- $progress.'%',
- $start_time,
- ];
- echo '<tr class="'.$css_class.'">';
- echo Display::tag('td', stripslashes($lp_name));
- echo Display::tag('td', api_time_to_hms($total_time));
- if (!is_null($score)) {
- if (is_numeric($score)) {
- $score = $score.'%';
- }
- }
- echo Display::tag('td', $score);
- if (!is_null($score_latest)) {
- if (is_numeric($score_latest)) {
- $score_latest = $score_latest.'%';
- }
- }
- echo Display::tag('td', $score_latest);
- if (is_numeric($progress)) {
- $progress = $progress.'%';
- } else {
- $progress = '-';
- }
- echo Display::tag('td', $progress);
- // Do not change with api_convert_and_format_date, because
- // this value came from the lp_item_view table
- // which implies several other changes not a priority right now
- echo Display::tag('td', $start_time);
- if ($any_result === true) {
- $from = '';
- if ($from_myspace) {
- $from = '&from=myspace';
- }
- $link = Display::url(
- Display::return_icon('2rightarrow.png', get_lang('Details')),
- 'lp_tracking.php?cidReq='.$course_code.'&course='.$course_code.$from.'&origin='.$origin.'&lp_id='.$learnpath->getId(
- ).'&student_id='.$user_info['user_id'].'&id_session='.$sessionId
- );
- echo Display::tag('td', $link);
- }
- if (api_is_allowed_to_edit()) {
- echo '<td>';
- if ($any_result === true) {
- echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.
- '&cidReq='.$course_code.
- '&course='.$course_code.
- '&details='.Security::remove_XSS($_GET['details']).
- '&origin='.$origin.
- '&lp_id='.$learnpath->getId().
- '&student='.$user_info['user_id'].
- '&details=true&id_session='.$sessionId.'">';
- echo Display::return_icon(
- 'clean.png',
- get_lang('Clean'),
- '',
- ICON_SIZE_SMALL
- ).'</a>';
- echo '</a>';
- }
- echo '</td>';
- echo '</tr>';
- }
- $data_learnpath[$i][] = $lp_name;
- $data_learnpath[$i][] = $progress.'%';
- } ?>
- </tbody>
- </table>
- </div>
- <?php
- }
- } ?>
- <!-- line about exercises -->
- <?php if ($user_info['status'] != INVITEE) {
- ?>
- <div class="table-responsive">
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th><?php echo get_lang('Tests'); ?></th>
- <th><?php echo get_lang('Learning paths'); ?></th>
- <th><?php echo get_lang('Average score in learning paths').' '.Display:: return_icon(
- 'info3.gif',
- get_lang('Average score'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <th><?php echo get_lang('Attempts'); ?></th>
- <th><?php echo get_lang('Latest attempt'); ?></th>
- <th><?php echo get_lang('All attempts'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- $csv_content[] = [];
- $csv_content[] = [
- get_lang('Tests'),
- get_lang('Learning paths'),
- get_lang('Average score in learning paths'),
- get_lang('Attempts'),
- ];
- $t_quiz = Database:: get_course_table(TABLE_QUIZ_TEST);
- $sessionCondition = api_get_session_condition(
- $sessionId,
- true,
- true,
- 'quiz.session_id'
- );
- $sql = "SELECT quiz.title, id FROM $t_quiz AS quiz
- WHERE
- quiz.c_id = ".$courseInfo['real_id']." AND
- active IN (0, 1)
- $sessionCondition
- ORDER BY quiz.title ASC ";
- $result_exercices = Database::query($sql);
- $i = 0;
- if (Database:: num_rows($result_exercices) > 0) {
- while ($exercices = Database:: fetch_array($result_exercices)) {
- $exercise_id = intval($exercices['id']);
- $count_attempts = Tracking::count_student_exercise_attempts(
- $studentId,
- $courseInfo['real_id'],
- $exercise_id,
- 0,
- 0,
- $sessionId,
- 2
- );
- $score_percentage = Tracking::get_avg_student_exercise_score(
- $studentId,
- $course_code,
- $exercise_id,
- $sessionId,
- 1,
- 0
- );
- if (!isset($score_percentage) && $count_attempts > 0) {
- $scores_lp = Tracking::get_avg_student_exercise_score(
- $studentId,
- $course_code,
- $exercise_id,
- $sessionId,
- 2,
- 1
- );
- $score_percentage = $scores_lp[0];
- $lp_name = $scores_lp[1];
- } else {
- $lp_name = '-';
- }
- $lp_name = !empty($lp_name) ? $lp_name : get_lang('This course could not be founds');
- if ($i % 2) {
- $css_class = 'row_odd';
- } else {
- $css_class = 'row_even';
- }
- echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
- echo '<td>';
- if (!empty($lp_name)) {
- echo $lp_name;
- } else {
- echo '-';
- }
- echo '</td>';
- echo '<td>';
- if ($count_attempts > 0) {
- echo $score_percentage.'%';
- } else {
- echo '-';
- $score_percentage = 0;
- }
- echo '</td>';
- echo '<td>'.$count_attempts.'</td>';
- echo '<td>';
- $sql = "SELECT exe_id FROM $tbl_stats_exercices
- WHERE
- exe_exo_id = $exercise_id AND
- exe_user_id = $studentId AND
- c_id = ".$courseInfo['real_id']." AND
- session_id = $sessionId AND
- status = ''
- ORDER BY exe_date DESC
- LIMIT 1";
- $result_last_attempt = Database::query($sql);
- if (Database:: num_rows($result_last_attempt) > 0) {
- $id_last_attempt = Database:: result($result_last_attempt, 0, 0);
- if ($count_attempts > 0) {
- echo '<a href="../exercise/exercise_show.php?id='.$id_last_attempt.
- '&cidReq='.$course_code.
- '&session_id='.$sessionId.
- '&student='.$studentId.
- '&origin='.(empty($origin) ? 'tracking' : $origin).
- '">';
- echo Display::return_icon('quiz.gif');
- echo '</a>';
- }
- }
- echo '</td>';
- echo '<td>';
- $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$studentId&id_session=$sessionId";
- echo Display::url(
- Display::return_icon(
- 'test_results.png',
- get_lang('All attempts'),
- [],
- ICON_SIZE_SMALL
- ),
- $all_attempt_url
- );
- echo '</td></tr>';
- $data_exercices[$i][] = $exercices['title'];
- $data_exercices[$i][] = $score_percentage.'%';
- $data_exercices[$i][] = $count_attempts;
- $csv_content[] = [
- $exercices['title'],
- $lp_name,
- $score_percentage,
- $count_attempts,
- ];
- $i++;
- }
- } else {
- echo '<tr><td colspan="6">'.get_lang('No tests').'</td></tr>';
- } ?>
- </tbody>
- </table>
- </div>
- <?php
- }
- // @when using sessions we do not show the survey list
- if (empty($sessionId)) {
- $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
- $survey_data = [];
- foreach ($survey_list as $survey) {
- $user_list = SurveyManager::get_people_who_filled_survey(
- $survey['survey_id'],
- false,
- $courseInfo['real_id']
- );
- $survey_done = Display::return_icon("accept_na.png", get_lang('There is no answer for the moment'), [], ICON_SIZE_SMALL);
- if (in_array($studentId, $user_list)) {
- $survey_done = Display::return_icon("accept.png", get_lang('Answered'), [], ICON_SIZE_SMALL);
- }
- $data = ['title' => $survey['title'], 'done' => $survey_done];
- $survey_data[] = $data;
- }
- if (!empty($survey_list)) {
- $table = new HTML_Table(['class' => 'data_table']);
- $header_names = [get_lang('Survey'), get_lang('Answered')];
- $row = 0;
- $column = 0;
- foreach ($header_names as $item) {
- $table->setHeaderContents($row, $column, $item);
- $column++;
- }
- $row = 1;
- if (!empty($survey_data)) {
- foreach ($survey_data as $data) {
- $column = 0;
- $table->setCellContents($row, $column, $data);
- $class = 'class="row_odd"';
- if ($row % 2) {
- $class = 'class="row_even"';
- }
- $table->setRowAttributes($row, $class, true);
- $column++;
- $row++;
- }
- }
- echo $table->toHtml();
- }
- }
- // line about other tools?>
- <div class="table-responsive">
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th colspan="2"><?php echo get_lang('OTI (Online Training Interaction) settings report'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- $csv_content[] = [];
- $nb_assignments = Tracking::count_student_assignments($studentId, $course_code, $sessionId);
- $messages = Tracking::count_student_messages($studentId, $course_code, $sessionId);
- $links = Tracking::count_student_visited_links($studentId, $courseInfo['real_id'], $sessionId);
- $chat_last_connection = Tracking::chat_last_connection($studentId, $courseInfo['real_id'], $sessionId);
- $documents = Tracking::count_student_downloaded_documents(
- $studentId,
- $courseInfo['real_id'],
- $sessionId
- );
- $uploaded_documents = Tracking::count_student_uploaded_documents($studentId, $course_code, $sessionId);
- $csv_content[] = [
- get_lang('OTI (Online Training Interaction) settings report'),
- ];
- $csv_content[] = [
- get_lang('Assignments'),
- $nb_assignments,
- ];
- $csv_content[] = [
- get_lang('Messages'),
- $messages,
- ];
- $csv_content[] = [
- get_lang('Links accessed'),
- $links,
- ];
- $csv_content[] = [
- get_lang('Documents downloaded'),
- $documents,
- ];
- $csv_content[] = [
- get_lang('Uploaded documents'),
- $uploaded_documents,
- ];
- $csv_content[] = [
- get_lang('Latest chat connection'),
- $chat_last_connection,
- ]; ?>
- <tr><!-- assignments -->
- <td width="40%"><?php echo get_lang('Assignments'); ?></td>
- <td><?php echo $nb_assignments; ?></td>
- </tr>
- <tr><!-- messages -->
- <td><?php echo get_lang('Forum').' - '.get_lang('Number of posts for this user'); ?></td>
- <td><?php echo $messages; ?></td>
- </tr>
- <tr><!-- links -->
- <td><?php echo get_lang('Links accessed'); ?></td>
- <td><?php echo $links; ?></td>
- </tr>
- <tr><!-- downloaded documents -->
- <td><?php echo get_lang('Documents downloaded'); ?></td>
- <td><?php echo $documents; ?></td>
- </tr>
- <tr><!-- uploaded documents -->
- <td><?php echo get_lang('Uploaded documents'); ?></td>
- <td><?php echo $uploaded_documents; ?></td>
- </tr>
- <tr><!-- Chats -->
- <td><?php echo get_lang('Latest chat connection'); ?></td>
- <td><?php echo $chat_last_connection; ?></td>
- </tr>
- </tbody>
- </table>
- </div>
- <?php
- } //end details
- echo Tracking::displayUserSkills(
- $user_info['user_id'],
- $courseInfo ? $courseInfo['real_id'] : 0,
- $sessionId
- );
- }
- if ($export) {
- ob_end_clean();
- switch ($export) {
- case 'csv':
- Export::arrayToCsv($csv_content, 'reporting_student');
- break;
- case 'xls':
- Export::arrayToXls($csv_content, 'reporting_student');
- break;
- }
- exit;
- }
- //Adding AB stuff 2016-12-14 CEMEQ
- $TABLECALHORAIRE = 'c_cal_horaire';
- $coursesList = [];
- //On cherche le calendrier pour ce user dans ce cours, groupe
- $sql = "SELECT * FROM user WHERE user_id = $studentId";
- $result = Database::query($sql);
- $horaire_id = Database::fetch_array($result);
- $nom_hor = $horaire_id['official_code'];
- $course_code_real = $_course['real_id'];
- //avec le nom d'horaire= official code, on trouve le nombre de jour a faire
- $sql = "SELECT * FROM $TABLECALHORAIRE
- where
- name = '$nom_hor' and
- c_id = $course_code_real ";
- $res = Database::query($sql);
- $resulta = Database::fetch_array($res);
- $num_hours = $resulta['num_hours'];
- $num_minute = $resulta['num_minute'];
- if ($num_minute == '0') {
- $num_minute = '1';
- }
- $minute_mod = $num_hours * 60;
- $num_days = 0;
- if (!empty($num_minute)) {
- $num_days = $minute_mod / $num_minute;
- }
- // affichage des jours complétés dans les parcours l'élève
- //on recherche les cours où sont inscrit les user
- $sql2 = "SELECT c_id, user_id FROM course_rel_user WHERE user_id = $studentId";
- $result2 = Database::query($sql2);
- $Total = 0;
- while ($a_courses = Database::fetch_array($result2)) {
- $Courses_code = $a_courses['c_id'];
- //on sort le c_id avec le code du cours
- $sql8 = "SELECT * FROM course WHERE code = '$Courses_code'
- ";
- $result8 = Database::query($sql8);
- $course_code_id = Database::fetch_array($result8);
- $c_id = $Courses_code;
- // pours chaque cours dans lequel il est inscrit, on cherche les jours complétés
- $Req1 = "SELECT * FROM c_lp_view
- WHERE user_id = $studentId AND c_id = $c_id";
- $res = Database::query($Req1);
- while ($result = Database::fetch_array($res)) {
- $lp_id = $result['lp_id'];
- $lp_id_view = $result['id'];
- $c_id_view = $result['c_id'];
- $Req2 = "SELECT id, lp_id ,title ,item_type
- FROM c_lp_item
- WHERE lp_id = $lp_id
- AND title LIKE '(+)%'
- AND c_id = $c_id_view
- AND item_type = 'document'
- ";
- $res2 = Database::query($Req2);
- while ($resulta = Database::fetch_array($res2)) {
- $lp_item_id = $resulta['id'];
- $Req3 = "SELECT MAX(id)
- FROM c_lp_item_view
- WHERE
- lp_item_id = $lp_item_id AND
- lp_view_id = $lp_id_view AND
- c_id = $c_id_view AND
- status = 'completed'
- ";
- $res3 = Database::query($Req3);
- while ($resul = Database::fetch_array($res3)) {
- $max = $resul['0'];
- $Req4 = "SELECT COUNT( id )
- FROM c_lp_item_view
- WHERE
- id = $max AND
- c_id = $c_id_view";
- $res4 = Database::query($Req4);
- while ($resultat = Database::fetch_array($res4)) {
- $Total = $Total + $resultat[0];
- }
- }
- }
- }
- }
- api_display_tool_title($nameTools);
- $tbl_personal_agenda = Database:: get_main_table(TABLE_PERSONAL_AGENDA);
- $now = date('Y-m-d');
- //on compte le nombre de m% dans l'agenda pour chaque module
- $sqljtot = "SELECT COUNT( * ) AS TOT
- FROM $tbl_personal_agenda
- WHERE user = $studentId
- And title like 'm%'";
- $resultjt = Database::query($sqljtot);
- $jour_realise = 0;
- while ($jtot = Database::fetch_array($resultjt)) {
- $jour_realise_tot = ($jour_realise + $jtot['TOT']) / 2;
- }
- //fin des jour de l'agenda
- //recherche du jour inséré dans agenda par le calendrier
- $jour_agenda = '';
- $tour = -1;
- while ($jour_agenda == '') {
- $tour++;
- $date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $tour, date("Y")));
- $sql4 = "SELECT * FROM $tbl_personal_agenda
- WHERE
- user = $studentId AND
- text='Pour le calendrier, ne pas effacer' AND
- date like '".$date." %:%' ";
- $result4 = Database::query($sql4);
- $res4 = Database::fetch_array($result4);
- $jour_agenda = $res4['title'];
- if ($tour > 300) {
- break;
- }
- }
- $diff = $jour_agenda - $Total;
- if ($diff > 0) {
- $sing = get_lang('retard');
- } else {
- $sing = get_lang('avance');
- }
- $diff = abs($diff);
- //pour trouver la date de fin de sa formation, on ajoute les retard (%diff) au nombre de jours total de la formation et
- //on regarde dans son agenda pour cette valeur qui donne ainsi la date
- $diff2 = $jour_agenda - $Total;
- $goto = $num_days + $diff2;
- $goto = number_format($goto);
- $sqlgo = "SELECT * FROM $tbl_personal_agenda
- WHERE user = $studentId
- AND title = '".$goto."'
- ";
- $result7 = Database::query($sqlgo);
- $res7 = Database::fetch_array($result7);
- $end_dates = $res7['date'];
- $end_date = date("Y-m-d", strtotime($end_dates));
- if ($end_date < '2010-01-01') {
- $end_date = get_lang('hors_cal');
- }
- ?>
- <table class="data_table">
- <th rowspan="6">
- <?php
- //on récupere les points de controle de l'élève
- /*$pt[] = '0';
- $pt[] = '0';
- $sqlcontrole = "SELECT diff
- FROM $tbl_stats_exercices
- WHERE exe_user_id = ".$studentId."
- AND diff != ''
- ORDER BY exe_date ASC
- ";
- $result = Database::query($sqlcontrole);
- while ($ptctl = Database::fetch_array($result)) {
- $pt[] = $ptctl ['diff'];
- }
- //graphique de suivi
- include "../inc/teechartphp/sources/TChart.php";
- $chart = new TChart(500, 300);
- $chart->getAspect()->setView3D(false);
- $chart->getHeader()->setText("Graphique de suivi");
- $chart->getAxes()->getLeft()->setMinimumOffset(10);
- $chart->getAxes()->getLeft()->setMaximumOffset(10);
- $chart->getAxes()->getBottom()->setMinimumOffset(10);
- $chart->getAxes()->getBottom()->setMaximumOffset(10);
- $line1 = new Line($chart->getChart());
- $data = $pt;
- $line1->addArray($data);
- foreach ($chart->getSeries() as $serie) {
- $pointer = $serie->getPointer();
- $pointer->setVisible(true);
- $pointer->getPen()->setVisible(false);
- $pointer->setHorizSize(2);
- $pointer->setVertSize(2);
- $marks = $serie->getMarks();
- $marks->setVisible(true);
- $marks->setArrowLength(5);
- $marks->getArrow()->setVisible(false);
- $marks->setTransparent(true);
- }
- $x = $student_id;
- $line1->getPointer()->setStyle(PointerStyle::$CIRCLE);
- $chart->getLegend()->setVisible(false);
- $chart->render("../garbage/$x-image.png");
- $rand = rand();
- print '<img src="../garbage/'.$x.'-image.png?rand='.$rand.'">';
- */
- ?>
- <tr>
- <th align="left" width="412">
- <?php echo get_lang('Cumulatif_agenda'); ?>: <b><font
- color=#CC0000> <?php echo $jour_realise_tot; ?></font></b></p>
- </th>
- </tr>
- <tr>
- <th align="left">
- <?php echo get_lang('Cumulatif'); ?> <b><font color=#CC0000> <?php echo $Total; ?></font></b></p>
- </th>
- </tr>
- <tr>
- <th align="left">
- <?php echo get_lang('jours_selon_horaire'); ?>: <b><font
- color=#CC0000> <?php echo $jour_agenda; ?><?php echo $Days; ?></font></b></p>
- </th>
- </tr>
- <tr>
- <th align="left">
- <?php echo get_lang('dif2'); ?>: <b><font
- color=#CC0000> <?php echo $diff; ?><?php echo $Days, $sing; ?></font></b></p>
- </th>
- </tr>
- <tr>
- <th align="left">
- <?php echo get_lang('date_fin'); ?>: <b><font color=#CC0000> <?php echo $end_date; ?></font></b></p>
- </th>
- </tr>
- </th>
- </table>
- <hr>
- <br>
- <form action="create_intervention.php" method="post" name="create_intervention">
- <table class='data_table'>
- <tr>
- <th colspan="6">
- <?php echo get_lang('create_interventions_commentaires');
- echo $user_info['complete_name']; ?>
- </th>
- <tr>
- <th><?php echo get_lang('level'); ?></th>
- <th><?php echo get_lang('lang_date'); ?></th>
- <th><?php echo get_lang('consignes_interventions'); ?></th>
- <th><?php echo get_lang('Detail'); ?></th>
- </tr>
- <tr>
- <td>
- <select name="level">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- </select>
- </td>
- <td>
- <input type="text" name="date" value="<?php echo date("Y-m-d"); ?>">
- </td>
- <td><textarea name="inter_coment" style="width:90%;" rows="2"> </textarea></td>
- <INPUT type=hidden name=ex_user_id value= <?php echo $studentId; ?>>
- <td><input type="SUBMIT" value="Sauvegarder" name="B1"></td>
- </tr>
- </table>
- </form>
- <?php
- // formulaire d'édition des commentaires
- ?>
- <form>
- <table class='data_table'>
- <tr>
- <th><?php echo get_lang('level'); ?> </th>
- <th>
- <?php echo get_lang('lang_date'); ?>
- </th>
- <th>
- <?php echo get_lang('interventions_commentaires'); ?>
- </th>
- <th>
- <?php echo get_lang('Detail'); ?>
- </th>
- </tr>
- <?php
- $tbl_stats_exercices = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
- $sqlinter = "SELECT *
- FROM $tbl_stats_exercices
- WHERE
- exe_user_id = $studentId AND
- level != 0
- ORDER BY exe_date ASC, level ASC
- ";
- $resultinter = Database::query($sqlinter);
- $mod_no = null;
- while ($a_inter = Database::fetch_array($resultinter)) {
- $level = $a_inter['level'];
- $mod_no = $a_inter['mod_no'];
- $inter_coment = stripslashes($a_inter['inter_coment']);
- $inter_date = substr($a_inter['exe_date'], 0, 11);
- echo "
- <tr><center>
- <td> ".$a_inter['level']."
- </td>
- <td>
- $inter_date
- </td>
-
- <td>$inter_coment
- </td>
- ";
- $exe_id = $a_inter['exe_id']; ?>
- <td class="highlight">
- <a href="edit_intervention.php?num=<?php echo $exe_id; ?>&student_id=<?php echo $studentId; ?> ">
- <?php echo Display::return_icon('edit.png', get_lang('Edit')); ?></a>
- <a
- href="delete_exam.php?num=<?php echo $exe_id; ?>&student_id=<?php echo $studentId; ?>">
- <img
- src="../img/delete.gif" border="0"
- onClick='return confirmDelete2()'>
- </a>
- <?php
- }
- ?>
- </td>
- </form>
- <?php
- $table_title = '';
- if (!empty($session_id)) {
- $session_name = api_get_session_name($session_id);
- $table_title = ($session_name ? Display::return_icon(
- 'session.png',
- get_lang('Session'),
- [],
- ICON_SIZE_SMALL
- ).' '.$session_name.' ' : '');
- }
- if (!empty($info_course['title'])) {
- $table_title .= ($info_course ? Display::return_icon(
- 'course.png',
- get_lang('Course'),
- [],
- ICON_SIZE_SMALL
- ).' '.$info_course['title'].' ' : '');
- }
- echo Display::page_subheader($table_title);
- if (empty($_GET['details'])) {
- $csv_content[] = [];
- $csv_content[] = [
- get_lang('Session', ''),
- get_lang('Course', ''),
- get_lang('Time', ''),
- get_lang('Progress', ''),
- get_lang('Score', ''),
- get_lang('Not attended', ''),
- get_lang('Evaluations'),
- ];
- $attendance = new Attendance();
- foreach ($courses_in_session as $key => $courses) {
- $session_id = $key;
- $session_info = api_get_session_info($session_id);
- $session_name = '';
- if (!empty($session_info)) {
- $session_name = $session_info['name'];
- }
- $date_start = '';
- if (!empty($session_info['date_start']) && $session_info['date_start'] != '0000-00-00') {
- $date_start = api_format_date($session_info['date_start'], DATE_FORMAT_SHORT);
- }
- $date_end = '';
- if (!empty($session_info['date_end']) && $session_info['date_end'] != '0000-00-00') {
- $date_end = api_format_date($session_info['date_end'], DATE_FORMAT_SHORT);
- }
- if (!empty($date_start) && !empty($date_end)) {
- $date_session = get_lang('From').' '.$date_start.' '.get_lang('Until').' '.$date_end;
- }
- $title = '';
- if (empty($session_id)) {
- $title = Display::return_icon('course.png', get_lang('Course'), [], ICON_SIZE_SMALL).' '.get_lang(
- 'Course'
- );
- } else {
- $title = Display::return_icon(
- 'session.png',
- get_lang('Session'),
- [],
- ICON_SIZE_SMALL
- ).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
- }
- // Courses
- echo '<table class="data_table">';
- echo '<h3>'.$title.'</h3>';
- echo '<tr>
- <th>'.get_lang('Course').'</th>
- <th>'.get_lang('Time').'</th>
- <th>'.get_lang('Score').'</th>
- <th>'.get_lang('FirstConnexion').'</th>
- <th>'.get_lang('Progress').'</th>
- <th>'.get_lang('fin_mod_prevue').'</th>
- <th>'.get_lang('Details').'</th>
- </tr>';
- if (!empty($courses)) {
- foreach ($courses as $course_code) {
- if (CourseManager:: is_user_subscribed_in_course($studentId, $course_code, true)) {
- $course_info = CourseManager:: get_course_information($course_code);
- $time_spent_on_course = api_time_to_hms(
- Tracking:: get_time_spent_on_the_course($user_info['user_id'], $course_code, $session_id)
- );
- //on sort le c_id avec le code du cours
- $sql8 = "SELECT *
- FROM course
- WHERE code = ' $course_code'
- ";
- $result8 = Database::query($sql8);
- $course_code_id = Database::fetch_array($result8);
- $c_id = $course_code_id['id'];
- // firts connection date
- $sql2 = 'SELECT STR_TO_DATE(access_date,"%Y-%m-%d")
- FROM '.$tbl_stats_access.'
- WHERE access_user_id = '.$studentId.'
- AND c_id = '.$c_id.'
- ORDER BY access_id ASC LIMIT 0,1
- ';
- $rs2 = Database::query($sql2);
- $first_connection_date_to_module = Database::result($rs2, 0, 0);
- //pour trouver la date de fin prévue du module
- $end_date_module = get_lang('hors_cal');
- //avec le nom d'horaire= official code, on trouve la date de
- // début de chaque module nombre de jour a faire
- $sql = "SELECT * FROM c_cal_dates
- where horaire_name = '$nom_hor'
- and c_id = '$c_id'
- AND date = date_format('$first_connection_date_to_module','%Y-%m-%d')
- ";
- $res = Database::query($sql);
- $resulta = Database::fetch_array($res);
- $date_debut = $resulta['date'];
- //on trouve le nombre de jour pour ce module
- $sql = "SELECT * FROM c_cal_set_module where c_id = '$c_id'";
- $res = Database::query($sql);
- $resulta = Database::fetch_array($res);
- $nombre_heure = $resulta['minutes'];
- // on trouve le nombre de minute par jour
- // Julio
- /*$sql = "SELECT * FROM c_cal_horaire where c_id = '$course_code_real'";
- $res = Database::query($sql);
- $resulta = Database::fetch_array($res);
- $nombre_minutes = $resulta['num_minute'];*/
- $nombre_minutes = 0;
- //on calcule le nombre de jour par module
- $nombre_jours_module = $nombre_heure * '60' / $nombre_minutes;
- //on arrondi
- $nombre_jours_module = number_format($nombre_jours_module, 0);
- //on trouve la date de fin de chaque module AND date = date_format('$first_connection_date_to_module','%Y-%m-%d')
- $sql = "SELECT * FROM `c_cal_dates`
- WHERE
- horaire_name = '$nom_hor' AND
- c_id = '$course_code_real' AND
- STR_TO_DATE(date,'%Y-%m-%d') >= STR_TO_DATE('$first_connection_date_to_module','%Y-%m-%d')
- ORDER BY STR_TO_DATE(date, '%Y-%m-%d') ASC ";
- $res = Database::query($sql);
- mysql_data_seek($res, $nombre_jours_module);
- $row = mysql_fetch_row($res);
- $end_date_module = $row[1];
- //fin de trouver la date de fin prévue du module
- // get average of faults in attendances by student
- $results_faults_avg = $attendance->get_faults_average_by_course(
- $studentId,
- $course_code,
- $session_id
- );
- if (!empty($results_faults_avg['total'])) {
- if (api_is_drh()) {
- $attendances_faults_avg = '<a title="'.get_lang('Go to attendances').'" href="'.api_get_path(
- WEB_CODE_PATH
- ).'attendance/index.php?cidReq='.$course_code.'&id_session='.$session_id.'&student_id='.$studentId.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
- } else {
- $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
- }
- } else {
- $attendances_faults_avg = '0/0 (0%)';
- }
- // Get evaluations by student
- $cats = Category::load(null, null, $course_code, null, null, $session_id);
- $scoretotal = [];
- if (isset($cats) && isset($cats[0])) {
- if (!empty($session_id)) {
- $scoretotal = $cats[0]->calc_score($studentId, $course_code, $session_id);
- } else {
- $scoretotal = $cats[0]->calc_score($studentId, $course_code);
- }
- }
- $scoretotal_display = '0/0 (0%)';
- if (!empty($scoretotal)) {
- $scoretotal_display = round($scoretotal[0], 1).'/'.round($scoretotal[1], 1).' ('.round(
- ($scoretotal[0] / $scoretotal[1]) * 100,
- 2
- ).' %)';
- }
- $progress = Tracking::get_avg_student_progress(
- $user_info['user_id'],
- $course_code,
- null,
- $session_id
- );
- $score = Tracking:: get_avg_student_score($user_info['user_id'], $course_code, null, $session_id);
- $progress = empty($progress) ? '0%' : $progress.'%';
- $score = empty($score) ? '0%' : $score.'%';
- $csv_content[] = [
- $session_name,
- $course_info['title'],
- $time_spent_on_course,
- $progress,
- $score,
- $attendances_faults_avg,
- $scoretotal_display,
- ];
- $warming = '';
- $today = date('Y-m-d');
- if ($end_date_module <= $today and $progress != '100%') {
- $warming = '<b><font color=#CC0000> '.get_lang('limite_atteinte').'</font></b>';
- }
- $end_date_module = $end_date_module.$warming;
- echo '<tr>
- <td >'.$course_info['title'].'</td>
- <td >'.$time_spent_on_course.'</td>
- <td >'.$score.'</td>
- <td >'.$first_connection_date_to_module.'</td>
- <td >'.$progress.'</td>
- <td >'.$end_date_module.'</td>';
- if (!empty($coachId)) {
- echo '<td width="10">
- <a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.$coachId.
- '&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent">'.
- Display::return_icon('2rightarrow.png', get_lang('Details')).'</a></td>';
- } else {
- echo '<td width="10"><a href="'.api_get_self(
- ).'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS(
- $_GET['origin']
- ).'&id_session='.$session_id.'#infosStudent">'.
- Display::return_icon('2rightarrow.png', get_lang('Details')).'</a></td>';
- }
- echo '</tr>';
- }
- }
- } else {
- echo "<tr><td colspan='5'>".get_lang('This course could not be found')."</td></tr>";
- }
- echo '</table>';
- }
- } else {
- $csv_content[] = [];
- $csv_content[] = [str_replace(' ', '', $table_title)];
- $t_lp = Database:: get_course_table(TABLE_LP_MAIN);
- // csv export headers
- $csv_content[] = [];
- $csv_content[] = [
- get_lang('Courses'),
- get_lang('Time'),
- get_lang('Average score'),
- get_lang('Latest attemptAverage score'),
- get_lang('Progress'),
- get_lang('Latest login'),
- ];
- $sql8 = "SELECT * FROM course WHERE code = '$course_code'";
- $result8 = Database::query($sql8);
- $course_code_id = Database::fetch_array($result8);
- $c_id = $course_code_id['id'];
- if (empty($session_id)) {
- $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
- WHERE session_id = 0 AND c_id = $c_id
- ORDER BY lp.display_order";
- } else {
- $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
- WHERE c_id = $c_id
- ORDER BY lp.display_order";
- }
- $rs_lp = Database::query($sql_lp);
- if (Database:: num_rows($rs_lp) > 0) {
- ?>
- <!-- LPs-->
- <table class="data_table">
- <tr>
- <th><?php echo get_lang('Coursess'); ?></th>
- <th><?php echo get_lang('FirstConnexion'); ?></th>
- <th><?php echo get_lang('Time').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Total time in course'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <th><?php echo get_lang('Average score').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Average is calculated based on all test attempts'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <th><?php echo get_lang('Latest attemptAverage score').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Average is calculated based on the latest attempts'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <th><?php echo get_lang('Progress').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('% of learning objects visited'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <th><?php echo get_lang('Latest login').' ';
- Display:: display_icon(
- 'info3.gif',
- get_lang('Last time learner entered the course'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <?php
- echo '<th>'.get_lang('Details').'</th>';
- if (api_is_allowed_to_edit()) {
- echo '<th>'.get_lang('Reset Learning path').'</th>';
- } ?>
- </tr>
- <?php
- // firts connection date
- $sql2 = 'SELECT access_date
- FROM '.$tbl_stats_access.'
- WHERE access_user_id = '.$studentId.'
- AND c_id = '.$c_id.'
- ORDER BY access_id ASC LIMIT 0,1
- ';
- $rs2 = Database::query($sql2);
- $first_connection_date_to_module = Database::result($rs2, 0, 0);
- $i = 0;
- while ($learnpath = Database:: fetch_array($rs_lp)) {
- $lp_id = intval($learnpath['id']);
- $lp_name = $learnpath['name'];
- $any_result = false;
- // Get progress in lp
- $progress = Tracking::get_avg_student_progress(
- $studentId,
- $course_code,
- [$lp_id],
- $session_id
- );
- if ($progress === null) {
- $progress = '0%';
- } else {
- $any_result = true;
- }
- // Get time in lp
- $total_time = Tracking::get_time_spent_in_lp(
- $studentId,
- $course_code,
- [$lp_id],
- $session_id
- );
- if (!empty($total_time)) {
- $any_result = true;
- }
- // Get last connection time in lp
- $start_time = Tracking::get_last_connection_time_in_lp(
- $studentId,
- $course_code,
- $lp_id,
- $session_id
- );
- if (!empty($start_time)) {
- $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
- } else {
- $start_time = '-';
- }
- if (!empty($total_time)) {
- $any_result = true;
- }
- // Quiz in lp
- $score = Tracking::get_avg_student_score(
- $studentId,
- $course_code,
- [$lp_id],
- $session_id
- );
- // Latest exercise results in a LP
- $score_latest = Tracking:: get_avg_student_score(
- $studentId,
- $course_code,
- [$lp_id],
- $session_id,
- false,
- true
- );
- if ($i % 2 == 0) {
- $css_class = "row_even";
- } else {
- $css_class = "row_odd";
- }
- $i++;
- // csv export content
- $csv_content[] = [
- api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
- api_time_to_hms($total_time),
- $score.'%',
- $score_latest.'%',
- $progress.'%',
- $start_time,
- ];
- echo '<tr class="'.$css_class.'">';
- echo Display::tag('td', stripslashes($lp_name));
- echo Display::tag('td', stripslashes($first_connection_date_to_module));
- echo Display::tag('td', api_time_to_hms($total_time));
- if (!is_null($score)) {
- if (is_numeric($score)) {
- $score = $score.'%';
- }
- }
- echo Display::tag('td', $score);
- if (!is_null($score_latest)) {
- if (is_numeric($score_latest)) {
- $score_latest = $score_latest.'%';
- }
- }
- echo Display::tag('td', $score_latest);
- if (is_numeric($progress)) {
- $progress = $progress.'%';
- } else {
- $progress = '-';
- }
- echo Display::tag('td', $progress);
- //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
- //which implies several other changes not a priority right now
- echo Display::tag('td', $start_time);
- if ($any_result === true) {
- $from = '';
- if ($from_myspace) {
- $from = '&from=myspace';
- }
- $link = Display::url(
- Display::return_icon('2rightarrow.png', get_lang('Details')),
- 'lp_tracking.php?cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS(
- $_GET['course']
- ).$from.'&origin='.Security::remove_XSS(
- $_GET['origin']
- ).'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$session_id
- );
- echo Display::tag('td', $link);
- }
- if (api_is_allowed_to_edit()) {
- echo '<td>';
- if ($any_result === true) {
- echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS(
- $_GET['course']
- ).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS(
- $_GET['details']
- ).'&origin='.Security::remove_XSS(
- $_GET['origin']
- ).'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.Security::remove_XSS(
- $_GET['id_session']
- ).'">';
- echo Display::return_icon('clean.png', get_lang('Clean'), '', ICON_SIZE_SMALL).'</a>';
- echo '</a>';
- }
- echo '</td>';
- echo '</tr>';
- }
- $data_learnpath[$i][] = $lp_name;
- $data_learnpath[$i][] = $progress.'%';
- }
- } else {
- //echo '<tr><td colspan="6">'.get_lang('This course could not be founds').'</td></tr>';
- } ?>
- </table>
- <!-- line about exercises -->
- <table class="data_table">
- <tr>
- <th><?php echo get_lang('Tests'); ?></th>
- <th><?php echo get_lang('Learning paths'); ?></th>
- <th><?php echo get_lang('Average score in learning paths').' '.Display:: return_icon(
- 'info3.gif',
- get_lang('Average score'),
- ['align' => 'absmiddle', 'hspace' => '3px']
- ); ?></th>
- <th><?php echo get_lang('Attempts'); ?></th>
- <th><?php echo get_lang('Latest attempt'); ?></th>
- <th><?php echo get_lang('All attempts'); ?></th>
- </tr>
- <?php
- $csv_content[] = [];
- $csv_content[] = [
- get_lang('Tests'),
- get_lang('Learning paths'),
- get_lang('Average score in learning paths'),
- get_lang('Attempts'),
- ];
- $t_quiz = Database:: get_course_table(TABLE_QUIZ_TEST);
- $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz
- WHERE
- quiz.c_id = $c_id AND
- (quiz.session_id = $session_id OR quiz.session_id = 0) AND
- active IN (0, 1)
- ORDER BY quiz.title ASC ";
- $result_exercices = Database::query($sql);
- $i = 0;
- if (Database:: num_rows($result_exercices) > 0) {
- while ($exercices = Database:: fetch_array($result_exercices)) {
- $exercise_id = intval($exercices['id']);
- $count_attempts = Tracking::count_student_exercise_attempts(
- $studentId,
- $course_code,
- $exercise_id,
- 0,
- 0,
- $session_id,
- 2
- );
- $score_percentage = Tracking::get_avg_student_exercise_score(
- $studentId,
- $course_code,
- $exercise_id,
- $session_id,
- 1,
- 0
- );
- if (!isset($score_percentage) && $count_attempts > 0) {
- $scores_lp = Tracking::get_avg_student_exercise_score(
- $studentId,
- $course_code,
- $exercise_id,
- $session_id,
- 2,
- 1
- );
- $score_percentage = $scores_lp[0];
- $lp_name = $scores_lp[1];
- } else {
- $lp_name = '-';
- }
- $lp_name = !empty($lp_name) ? $lp_name : get_lang('This course could not be founds');
- if ($i % 2) {
- $css_class = 'row_odd';
- } else {
- $css_class = 'row_even';
- }
- echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
- echo '<td>';
- if (!empty($lp_name)) {
- echo $lp_name;
- } else {
- echo '-';
- }
- echo '</td>';
- echo '<td>';
- if ($count_attempts > 0) {
- echo $score_percentage.'%';
- } else {
- echo '-';
- $score_percentage = 0;
- }
- echo '</td>';
- echo '<td>'.$count_attempts.'</td>';
- echo '<td>';
- $sql_last_attempt = 'SELECT exe_id FROM '.$tbl_stats_exercices.'
- WHERE exe_exo_id ="'.$exercise_id.'" AND
- exe_user_id ="'.$studentId.'" AND
- c_id ="'.$course_code.'" AND
- session_id ="'.$session_id.'" AND
- status = ""
- ORDER BY exe_date DESC LIMIT 1';
- $result_last_attempt = Database::query($sql_last_attempt);
- if (Database:: num_rows($result_last_attempt) > 0) {
- $id_last_attempt = Database:: result($result_last_attempt, 0, 0);
- if ($count_attempts > 0) {
- echo '<a href="../exercice/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$session_id.'&student='.$studentId.'&origin='.(empty($_GET['origin']) ? 'tracking' : Security::remove_XSS(
- $_GET['origin']
- )).'"> <img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif" border="0" /> </a>';
- }
- }
- echo '</td>';
- echo '<td>';
- $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$studentId&id_session=$session_id";
- echo Display::url(
- Display::return_icon('test_results.png', get_lang('All attempts'), [], ICON_SIZE_SMALL),
- $all_attempt_url
- );
- echo '</td></tr>';
- $data_exercices[$i][] = $exercices['title'];
- $data_exercices[$i][] = $score_percentage.'%';
- $data_exercices[$i][] = $count_attempts;
- $csv_content[] = [
- $exercices['title'],
- $lp_name,
- $score_percentage,
- $count_attempts,
- ];
- $i++;
- }
- } else {
- echo '<tr><td colspan="6">'.get_lang('No tests').'</td></tr>';
- }
- echo '</table>';
- //@when using sessions we do not show the survey list
- if (empty($session_id)) {
- $survey_list = SurveyManager::get_surveys($course_code, $session_id);
- $survey_data = [];
- foreach ($survey_list as $survey) {
- $user_list = SurveyManager::get_people_who_filled_survey(
- $survey['survey_id'],
- false,
- $info_course['real_id']
- );
- $survey_done = Display::return_icon("accept_na.png", get_lang('There is no answer for the moment'), [], ICON_SIZE_SMALL);
- if (in_array($studentId, $user_list)) {
- $survey_done = Display::return_icon("accept.png", get_lang('Answered'), [], ICON_SIZE_SMALL);
- }
- $data = ['title' => $survey['title'], 'done' => $survey_done];
- $survey_data[] = $data;
- }
- if (!empty($survey_list)) {
- $table = new HTML_Table(['class' => 'data_table']);
- $header_names = [get_lang('Survey'), get_lang('Answered')];
- $row = 0;
- $column = 0;
- foreach ($header_names as $item) {
- $table->setHeaderContents($row, $column, $item);
- $column++;
- }
- $row = 1;
- if (!empty($survey_data)) {
- foreach ($survey_data as $data) {
- $column = 0;
- $table->setCellContents($row, $column, $data);
- $class = 'class="row_odd"';
- if ($row % 2) {
- $class = 'class="row_even"';
- }
- $table->setRowAttributes($row, $class, true);
- $column++;
- $row++;
- }
- }
- echo $table->toHtml();
- }
- }
- // line about other tools
- echo '<table class="data_table">';
- $csv_content[] = [];
- $nb_assignments = Tracking::count_student_assignments($studentId, $course_code, $session_id);
- $messages = Tracking::count_student_messages($studentId, $course_code, $session_id);
- $links = Tracking::count_student_visited_links($studentId, $course_code, $session_id);
- $chat_last_connection = Tracking::chat_last_connection($studentId, $course_code, $session_id);
- $documents = Tracking::count_student_downloaded_documents($studentId, $course_code, $session_id);
- $uploaded_documents = Tracking::count_student_uploaded_documents($studentId, $course_code, $session_id);
- $csv_content[] = [
- get_lang('OTI (Online Training Interaction) settings report'),
- ];
- $csv_content[] = [
- get_lang('Assignments'),
- $nb_assignments,
- ];
- $csv_content[] = [
- get_lang('Messages'),
- $messages,
- ];
- $csv_content[] = [
- get_lang('Links accessed'),
- $links,
- ];
- $csv_content[] = [
- get_lang('Documents downloaded'),
- $documents,
- ];
- $csv_content[] = [
- get_lang('Uploaded documents'),
- $uploaded_documents,
- ];
- $csv_content[] = [
- get_lang('Latest chat connection'),
- $chat_last_connection,
- ]; ?>
- <tr>
- <th colspan="2"><?php echo get_lang('OTI (Online Training Interaction) settings report'); ?></th>
- </tr>
- <tr><!-- assignments -->
- <td width="40%"><?php echo get_lang('Assignments'); ?></td>
- <td><?php echo $nb_assignments; ?></td>
- </tr>
- <tr><!-- messages -->
- <td><?php echo get_lang('Forum').' - '.get_lang('Number of posts for this user'); ?></td>
- <td><?php echo $messages; ?></td>
- </tr>
- <tr><!-- links -->
- <td><?php echo get_lang('Links accessed'); ?></td>
- <td><?php echo $links; ?></td>
- </tr>
- <tr><!-- downloaded documents -->
- <td><?php echo get_lang('Documents downloaded'); ?></td>
- <td><?php echo $documents; ?></td>
- </tr>
- <tr><!-- uploaded documents -->
- <td><?php echo get_lang('Uploaded documents'); ?></td>
- <td><?php echo $uploaded_documents; ?></td>
- </tr>
- <tr><!-- Chats -->
- <td><?php echo get_lang('Latest chat connection'); ?></td>
- <td><?php echo $chat_last_connection; ?></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <?php
- } //end details
- if ($export_csv) {
- ob_end_clean();
- Export:: export_table_csv($csv_content, 'reporting_student');
- exit;
- }
- ?>
- <br>
- <form action="create_exam.php" method="post" name="create_exam">
- <table class='data_table'>
- <tr>
- <th colspan="6">
- <?php echo get_lang('Title');
- echo $user_info['complete_name']; ?>
- </th>
- <tr>
- <th style="width: 60px">
- <?php echo get_lang('Module'); ?>
- </th>
- <th style="width: 120px">
- <?php echo get_lang('Results and feedback and feedback'); ?>
- </th>
- <th style="width: 100px">
- <?php echo get_lang('result_rep_1'); ?>
- </th>
- <th style="width: 100px">
- <?php echo get_lang('result_rep_2'); ?>
- </th>
- <th style="width: 720px">
- <?php echo get_lang('Comment'); ?>
- </th>
- <th style="width: 60px">
- <?php echo get_lang('Detail'); ?>
- </th>
- </tr>
- <tr>
- <td><input type="text" style="width:90%;" NAME="mod_no" size="1" <?php echo "$mod_no "; ?></textarea></td>
- <td>
- <select name="score_ex">
- <option value="-">-</option>
- <option value="SU">SU</option>
- <option value="EC">EC</option>
- </select>
- </td>
- <td>
- <select name="score_rep1">
- <option value="-">-</option>
- <option value="SU">SU</option>
- <option value="EC">EC</option>
- </select>
- </td>
- <td>
- <select name="score_rep2">
- <option value="-">-</option>
- <option value="SU">SU</option>
- <option value="EC">EC</option>
- </select>
- </td>
- <td><textarea name="coment" style="width:70%; rows=" 2"><?php echo "$coment"; ?></textarea></td>
- <INPUT type=hidden name=ex_user_id value= <?php echo $studentId; ?>>
- <td><input type="SUBMIT" value="<?php echo get_lang('Save'); ?>" name="create_exam"></td>
- </tr>
- </table>
- </form>
- <form name="save_exam">
- <table class='data_table'>
- <tr>
- <th colspan="6">
- <?php echo get_lang('result_exam_title');
- echo $user_info['complete_name']; ?>
- </th>
- <tr>
- <th><?php echo get_lang('Module'); ?> </th>
- <th>
- <?php echo get_lang('Results and feedback and feedback'); ?>
- </th>
- <th>
- <?php echo get_lang('result_rep_1'); ?>
- </th>
- <th>
- <?php echo get_lang('result_rep_2'); ?>
- </th>
- <th>
- <?php echo get_lang('Comment'); ?>
- </th>
- <th>
- <?php echo get_lang('Detail'); ?>
- </th>
- </tr>
- <?php
- $sqlexam = "SELECT *
- FROM $tbl_stats_exercices
- WHERE exe_user_id = $studentId
- AND c_id = 0 AND mod_no != '0'
- ORDER BY mod_no ASC";
- $resultexam = Database::query($sqlexam);
- $coment = '';
- while ($a_exam = Database::fetch_array($resultexam)) {
- //$ex_id = $a_exam['ex_id'];
- $mod_no = $a_exam['mod_no'];
- $score_ex = $a_exam['score_ex'];
- $score_rep1 = $a_exam['score_rep1'];
- $score_rep2 = $a_exam['score_rep2'];
- $coment = stripslashes($a_exam['coment']);
- echo "
- <tr><center>
- <td> ".$a_exam['mod_no']."
- </td>
- <td><center>
- ".$a_exam['score_ex']."
- </td>
- <td><center>
- ".$a_exam['score_rep1']."
- </td>
- <td><center>
- ".$a_exam['score_rep2']."
- </td>
- <td>$coment
- ";
- $exe_idd = $a_exam['exe_id']; ?>
- <INPUT type=hidden name=ex_idd value= <?php echo "$exe_idd"; ?>>
- <td class="highlight">
- <a href="edit_exam.php?num=<?php echo $exe_idd; ?>&student_id=<?php echo $studentId; ?>">
- <?php echo Display::return_icon('edit.png', get_lang('Edit')); ?>
- </a>
- <a href="delete_exam.php?num=<?php echo $exe_idd; ?>&student_id=<?php echo $studentId; ?>">
- <img
- src="../img/delete.gif" border="0"
- onClick='return confirmDelete2()'></a>
- </td>
- </tr>
- <?php
- }
- ?>
- </table>
- </form>
- <strong><?php echo get_lang('imprime_sommaire'); ?> </strong>
- <?php
- echo '<a target="_blank"
- href="print_myStudents.php?student='.$studentId.'&details=true&course='.$course_code.'&origin=tracking_course">
- <img src="'.api_get_path(WEB_IMG_PATH).'printmgr.gif" border="0" /></a>';
- // tableau pour date de fin prévue pour chaque module
- ?>
- <table class='data_table'>
- <tr>
- <th colspan="6">
- <?php echo get_lang('fin_mod_prevue');
- echo $user_info['complete_name']; ?>
- </th>
- <tr>
- <th style="width: 17%">
- <?php echo get_lang('Module'); ?>
- </th>
- <th style="width: 17%">
- <?php echo get_lang('First connection'); ?>
- </th>
- <th style="width: 16%">
- <?php echo get_lang('To do'); ?>
- </th>
- <th style="width: 16%">
- <?php echo get_lang('realise'); ?>
- </th>
- <th style="width: 16%">
- <?php echo get_lang('pour_realise'); ?>
- </th>
- <th style="width: 16%">
- <?php echo get_lang('fin_mod_prevue'); ?>
- </th>
- </tr>
- </table>
- <?php Display:: display_footer();
|