index.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  1. <?php // $Id: index.php 16620 2008-10-25 20:03:54Z yannoo $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. For a full list of contributors, see "credits.txt".
  8. The full license can be read in "license.txt".
  9. This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License
  11. as published by the Free Software Foundation; either version 2
  12. of the License, or (at your option) any later version.
  13. See the GNU General Public License for more details.
  14. Contact: Dokeos, rue Notre Dame, 152, B-1140 Evere, Belgium, info@dokeos.com
  15. ==============================================================================
  16. */
  17. /**
  18. * @todo use constant for $this_section
  19. */
  20. // name of the language file that needs to be included
  21. $language_file = array ('registration', 'index','tracking');
  22. $cidReset=true;
  23. require ('../inc/global.inc.php');
  24. require (api_get_path(LIBRARY_PATH).'tracking.lib.php');
  25. require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
  26. require_once(api_get_path(LIBRARY_PATH).'export.lib.inc.php');
  27. ob_start();
  28. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  29. $csv_content = array();
  30. $nameTools= get_lang("MySpace");
  31. $this_section = "session_my_space";
  32. // access control
  33. api_block_anonymous_users();
  34. if(!$export_csv)
  35. {
  36. Display :: display_header($nameTools);
  37. }
  38. else
  39. {
  40. if ($_GET['view'] == 'admin' AND $_GET['display'] == 'useroverview')
  41. {
  42. export_tracking_user_overview();
  43. exit;
  44. }
  45. }
  46. // Database table definitions
  47. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  48. $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  49. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  50. $tbl_class = Database :: get_main_table(TABLE_MAIN_CLASS);
  51. $tbl_sessions = Database :: get_main_table(TABLE_MAIN_SESSION);
  52. $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
  53. $tbl_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
  54. $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
  55. $tbl_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
  56. /********************
  57. * FUNCTIONS
  58. ********************/
  59. function count_teacher_courses()
  60. {
  61. global $nb_teacher_courses;
  62. return $nb_teacher_courses;
  63. }
  64. function count_coaches()
  65. {
  66. global $total_no_coachs;
  67. return $total_no_coachs;
  68. }
  69. function sort_users($a,$b){
  70. $a = trim(strtolower($a[$_SESSION['tracking_column']]));
  71. $b = trim(strtolower($b[$_SESSION['tracking_column']]));
  72. if($_SESSION['tracking_direction'] == 'DESC')
  73. return strcmp($b, $a);
  74. else
  75. return strcmp($a, $b);
  76. }
  77. /**************************
  78. * MAIN CODE
  79. ***************************/
  80. $isCoach = api_is_coach();
  81. $isPlatformAdmin = api_is_platform_admin();
  82. $view = isset($_GET['view']) ? $_GET['view'] : 'teacher';
  83. $menu_items = array();
  84. if(api_is_allowed_to_create_course())
  85. {
  86. $sqlNbCours = " SELECT course_rel_user.course_code, course.title
  87. FROM $tbl_course_user as course_rel_user
  88. INNER JOIN $tbl_course as course
  89. ON course.code = course_rel_user.course_code
  90. WHERE course_rel_user.user_id='".$_user['user_id']."' AND course_rel_user.status='1'
  91. ORDER BY course.title";
  92. $resultNbCours = api_sql_query($sqlNbCours, __FILE__, __LINE__);
  93. $a_courses = api_store_result($resultNbCours);
  94. $nb_teacher_courses = count($a_courses);
  95. if($nb_teacher_courses)
  96. {
  97. if(!$isCoach && !api_is_platform_admin())
  98. {
  99. $view = 'teacher';
  100. }
  101. if($view=='teacher')
  102. {
  103. $menu_items[] = get_lang('TeacherInterface');
  104. $title = get_lang('YourCourseList');
  105. }
  106. else
  107. {
  108. $menu_items[] = '<a href="'.api_get_self().'?view=teacher">'.get_lang('TeacherInterface').'</a>';
  109. }
  110. }
  111. }
  112. if($isCoach)
  113. {
  114. if($nb_teacher_courses==0 && !api_is_platform_admin())
  115. {
  116. $view = 'coach';
  117. }
  118. if($view=='coach')
  119. {
  120. $menu_items[] = get_lang('CoachInterface');
  121. $title = get_lang('YourStatistics');
  122. }
  123. else
  124. {
  125. $menu_items[] = '<a href="'.api_get_self().'?view=coach">'.get_lang('CoachInterface').'</a>';
  126. }
  127. }
  128. if(api_is_platform_admin())
  129. {
  130. if(!$isCoach && $nb_teacher_courses==0)
  131. {
  132. $view = 'admin';
  133. }
  134. if($view=='admin')
  135. {
  136. $menu_items[] = get_lang('AdminInterface');
  137. $title = get_lang('CoachList');
  138. }
  139. else
  140. {
  141. $menu_items[] = '<a href="'.api_get_self().'?view=admin">'.get_lang('AdminInterface').'</a>';
  142. }
  143. }
  144. if($_user['status']==DRH)
  145. {
  146. $view = 'drh';
  147. $title = get_lang('DrhInterface');
  148. $menu_items[] = '<a href="'.api_get_self().'?view=drh">'.get_lang('DrhInterface').'</a>';
  149. }
  150. echo '<div class="actions">';
  151. $nb_menu_items = count($menu_items);
  152. if($nb_menu_items>1)
  153. {
  154. foreach($menu_items as $key=> $item)
  155. {
  156. echo $item;
  157. if($key!=$nb_menu_items-1)
  158. {
  159. echo ' | ';
  160. }
  161. }
  162. }
  163. echo '
  164. <a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
  165. <a href="'.api_get_self().'?export=csv&view='.$view.'"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
  166. ';
  167. echo '</div>';
  168. echo '<h4>'.$title.'</h4>';
  169. if($_user['status']==DRH && $view=='drh')
  170. {
  171. $a_students = Tracking :: get_student_followed_by_drh($_user['user_id']);
  172. $courses_of_the_platform = CourseManager :: get_real_course_list();
  173. foreach($courses_of_the_platform as $course)
  174. $a_courses[$course['code']] = $course['code'];
  175. }
  176. if($isCoach && $view=='coach')
  177. {
  178. $a_students = Tracking :: get_student_followed_by_coach($_user['user_id']);
  179. $a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
  180. }
  181. if($view=='coach' || $view=='drh')
  182. {
  183. $nbStudents = count($a_students);
  184. $totalTimeSpent = 0;
  185. $totalCourses = 0;
  186. $avgTotalProgress = 0;
  187. $avgResultsToExercises = 0;
  188. $nb_inactive_students = 0;
  189. $nb_posts = $nb_assignments = 0;
  190. foreach($a_students as $student_id)
  191. {
  192. // inactive students
  193. $last_connection_date = Tracking :: get_last_connection_date($student_id,true,true);
  194. if($last_connection_date!=false)
  195. {
  196. /*
  197. list($last_connection_date, $last_connection_hour) = explode(' ',$last_connection_date);
  198. $last_connection_date = explode('-',$last_connection_date);
  199. $last_connection_hour = explode(':',$last_connection_hour);
  200. $last_connection_hour[0];
  201. $last_connection_time = mktime($last_connection_hour[0],$last_connection_hour[1],$last_connection_hour[2],$last_connection_date[1],$last_connection_date[2],$last_connection_date[0]);
  202. */
  203. if(time()-(3600*24*7) > $last_connection_time)
  204. {
  205. $nb_inactive_students++;
  206. }
  207. }
  208. else
  209. {
  210. $nb_inactive_students++;
  211. }
  212. $totalTimeSpent += Tracking :: get_time_spent_on_the_platform($student_id);
  213. $totalCourses += Tracking :: count_course_per_student($student_id);
  214. $avgStudentProgress = $avgStudentScore = 0;
  215. $nb_courses_student = 0;
  216. foreach($a_courses as $course_code)
  217. {
  218. if(CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true))
  219. {
  220. $nb_courses_student++;
  221. $nb_posts += Tracking :: count_student_messages($student_id,$course_code);
  222. $nb_assignments += Tracking :: count_student_assignments($student_id,$course_code);
  223. $avgStudentProgress += Tracking :: get_avg_student_progress($student_id,$course_code);
  224. $avgStudentScore += Tracking :: get_avg_student_score($student_id,$course_code);
  225. if($nb_posts !== null && $nb_assignments !== null && $avgStudentProgress !== null && $avgStudentScore !== null)
  226. {
  227. //if one of these scores is null, it means that we had a problem connecting to the right database, so don't count it in
  228. $nb_courses_student++;
  229. }
  230. }
  231. }
  232. // average progress of the student
  233. $avgStudentProgress = $avgStudentProgress / $nb_courses_student;
  234. $avgTotalProgress += $avgStudentProgress;
  235. // average test results of the student
  236. $avgStudentScore = $avgStudentScore / $nb_courses_student;
  237. $avgResultsToExercises += $avgStudentScore;
  238. }
  239. // average progress
  240. $avgTotalProgress = $avgTotalProgress/$nbStudents;
  241. // average results to the tests
  242. $avgResultsToExercises = $avgResultsToExercises/$nbStudents;
  243. // average courses by student
  244. $avgCoursesPerStudent = round($totalCourses / $nbStudents,2);
  245. // average time spent on the platform
  246. $avgTimeSpent = $totalTimeSpent / $nbStudents;
  247. // average assignments
  248. $nb_assignments = $nb_assignments / $nbStudents;
  249. // average posts
  250. $nb_posts = $nb_posts / $nbStudents;
  251. //csv part
  252. if($export_csv)
  253. {
  254. $csv_content[] = array( get_lang('Probationers'));
  255. $csv_content[] = array( get_lang('InactivesStudents'),$nb_inactive_students );
  256. $csv_content[] = array( get_lang('AverageTimeSpentOnThePlatform'),$avgTimeSpent);
  257. $csv_content[] = array( get_lang('AverageCoursePerStudent'),$avgCoursesPerStudent);
  258. $csv_content[] = array( get_lang('AverageProgressInLearnpath'),$avgTotalProgress);
  259. $csv_content[] = array( get_lang('AverageResultsToTheExercices'),$avgResultsToExercises);
  260. $csv_content[] = array( get_lang('AveragePostsInForum'),$nb_posts);
  261. $csv_content[] = array( get_lang('AverageAssignments'),$nb_assignments);
  262. $csv_content[] = array();
  263. }
  264. // html part
  265. else
  266. {
  267. echo '
  268. <div class="admin_section">
  269. <h4>
  270. <a href="student.php"><img src="'.api_get_path(WEB_IMG_PATH).'students.gif">&nbsp;'.get_lang('Probationers').' ('.$nbStudents.')'.'</a>
  271. </h4>
  272. <table class="data_table">
  273. <tr>
  274. <td>
  275. '.get_lang('InactivesStudents').'
  276. </td>
  277. <td align="right">
  278. '.$nb_inactive_students.'
  279. </td>
  280. </tr>
  281. <tr>
  282. <td>
  283. '.get_lang('AverageTimeSpentOnThePlatform').'
  284. </td>
  285. <td align="right">
  286. '.api_time_to_hms($avgTimeSpent).'
  287. </td>
  288. </tr>
  289. <tr>
  290. <td>
  291. '.get_lang('AverageCoursePerStudent').'
  292. </td>
  293. <td align="right">
  294. '.$avgCoursesPerStudent.'
  295. </td>
  296. </tr>
  297. <tr>
  298. <td>
  299. '.get_lang('AverageProgressInLearnpath').'
  300. </td>
  301. <td align="right">
  302. '.round($avgTotalProgress,2).' %
  303. </td>
  304. </tr>
  305. <tr>
  306. <td>
  307. '.get_lang('AverageResultsToTheExercices').'
  308. </td>
  309. <td align="right">
  310. '.round($avgResultsToExercises,2).' %
  311. </td>
  312. </tr>
  313. <tr>
  314. <td>
  315. '.get_lang('AveragePostsInForum').'
  316. </td>
  317. <td align="right">
  318. '.round($nb_posts,2).'
  319. </td>
  320. </tr>
  321. <tr>
  322. <td>
  323. '.get_lang('AverageAssignments').'
  324. </td>
  325. <td align="right">
  326. '.round($nb_assignments,2).'
  327. </td>
  328. </tr>
  329. </table>
  330. <a href="student.php">'.get_lang('SeeStudentList').'</a>
  331. </div>';
  332. }
  333. }
  334. if($view == 'coach')
  335. {
  336. /****************************************
  337. * Infos about sessions of the coach
  338. ****************************************/
  339. $a_sessions = Tracking :: get_sessions_coached_by_user($_user['user_id']);
  340. $nbSessions = count($a_sessions);
  341. $nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0;
  342. $a_courses = array();
  343. foreach($a_sessions as $a_session)
  344. {
  345. if($a_session['date_start'] == '0000-00-00')
  346. {
  347. $nb_sessions_current ++;
  348. }
  349. else
  350. {
  351. $date_start = explode('-',$a_session['date_start']);
  352. $time_start = mktime(0,0,0,$date_start[1],$date_start[2],$date_start[0]);
  353. $date_end = explode('-',$a_session['date_end']);
  354. $time_end = mktime(0,0,0,$date_end[1],$date_end[2],$date_end[0]);
  355. if($time_start < time() && time() < $time_end)
  356. {
  357. $nb_sessions_current++;
  358. }
  359. else if(time() < $time_start)
  360. {
  361. $nb_sessions_future++;
  362. }
  363. else if(time() > $time_end)
  364. {
  365. $nb_sessions_past++;
  366. }
  367. }
  368. $a_courses = array_merge($a_courses, Tracking::get_courses_list_from_session($a_session['id']));
  369. }
  370. $nb_courses_per_session = round(count($a_courses)/$nbSessions,2);
  371. //csv part
  372. if($export_csv)
  373. {
  374. $csv_content[] = array( get_lang('Sessions'));
  375. $csv_content[] = array( get_lang('NbActiveSessions').';'.$nb_sessions_current);
  376. $csv_content[] = array( get_lang('NbPastSessions').';'.$nb_sessions_past);
  377. $csv_content[] = array( get_lang('NbFutureSessions').';'.$nb_sessions_future);
  378. $csv_content[] = array( get_lang('NbStudentPerSession').';'.round($nbStudents/$nbSessions,2));
  379. $csv_content[] = array( get_lang('NbCoursesPerSession').';'.$nb_courses_per_session);
  380. $csv_content[] = array();
  381. }
  382. // html part
  383. else
  384. {
  385. echo '
  386. <div class="admin_section">
  387. <h4>
  388. <a href="session.php"><img src="'.api_get_path(WEB_IMG_PATH).'sessions.gif">&nbsp;'.get_lang('Sessions').' ('.$nbSessions.')'.'</a>
  389. </h4>
  390. <table class="data_table">
  391. <tr>
  392. <td>
  393. '.get_lang('NbActiveSessions').'
  394. </td>
  395. <td align="right">
  396. '.$nb_sessions_current.'
  397. </td>
  398. </tr>
  399. <tr>
  400. <td>
  401. '.get_lang('NbPastSessions').'
  402. </td>
  403. <td align="right">
  404. '.$nb_sessions_past.'
  405. </td>
  406. </tr>
  407. <tr>
  408. <td>
  409. '.get_lang('NbFutureSessions').'
  410. </td>
  411. <td align="right">
  412. '.$nb_sessions_future.'
  413. </td>
  414. </tr>
  415. <tr>
  416. <td>
  417. '.get_lang('NbStudentPerSession').'
  418. </td>
  419. <td align="right">
  420. '.round($nbStudents/$nbSessions,2).'
  421. </td>
  422. </tr>
  423. <tr>
  424. <td>
  425. '.get_lang('NbCoursesPerSession').'
  426. </td>
  427. <td align="right">
  428. '.$nb_courses_per_session.'
  429. </td>
  430. </tr>
  431. </table>
  432. <a href="session.php">'.get_lang('SeeSessionList').'</a>
  433. </div>';
  434. }
  435. }
  436. echo '<div class="clear">&nbsp;</div>';
  437. if(api_is_allowed_to_create_course() && $view=='teacher')
  438. {
  439. if($nb_teacher_courses)
  440. {
  441. $table = new SortableTable('tracking_list_course', 'count_teacher_courses');
  442. $parameters['view'] = 'teacher';
  443. $table->set_additional_parameters($parameters);
  444. $table -> set_header(0, get_lang('CourseTitle'), false, 'align="center"');
  445. $table -> set_header(1, get_lang('NbStudents'), false);
  446. $table -> set_header(2, get_lang('AvgTimeSpentInTheCourse'), false);
  447. $table -> set_header(3, get_lang('AvgStudentsProgress'), false);
  448. $table -> set_header(4, get_lang('AvgStudentsScore'), false);
  449. $table -> set_header(5, get_lang('AvgMessages'), false);
  450. $table -> set_header(6, get_lang('AvgAssignments'), false);
  451. $table -> set_header(7, get_lang('Details'), false);
  452. $csv_content[] = array(
  453. get_lang('CourseTitle'),
  454. get_lang('NbStudents'),
  455. get_lang('AvgTimeSpentInTheCourse'),
  456. get_lang('AvgStudentsProgress'),
  457. get_lang('AvgStudentsScore'),
  458. get_lang('AvgMessages'),
  459. get_lang('AvgAssignments')
  460. );
  461. $a_course_students = array();
  462. foreach($a_courses as $course)
  463. {
  464. $course_code = $course['course_code'];
  465. $avg_assignments_in_course = $avg_messages_in_course = $nb_students_in_course = $avg_progress_in_course = $avg_score_in_course = $avg_time_spent_in_course = 0;
  466. // students directly subscribed to the course
  467. $sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status='5' AND course_rel_user.course_code='$course_code'";
  468. $rs = api_sql_query($sql, __FILE__, __LINE__);
  469. while($row = Database::fetch_array($rs))
  470. {
  471. $nb_students_in_course++;
  472. // tracking datas
  473. $avg_progress_in_course += Tracking :: get_avg_student_progress ($row['user_id'], $course_code);
  474. $avg_score_in_course += Tracking :: get_avg_student_score ($row['user_id'], $course_code);
  475. $avg_time_spent_in_course += Tracking :: get_time_spent_on_the_course ($row['user_id'], $course_code);
  476. $avg_messages_in_course += Tracking :: count_student_messages ($row['user_id'], $course_code);
  477. $avg_assignments_in_course += Tracking :: count_student_assignments ($row['user_id'], $course_code);
  478. $a_course_students[] = $row['user_id'];
  479. }
  480. // students subscribed to the course through a session
  481. if(api_get_setting('use_session_mode') == 'true')
  482. {
  483. $sql = 'SELECT id_user as user_id
  484. FROM '.$tbl_session_course_user.'
  485. WHERE course_code="'.addslashes($course_code).'" ORDER BY course_code';
  486. $rs = api_sql_query($sql, __FILE__, __LINE__);
  487. while($row = Database::fetch_array($rs))
  488. {
  489. if(!in_array($row['user_id'], $a_course_students))
  490. {
  491. $nb_students_in_course++;
  492. // tracking datas
  493. $avg_progress_in_course += Tracking :: get_avg_student_progress ($row['user_id'], $course_code);
  494. $avg_score_in_course += Tracking :: get_avg_student_score ($row['user_id'], $course_code);
  495. $avg_time_spent_in_course += Tracking :: get_time_spent_on_the_course ($row['user_id'], $course_code);
  496. $avg_messages_in_course += Tracking :: count_student_messages ($row['user_id'], $course_code);
  497. $avg_assignments_in_course += Tracking :: count_student_assignments ($row['user_id'], $course_code);
  498. $a_course_students[] = $row['user_id'];
  499. }
  500. }
  501. }
  502. if($nb_students_in_course>0)
  503. {
  504. $avg_time_spent_in_course = api_time_to_hms($avg_time_spent_in_course / $nb_students_in_course);
  505. $avg_progress_in_course = round($avg_progress_in_course / $nb_students_in_course,2).' %';
  506. $avg_score_in_course = round($avg_score_in_course / $nb_students_in_course,2).' %';
  507. $avg_messages_in_course = round($avg_messages_in_course / $nb_students_in_course,2);
  508. $avg_assignments_in_course = round($avg_assignments_in_course / $nb_students_in_course,2);
  509. }
  510. $table_row = array();
  511. $table_row[] = $course['title'];
  512. $table_row[] = $nb_students_in_course;
  513. $table_row[] = $avg_time_spent_in_course;
  514. $table_row[] = $avg_progress_in_course;
  515. $table_row[] = $avg_score_in_course;
  516. $table_row[] = $avg_messages_in_course;
  517. $table_row[] = $avg_assignments_in_course;
  518. $table_row[] = '<a href="../tracking/courseLog.php?cidReq='.$course_code.'&studentlist=true"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
  519. $csv_content[] = array(
  520. html_entity_decode($course['title']),
  521. $nb_students_in_course,
  522. $avg_time_spent_in_course,
  523. $avg_progress_in_course,
  524. $avg_score_in_course,
  525. $avg_messages_in_course,
  526. $avg_assignments_in_course,
  527. );
  528. $table -> addRow($table_row, 'align="right"');
  529. $a_course_students = array();
  530. }
  531. $table -> updateColAttributes(0,array('align'=>'left'));
  532. $table -> updateColAttributes(7,array('align'=>'center'));
  533. $table -> display();
  534. }
  535. }
  536. if(api_is_platform_admin() && $view=='admin')
  537. {
  538. echo '<a href="'.api_get_self().'?view=admin&amp;display=coaches">'.get_lang('DisplayCoaches').'</a> | ';
  539. echo '<a href="'.api_get_self().'?view=admin&amp;display=useroverview">'.get_lang('DisplayUserOverview').'</a>';
  540. if ($_GET['display'] == 'useroverview')
  541. {
  542. echo ' | <a href="'.api_get_self().'?view=admin&amp;display=useroverview&amp;export=options">'.get_lang('ExportUserOverviewOptions').'</a>';
  543. }
  544. if ($_GET['display'] === 'useroverview')
  545. {
  546. display_tracking_user_overview();
  547. }
  548. else
  549. {
  550. $tracking_column = isset($_GET['tracking_list_coaches_column']) ? $_GET['tracking_list_coaches_column'] : 0;
  551. $tracking_direction = (isset($_GET['tracking_list_coaches_direction']) && in_array(strtoupper($_GET['tracking_list_coaches_direction']),array('ASC','DESC','ASCENDING','DESCENDING','0','1'))) ? $_GET['tracking_list_coaches_direction'] : 'DESC';
  552. //prepare array for column order - when impossible, use lastname
  553. $order = array(0=>'firstname',1=>'lastname',2=>'lastname',3=>'login_date',4=>'lastname',5=>'lastname');
  554. $table = new SortableTable('tracking_list_coaches', 'count_coaches');
  555. $parameters['view'] = 'admin';
  556. $table->set_additional_parameters($parameters);
  557. $table -> set_header(0, get_lang('FirstName'), true, 'align="center"');
  558. $table -> set_header(1, get_lang('LastName'), true, 'align="center"');
  559. $table -> set_header(2, get_lang('TimeSpentOnThePlatform'), false);
  560. $table -> set_header(3, get_lang('LastConnexion'), true, 'align="center"');
  561. $table -> set_header(4, get_lang('NbStudents'), false);
  562. $table -> set_header(5, get_lang('CountCours'), false);
  563. $table -> set_header(6, get_lang('NumberOfSessions'), false);
  564. $table -> set_header(7, get_lang('Sessions'), false,'align="center"');
  565. $csv_content[] = array(
  566. get_lang('FirstName'),
  567. get_lang('LastName'),
  568. get_lang('TimeSpentOnThePlatform'),
  569. get_lang('LastConnexion'),
  570. get_lang('NbStudents'),
  571. get_lang('CountCours'),
  572. get_lang('NumberOfSessions')
  573. );
  574. $tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
  575. $sqlCoachs = " SELECT DISTINCT id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
  576. FROM $tbl_user, $tbl_session_course, $tbl_track_login
  577. WHERE id_coach=user_id AND login_user_id=user_id
  578. GROUP BY user_id " ;
  579. // ORDER BY login_date ".$tracking_direction;
  580. if(!empty($order[$tracking_column]))
  581. {
  582. $sqlCoachs .= "ORDER BY ".$order[$tracking_column]." ".$tracking_direction;
  583. }
  584. $result_coaches=api_sql_query($sqlCoachs, __FILE__, __LINE__);
  585. $total_no_coachs = Database::num_rows($result_coaches);
  586. $global_coachs=array();
  587. while($a_coach=Database::fetch_array($result_coaches)){
  588. $global_coachs[$a_coach['user_id']] = $a_coach;
  589. }
  590. $sql_session_coach = 'SELECT session.id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
  591. FROM '.$tbl_user.','.$tbl_sessions.' as session,'.$tbl_track_login.'
  592. WHERE id_coach=user_id AND login_user_id=user_id
  593. GROUP BY user_id
  594. ORDER BY login_date '.$tracking_direction;
  595. $result_sessions_coach=api_sql_query($sql_session_coach, __FILE__, __LINE__);
  596. $total_no_coachs += Database::num_rows($result_sessions_coach);
  597. while($a_coach=Database::fetch_array($result_sessions_coach)){
  598. $global_coachs[$a_coach['user_id']] = $a_coach;
  599. }
  600. $all_datas=array();
  601. foreach($global_coachs as $id_coach => $a_coachs){
  602. $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($a_coachs['user_id']));
  603. $last_connection = Tracking :: get_last_connection_date($a_coachs['user_id']);
  604. $nb_students = count(Tracking :: get_student_followed_by_coach($a_coachs['user_id']));
  605. $nb_courses = count(Tracking :: get_courses_followed_by_coach($a_coachs['user_id']));
  606. $nb_sessions = count(Tracking :: get_sessions_coached_by_user($a_coachs['user_id']));
  607. $table_row = array();
  608. $table_row[] = $a_coachs['firstname'];
  609. $table_row[] = $a_coachs['lastname'];
  610. $table_row[] = $time_on_platform;
  611. $table_row[] = $last_connection;
  612. $table_row[] = $nb_students;
  613. $table_row[] = $nb_courses;
  614. $table_row[] = $nb_sessions;
  615. $table_row[] = '<a href="session.php?id_coach='.$a_coachs['user_id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
  616. $all_datas[] = $table_row;
  617. $csv_content[] = array(
  618. html_entity_decode($a_coachs['firstname']),
  619. html_entity_decode($a_coachs['lastname']),
  620. $time_on_platform,
  621. $last_connection,
  622. $nb_courses,
  623. $nb_sessions
  624. );
  625. }
  626. if($tracking_column != 3){
  627. usort($all_datas, 'sort_users');
  628. if($tracking_direction == 'DESC')
  629. rsort($all_datas);
  630. }
  631. if($export_csv && $tracking_column != 3)
  632. {
  633. usort($csv_content, 'sort_users');
  634. }
  635. foreach($all_datas as $row)
  636. {
  637. $table -> addRow($row,'align="right"');
  638. }
  639. $table -> updateColAttributes(0,array('align'=>'left'));
  640. $table -> updateColAttributes(1,array('align'=>'left'));
  641. $table -> updateColAttributes(3,array('align'=>'left'));
  642. $table -> updateColAttributes(7,array('align'=>'center'));
  643. $table -> display();
  644. }
  645. }
  646. // send the csv file if asked
  647. if($export_csv)
  648. {
  649. ob_end_clean();
  650. /*echo "<pre>";
  651. print_r($csv_content);
  652. echo "</pre>";*/
  653. Export :: export_table_csv($csv_content, 'reporting_index');
  654. }
  655. //footer
  656. if(!$export_csv)
  657. {
  658. Display::display_footer();
  659. }
  660. /**
  661. * This function exports the table that we see in display_tracking_user_overview()
  662. *
  663. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  664. * @version Dokeos 1.8.6
  665. * @since October 2008
  666. */
  667. function export_tracking_user_overview()
  668. {
  669. // database table definitions
  670. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  671. // the values of the sortable table
  672. if ($_GET['tracking_user_overview_page_nr'])
  673. {
  674. $from = $_GET['tracking_user_overview_page_nr'];
  675. }
  676. else
  677. {
  678. $from = 0;
  679. }
  680. if ($_GET['tracking_user_overview_column'])
  681. {
  682. $orderby = $_GET['tracking_user_overview_column'];
  683. }
  684. else
  685. {
  686. $orderby = 0;
  687. }
  688. if ($_GET['tracking_user_overview_direction'])
  689. {
  690. $direction = $_GET['tracking_user_overview_direction'];
  691. }
  692. else
  693. {
  694. $direction = 'ASC';
  695. }
  696. $user_data = get_user_data_tracking_overview($from, 1000 , $orderby, $direction);
  697. // the first line of the csv file with the column headers
  698. $csv_row = array();
  699. $csv_row[] = get_lang('OfficialCode');
  700. $csv_row[] = get_lang('LastName');
  701. $csv_row[] = get_lang('FirstName');
  702. $csv_row[] = get_lang('LoginName');
  703. $csv_row[] = get_lang('CourseCode');
  704. // the additional user defined fields (only those that were selected to be exported)
  705. require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  706. $fields = UserManager::get_extra_fields(0,50,5,'ASC');
  707. foreach ($_SESSION['additional_export_fields'] as $key=>$extra_field_export)
  708. {
  709. $csv_row[] = $fields[$extra_field_export][3];
  710. $field_names_to_be_exported[] = 'extra_'.$fields[$extra_field_export][1];
  711. }
  712. $csv_row[] = get_lang('AvgTimeSpentInTheCourse');
  713. $csv_row[] = get_lang('AvgStudentsProgress');
  714. $csv_row[] = get_lang('AvgStudentsScore');
  715. $csv_row[] = get_lang('AvgMessages');
  716. $csv_row[] = get_lang('AvgAssignments');
  717. $csv_row[] = get_lang('TotalExercisesScoreObtained');
  718. $csv_row[] = get_lang('TotalExercisesScorePossible');
  719. $csv_row[] = get_lang('TotalExercisesAnswered');
  720. $csv_row[] = get_lang('TotalExercisesScorePercentage');
  721. $csv_row[] = get_lang('FirstLogin');
  722. $csv_row[] = get_lang('LatestLogin');
  723. $csv_content[] = $csv_row;
  724. // the other lines (the data)
  725. foreach($user_data as $key=>$user)
  726. {
  727. // getting all the courses of the user
  728. $sql = "SELECT * FROM $tbl_course_user WHERE user_id = '".Database::escape_string($user[4])."'";
  729. $result = api_sql_query($sql, __FILE__, __LINE__);
  730. while ($row = Database::fetch_row($result))
  731. {
  732. $csv_row = array();
  733. // user official code
  734. $csv_row[] = $user[0];
  735. // user last name
  736. $csv_row[] = $user[1];
  737. // user first name
  738. $csv_row[] = $user[2];
  739. // user login name
  740. $csv_row[] = $user[3];
  741. // course code
  742. $csv_row[] = $row[0];
  743. // the additional defined user fields
  744. $extra_fields = get_user_overview_export_extra_fields($user[4]);
  745. foreach ($field_names_to_be_exported as $key=>$extra_field_export)
  746. {
  747. $csv_row[] = $extra_fields[$extra_field_export];
  748. }
  749. // time spent in the course
  750. $csv_row[] = api_time_to_hms(Tracking :: get_time_spent_on_the_course ($user[4], $row[0]));
  751. // student progress in course
  752. $csv_row[] = Tracking :: get_avg_student_progress ($user[4], $row[0]);
  753. // student score
  754. $csv_row[] = Tracking :: get_avg_student_score ($user[4], $row[0]);
  755. // student messages
  756. $csv_row[] = Tracking :: count_student_messages ($user[4], $row[0]);
  757. // student assignments
  758. $csv_row[] = Tracking :: count_student_assignments ($user[4], $row[0]);
  759. // student exercises results
  760. $exercises_results = exercises_results($user[4], $row[0]);
  761. $csv_row[] = $exercises_results['score_obtained'];
  762. $csv_row[] = $exercises_results['score_possible'];
  763. $csv_row[] = $exercises_results['questions_answered'];
  764. $csv_row[] = $exercises_results['percentage'];
  765. // first connection
  766. $csv_row[] = Tracking :: get_first_connection_date_on_the_course ($user[4], $row[0]);
  767. // last connection
  768. $csv_row[] = strip_tags(Tracking :: get_last_connection_date_on_the_course ($user[4], $row[0]));
  769. $csv_content[] = $csv_row;
  770. }
  771. }
  772. Export :: export_table_csv($csv_content, 'reporting_user_overview');
  773. }
  774. /**
  775. * Display a sortable table that contains an overview off all the reporting progress of all users and all courses the user is subscribed to
  776. *
  777. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  778. * @version Dokeos 1.8.6
  779. * @since October 2008
  780. */
  781. function display_tracking_user_overview()
  782. {
  783. display_user_overview_export_options();
  784. $table = new SortableTable('tracking_user_overview', 'get_number_of_users_tracking_overview', 'get_user_data_tracking_overview',1);
  785. $table->set_header(0, get_lang('OfficialCode'));
  786. $table->set_header(1, get_lang('LastName'));
  787. $table->set_header(2, get_lang('FirstName'));
  788. $table->set_header(3, get_lang('LoginName'));
  789. $table->set_header(4, get_lang('CourseInformation'), false);
  790. $table->set_column_filter(4, 'course_info_tracking_filter');
  791. $table -> display();
  792. }
  793. /**
  794. * get the numer of users of the platform
  795. *
  796. * @return integer
  797. *
  798. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  799. * @version Dokeos 1.8.6
  800. * @since October 2008
  801. */
  802. function get_number_of_users_tracking_overview()
  803. {
  804. // database table definition
  805. $main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
  806. // query
  807. $sql = 'SELECT user_id FROM '.$main_user_table;
  808. $result = api_sql_query($sql, __FILE__, __LINE__);
  809. // return the number of results
  810. return Database::num_rows($result);
  811. }
  812. /**
  813. * get all the data for the sortable table of the reporting progress of all users and all the courses the user is subscribed to.
  814. *
  815. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  816. * @version Dokeos 1.8.6
  817. * @since October 2008
  818. */
  819. function get_user_data_tracking_overview($from, $number_of_items, $column, $direction)
  820. {
  821. // database table definition
  822. $main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
  823. $sql = "SELECT
  824. official_code AS col0,
  825. lastname AS col1,
  826. firstname AS col2,
  827. username AS col3,
  828. user_id AS col4
  829. FROM
  830. $main_user_table
  831. ";
  832. $sql .= " ORDER BY col$column $direction ";
  833. $sql .= " LIMIT $from,$number_of_items";
  834. $result = api_sql_query($sql, __FILE__, __LINE__);
  835. $return = array ();
  836. while ($user = Database::fetch_row($result))
  837. {
  838. $return[] = $user;
  839. }
  840. return $return;
  841. }
  842. /**
  843. * Creates a small table in the last column of the table with the user overview
  844. *
  845. * @param integer $user_id the id of the user
  846. * @param array $url_params additonal url parameters
  847. * @param array $row the row information (the other columns)
  848. * @return html code
  849. *
  850. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  851. * @version Dokeos 1.8.6
  852. * @since October 2008
  853. */
  854. function course_info_tracking_filter($user_id,$url_params,$row)
  855. {
  856. // the table header
  857. $return .= '<table class="data_table">';
  858. $return .= ' <tr>';
  859. $return .= ' <th>'.get_lang('Course').'</th>';
  860. $return .= ' <th>'.get_lang('AvgTimeSpentInTheCourse').'</th>';
  861. $return .= ' <th>'.get_lang('AvgStudentsProgress').'</th>';
  862. $return .= ' <th>'.get_lang('AvgStudentsScore').'</th>';
  863. $return .= ' <th>'.get_lang('AvgMessages').'</th>';
  864. $return .= ' <th>'.get_lang('AvgAssignments').'</th>';
  865. $return .= ' <th>'.get_lang('TotalExercisesScoreObtained').'</th>';
  866. $return .= ' <th>'.get_lang('TotalExercisesScorePossible').'</th>';
  867. $return .= ' <th>'.get_lang('TotalExercisesAnswered').'</th>';
  868. $return .= ' <th>'.get_lang('TotalExercisesScorePercentage').'</th>';
  869. $return .= ' <th>'.get_lang('FirstLogin').'</th>';
  870. $return .= ' <th>'.get_lang('LatestLogin').'</th>';
  871. $return .= ' </tr>';
  872. // database table definition
  873. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  874. // getting all the courses of the user
  875. $sql = "SELECT * FROM $tbl_course_user WHERE user_id = '".Database::escape_string($user_id)."'";
  876. $result = api_sql_query($sql, __FILE__, __LINE__);
  877. while ($row = Database::fetch_row($result))
  878. {
  879. $return .= '<tr>';
  880. // course code
  881. $return .= ' <td>'.$row[0].'</td>';
  882. // time spent in the course
  883. $return .= ' <td>'.api_time_to_hms(Tracking :: get_time_spent_on_the_course ($user_id, $row[0])).'</td>';
  884. // student progress in course
  885. $return .= ' <td>'.Tracking :: get_avg_student_progress ($user_id, $row[0]).'</td>';
  886. // student score
  887. $return .= ' <td>'.Tracking :: get_avg_student_score ($user_id, $row[0]).'</td>';
  888. // student messages
  889. $return .= ' <td>'.Tracking :: count_student_messages ($user_id, $row[0]).'</td>';
  890. // student assignments
  891. $return .= ' <td>'.Tracking :: count_student_assignments ($user_id, $row[0]).'</td>';
  892. // student exercises results (obtained score, maximum score, number of exercises answered, score percentage)
  893. $exercises_results = exercises_results($user_id, $row[0]);
  894. $return .= ' <td>'.$exercises_results['score_obtained'].'</td>';
  895. $return .= ' <td>'.$exercises_results['score_possible'].'</td>';
  896. $return .= ' <td>'.$exercises_results['questions_answered'].'</td>';
  897. $return .= ' <td>'.$exercises_results['percentage'].'% </td>';
  898. // first connection
  899. $return .= ' <td>'.Tracking :: get_first_connection_date_on_the_course ($user_id, $row[0]).'</td>';
  900. // last connection
  901. $return .= ' <td>'.Tracking :: get_last_connection_date_on_the_course ($user_id, $row[0]).'</td>';
  902. $return .= '<tr>';
  903. }
  904. $return .= '</table>';
  905. return $return;
  906. }
  907. /**
  908. * Get general information about the exercise performance of the user
  909. * the total obtained score (all the score on all the questions)
  910. * the maximum score that could be obtained
  911. * the number of questions answered
  912. * the success percentage
  913. *
  914. * @param integer $user_id the id of the user
  915. * @param string $course_code the course code
  916. *
  917. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  918. * @version Dokeos 1.8.6
  919. * @since November 2008
  920. */
  921. function exercises_results($user_id, $course_code)
  922. {
  923. $sql = 'SELECT exe_result , exe_weighting
  924. FROM '.Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES)."
  925. WHERE exe_cours_id = '".Database::escape_string($course_code)."'
  926. AND exe_user_id = '".Database::escape_string($user_id)."'";
  927. $result = api_sql_query($sql, __FILE__, __LINE__);
  928. while ($row = Database::fetch_array($result))
  929. {
  930. $score_obtained += $row['exe_result'];
  931. $score_possible += $row['exe_weighting'];
  932. $questions_answered ++;
  933. }
  934. $percentage = round(($score_obtained / $score_possible * 100),2);
  935. return array('score_obtained' => $score_obtained, 'score_possible' => $score_possible, 'questions_answered' => $questions_answered, 'percentage' => $percentage);
  936. }
  937. /**
  938. * Displays a form with all the additionally defined user fields of the profile
  939. * and give you the opportunity to include these in the CSV export
  940. *
  941. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  942. * @version Dokeos 1.8.6
  943. * @since November 2008
  944. */
  945. function display_user_overview_export_options()
  946. {
  947. // include the user manager and formvalidator library
  948. require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  949. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  950. if ($_GET['export'] == 'options')
  951. {
  952. // get all the defined extra fields
  953. $extrafields = UserManager::get_extra_fields(0,50,5,'ASC');
  954. // creating the form with all the defined extra fields
  955. $form = new FormValidator('exportextrafields', 'post', api_get_self()."?view=".Security::remove_XSS($_GET['view']).'&display='.Security::remove_XSS($_GET['display']).'&export='.Security::remove_XSS($_GET['export']));
  956. foreach ($extrafields as $key=>$extra)
  957. {
  958. $form->addElement('checkbox', 'extra_export_field'.$extra[0], '', $extra[3]);
  959. }
  960. $form->addElement('submit', null, get_lang('Ok'));
  961. // setting the default values for the form that contains all the extra fields
  962. foreach ($_SESSION['additional_export_fields'] as $key => $value)
  963. {
  964. $defaults['extra_export_field'.$value]=1;
  965. }
  966. $form->setDefaults($defaults);
  967. if ($form->validate())
  968. {
  969. // exporting the form values
  970. $values = $form->exportValues();
  971. // re-initialising the session that contains the additional fields that need to be exported
  972. $_SESSION['additional_export_fields'] = array();
  973. // adding the fields that are checked to the session
  974. $message='';
  975. foreach ($values as $field_ids => $value)
  976. {
  977. if ($value == 1 AND strstr($field_ids,'extra_export_field'))
  978. {
  979. $_SESSION['additional_export_fields'][] = str_replace('extra_export_field','',$field_ids);
  980. }
  981. }
  982. // adding the fields that will be also exported to a message string
  983. foreach ($_SESSION['additional_export_fields'] as $key=>$extra_field_export)
  984. {
  985. $message .= '<li>'.$extrafields[$extra_field_export][3].$count.'</li>';
  986. }
  987. // Displaying a feedback message
  988. if (!empty($_SESSION['additional_export_fields']))
  989. {
  990. Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>',false);
  991. }
  992. else
  993. {
  994. Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'),false);
  995. }
  996. $message = '';
  997. }
  998. else
  999. {
  1000. $form->display();
  1001. }
  1002. }
  1003. else
  1004. {
  1005. if (!empty($_SESSION['additional_export_fields']))
  1006. {
  1007. // get all the defined extra fields
  1008. $extrafields = UserManager::get_extra_fields(0,50,5,'ASC');
  1009. foreach ($_SESSION['additional_export_fields'] as $key=>$extra_field_export)
  1010. {
  1011. $message .= '<li>'.$extrafields[$extra_field_export][3].'</li>';
  1012. }
  1013. Display::display_normal_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>',false);
  1014. $message = '';
  1015. }
  1016. }
  1017. }
  1018. /**
  1019. * Get all information that the user with user_id = $user_data has
  1020. * entered in the additionally defined profile fields
  1021. *
  1022. * @param integer $user_id the id of the user
  1023. *
  1024. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  1025. * @version Dokeos 1.8.6
  1026. * @since November 2008
  1027. */
  1028. function get_user_overview_export_extra_fields($user_id)
  1029. {
  1030. // include the user manager
  1031. require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  1032. $extra_data = UserManager::get_extra_user_data($user_id,true);
  1033. return $extra_data;
  1034. }
  1035. ?>