myStudents.php 27 KB

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