myStudents.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  1. <?php
  2. /*
  3. * Created on 20 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
  4. */
  5. $langFile = array ('registration', 'index','trad4all', 'tracking');
  6. $nameTools="Mes stagiaires";
  7. $langFile = array ('registration', 'index','trad4all');
  8. require ('main/inc/global.inc.php');
  9. api_block_anonymous_users();
  10. Display :: display_header($nameTools);
  11. /*
  12. * ======================================================================================
  13. * FUNCTIONS
  14. * ======================================================================================
  15. */
  16. function exportCsv($a_infosUser,$tableTitle,$a_header,$a_dataLearnpath,$a_dataExercices,$a_dataProduction)
  17. {
  18. global $archiveDirName;
  19. $fileName = 'test.csv';
  20. $archivePath = api_get_path(SYS_PATH).$archiveDirName.'/';
  21. $archiveURL = api_get_path(WEB_CODE_PATH).'course_info/download.php?archive=';
  22. if(!$open = fopen($archivePath.$fileName,'w+'))
  23. {
  24. $message = get_lang('noOpen');
  25. }
  26. else
  27. {
  28. $info = '';
  29. $info .= $a_infosUser['name'];
  30. $info .= "\r\n";
  31. $info .= $a_infosUser['email'];
  32. $info .= "\r\n";
  33. $info .= $a_infosUser['phone'];
  34. /*$info .= "\r\n";
  35. $info .= $a_infosUser['adresse'];*/
  36. $info .= "\r\n";
  37. $info .= "\r\n";
  38. $info .= $tableTitle;
  39. $info .= "\r\n";
  40. for($i=0;$i<4;$i++)
  41. {
  42. $info .= $a_header[$i].';';
  43. }
  44. $info .= "\r\n";
  45. foreach($a_dataLearnpath as $a_learnpath)
  46. {
  47. foreach($a_learnpath as $learnpath)
  48. {
  49. $info .= $learnpath.';';
  50. }
  51. $info .= "\r\n";
  52. }
  53. for($i=4;$i<8;$i++)
  54. {
  55. $info .= $a_header[$i].';';
  56. }
  57. $info .= "\r\n";
  58. foreach($a_dataExercices as $a_exercice)
  59. {
  60. foreach($a_exercice as $exercice)
  61. {
  62. $info .= $exercice.';';
  63. }
  64. $info .= "\r\n";
  65. }
  66. for($i=8;$i<12;$i++)
  67. {
  68. $info .= $a_header[$i].';';
  69. }
  70. $info .= "\r\n";
  71. foreach($a_dataProduction as $a_production)
  72. {
  73. foreach($a_production as $production)
  74. {
  75. $info .= $production.';';
  76. }
  77. $info .= "\r\n";
  78. }
  79. fwrite($open,$info);
  80. fclose($open);
  81. chmod($fileName,0777);
  82. $message = get_lang('UsageDatacreated');
  83. header("Location:".$archiveURL.$fileName);
  84. }
  85. return $message;
  86. }
  87. /*
  88. *===============================================================================
  89. * MAIN CODE
  90. *===============================================================================
  91. */
  92. $tbl_user = Database :: get_main_table(MAIN_USER_TABLE);
  93. $tbl_session_user = Database :: get_main_table(MAIN_SESSION_USER_TABLE);
  94. $tbl_session = Database :: get_main_table(MAIN_SESSION_TABLE);
  95. $tbl_session_course = Database :: get_main_table(MAIN_SESSION_COURSE_TABLE);
  96. $tbl_session_course_user = Database :: get_main_table(MAIN_SESSION_COURSE_USER_TABLE);
  97. $tbl_course = Database :: get_main_table(MAIN_COURSE_TABLE);
  98. $tbl_stats_exercices = Database :: get_statistic_table(STATISTIC_TRACK_E_EXERCICES_TABLE);
  99. //$tbl_course_lp_view = Database :: get_course_table('lp_view');
  100. //$tbl_course_lp_view_item = Database :: get_course_table('lp_item_view');
  101. //$tbl_course_lp_item = Database :: get_course_table('lp_item');
  102. $tbl_course_lp_view = 'lp_view';
  103. $tbl_course_lp_view_item = 'lp_item_view';
  104. $tbl_course_lp_item = 'lp_item';
  105. $tbl_course_lp = 'lp';
  106. $tbl_course_quiz = 'quiz';
  107. $course_quiz_question = 'quiz_question';
  108. $course_quiz_rel_question = 'quiz_rel_question';
  109. $course_quiz_answer = 'quiz_answer';
  110. $course_student_publication = Database::get_course_table(STUDENT_PUBLICATION_TABLE);
  111. //api_display_tool_title($nameTools);
  112. ?>
  113. <table class="data_table">
  114. <tr>
  115. <th>
  116. <?php echo get_lang('Name'); ?>
  117. </th>
  118. <th>
  119. <?php echo get_lang('Email'); ?>
  120. </th>
  121. <th>
  122. <?php echo get_lang('Progress'); ?>
  123. </th>
  124. </tr>
  125. <?php
  126. $sqlSessions = "SELECT id
  127. FROM $tbl_session
  128. WHERE id_coach = $_uid
  129. ";
  130. $resultSessions = api_sql_query($sqlSessions);
  131. $a_sessions = api_store_result($resultSessions);
  132. $sqlSessions = "SELECT DISTINCT id_session as id
  133. FROM $tbl_session_course
  134. WHERE id_coach = $_uid
  135. ";
  136. $resultSessions = api_sql_query($sqlSessions);
  137. $a_sessions = array_merge($a_sessions,api_store_result($resultSessions));
  138. $a_Students = array();
  139. foreach($a_sessions as $a_session){
  140. $sqlStudents = "SELECT session.id_user,
  141. CONCAT(user.lastname,' ',user.firstname) as name,
  142. user.email
  143. FROM $tbl_session_user AS session
  144. INNER JOIN $tbl_user as user
  145. ON session.id_user = user.user_id
  146. AND user.status = 5
  147. WHERE id_session = ".$a_session['id']."
  148. ORDER BY user.lastname"
  149. ;
  150. $resultStudents = api_sql_query($sqlStudents);
  151. while($a_student = mysql_fetch_array($resultStudents))
  152. {
  153. $a_Students[$a_student['id_user']] = $a_student;
  154. }
  155. }
  156. foreach($a_Students as $students)
  157. {
  158. ?>
  159. <tr>
  160. <td>
  161. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?student=<?php echo $students['id_user']; ?>#infosStudent"><?php echo $students['name']; ?></a>
  162. </td>
  163. <td>
  164. <?php
  165. if(!empty($students['email']))
  166. echo $students['email'];
  167. else
  168. echo get_lang('NoEmail');
  169. ?>
  170. </td>
  171. <td>
  172. </td>
  173. </tr>
  174. <?php
  175. }
  176. ?>
  177. </table>
  178. <?php
  179. if(!empty($_GET['student']))
  180. {
  181. $statistics_database = Database :: get_statistic_database();
  182. $a_usersOnline = WhoIsOnline($_GET['student'], $statistics_database, 30);
  183. foreach($a_usersOnline as $a_online)
  184. {
  185. if(in_array($_GET['student'],$a_online))
  186. {
  187. $online = get_lang('Yes');
  188. }
  189. else
  190. {
  191. $online = get_lang('No');
  192. }
  193. }
  194. $sqlInfosUser = " SELECT user_id,
  195. CONCAT(firstname,' ',lastname) AS name,
  196. email,
  197. phone,
  198. picture_uri
  199. FROM $tbl_user
  200. WHERE user_id = ".$_GET['student']
  201. ;
  202. $resultInfosUser = api_sql_query($sqlInfosUser);
  203. $a_infosUser = mysql_fetch_array($resultInfosUser);
  204. $sqlCours = " SELECT DISTINCT course.title,
  205. course.code,
  206. course.db_name,
  207. CONCAT(user.firstname,' ',user.lastname) as tutor_name,
  208. sessionCourse.id_coach
  209. FROM $tbl_user as user, $tbl_course AS course
  210. INNER JOIN $tbl_session_course_user AS course_user
  211. ON course_user.course_code = course.code
  212. INNER JOIN $tbl_session_course as sessionCourse
  213. ON sessionCourse.course_code = course.code
  214. WHERE course_user.id_user = ".$_GET['student']."
  215. AND sessionCourse.id_coach = user.user_id
  216. ORDER BY course.title ASC
  217. ";
  218. $resultCours = api_sql_query($sqlCours);
  219. ?>
  220. <br/><br/>
  221. <br/>
  222. <a name="infosStudent">
  223. <table class="data_table">
  224. <tr>
  225. <td
  226. <?php
  227. if(empty($details))
  228. echo 'colspan="5"';
  229. else
  230. echo 'colspan="6"';
  231. ?>
  232. class="border">
  233. <table width="100%" border="0" >
  234. <tr>
  235. <?php
  236. if(!empty($a_infosUser['picture_uri']))
  237. {
  238. echo ' <td class="borderRight">
  239. <img src="'.$a_infosUser['picture_uri'].'" />
  240. </td>
  241. ';
  242. }
  243. ?>
  244. <td class="none">
  245. <table>
  246. <tr>
  247. <td class="none">
  248. <?php
  249. echo get_lang('Name').' : ';
  250. echo $a_infosUser['name'];
  251. ?>
  252. </td>
  253. </tr>
  254. <tr>
  255. <td class="none">
  256. <?php
  257. echo get_lang('Email').' : ';
  258. if(!empty($a_infosUser['email']))
  259. {
  260. echo $a_infosUser['email'];
  261. }
  262. else
  263. {
  264. echo get_lang('NoEmail');
  265. }
  266. ?>
  267. </td>
  268. </tr>
  269. <tr>
  270. <td class="none">
  271. <?php
  272. echo get_lang('Tel').'. ';
  273. if(!empty($a_infosUser['phone']))
  274. {
  275. echo $a_infosUser['phone'];
  276. }
  277. else
  278. {
  279. echo get_lang('NoTel');
  280. }
  281. ?>
  282. </td>
  283. </tr>
  284. <tr>
  285. <td class="none">
  286. <?php
  287. echo get_lang('OnLine').' : ';
  288. echo $online;
  289. ?>
  290. </td>
  291. </tr>
  292. </table>
  293. </td>
  294. <?php
  295. if(!empty($_GET['details']))
  296. {
  297. $sendMail = Display::encrypted_mailto_link($a_infosUser['email'], '> '.get_lang('SendMail'));
  298. ?>
  299. <td class="borderLeft">
  300. <table width="100%">
  301. <tr>
  302. <th>
  303. <?php echo get_lang('Actions'); ?>
  304. </th>
  305. </tr>
  306. <tr>
  307. <?php
  308. if(!empty($a_infosUser['email']))
  309. {
  310. echo "<td class='none'>";
  311. echo $sendMail;
  312. echo "</td>";
  313. }
  314. else
  315. {
  316. echo "<td class='noLink none'>";
  317. echo '<strong> > '.get_lang('SendMail').'</strong>';
  318. echo "</td>";
  319. }
  320. ?>
  321. </tr>
  322. <tr>
  323. <td class="none">
  324. <?php echo "<a href=''>".'> '.get_lang('RdvAgenda')."</a>"; ?>
  325. </td>
  326. </tr>
  327. <tr>
  328. <td class="none">
  329. <?php echo "<a href=''>".'> '.get_lang('VideoConf')."</a>"; ?>
  330. </td>
  331. </tr>
  332. <tr>
  333. <td class="none">
  334. <?php echo "<a href=''>".'> '.get_lang('Chat')."</a>"; ?>
  335. </td>
  336. </tr>
  337. <tr>
  338. <td class="none">
  339. <?php echo "<a href='".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."&csv=true#infosStudent'>".'> '.get_lang('ExcelFormat')."</a>"; ?>
  340. </td>
  341. </tr>
  342. </table>
  343. </td>
  344. <?php
  345. }
  346. ?>
  347. </tr>
  348. </table>
  349. </td>
  350. </tr>
  351. </a>
  352. <?php
  353. if(!empty($_GET['details']))
  354. {
  355. ?>
  356. <br /><br />
  357. <div align="left">
  358. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?student=<?php echo $a_infosUser['user_id']; ?>#infosStudent"><?php echo get_lang('Back'); ?></a>
  359. </div>
  360. <br />
  361. <?php
  362. $sqlInfosCourse = " SELECT course.code,
  363. course.title,
  364. course.db_name,
  365. CONCAT(user.firstname,' ',user.lastname) as tutor_name,
  366. session.date_start,
  367. session.date_end
  368. FROM $tbl_user as user, $tbl_course as course
  369. INNER JOIN $tbl_session_course as sessionCourse
  370. ON sessionCourse.course_code = course.code
  371. INNER JOIN $tbl_session AS session
  372. ON session.id = sessionCourse.id_session
  373. WHERE sessionCourse.id_coach = user.user_id
  374. AND course.code= '".$_GET['course']."'
  375. ";
  376. $resultInfosCourse = api_sql_query($sqlInfosCourse);
  377. $a_infosCours = mysql_fetch_array($resultInfosCourse);
  378. $a_date_start = explode('-',$a_infosCours['date_start']);
  379. $date_start = $a_date_start[2].'/'.$a_date_start[1].'/'.$a_date_start[0];
  380. $a_date_end = explode('-',$a_infosCours['date_end']);
  381. $date_end = $a_date_end[2].'/'.$a_date_end[1].'/'.$a_date_end[0];
  382. $dateSession = get_lang('Du').' '.$date_start.' '.get_lang('Au').' '.$date_end;
  383. $tableTitle = $a_infosCours['title'].'. '.get_lang('Tutor').' : '.$a_infosCours['tutor_name'].'. '.get_lang('Session').' : '.$dateSession;
  384. ?>
  385. <tr class="tableName">
  386. <td colspan="6">
  387. <strong><?php echo $tableTitle; ?></strong>
  388. </td>
  389. </tr>
  390. <tr>
  391. <th class="head">
  392. <?php echo get_lang('Learnpath'); ?>
  393. </th>
  394. <th class="head" colspan="2">
  395. <?php echo get_lang('Time'); ?>
  396. </th>
  397. <th class="head">
  398. <?php echo get_lang('Progress'); ?>
  399. </th>
  400. <th class="head" colspan="2">
  401. <?php echo get_lang('LastConnexion'); ?>
  402. </th>
  403. </tr>
  404. <?php
  405. $a_headerLearnpath = array(get_lang('Learnpath'),get_lang('Time'),get_lang('Progress'),get_lang('LastConnexion'));
  406. $sqlLearnpath = " SELECT lp.name,lp.id
  407. FROM ".$a_infosCours['db_name'].".".$tbl_course_lp." AS lp
  408. ";
  409. $resultLearnpath = api_sql_query($sqlLearnpath);
  410. if(mysql_num_rows($resultLearnpath)>0)
  411. {
  412. $i = 0;
  413. while($a_learnpath = mysql_fetch_array($resultLearnpath))
  414. {
  415. $sqlProgress = "SELECT COUNT(DISTINCT lp_item_id) AS nbItem
  416. FROM ".$a_infosCours['db_name'].".".$tbl_course_lp_view_item." AS item_view
  417. INNER JOIN ".$a_infosCours['db_name'].".".$tbl_course_lp_view." AS view
  418. ON item_view.lp_view_id = view.id
  419. AND view.lp_id = ".$a_learnpath['id']."
  420. AND view.user_id = ".$_GET['student']."
  421. WHERE item_view.status = 'completed'
  422. ";
  423. $resultProgress = api_sql_query($sqlProgress);
  424. $a_nbItem = mysql_fetch_array($resultProgress);
  425. $sqlTotalItem = " SELECT COUNT(item_type) AS totalItem
  426. FROM ".$a_infosCours['db_name'].".".$tbl_course_lp_item."
  427. WHERE lp_id = ".$a_learnpath['id']
  428. ;
  429. $resultItem = api_sql_query($sqlTotalItem);
  430. $a_totalItem = mysql_fetch_array($resultItem);
  431. $progress = round(($a_nbItem['nbItem'] * 100)/$a_totalItem['totalItem']);
  432. ?>
  433. <tr>
  434. <td>
  435. <?php echo $a_learnpath['name']; ?>
  436. </td>
  437. <td colspan="2">
  438. </td>
  439. <td align="center">
  440. <?php echo $progress.'%'; ?>
  441. </td>
  442. <td colspan="2">
  443. </td>
  444. </tr>
  445. <?php
  446. $dataLearnpath[$i][] = $a_learnpath['name'];
  447. $dataLearnpath[$i][] = $progress.'%';
  448. $i++;
  449. }
  450. }
  451. else
  452. {
  453. echo " <tr>
  454. <td colspan='6'>
  455. ".get_lang('NoLearnpath')."
  456. </td>
  457. </tr>
  458. ";
  459. }
  460. ?>
  461. <tr>
  462. <th class="head">
  463. <?php echo get_lang('Exercices'); ?>
  464. </th>
  465. <th class="head">
  466. <?php echo get_lang('Score') ?>
  467. </th>
  468. <th class="head">
  469. <?php echo get_lang('Details'); ?>
  470. </th>
  471. <th class="head">
  472. <?php echo get_lang('Essais'); ?>
  473. </th>
  474. <th class="head">
  475. <?php echo get_lang('Correction'); ?>
  476. </th>
  477. <th class="head">
  478. <?php echo get_lang('Corriger'); ?>
  479. </th>
  480. </tr>
  481. <?php
  482. $a_headerExercices = array(get_lang('Exercices'),get_lang('Score'),get_lang('Essais'),get_lang('Correction'));
  483. $sqlExercices = " SELECT quiz.title,id
  484. FROM ".$a_infosCours['db_name'].".".$tbl_course_quiz." AS quiz
  485. ";
  486. $resultExercices = api_sql_query($sqlExercices);
  487. $i = 0;
  488. if(mysql_num_rows($resultExercices)>0)
  489. {
  490. while($a_exercices = mysql_fetch_array($resultExercices))
  491. {
  492. $sqlEssais = " SELECT COUNT(ex.exe_id) as essais
  493. FROM $tbl_stats_exercices AS ex
  494. WHERE ex.exe_cours_id = '".$a_infosCours['code']."'
  495. AND ex.exe_exo_id = ".$a_exercices['id']
  496. ;
  497. $resultEssais = api_sql_query($sqlEssais);
  498. $a_essais = mysql_fetch_array($resultEssais);
  499. $sqlScore = "SELECT exe_result,exe_weighting
  500. FROM $tbl_stats_exercices
  501. WHERE exe_user_id = ".$_GET['student']."
  502. AND exe_cours_id = '".$a_infosCours['code']."'
  503. AND exe_exo_id = ".$a_exercices['id']
  504. ;
  505. $resultScore = api_sql_query($sqlScore);
  506. $score = 0;
  507. while($a_score = mysql_fetch_array($resultScore))
  508. {
  509. $score = $score + $a_score['exe_result'];
  510. $weighting = $weighting + $a_score['exe_weighting'];
  511. }
  512. $pourcentageScore = round(($score*100)/$weighting);
  513. $weighting = 0;
  514. echo "<tr>
  515. <td>
  516. ";
  517. echo $a_exercices['title'];
  518. echo " </td>
  519. ";
  520. echo " <td align='center'>
  521. ";
  522. echo $pourcentageScore.'%';
  523. echo " </td>
  524. <td align='center'>
  525. ";
  526. echo "<a href='".$_SERVER['PHP_SELF']."?student=".$_GET['student']."&details=true&course=".$_GET['course']."&exe_id=".$a_exercices['id']."#infosExe'> -> </a>";
  527. echo " </td>
  528. <td align='center'>
  529. ";
  530. echo $a_essais['essais'];
  531. echo " </td>
  532. <td>
  533. ";
  534. echo " </td>
  535. <td align='center'>
  536. ";
  537. echo "<a href=''> -> </a>";
  538. echo " </td>
  539. </tr>
  540. ";
  541. $dataExercices[$i][] = $a_exercices['title'];
  542. $dataExercices[$i][] = $pourcentageScore.'%';
  543. $dataExercices[$i][] = $a_essais['essais'];
  544. //$dataExercices[$i][] = corrections;
  545. $i++;
  546. }
  547. }
  548. else
  549. {
  550. echo " <tr>
  551. <td colspan='6'>
  552. ".get_lang('NoExercice')."
  553. </td>
  554. </tr>
  555. ";
  556. }
  557. ?>
  558. <tr>
  559. <th class="head">
  560. <?php echo get_lang('Productions'); ?>
  561. </th>
  562. <th class="head" colspan="2">
  563. <?php echo get_lang('LimitDate'); ?>
  564. </th>
  565. <th class="head">
  566. <?php echo get_lang('RemiseDate'); ?>
  567. </th>
  568. <th class="head">
  569. <?php echo get_lang('Remarques'); ?>
  570. </th>
  571. <th class="head">
  572. <?php echo get_lang('Annoter'); ?>
  573. </th>
  574. </tr>
  575. <?php
  576. $a_headerProductions = array(get_lang('Productions'),get_lang('LimitDate'),get_lang('RemiseDate'),get_lang('Remarques'));
  577. $sqlProduction = " SELECT title,sent_date
  578. FROM ".$a_infosCours['db_name'].".".$course_student_publication."
  579. ";
  580. $resultProduction = api_sql_query($sqlProduction);
  581. if(mysql_num_rows($resultProduction)>0)
  582. {
  583. $i = 0;
  584. while($a_production = mysql_fetch_array($resultProduction))
  585. {
  586. //$tmp_limitDate = $newDate = mktime(0 , 0 , 0 , date("m") , date("d") , date("Y"));
  587. $tmp_limitDate = $newDate = mktime(0 , 0 , 0 ,8 , 20 , 2006);
  588. $a_sentDate = explode(' ',$a_production['sent_date']);
  589. $a_sentDate = explode('-',$a_sentDate[0]);
  590. $tmp_sentDate = mktime(0,0,0,$a_sentDate[1],$a_sentDate[2],$a_sentDate[0]);
  591. $sentDate = $a_sentDate[2].'/'.$a_sentDate[1].'/'.$a_sentDate[0];
  592. echo "<tr>
  593. <td>
  594. ";
  595. echo $a_production['title'];
  596. echo " </td>
  597. ";
  598. echo " <td align='center' colspan='2'>
  599. ";
  600. echo " </td>
  601. ";
  602. if($tmp_sentDate > $tmp_limitDate)
  603. {
  604. echo "<td align='center' class='redText'>";
  605. $tmp_retard = $tmp_sentDate - $tmp_limitDate;
  606. $retard = round($tmp_retard/86400);
  607. echo $retard.' '.get_lang('DayOfDelay');
  608. echo "</td>";
  609. }
  610. else
  611. {
  612. echo "<td align='center'>";
  613. echo $sentDate;
  614. echo "</td>";
  615. }
  616. echo " <td align='center'>
  617. ";
  618. $remarque = '';
  619. if($remarque == '')
  620. {
  621. echo "--";
  622. }
  623. echo " </td>
  624. <td align='center'>
  625. ";
  626. echo "<a href=''> -> </a>";
  627. echo " </td>
  628. </tr>
  629. ";
  630. $dataProduction[$i][] = $a_production['title'];
  631. //$dataProduction[$i][] = $a_production['sent_date'];
  632. $dataProduction[$i][] = $a_production['sent_date'];
  633. //$dataProduction[$i][] = remarques;
  634. $i++;
  635. }
  636. }
  637. else
  638. {
  639. echo " <tr>
  640. <td colspan='6'>
  641. ".get_lang('NoProduction')."
  642. </td>
  643. </tr>
  644. ";
  645. }
  646. }
  647. else
  648. {
  649. ?>
  650. <tr>
  651. <th>
  652. <?php echo get_lang('Course'); ?>
  653. </th>
  654. <th>
  655. <?php echo get_lang('Time'); ?>
  656. </th>
  657. <th>
  658. <?php echo get_lang('Progress'); ?>
  659. </th>
  660. <th>
  661. <?php echo get_lang('Score'); ?>
  662. </th>
  663. <th>
  664. <?php echo get_lang('Details'); ?>
  665. </th>
  666. </tr>
  667. <?php
  668. if(mysql_num_rows($resultCours)>0)
  669. {
  670. while($a_cours = mysql_fetch_array($resultCours))
  671. {
  672. $sqlScore = " SELECT exe_result,
  673. exe_weighting
  674. FROM $tbl_stats_exercices
  675. WHERE exe_user_id = ".$_GET['student']."
  676. AND exe_cours_id = '".$a_cours['code']."'
  677. ";
  678. $resultScore = api_sql_query($sqlScore);
  679. $i = 0;
  680. $score = 0;
  681. while($a_score = mysql_fetch_array($resultScore))
  682. {
  683. $score = $score + $a_score['exe_result'];
  684. $weighting = $weighting + $a_score['exe_weighting'];
  685. $i++;
  686. }
  687. $totalScore = $totalScore + $score;
  688. $totalWeighting = $totalWeighting + $weighting;
  689. $pourcentageScore = round(($score*100)/$weighting);
  690. $weighting = 0;
  691. $sqlProgress = "SELECT COUNT( DISTINCT item_view.lp_item_id ) AS nbItem
  692. FROM ".$a_cours['db_name'].".".$tbl_course_lp_view_item." AS item_view
  693. INNER JOIN ".$a_cours['db_name'].".".$tbl_course_lp_view." AS lpview
  694. ON lpview.user_id = ".$_GET['student']."
  695. WHERE item_view.status = 'completed'
  696. ";
  697. //echo $sqlProgress;
  698. $resultProgress = api_sql_query($sqlProgress);
  699. $a_nbItem = mysql_fetch_array($resultProgress);
  700. $table = $a_cours['db_name'].'.'.$tbl_course_lp_item;
  701. $nbTotalItem = Database::count_rows($table);
  702. $totalItem = $totalItem + $nbTotalItem;
  703. $totalProgress = $totalProgress + $a_nbItem['nbItem'];
  704. $progress = round(($a_nbItem['nbItem'] * 100)/$nbTotalItem);
  705. ?>
  706. <tr>
  707. <td>
  708. <?php echo $a_cours['title'].' - '.get_lang('Tutor').' : '.$a_cours['tutor_name']; ?>
  709. </td>
  710. <td>
  711. </td>
  712. <td align="center">
  713. <?php echo $progress.'%'; ?>
  714. </td>
  715. <td align="center">
  716. <?php echo $pourcentageScore.'%'; ?>
  717. </td>
  718. <td align="center">
  719. <?php
  720. if($_uid == $a_cours['id_coach'])
  721. {
  722. echo '<a href="'.$_SERVER['PHP_SELF'].'?student='.$a_infosUser['user_id'].'&details=true&course='.$a_cours['code'].'#infosStudent"> -> </a>';
  723. }
  724. ?>
  725. </td>
  726. </tr>
  727. <?php
  728. }
  729. $totalPourcentageScore = round(($totalScore*100)/$totalWeighting);
  730. $progress = round(($totalProgress*100)/$totalItem);
  731. ?>
  732. <tr class='total'>
  733. <td>
  734. <strong>Total</strong>
  735. </td>
  736. <td>
  737. </td>
  738. <td align="center">
  739. <?php echo $progress.'%'; ?>
  740. </td>
  741. <td align="center">
  742. <?php echo $totalPourcentageScore.'%'; ?>
  743. </td>
  744. <td>
  745. </td>
  746. </tr>
  747. <?php
  748. }
  749. else
  750. {
  751. echo "<tr>
  752. <td colspan='5'>
  753. ".get_lang('NoCourse')."
  754. </td>
  755. </tr>
  756. ";
  757. }
  758. }//end of else !empty($details)
  759. ?>
  760. </table>
  761. <br />
  762. <?php
  763. if(!empty($_GET['details']))
  764. {
  765. ?>
  766. <div align="left">
  767. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?student=<?php echo $a_infosUser['user_id']; ?>#infosStudent"><?php echo get_lang('Back'); ?></a>
  768. </div>
  769. <br /><br />
  770. <?php
  771. }
  772. if(!empty($_GET['exe_id']))
  773. {
  774. $sqlExerciceDetails = " SELECT qq.question, qq.ponderation, qq.id
  775. FROM ".$a_infosCours['db_name'].".".$course_quiz_question." as qq
  776. INNER JOIN ".$a_infosCours['db_name'].".".$course_quiz_rel_question." as qrq
  777. ON qrq.question_id = qq.id
  778. AND qrq.exercice_id = ".$_GET['exe_id']
  779. ;
  780. $resultExerciceDetails = api_sql_query($sqlExerciceDetails);
  781. $sqlExName = " SELECT quiz.title
  782. FROM ".$a_infosCours['db_name'].".".$tbl_course_quiz." AS quiz
  783. WHERE quiz.id = ".$_GET['exe_id']
  784. ;
  785. $resultExName = api_sql_query($sqlExName);
  786. $a_exName = mysql_fetch_array($resultExName);
  787. echo "<table class='data_table'>
  788. <tr>
  789. <th colspan='2'>
  790. ".$a_exName['title']."
  791. </th>
  792. </tr>
  793. ";
  794. while($a_exerciceDetails = mysql_fetch_array($resultExerciceDetails))
  795. {
  796. $sqlAnswer = " SELECT qa.comment, qa.answer
  797. FROM ".$a_infosCours['db_name'].".".$course_quiz_answer." as qa
  798. WHERE qa.question_id = ".$a_exerciceDetails['id']
  799. ;
  800. $resultAnswer = api_sql_query($sqlAnswer);
  801. echo "<a name='infosExe'></a>";
  802. //print_r($a_exerciceDetails);
  803. echo"
  804. <tr>
  805. <td colspan='2'>
  806. <strong>".$a_exerciceDetails['question'].' /'.$a_exerciceDetails['ponderation']."</strong>
  807. </td>
  808. </tr>
  809. ";
  810. while($a_answer = mysql_fetch_array($resultAnswer))
  811. {
  812. echo"
  813. <tr>
  814. <td>
  815. ".$a_answer['answer']."
  816. </td>
  817. <td>
  818. ";
  819. if(!empty($a_answer['comment']))
  820. echo $a_answer['comment'];
  821. else
  822. echo get_lang('NoComment');
  823. echo "
  824. </td>
  825. </tr>
  826. ";
  827. }
  828. }
  829. echo "</table>";
  830. }
  831. $a_header = array_merge($a_headerLearnpath,$a_headerExercices,$a_headerProductions);
  832. if($_GET['csv'] == "true")
  833. {
  834. $exportResult = exportCsv($a_infosUser,$tableTitle,$a_header,$dataLearnpath,$dataExercices,$dataProduction);
  835. Display :: display_error_message($exportResult);
  836. }
  837. }
  838. /*
  839. ==============================================================================
  840. FOOTER
  841. ==============================================================================
  842. */
  843. Display::display_footer();
  844. ?>