myStudents.php 26 KB

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