myStudents.php 26 KB

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