user_portal.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101
  1. <?php
  2. // $Id: user_portal.php,v 1.10 2006/08/19 09:33:14 yannoo Exp $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2004-2005 Dokeos S.A.
  7. Copyright (c) 2003 Ghent University (UGent)
  8. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9. Copyright (c) various contributors
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  18. Mail: info@dokeos.com
  19. ==============================================================================
  20. */
  21. /**
  22. ==============================================================================
  23. * This is the index file displayed when a user is logged in on Dokeos.
  24. *
  25. * It displays:
  26. * - personal course list
  27. * - menu bar
  28. *
  29. * Part of the what's new ideas were based on a rene haentjens hack
  30. *
  31. * Search for
  32. * CONFIGURATION parameters
  33. * to modify settings
  34. *
  35. * @todo rewrite code to separate display, logic, database code
  36. * @package dokeos.main
  37. ==============================================================================
  38. */
  39. /*
  40. ==============================================================================
  41. INIT SECTION
  42. ==============================================================================
  43. */
  44. // Don't change these settings
  45. define('SCRIPTVAL_No', 0);
  46. define('SCRIPTVAL_InCourseList', 1);
  47. define('SCRIPTVAL_UnderCourseList', 2);
  48. define('SCRIPTVAL_Both', 3);
  49. define('SCRIPTVAL_NewEntriesOfTheDay', 4);
  50. define('SCRIPTVAL_NewEntriesOfTheDayOfLastLogin', 5);
  51. define('SCRIPTVAL_NoTimeLimit', 6);
  52. // End 'don't change' section
  53. $langFile = array ('courses', 'index');
  54. $cidReset = true; /* Flag forcing the 'current course' reset,
  55. as we're not inside a course anymore */
  56. /*
  57. -----------------------------------------------------------
  58. Included libraries
  59. -----------------------------------------------------------
  60. */
  61. //this includes main_api too:
  62. include_once ('./main/inc/global.inc.php');
  63. api_block_anonymous_users(); // only users who are logged in can proceed
  64. include_once (api_get_path(LIBRARY_PATH).'course.lib.php');
  65. include_once (api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
  66. include_once (api_get_path(LIBRARY_PATH).'system_announcements.lib.php');
  67. include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
  68. /*
  69. -----------------------------------------------------------
  70. Table definitions
  71. -----------------------------------------------------------
  72. */
  73. //new table definitions, using database library
  74. //these already have backticks around them!
  75. $main_user_table = Database :: get_main_table(MAIN_USER_TABLE);
  76. $main_admin_table = Database :: get_main_table(MAIN_ADMIN_TABLE);
  77. $main_course_table = Database :: get_main_table(MAIN_COURSE_TABLE);
  78. $main_course_user_table = Database :: get_main_table(MAIN_COURSE_USER_TABLE);
  79. $main_category_table = Database :: get_main_table(MAIN_CATEGORY_TABLE);
  80. /*
  81. -----------------------------------------------------------
  82. Constants and CONFIGURATION parameters
  83. -----------------------------------------------------------
  84. */
  85. // ---- Course list options ----
  86. define('CONFVAL_showCourseLangIfNotSameThatPlatform', TRUE);
  87. // Preview of course content
  88. // to disable all: set CONFVAL_maxTotalByCourse = 0
  89. // to enable all: set e.g. CONFVAL_maxTotalByCourse = 5
  90. // by default disabled since what's new icons are better (see function display_digest() )
  91. define('CONFVAL_maxValvasByCourse', 2); // Maximum number of entries
  92. define('CONFVAL_maxAgendaByCourse', 2); // collected from each course
  93. define('CONFVAL_maxTotalByCourse', 0); // and displayed in summary.
  94. define('CONFVAL_NB_CHAR_FROM_CONTENT', 80);
  95. // Order to sort data
  96. $orderKey = array('keyTools', 'keyTime', 'keyCourse'); // default "best" Choice
  97. //$orderKey = array('keyTools', 'keyCourse', 'keyTime');
  98. //$orderKey = array('keyCourse', 'keyTime', 'keyTools');
  99. //$orderKey = array('keyCourse', 'keyTools', 'keyTime');
  100. define('CONFVAL_showExtractInfo', SCRIPTVAL_UnderCourseList);
  101. // SCRIPTVAL_InCourseList // best choice if $orderKey[0] == 'keyCourse'
  102. // SCRIPTVAL_UnderCourseList // best choice
  103. // SCRIPTVAL_Both // probably only for debug
  104. //define('CONFVAL_dateFormatForInfosFromCourses', get_lang('dateFormatShort'));
  105. define('CONFVAL_dateFormatForInfosFromCourses', get_lang('dateFormatLong'));
  106. //define("CONFVAL_limitPreviewTo",SCRIPTVAL_NewEntriesOfTheDay);
  107. //define("CONFVAL_limitPreviewTo",SCRIPTVAL_NoTimeLimit);
  108. define("CONFVAL_limitPreviewTo", SCRIPTVAL_NewEntriesOfTheDayOfLastLogin);
  109. if(api_is_allowed_to_create_course() && !isset($_GET['sessionview'])){
  110. $nosession = true;
  111. }
  112. else {
  113. $nosession = false;
  114. }
  115. if(api_get_setting('use_session_mode')=='true' && !$nosession)
  116. {
  117. if (isset($_GET['inactives'])){
  118. $display_actives = false;
  119. }
  120. else {
  121. $display_actives = true;
  122. }
  123. }
  124. $nameTools = get_lang('MyCourses');
  125. $this_section = SECTION_COURSES;
  126. /*
  127. -----------------------------------------------------------
  128. Check configuration parameters integrity
  129. -----------------------------------------------------------
  130. */
  131. if (CONFVAL_showExtractInfo != SCRIPTVAL_UnderCourseList and $orderKey[0] != "keyCourse")
  132. {
  133. // CONFVAL_showExtractInfo must be SCRIPTVAL_UnderCourseList to accept $orderKey[0] !="keyCourse"
  134. if (DEBUG || api_is_platform_admin()) // Show bug if admin. Else force a new order
  135. die('
  136. <strong>config error:'.__FILE__.'</strong><br />
  137. set
  138. <ul>
  139. <li>
  140. CONFVAL_showExtractInfo = SCRIPTVAL_UnderCourseList
  141. (actually : '.CONFVAL_showExtractInfo.')
  142. </li>
  143. </ul>
  144. or
  145. <ul>
  146. <li>
  147. $orderKey[0] != "keyCourse"
  148. (actually : '.$orderKey[0].')
  149. </li>
  150. </ul>');
  151. else
  152. {
  153. $orderKey = array ('keyCourse', 'keyTools', 'keyTime');
  154. }
  155. }
  156. /*
  157. -----------------------------------------------------------
  158. Header
  159. include the HTTP, HTML headers plus the top banner
  160. -----------------------------------------------------------
  161. */
  162. Display :: display_header($nameTools);
  163. /*
  164. ==============================================================================
  165. FUNCTIONS
  166. display_admin_links()
  167. display_create_course_link()
  168. display_edit_course_list_links()
  169. display_digest($toolsList, $digest, $orderKey, $courses)
  170. show_notification($mycours)
  171. get_personal_course_list($user_id)
  172. get_logged_user_course_html($mycours)
  173. get_user_course_categories()
  174. ==============================================================================
  175. */
  176. /*
  177. -----------------------------------------------------------
  178. Database functions
  179. some of these can go to database layer.
  180. -----------------------------------------------------------
  181. */
  182. /**
  183. * Database function that gets the list of courses for a particular user.
  184. * @param $user_id, the id of the user
  185. * @return an array with courses
  186. */
  187. function get_personal_course_list($user_id)
  188. {
  189. $personal_course_list = array();
  190. $main_user_table = Database :: get_main_table(MAIN_USER_TABLE);
  191. $main_course_table = Database :: get_main_table(MAIN_COURSE_TABLE);
  192. $main_course_user_table = Database :: get_main_table(MAIN_COURSE_USER_TABLE);
  193. $personal_course_list_sql = "SELECT course.code k, course.directory d, course.visual_code c, course.db_name db, course.title i,
  194. course.tutor_name t, course.course_language l, course_rel_user.status s, course_rel_user.sort sort,
  195. course_rel_user.user_course_cat user_course_cat
  196. FROM ".$main_course_table." course,".$main_course_user_table." course_rel_user
  197. WHERE course.code = course_rel_user.course_code"."
  198. AND course_rel_user.user_id = '".$user_id."'
  199. ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC,course.title,course.code";
  200. $course_list_sql_result = api_sql_query($personal_course_list_sql, __FILE__, __LINE__);
  201. $personal_course_list = array ();
  202. while ($result_row = mysql_fetch_array($course_list_sql_result))
  203. {
  204. $personal_course_list[] = $result_row;
  205. }
  206. return $personal_course_list;
  207. }
  208. function get_personal_session_course_list($user_id, $list_sessions){
  209. global $_uid;
  210. $tbl_course = Database :: get_main_table(MAIN_COURSE_TABLE);
  211. $tbl_user = Database :: get_main_table(MAIN_USER_TABLE);
  212. $tbl_session = Database :: get_main_table(MAIN_SESSION_TABLE);
  213. $tbl_course_user = Database :: get_main_table(MAIN_COURSE_USER_TABLE);
  214. $tbl_session_course = Database :: get_main_table(MAIN_SESSION_COURSE_TABLE);
  215. $tbl_session_course_user = Database :: get_main_table(MAIN_SESSION_COURSE_USER_TABLE);
  216. $tbl_session_rel_user = Database :: get_main_table(MAIN_SESSION_USER_TABLE);
  217. $personal_course_list_sql="";
  218. $personal_course_list = array();
  219. // get the list of sessions where the user is subscribed / coach
  220. $result=api_sql_query("SELECT DISTINCT id, name, date_start, date_end, 5 as s
  221. FROM session_rel_user, session
  222. WHERE id_session=id AND id_user=$_uid ORDER BY date_start, date_end, name",__FILE__,__LINE__);
  223. $Sessions=api_store_result($result);
  224. $Sessions = array_merge($Sessions , api_store_result($result));
  225. $result=api_sql_query("SELECT DISTINCT id, name, date_start, date_end, 2 as s
  226. FROM $tbl_session as session
  227. INNER JOIN $tbl_session_course as session_rel_course
  228. ON session_rel_course.id_coach = $_uid
  229. ORDER BY date_start, date_end, name",__FILE__,__LINE__);
  230. //global $sessionIsCoach;
  231. $sessionIsCoach = api_store_result($result);
  232. $Sessions = array_merge($Sessions , $sessionIsCoach);
  233. $result=api_sql_query("SELECT DISTINCT id, name, date_start, date_end, 2 as s
  234. FROM $tbl_session as session
  235. WHERE session.id_coach = $_uid
  236. ORDER BY date_start, date_end, name",__FILE__,__LINE__);
  237. $Sessions = array_merge($Sessions , api_store_result($result));
  238. if(api_is_allowed_to_create_course())
  239. {
  240. foreach($Sessions as $enreg){
  241. $id_session = $enreg['id'];
  242. $personal_course_list_sql = "SELECT DISTINCT course.code k, course.directory d, course.visual_code c, course.db_name db, course.title i, CONCAT(user.lastname,' ',user.firstname) t, email, course.course_language l, 1 sort, category_code user_course_cat, date_start, date_end, session.id as id_session, session.name as session_name
  243. FROM $tbl_session_course as session_course
  244. INNER JOIN $tbl_course AS course
  245. ON course.code = session_course.course_code
  246. INNER JOIN $tbl_session as session
  247. ON session.id = session_course.id_session
  248. LEFT JOIN $tbl_user as user
  249. ON user.user_id = session_course.id_coach
  250. WHERE session_course.id_session = $id_session
  251. AND (session_course.id_coach=$user_id OR session.id_coach=$user_id)
  252. ORDER BY i";
  253. $course_list_sql_result = api_sql_query($personal_course_list_sql, __FILE__, __LINE__);
  254. while ($result_row = mysql_fetch_array($course_list_sql_result))
  255. {
  256. $result_row['s'] = 1;
  257. $key = $result_row['id_session'].' - '.$result_row['k'];
  258. $personal_course_list[$key] = $result_row;
  259. }
  260. }
  261. }
  262. foreach($Sessions as $enreg){
  263. $id_session = $enreg['id'];
  264. $personal_course_list_sql = "SELECT DISTINCT course.code k, course.directory d, course.visual_code c, course.db_name db, course.title i, CONCAT(user.lastname,' ',user.firstname) t, email, course.course_language l, 1 sort, category_code user_course_cat, date_start, date_end, session.id as id_session, session.name as session_name
  265. FROM $tbl_session_course as session_course
  266. INNER JOIN $tbl_course AS course
  267. ON course.code = session_course.course_code
  268. LEFT JOIN $tbl_user as user
  269. ON user.user_id = session_course.id_coach
  270. INNER JOIN $tbl_session_course_user
  271. ON $tbl_session_course_user.id_session = $id_session
  272. AND $tbl_session_course_user.id_user = $user_id
  273. INNER JOIN $tbl_session as session
  274. ON session_course.id_session = session.id
  275. WHERE session_course.id_session = $id_session
  276. ORDER BY i";
  277. $course_list_sql_result = api_sql_query($personal_course_list_sql, __FILE__, __LINE__);
  278. while ($result_row = mysql_fetch_array($course_list_sql_result))
  279. {
  280. $key = $result_row['id_session'].' - '.$result_row['k'];
  281. $result_row['s'] = $enreg['s'];
  282. if(!isset($personal_course_list[$key])) {
  283. $personal_course_list[$key] = $result_row;
  284. }
  285. }
  286. }
  287. return $personal_course_list;
  288. }
  289. /*
  290. -----------------------------------------------------------
  291. Display functions
  292. -----------------------------------------------------------
  293. */
  294. /**
  295. * Warning: this function defines a global.
  296. */
  297. function display_admin_links()
  298. {
  299. global $rootAdminWeb;
  300. echo "<li><a href=\"".$rootAdminWeb."\">".get_lang("PlatformAdmin")."</a></li>";
  301. }
  302. function display_create_course_link()
  303. {
  304. echo "<li><a href=\"main/create_course/add_course.php\">".get_lang("CourseCreate")."</a></li>";
  305. }
  306. function display_edit_course_list_links()
  307. {
  308. echo "<li><a href=\"main/auth/courses.php\">".get_lang("CourseManagement")."</a></li>";
  309. }
  310. /**
  311. * Displays a digest e.g. short summary of new agenda and announcements items.
  312. * This used to be displayed in the right hand menu, but is now
  313. * disabled by default (see config settings in this file) because most people like
  314. * the what's new icons better.
  315. *
  316. * @version 1.0
  317. */
  318. function display_digest($toolsList, $digest, $orderKey, $courses)
  319. {
  320. if (is_array($digest) && (CONFVAL_showExtractInfo == SCRIPTVAL_UnderCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both))
  321. {
  322. // // // LEVEL 1 // // //
  323. reset($digest);
  324. echo "<br/><br/>\n";
  325. while (list ($key1) = each($digest))
  326. {
  327. if (is_array($digest[$key1]))
  328. {
  329. // // // Title of LEVEL 1 // // //
  330. echo "<b>\n";
  331. if ($orderKey[0] == 'keyTools')
  332. {
  333. $tools = $key1;
  334. echo $toolsList[$key1][name];
  335. }
  336. elseif ($orderKey[0] == 'keyCourse')
  337. {
  338. $courseSysCode = $key1;
  339. echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key1][coursePath], "\">", $courses[$key1][courseCode], "</a>\n";
  340. }
  341. elseif ($orderKey[0] == 'keyTime')
  342. {
  343. echo format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($digest[$key1]));
  344. }
  345. echo "</b>\n";
  346. // // // End Of Title of LEVEL 1 // // //
  347. // // // LEVEL 2 // // //
  348. reset($digest[$key1]);
  349. while (list ($key2) = each($digest[$key1]))
  350. {
  351. // // // Title of LEVEL 2 // // //
  352. echo "<p>\n", "\n";
  353. if ($orderKey[1] == 'keyTools')
  354. {
  355. $tools = $key2;
  356. echo $toolsList[$key2][name];
  357. }
  358. elseif ($orderKey[1] == 'keyCourse')
  359. {
  360. $courseSysCode = $key2;
  361. echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key2]['coursePath'], "\">", $courses[$key2]['courseCode'], "</a>\n";
  362. }
  363. elseif ($orderKey[1] == 'keyTime')
  364. {
  365. echo format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
  366. }
  367. echo "\n";
  368. echo "</p>";
  369. // // // End Of Title of LEVEL 2 // // //
  370. // // // LEVEL 3 // // //
  371. reset($digest[$key1][$key2]);
  372. while (list ($key3, $dataFromCourse) = each($digest[$key1][$key2]))
  373. {
  374. // // // Title of LEVEL 3 // // //
  375. if ($orderKey[2] == 'keyTools')
  376. {
  377. $level3title = "<a href=\"".$toolsList[$key3]["path"].$courseSysCode."\">".$toolsList[$key3]["name"]."</a>";
  378. }
  379. elseif ($orderKey[2] == 'keyCourse')
  380. {
  381. $level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$key3."\">".$courses[$key3]['courseCode']."</a>\n";
  382. }
  383. elseif ($orderKey[2] == 'keyTime')
  384. {
  385. $level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$courseSysCode."\">".format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3))."</a>";
  386. }
  387. // // // End Of Title of LEVEL 3 // // //
  388. // // // LEVEL 4 (data) // // //
  389. reset($digest[$key1][$key2][$key3]);
  390. while (list ($key4, $dataFromCourse) = each($digest[$key1][$key2][$key3]))
  391. {
  392. echo $level3title, ' &ndash; ', substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT);
  393. //adding ... (three dots) if the texts are too large and they are shortened
  394. if (strlen($dataFromCourse) >= CONFVAL_NB_CHAR_FROM_CONTENT)
  395. {
  396. echo '...';
  397. }
  398. }
  399. echo "<br/>\n";
  400. }
  401. }
  402. }
  403. }
  404. }
  405. } // end function display_digest
  406. /**
  407. * Display code for one specific course a logged in user is subscribed to.
  408. * Shows a link to the course, what's new icons...
  409. *
  410. * $mycours['d'] - course directory
  411. * $mycours['i'] - course title
  412. * $mycours['c'] - visual course code
  413. * $mycours['k'] - system course code
  414. * $mycours['db'] - course database
  415. *
  416. * @version 1.0.3
  417. * @todo refactor into different functions for database calls | logic | display
  418. * @todo replace single-character $mycours['d'] indices
  419. * @todo move code for what's new icons to a separate function to clear things up
  420. */
  421. function get_logged_user_course_html($mycours)
  422. {
  423. global $nosession;
  424. if(api_get_setting('use_session_mode')=='true' && !$nosession){
  425. global $now, $date_start, $date_end;
  426. }
  427. //initialise
  428. $result = '';
  429. //$statistic_database = Database::get_statistic_database();
  430. $user_id = api_get_user_id();
  431. $course_database = $mycours['db'];
  432. $course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
  433. $tool_edit_table = Database::get_course_table(LAST_TOOL_EDIT_TABLE, $course_database);
  434. $course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database);
  435. $course_system_code = $mycours['k'];
  436. $course_visual_code = $mycours['c'];
  437. $course_title = $mycours['i'];
  438. $course_directory = $mycours['d'];
  439. $course_teacher = $mycours['t'];
  440. $course_info = Database :: get_course_info($course_system_code);
  441. $course_access_settings = CourseManager :: get_access_settings($course_system_code);
  442. $course_id = $course_info['course_id'];
  443. $course_visibility = $course_access_settings['visibility'];
  444. $user_in_course_status = CourseManager :: get_user_in_course_status($user_id, $course_system_code);
  445. //function logic - act on the data
  446. $is_virtual_course = CourseManager :: is_virtual_course_from_system_code($mycours['c']);
  447. if ($is_virtual_course)
  448. {
  449. // If the current user is also subscribed in the real course to which this
  450. // virtual course is linked, we don't need to display the virtual course entry in
  451. // the course list - it is combined with the real course entry.
  452. $target_course_code = CourseManager :: get_target_of_linked_course($course_system_code);
  453. $is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course($user_id, $target_course_code);
  454. if ($is_subscribed_in_target_course)
  455. {
  456. return; //do not display this course entry
  457. }
  458. }
  459. $has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course_system_code, $user_id);
  460. if ($has_virtual_courses)
  461. {
  462. $return_result = CourseManager :: determine_course_title_from_course_info($user_id, $course_info);
  463. $course_display_title = $return_result['title'];
  464. $course_display_code = $return_result['code'];
  465. }
  466. else
  467. {
  468. $course_display_title = $course_title;
  469. $course_display_code = $course_visual_code;
  470. }
  471. $s_course_status=$mycours["s"];
  472. $s_htlm_status_icon="";
  473. if($s_course_status==1){
  474. $s_htlm_status_icon="<img src='main/img/staryellow.jpg'>";
  475. }
  476. if($s_course_status==2){
  477. $s_htlm_status_icon="<img src='main/img/starblue.jpg'>";
  478. }
  479. if($s_course_status==5){
  480. $s_htlm_status_icon="<img src='main/img/stargreen.jpg'>";
  481. }
  482. //display course entry
  483. $result.="\n\t";
  484. $result .= '<li style="list-style-type: none;"><div style="border:0px solid #000; width: auto; float:left;padding-right: 5px;">'.$s_htlm_status_icon.'</div>';
  485. //show a hyperlink to the course, unless the course is closed and user is not course admin
  486. if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
  487. {
  488. if(api_get_setting('use_session_mode')=='true' && !$nosession){
  489. if(empty($mycours['id_session']))
  490. $mycours['id_session'] = 0;
  491. if($user_in_course_status == COURSEMANAGER || ($date_start <= $now && $date_end >= $now) || $date_start=='0000-00-00')
  492. {
  493. $result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$mycours['id_session'].'">'.$course_display_title.'</a>';
  494. }
  495. }
  496. else {
  497. $result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/">'.$course_display_title.'</a>';
  498. }
  499. }
  500. else
  501. {
  502. $result .= $course_display_title." "." ".get_lang("CourseClosed")."";
  503. }
  504. // show the course_code and teacher if chosen to display this
  505. if (get_setting("display_coursecode_in_courselist") == "true" OR get_setting("display_teacher_in_courselist") == "true")
  506. {
  507. $result .= "<br/>";
  508. }
  509. if (get_setting("display_coursecode_in_courselist") == "true")
  510. {
  511. $result .= $course_display_code;
  512. }
  513. if (get_setting("display_coursecode_in_courselist") == "true" AND get_setting("display_teacher_in_courselist") == "true")
  514. {
  515. $result .= ' &ndash; ';
  516. }
  517. if (get_setting("display_teacher_in_courselist") == "true")
  518. {
  519. $result .= $course_teacher;
  520. }
  521. // display the what's new icons
  522. $result .= show_notification($mycours);
  523. /*
  524. // get the user's last access dates to all tools of this course
  525. $sqlLastTrackInCourse = "SELECT * FROM $statistic_database.track_e_lastaccess"
  526. ." WHERE access_user_id = ".$user_id
  527. ." AND access_cours_code = '".$mycours['k']."'";
  528. $resLastTrackInCourse = api_sql_query($sqlLastTrackInCourse,__FILE__,__LINE__);
  529. while($lastTrackInCourse = mysql_fetch_array($resLastTrackInCourse))
  530. {
  531. $lastTrackInCourseDate[$lastTrackInCourse["access_tool"]] = $lastTrackInCourse["access_date"];
  532. }
  533. // get the last edits of all tools of this course
  534. $sql = "SELECT tooledit.lastedit_date last_date, tooledit.tool tool, tooledit.ref ref,
  535. tooledit.lastedit_type type, tooledit.to_group_id group_id,
  536. accueil.image image, accueil.link link
  537. FROM $tool_edit_table tooledit, $course_tool_table accueil
  538. WHERE accueil.name = tooledit.tool
  539. AND accueil.visibility = '1'
  540. AND tooledit.insert_user_id != $user_id
  541. AND (tooledit.to_user_id = '$user_id' OR tooledit.to_user_id = 0)";
  542. $res = api_sql_query($sql,__FILE__,__LINE__);
  543. $sql = "SELECT group_id FROM $course_group_user_table WHERE user_id = '$user_id'";
  544. $groupres = api_sql_query($sql,__FILE__,__LINE__);
  545. $groups = mysql_fetch_array($groupres);
  546. $groups[] = 0;
  547. //show icons of tools where there is something new
  548. while($lastToolEdit = mysql_fetch_array($res))
  549. {
  550. if ($lastTrackInCourseDate[$lastToolEdit["tool"]]<$lastToolEdit["last_date"] && in_array($lastToolEdit["group_id"], $groups))
  551. {
  552. $lastDate = date("d/m/Y H:i", convert_mysql_date($lastToolEdit["last_date"]));
  553. $type = ($lastToolEdit["type"]=="" || $lastToolEdit["type"]==NULL) ? get_lang('_new_item') : $lastToolEdit["type"];
  554. $result.= '<a href="'.api_get_path(WEB_CODE_PATH).$lastToolEdit['link'].'?cidReq='.$mycours['k'].'">'.
  555. '<img title="&mdash; '.$lastToolEdit['tool'].' &mdash; '.get_lang('_title_notification').": $type ($lastDate).\""
  556. .' src="'.api_get_path(WEB_IMG_PATH).$lastToolEdit['image'].'" border="0" align="middle" alt="'.$lastToolEdit['image'].'" /></a>';
  557. }
  558. }
  559. unset($lastTrackInCourseDate);
  560. unset($groups);*/
  561. if ((CONFVAL_showExtractInfo == SCRIPTVAL_InCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both) && $nbDigestEntries > 0)
  562. {
  563. reset($digest);
  564. $result .= "<ul>";
  565. while (list ($key2) = each($digest[$thisCourseSysCode]))
  566. {
  567. $result .= "<li>";
  568. if ($orderKey[1] == 'keyTools')
  569. {
  570. $result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
  571. $result .= "$toolsList[$key2][\"name\"]</a>";
  572. }
  573. else
  574. {
  575. $result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
  576. }
  577. $result .= "</li>";
  578. $result .= "<ul>";
  579. reset($digest[$thisCourseSysCode][$key2]);
  580. while (list ($key3, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2]))
  581. {
  582. $result .= "<li>";
  583. if ($orderKey[2] == 'keyTools')
  584. {
  585. $result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
  586. $result .= "$toolsList[$key3][\"name\"]</a>";
  587. }
  588. else
  589. {
  590. $result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3));
  591. }
  592. $result .= "<ul compact=\"compact\">";
  593. reset($digest[$thisCourseSysCode][$key2][$key3]);
  594. while (list ($key4, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2][$key3]))
  595. {
  596. $result .= "<li>";
  597. $result .= htmlspecialchars(substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
  598. $result .= "</li>";
  599. }
  600. $result .= "</ul>";
  601. $result .= "</li>";
  602. }
  603. $result .= "</ul>";
  604. $result .= "</li>";
  605. }
  606. $result .= "</ul>";
  607. }
  608. $result .= "</li>";
  609. if(api_get_setting('use_session_mode')=='true' && !$nosession){
  610. if(!empty($mycours['session_name'])){
  611. $session = $mycours['session_name'];
  612. if($date_start=='0000-00-00'){
  613. $session .= ' - '.get_lang('Without time limits');
  614. $active = true;
  615. }
  616. else {
  617. $session .= ' - '.get_lang('From').' '.$mycours['date_start'].' '.get_lang('To').' '.$mycours['date_end'];
  618. $active = ($date_start <= $now && $date_end >= $now)?true:false;
  619. }
  620. }
  621. $output = array ($mycours['user_course_cat'], $result, $mycours['id_session'], $session, 'active'=>$active);
  622. }
  623. else {
  624. $output = array ($mycours['user_course_cat'], $result);
  625. }
  626. return $output;
  627. }
  628. /**
  629. * Returns the "what's new" icon notifications
  630. * @version
  631. */
  632. function show_notification($mycours)
  633. {
  634. $statistic_database = Database :: get_statistic_database();
  635. $user_id = api_get_user_id();
  636. $course_database = $mycours['db'];
  637. $course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
  638. $tool_edit_table = Database::get_course_table(LAST_TOOL_EDIT_TABLE, $course_database);
  639. $course_group_user_table = Database :: get_course_table(GROUP_USER_TABLE, $course_database);
  640. // get the user's last access dates to all tools of this course
  641. $sqlLastTrackInCourse = "SELECT * FROM $statistic_database.track_e_lastaccess
  642. USE INDEX (access_cours_code, access_user_id)
  643. WHERE access_cours_code = '".$mycours['k']."'
  644. AND access_user_id = '$user_id'";
  645. $resLastTrackInCourse = api_sql_query($sqlLastTrackInCourse, __FILE__, __LINE__);
  646. $oldestTrackDate = "3000-01-01 00:00:00";
  647. while ($lastTrackInCourse = mysql_fetch_array($resLastTrackInCourse))
  648. {
  649. $lastTrackInCourseDate[$lastTrackInCourse["access_tool"]] = $lastTrackInCourse["access_date"];
  650. if ($oldestTrackDate > $lastTrackInCourse["access_date"])
  651. $oldestTrackDate = $lastTrackInCourse["access_date"];
  652. }
  653. // get the last edits of all tools of this course
  654. $sql = "SELECT tet.*, tet.lastedit_date last_date, tet.tool tool, tet.ref ref,
  655. tet.lastedit_type type, tet.to_group_id group_id,
  656. ctt.image image, ctt.link link
  657. FROM $tool_edit_table tet, $course_tool_table ctt
  658. WHERE tet.lastedit_date > '$oldestTrackDate'
  659. AND ctt.name = tet.tool
  660. AND ctt.visibility = '1'
  661. AND tet.lastedit_user_id != $user_id
  662. ORDER BY tet.lastedit_date";
  663. $res = api_sql_query($sql);
  664. //get the group_id's with user membership
  665. $group_ids = GroupManager :: get_group_ids($course_database, $user_id);
  666. $groups_ids[] = 0; //add group 'everyone'
  667. //filter all selected items
  668. while ($res && ($item_property = mysql_fetch_array($res)))
  669. {
  670. if ((!isset ($lastTrackInCourseDate[$item_property['tool']]) || $lastTrackInCourseDate[$item_property['tool']] < $item_property['lastedit_date']) && (in_array($item_property['to_group_id'], $groups_ids) || $item_property['to_user_id'] == $user_id) && ($item_property['visibility'] == '1' || ($mycours['s'] == '1' && $item_property['visibility'] == '0') || !isset ($item_property['visibility'])))
  671. {
  672. $notifications[$item_property['tool']] = $item_property;
  673. }
  674. }
  675. //show all tool icons where there is something new
  676. $retvalue = '&nbsp;';
  677. if (isset ($notifications))
  678. {
  679. while (list ($key, $notification) = each($notifications))
  680. {
  681. $lastDate = date("d/m/Y H:i", convert_mysql_date($notification['lastedit_date']));
  682. $type = $notification['lastedit_type'];
  683. //$notification[image]=str_replace(".png","gif",$notification[image]);
  684. //$notification[image]=str_replace(".gif","_s.gif",$notification[image]);
  685. $retvalue .= '<a href="'.api_get_path(WEB_CODE_PATH).$notification['link'].'?cidReq='.$mycours['k'].'&amp;ref='.$notification['ref'].'">'.'<img title="-- '.get_lang($notification['tool']).' -- '.get_lang('_title_notification').": $type ($lastDate).\"".' src="'.api_get_path(WEB_CODE_PATH).'img/'.$notification['image'].'" border="0" align="middle" /></a>&nbsp;';
  686. }
  687. }
  688. return $retvalue;
  689. }
  690. /**
  691. * retrieves the user defined course categories
  692. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  693. * @return array containing all the titles of the user defined courses with the id as key of the array
  694. */
  695. function get_user_course_categories()
  696. {
  697. global $_uid;
  698. $table_category = Database::get_user_personal_table(USER_COURSE_CATEGORY_TABLE);
  699. $sql = "SELECT * FROM ".$table_category." WHERE user_id='".$_uid."'";
  700. $result = api_sql_query($sql,__FILE__,__LINE__);
  701. while ($row = mysql_fetch_array($result))
  702. {
  703. $output[$row['id']] = $row['title'];
  704. }
  705. return $output;
  706. }
  707. /*
  708. ==============================================================================
  709. MAIN CODE
  710. ==============================================================================
  711. */
  712. /*
  713. ==============================================================================
  714. PERSONAL COURSE LIST
  715. ==============================================================================
  716. */
  717. if (!isset ($maxValvas))
  718. $maxValvas = CONFVAL_maxValvasByCourse; // Maximum number of entries
  719. if (!isset ($maxAgenda))
  720. $maxAgenda = CONFVAL_maxAgendaByCourse; // collected from each course
  721. if (!isset ($maxCourse))
  722. $maxCourse = CONFVAL_maxTotalByCourse; // and displayed in summary.
  723. $maxValvas = (int) $maxValvas;
  724. $maxAgenda = (int) $maxAgenda;
  725. $maxCourse = (int) $maxCourse; // 0 if invalid
  726. if ($maxCourse > 0)
  727. {
  728. unset ($allentries); // we shall collect all summary$key1 entries in here:
  729. $toolsList['agenda']['name'] = get_lang('Agenda');
  730. $toolsList['agenda']['path'] = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=";
  731. $toolsList['valvas']['name'] = get_lang('Valvas');
  732. $toolsList['valvas']['path'] = api_get_path(WEB_CODE_PATH)."announcements/announcements.php?cidReq=";
  733. }
  734. /*
  735. -----------------------------------------------------------------------------
  736. Plugins for banner section
  737. -----------------------------------------------------------------------------
  738. */
  739. api_plugin('mycourses_main');
  740. echo "<div class=\"maincontent\">"; // start of content for logged in users
  741. // link to see the session view or course view
  742. if(api_get_setting('use_session_mode')=='true' && api_is_allowed_to_create_course()) {
  743. if(isset($_GET['sessionview'])){
  744. echo '<a href="'.$_SERVER['PHP_SELF'].'">'.get_lang('CourseView').'</a>';
  745. }
  746. else {
  747. echo '<a href="'.$_SERVER['PHP_SELF'].'?sessionview=true">'.get_lang('SessionView').'</a>';
  748. }
  749. }
  750. /*
  751. -----------------------------------------------------------------------------
  752. System Announcements
  753. -----------------------------------------------------------------------------
  754. */
  755. $announcement = $_GET['announcement'] ? $_GET['announcement'] : -1;
  756. $visibility = api_is_allowed_to_create_course() ? VISIBLE_TEACHER : VISIBLE_STUDENT;
  757. SystemAnnouncementManager :: display_announcements($visibility, $announcement);
  758. if (!empty ($_GET['include']) && !strstr($_GET['include'], '/') && strstr($_GET['include'], '.html'))
  759. {
  760. include ('./home/'.$_GET['include']);
  761. $pageIncluded = true;
  762. }
  763. else
  764. {
  765. /*--------------------------------------
  766. DISPLAY COURSES
  767. --------------------------------------*/
  768. $list = '';
  769. if(api_get_setting('use_session_mode')=='true' && !$nosession)
  770. {
  771. $personal_course_list = get_personal_session_course_list($_uid);
  772. }
  773. else
  774. {
  775. $personal_course_list = get_personal_course_list($_uid);
  776. }
  777. foreach ($personal_course_list as $mycours)
  778. {
  779. $thisCourseDbName = $mycours['db'];
  780. $thisCourseSysCode = $mycours['k'];
  781. $thisCoursePublicCode = $mycours['c'];
  782. $thisCoursePath = $mycours['d'];
  783. $sys_course_path = api_get_path(SYS_COURSE_PATH);
  784. /*
  785. currently disabled functionality, should return
  786. $thisCoursePath = $sys_course_path . $thisCoursePath;
  787. if(! file_exists($thisCoursePath))
  788. {
  789. echo "<li>".$mycours['i']."<br/>";
  790. echo "".get_lang("CourseDoesntExist")." (<a href=\"main/install/update_courses.php\">";
  791. echo "".get_lang("GetCourseFromOldPortal")."</a>)</li>";
  792. continue;
  793. }*/
  794. $dbname = $mycours['k'];
  795. $status[$dbname] = $mycours['s'];
  796. $nbDigestEntries = 0; // number of entries already collected
  797. if ($maxCourse < $maxValvas)
  798. $maxValvas = $maxCourse;
  799. if ($maxCourse > 0)
  800. {
  801. $courses[$thisCourseSysCode]['coursePath'] = $thisCoursePath;
  802. $courses[$thisCourseSysCode]['courseCode'] = $thisCoursePublicCode;
  803. }
  804. /*
  805. -----------------------------------------------------------
  806. Announcements
  807. -----------------------------------------------------------
  808. */
  809. $course_database = $mycours['db'];
  810. $course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
  811. $query = "SELECT visibility FROM $course_tool_table WHERE link = 'announcements/announcements.php' AND visibility = 1";
  812. $result = api_sql_query($query);
  813. // collect from announcements, but only if tool is visible for the course
  814. if ($result && $maxValvas > 0 && mysql_num_rows($result) > 0)
  815. {
  816. //Search announcements table
  817. //Take the entries listed at the top of advalvas/announcements tool
  818. $course_announcement_table = Database :: get_course_announcement_table($thisCourseDbName);
  819. $sqlGetLastAnnouncements = "SELECT end_date publicationDate, content
  820. FROM ".$course_announcement_table;
  821. switch (CONFVAL_limitPreviewTo)
  822. {
  823. case SCRIPTVAL_NewEntriesOfTheDay :
  824. $sqlGetLastAnnouncements .= "WHERE DATE_FORMAT(end_date,'%Y %m %d') >= '".date("Y m d")."'";
  825. break;
  826. case SCRIPTVAL_NoTimeLimit :
  827. break;
  828. case SCRIPTVAL_NewEntriesOfTheDayOfLastLogin :
  829. // take care mysql -> DATE_FORMAT(time,format) php -> date(format,date)
  830. $sqlGetLastAnnouncements .= "WHERE DATE_FORMAT(end_date,'%Y %m %d') >= '".date("Y m d", $_user["lastLogin"])."'";
  831. }
  832. $sqlGetLastAnnouncements .= "ORDER BY end_date DESC
  833. LIMIT ".$maxValvas;
  834. $resGetLastAnnouncements = api_sql_query($sqlGetLastAnnouncements, __FILE__, __LINE__);
  835. if ($resGetLastAnnouncements)
  836. {
  837. while ($annoncement = mysql_fetch_array($resGetLastAnnouncements))
  838. {
  839. $keyTools = "valvas";
  840. $keyTime = $annoncement['publicationDate'];
  841. $keyCourse = $thisCourseSysCode;
  842. $digest[$$orderKey[0]][$$orderKey[1]][$$orderKey[2]][] = htmlspecialchars(substr(strip_tags($annoncement["content"]), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
  843. $nbDigestEntries ++; // summary has same order as advalvas
  844. }
  845. }
  846. }
  847. /*
  848. -----------------------------------------------------------
  849. Agenda
  850. -----------------------------------------------------------
  851. */
  852. $course_database = $mycours['db'];
  853. $course_tool_table = Database :: get_course_table(TOOL_LIST_TABLE,$course_database);
  854. $query = "SELECT visibility FROM $course_tool_table WHERE link = 'calendar/agenda.php' AND visibility = 1";
  855. $result = api_sql_query($query);
  856. $thisAgenda = $maxCourse - $nbDigestEntries; // new max entries for agenda
  857. if ($maxAgenda < $thisAgenda)
  858. $thisAgenda = $maxAgenda;
  859. // collect from agenda, but only if tool is visible for the course
  860. if ($result && $thisAgenda > 0 && mysql_num_rows($result) > 0)
  861. {
  862. $tableCal = $courseTablePrefix.$thisCourseDbName.$dbGlu."calendar_event";
  863. $sqlGetNextAgendaEvent = "SELECT start_date , title content, start_time
  864. FROM $tableCal
  865. WHERE start_date >= CURDATE()
  866. ORDER BY start_date, start_time
  867. LIMIT $maxAgenda";
  868. $resGetNextAgendaEvent = api_sql_query($sqlGetNextAgendaEvent, __FILE__, __LINE__);
  869. if ($resGetNextAgendaEvent)
  870. {
  871. while ($agendaEvent = mysql_fetch_array($resGetNextAgendaEvent))
  872. {
  873. $keyTools = 'agenda';
  874. $keyTime = $agendaEvent['start_date'];
  875. $keyCourse = $thisCourseSysCode;
  876. $digest[$$orderKey[0]][$$orderKey[1]][$$orderKey[2]][] = htmlspecialchars(substr(strip_tags($agendaEvent["content"]), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
  877. $nbDigestEntries ++; // summary has same order as advalvas
  878. }
  879. }
  880. }
  881. /*
  882. -----------------------------------------------------------
  883. Digest Display
  884. take collected data and display it
  885. -----------------------------------------------------------
  886. */
  887. $list[] = get_logged_user_course_html($mycours);
  888. } //end while mycourse...
  889. }
  890. if (is_array($list))
  891. {
  892. if(api_get_setting('use_session_mode')=='true' && !$nosession)
  893. {
  894. $listActives = $listInactives = $listCourses = array();
  895. foreach($list as $key=>$value){
  896. if($value['active'])
  897. $listActives[] = $value;
  898. else if(!empty($value[2]))
  899. $listInactives[] = $value;
  900. }
  901. $old_user_category = 0;
  902. $userdefined_categories = get_user_course_categories();
  903. if(count($listActives)>0 && $display_actives){
  904. echo "<ul style=\"line-height: 20px;\">\n";
  905. foreach ($listActives as $key => $value)
  906. {
  907. if(!empty($value[2])){
  908. if($old_session != $value[2]){
  909. $old_session = $value[2];
  910. if($key != 0){
  911. echo "\n</ul>";
  912. }
  913. echo "\n\n\t<ul class=\"user_course_category\"><li>".$value[3]."</li></ul>\n";
  914. echo "<ul>";
  915. }
  916. }
  917. echo $value[1];
  918. }
  919. echo "\n</ul></ul><br /><br />\n";
  920. }
  921. if(count($listInactives)>0 && !$display_actives){
  922. echo "<ul style=\"line-height: 20px;\">";
  923. foreach ($listInactives as $key => $value)
  924. {
  925. if(!empty($value[2])){
  926. if($old_session != $value[2]){
  927. $old_session = $value[2];
  928. if($key != 0){
  929. echo "\n</ul>";
  930. }
  931. echo "\n\n\t<ul class=\"user_course_category\"><li>".$value[3]."</li></ul>\n";
  932. echo "<ul>";
  933. }
  934. }
  935. echo $value[1];
  936. }
  937. echo "\n</ul><br /><br />\n";
  938. }
  939. }
  940. else
  941. {
  942. $old_user_category = 0;
  943. $userdefined_categories = get_user_course_categories();
  944. echo "<ul>\n";
  945. foreach ($list as $key => $value)
  946. {
  947. if ($old_user_category<>$value[0])
  948. {
  949. if ($key<>0 OR $value[0]<>0) // there are courses in the previous category
  950. {
  951. echo "\n</ul>";
  952. }
  953. echo "\n\n\t<ul class=\"user_course_category\"><li>".$userdefined_categories[$value[0]]."</li></ul>\n";
  954. if ($key<>0 OR $value[0]<>0) // there are courses in the previous category
  955. {
  956. echo "<ul>";
  957. }
  958. $old_user_category=$value[0];
  959. }
  960. echo $value[1];
  961. }
  962. echo "\n</ul>\n";
  963. }
  964. }
  965. echo "</div>"; // end of content section
  966. // Register whether full admin or null admin course
  967. // by course through an array dbname x user status
  968. api_session_register('status');
  969. /*
  970. ==============================================================================
  971. RIGHT MENU
  972. ==============================================================================
  973. */
  974. echo "<div class=\"menu\">";
  975. // api_display_language_form(); // moved to the profile page.
  976. echo "<div class=\"menusection\">";
  977. echo "<span class=\"menusectioncaption\">".get_lang("MenuUser")."</span>";
  978. echo "<ul class=\"menulist\">";
  979. $display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION["studentview"] != "studentenview");
  980. if ($display_add_course_link)
  981. display_create_course_link();
  982. display_edit_course_list_links();
  983. display_digest($toolsList, $digest, $orderKey, $courses);
  984. echo "</ul>";
  985. echo "</div>";
  986. /*
  987. -----------------------------------------------------------------------------
  988. Plugins for banner section
  989. -----------------------------------------------------------------------------
  990. */
  991. api_plugin('mycourses_menu');
  992. echo "</div>"; // end of menu
  993. /*
  994. ==============================================================================
  995. FOOTER
  996. ==============================================================================
  997. */
  998. Display :: display_footer();
  999. ?>