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. if(api_get_setting('use_session_mode')=='true' && !isset($_GET['nosession'])){
  424. global $now, $date_start, $date_end;
  425. }
  426. //initialise
  427. $result = '';
  428. //$statistic_database = Database::get_statistic_database();
  429. $user_id = api_get_user_id();
  430. $course_database = $mycours['db'];
  431. $course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
  432. $tool_edit_table = Database::get_course_table(LAST_TOOL_EDIT_TABLE, $course_database);
  433. $course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database);
  434. $course_system_code = $mycours['k'];
  435. $course_visual_code = $mycours['c'];
  436. $course_title = $mycours['i'];
  437. $course_directory = $mycours['d'];
  438. $course_teacher = $mycours['t'];
  439. $course_info = Database :: get_course_info($course_system_code);
  440. $course_access_settings = CourseManager :: get_access_settings($course_system_code);
  441. $course_id = $course_info['course_id'];
  442. $course_visibility = $course_access_settings['visibility'];
  443. $user_in_course_status = CourseManager :: get_user_in_course_status($user_id, $course_system_code);
  444. //function logic - act on the data
  445. $is_virtual_course = CourseManager :: is_virtual_course_from_system_code($mycours['c']);
  446. if ($is_virtual_course)
  447. {
  448. // If the current user is also subscribed in the real course to which this
  449. // virtual course is linked, we don't need to display the virtual course entry in
  450. // the course list - it is combined with the real course entry.
  451. $target_course_code = CourseManager :: get_target_of_linked_course($course_system_code);
  452. $is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course($user_id, $target_course_code);
  453. if ($is_subscribed_in_target_course)
  454. {
  455. return; //do not display this course entry
  456. }
  457. }
  458. $has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course_system_code, $user_id);
  459. if ($has_virtual_courses)
  460. {
  461. $return_result = CourseManager :: determine_course_title_from_course_info($user_id, $course_info);
  462. $course_display_title = $return_result['title'];
  463. $course_display_code = $return_result['code'];
  464. }
  465. else
  466. {
  467. $course_display_title = $course_title;
  468. $course_display_code = $course_visual_code;
  469. }
  470. $s_course_status=$mycours["s"];
  471. $s_htlm_status_icon="";
  472. if($s_course_status==1){
  473. $s_htlm_status_icon="<img src='main/img/staryellow.jpg'>";
  474. }
  475. if($s_course_status==2){
  476. $s_htlm_status_icon="<img src='main/img/starblue.jpg'>";
  477. }
  478. if($s_course_status==5){
  479. $s_htlm_status_icon="<img src='main/img/stargreen.jpg'>";
  480. }
  481. //display course entry
  482. $result.="\n\t";
  483. $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>';
  484. //show a hyperlink to the course, unless the course is closed and user is not course admin
  485. if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
  486. {
  487. if(api_get_setting('use_session_mode')=='true' && !isset($_GET['nosession'])){
  488. if(empty($mycours['id_session']))
  489. $mycours['id_session'] = 0;
  490. if($user_in_course_status == COURSEMANAGER || ($date_start <= $now && $date_end >= $now) || $date_start=='0000-00-00')
  491. {
  492. $result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$mycours['id_session'].'">'.$course_display_title.'</a>';
  493. }
  494. }
  495. else {
  496. $result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/">'.$course_display_title.'</a>';
  497. }
  498. }
  499. else
  500. {
  501. $result .= $course_display_title." "." ".get_lang("CourseClosed")."";
  502. }
  503. // show the course_code and teacher if chosen to display this
  504. if (get_setting("display_coursecode_in_courselist") == "true" OR get_setting("display_teacher_in_courselist") == "true")
  505. {
  506. $result .= "<br/>";
  507. }
  508. if (get_setting("display_coursecode_in_courselist") == "true")
  509. {
  510. $result .= $course_display_code;
  511. }
  512. if (get_setting("display_coursecode_in_courselist") == "true" AND get_setting("display_teacher_in_courselist") == "true")
  513. {
  514. $result .= ' &ndash; ';
  515. }
  516. if (get_setting("display_teacher_in_courselist") == "true")
  517. {
  518. $result .= $course_teacher;
  519. }
  520. // display the what's new icons
  521. $result .= show_notification($mycours);
  522. /*
  523. // get the user's last access dates to all tools of this course
  524. $sqlLastTrackInCourse = "SELECT * FROM $statistic_database.track_e_lastaccess"
  525. ." WHERE access_user_id = ".$user_id
  526. ." AND access_cours_code = '".$mycours['k']."'";
  527. $resLastTrackInCourse = api_sql_query($sqlLastTrackInCourse,__FILE__,__LINE__);
  528. while($lastTrackInCourse = mysql_fetch_array($resLastTrackInCourse))
  529. {
  530. $lastTrackInCourseDate[$lastTrackInCourse["access_tool"]] = $lastTrackInCourse["access_date"];
  531. }
  532. // get the last edits of all tools of this course
  533. $sql = "SELECT tooledit.lastedit_date last_date, tooledit.tool tool, tooledit.ref ref,
  534. tooledit.lastedit_type type, tooledit.to_group_id group_id,
  535. accueil.image image, accueil.link link
  536. FROM $tool_edit_table tooledit, $course_tool_table accueil
  537. WHERE accueil.name = tooledit.tool
  538. AND accueil.visibility = '1'
  539. AND tooledit.insert_user_id != $user_id
  540. AND (tooledit.to_user_id = '$user_id' OR tooledit.to_user_id = 0)";
  541. $res = api_sql_query($sql,__FILE__,__LINE__);
  542. $sql = "SELECT group_id FROM $course_group_user_table WHERE user_id = '$user_id'";
  543. $groupres = api_sql_query($sql,__FILE__,__LINE__);
  544. $groups = mysql_fetch_array($groupres);
  545. $groups[] = 0;
  546. //show icons of tools where there is something new
  547. while($lastToolEdit = mysql_fetch_array($res))
  548. {
  549. if ($lastTrackInCourseDate[$lastToolEdit["tool"]]<$lastToolEdit["last_date"] && in_array($lastToolEdit["group_id"], $groups))
  550. {
  551. $lastDate = date("d/m/Y H:i", convert_mysql_date($lastToolEdit["last_date"]));
  552. $type = ($lastToolEdit["type"]=="" || $lastToolEdit["type"]==NULL) ? get_lang('_new_item') : $lastToolEdit["type"];
  553. $result.= '<a href="'.api_get_path(WEB_CODE_PATH).$lastToolEdit['link'].'?cidReq='.$mycours['k'].'">'.
  554. '<img title="&mdash; '.$lastToolEdit['tool'].' &mdash; '.get_lang('_title_notification').": $type ($lastDate).\""
  555. .' src="'.api_get_path(WEB_IMG_PATH).$lastToolEdit['image'].'" border="0" align="middle" alt="'.$lastToolEdit['image'].'" /></a>';
  556. }
  557. }
  558. unset($lastTrackInCourseDate);
  559. unset($groups);*/
  560. if ((CONFVAL_showExtractInfo == SCRIPTVAL_InCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both) && $nbDigestEntries > 0)
  561. {
  562. reset($digest);
  563. $result .= "<ul>";
  564. while (list ($key2) = each($digest[$thisCourseSysCode]))
  565. {
  566. $result .= "<li>";
  567. if ($orderKey[1] == 'keyTools')
  568. {
  569. $result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
  570. $result .= "$toolsList[$key2][\"name\"]</a>";
  571. }
  572. else
  573. {
  574. $result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
  575. }
  576. $result .= "</li>";
  577. $result .= "<ul>";
  578. reset($digest[$thisCourseSysCode][$key2]);
  579. while (list ($key3, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2]))
  580. {
  581. $result .= "<li>";
  582. if ($orderKey[2] == 'keyTools')
  583. {
  584. $result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
  585. $result .= "$toolsList[$key3][\"name\"]</a>";
  586. }
  587. else
  588. {
  589. $result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3));
  590. }
  591. $result .= "<ul compact=\"compact\">";
  592. reset($digest[$thisCourseSysCode][$key2][$key3]);
  593. while (list ($key4, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2][$key3]))
  594. {
  595. $result .= "<li>";
  596. $result .= htmlspecialchars(substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
  597. $result .= "</li>";
  598. }
  599. $result .= "</ul>";
  600. $result .= "</li>";
  601. }
  602. $result .= "</ul>";
  603. $result .= "</li>";
  604. }
  605. $result .= "</ul>";
  606. }
  607. $result .= "</li>";
  608. if(api_get_setting('use_session_mode')=='true' && !isset($_GET['nosession'])){
  609. if(!empty($mycours['session_name'])){
  610. $session = $mycours['session_name'];
  611. if($date_start=='0000-00-00'){
  612. $session .= ' - '.get_lang('Without time limits');
  613. $active = true;
  614. }
  615. else {
  616. $session .= ' - '.get_lang('From').' '.$mycours['date_start'].' '.get_lang('To').' '.$mycours['date_end'];
  617. $active = ($date_start <= $now && $date_end >= $now)?true:false;
  618. }
  619. }
  620. $output = array ($mycours['user_course_cat'], $result, $mycours['id_session'], $session, 'active'=>$active);
  621. }
  622. else {
  623. $output = array ($mycours['user_course_cat'], $result);
  624. }
  625. return $output;
  626. }
  627. /**
  628. * Returns the "what's new" icon notifications
  629. * @version
  630. */
  631. function show_notification($mycours)
  632. {
  633. $statistic_database = Database :: get_statistic_database();
  634. $user_id = api_get_user_id();
  635. $course_database = $mycours['db'];
  636. $course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
  637. $tool_edit_table = Database::get_course_table(LAST_TOOL_EDIT_TABLE, $course_database);
  638. $course_group_user_table = Database :: get_course_table(GROUP_USER_TABLE, $course_database);
  639. // get the user's last access dates to all tools of this course
  640. $sqlLastTrackInCourse = "SELECT * FROM $statistic_database.track_e_lastaccess
  641. USE INDEX (access_cours_code, access_user_id)
  642. WHERE access_cours_code = '".$mycours['k']."'
  643. AND access_user_id = '$user_id'";
  644. $resLastTrackInCourse = api_sql_query($sqlLastTrackInCourse, __FILE__, __LINE__);
  645. $oldestTrackDate = "3000-01-01 00:00:00";
  646. while ($lastTrackInCourse = mysql_fetch_array($resLastTrackInCourse))
  647. {
  648. $lastTrackInCourseDate[$lastTrackInCourse["access_tool"]] = $lastTrackInCourse["access_date"];
  649. if ($oldestTrackDate > $lastTrackInCourse["access_date"])
  650. $oldestTrackDate = $lastTrackInCourse["access_date"];
  651. }
  652. // get the last edits of all tools of this course
  653. $sql = "SELECT tet.*, tet.lastedit_date last_date, tet.tool tool, tet.ref ref,
  654. tet.lastedit_type type, tet.to_group_id group_id,
  655. ctt.image image, ctt.link link
  656. FROM $tool_edit_table tet, $course_tool_table ctt
  657. WHERE tet.lastedit_date > '$oldestTrackDate'
  658. AND ctt.name = tet.tool
  659. AND ctt.visibility = '1'
  660. AND tet.lastedit_user_id != $user_id
  661. ORDER BY tet.lastedit_date";
  662. $res = api_sql_query($sql);
  663. //get the group_id's with user membership
  664. $group_ids = GroupManager :: get_group_ids($course_database, $user_id);
  665. $groups_ids[] = 0; //add group 'everyone'
  666. //filter all selected items
  667. while ($res && ($item_property = mysql_fetch_array($res)))
  668. {
  669. 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'])))
  670. {
  671. $notifications[$item_property['tool']] = $item_property;
  672. }
  673. }
  674. //show all tool icons where there is something new
  675. $retvalue = '&nbsp;';
  676. if (isset ($notifications))
  677. {
  678. while (list ($key, $notification) = each($notifications))
  679. {
  680. $lastDate = date("d/m/Y H:i", convert_mysql_date($notification['lastedit_date']));
  681. $type = $notification['lastedit_type'];
  682. //$notification[image]=str_replace(".png","gif",$notification[image]);
  683. //$notification[image]=str_replace(".gif","_s.gif",$notification[image]);
  684. $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;';
  685. }
  686. }
  687. return $retvalue;
  688. }
  689. /**
  690. * retrieves the user defined course categories
  691. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  692. * @return array containing all the titles of the user defined courses with the id as key of the array
  693. */
  694. function get_user_course_categories()
  695. {
  696. global $_uid;
  697. $table_category = Database::get_user_personal_table(USER_COURSE_CATEGORY_TABLE);
  698. $sql = "SELECT * FROM ".$table_category." WHERE user_id='".$_uid."'";
  699. $result = api_sql_query($sql,__FILE__,__LINE__);
  700. while ($row = mysql_fetch_array($result))
  701. {
  702. $output[$row['id']] = $row['title'];
  703. }
  704. return $output;
  705. }
  706. /*
  707. ==============================================================================
  708. MAIN CODE
  709. ==============================================================================
  710. */
  711. /*
  712. ==============================================================================
  713. PERSONAL COURSE LIST
  714. ==============================================================================
  715. */
  716. if (!isset ($maxValvas))
  717. $maxValvas = CONFVAL_maxValvasByCourse; // Maximum number of entries
  718. if (!isset ($maxAgenda))
  719. $maxAgenda = CONFVAL_maxAgendaByCourse; // collected from each course
  720. if (!isset ($maxCourse))
  721. $maxCourse = CONFVAL_maxTotalByCourse; // and displayed in summary.
  722. $maxValvas = (int) $maxValvas;
  723. $maxAgenda = (int) $maxAgenda;
  724. $maxCourse = (int) $maxCourse; // 0 if invalid
  725. if ($maxCourse > 0)
  726. {
  727. unset ($allentries); // we shall collect all summary$key1 entries in here:
  728. $toolsList['agenda']['name'] = get_lang('Agenda');
  729. $toolsList['agenda']['path'] = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=";
  730. $toolsList['valvas']['name'] = get_lang('Valvas');
  731. $toolsList['valvas']['path'] = api_get_path(WEB_CODE_PATH)."announcements/announcements.php?cidReq=";
  732. }
  733. /*
  734. -----------------------------------------------------------------------------
  735. Plugins for banner section
  736. -----------------------------------------------------------------------------
  737. */
  738. api_plugin('mycourses_main');
  739. echo "<div class=\"maincontent\">"; // start of content for logged in users
  740. // link to see the session view or course view
  741. if(api_is_allowed_to_create_course()) {
  742. if(isset($_GET['sessionview'])){
  743. echo '<a href="'.$_SERVER['PHP_SELF'].'">'.get_lang('CourseView').'</a>';
  744. }
  745. else {
  746. echo '<a href="'.$_SERVER['PHP_SELF'].'?sessionview=true">'.get_lang('SessionView').'</a>';
  747. }
  748. }
  749. /*
  750. -----------------------------------------------------------------------------
  751. System Announcements
  752. -----------------------------------------------------------------------------
  753. */
  754. $announcement = $_GET['announcement'] ? $_GET['announcement'] : -1;
  755. $visibility = api_is_allowed_to_create_course() ? VISIBLE_TEACHER : VISIBLE_STUDENT;
  756. SystemAnnouncementManager :: display_announcements($visibility, $announcement);
  757. if (!empty ($_GET['include']) && !strstr($_GET['include'], '/') && strstr($_GET['include'], '.html'))
  758. {
  759. include ('./home/'.$_GET['include']);
  760. $pageIncluded = true;
  761. }
  762. else
  763. {
  764. /*--------------------------------------
  765. DISPLAY COURSES
  766. --------------------------------------*/
  767. $list = '';
  768. if(api_get_setting('use_session_mode')=='true' && !isset($_GET['nosession']))
  769. {
  770. $personal_course_list = get_personal_session_course_list($_uid);
  771. }
  772. else
  773. {
  774. $personal_course_list = get_personal_course_list($_uid);
  775. }
  776. foreach ($personal_course_list as $mycours)
  777. {
  778. $thisCourseDbName = $mycours['db'];
  779. $thisCourseSysCode = $mycours['k'];
  780. $thisCoursePublicCode = $mycours['c'];
  781. $thisCoursePath = $mycours['d'];
  782. $sys_course_path = api_get_path(SYS_COURSE_PATH);
  783. /*
  784. currently disabled functionality, should return
  785. $thisCoursePath = $sys_course_path . $thisCoursePath;
  786. if(! file_exists($thisCoursePath))
  787. {
  788. echo "<li>".$mycours['i']."<br/>";
  789. echo "".get_lang("CourseDoesntExist")." (<a href=\"main/install/update_courses.php\">";
  790. echo "".get_lang("GetCourseFromOldPortal")."</a>)</li>";
  791. continue;
  792. }*/
  793. $dbname = $mycours['k'];
  794. $status[$dbname] = $mycours['s'];
  795. $nbDigestEntries = 0; // number of entries already collected
  796. if ($maxCourse < $maxValvas)
  797. $maxValvas = $maxCourse;
  798. if ($maxCourse > 0)
  799. {
  800. $courses[$thisCourseSysCode]['coursePath'] = $thisCoursePath;
  801. $courses[$thisCourseSysCode]['courseCode'] = $thisCoursePublicCode;
  802. }
  803. /*
  804. -----------------------------------------------------------
  805. Announcements
  806. -----------------------------------------------------------
  807. */
  808. $course_database = $mycours['db'];
  809. $course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
  810. $query = "SELECT visibility FROM $course_tool_table WHERE link = 'announcements/announcements.php' AND visibility = 1";
  811. $result = api_sql_query($query);
  812. // collect from announcements, but only if tool is visible for the course
  813. if ($result && $maxValvas > 0 && mysql_num_rows($result) > 0)
  814. {
  815. //Search announcements table
  816. //Take the entries listed at the top of advalvas/announcements tool
  817. $course_announcement_table = Database :: get_course_announcement_table($thisCourseDbName);
  818. $sqlGetLastAnnouncements = "SELECT end_date publicationDate, content
  819. FROM ".$course_announcement_table;
  820. switch (CONFVAL_limitPreviewTo)
  821. {
  822. case SCRIPTVAL_NewEntriesOfTheDay :
  823. $sqlGetLastAnnouncements .= "WHERE DATE_FORMAT(end_date,'%Y %m %d') >= '".date("Y m d")."'";
  824. break;
  825. case SCRIPTVAL_NoTimeLimit :
  826. break;
  827. case SCRIPTVAL_NewEntriesOfTheDayOfLastLogin :
  828. // take care mysql -> DATE_FORMAT(time,format) php -> date(format,date)
  829. $sqlGetLastAnnouncements .= "WHERE DATE_FORMAT(end_date,'%Y %m %d') >= '".date("Y m d", $_user["lastLogin"])."'";
  830. }
  831. $sqlGetLastAnnouncements .= "ORDER BY end_date DESC
  832. LIMIT ".$maxValvas;
  833. $resGetLastAnnouncements = api_sql_query($sqlGetLastAnnouncements, __FILE__, __LINE__);
  834. if ($resGetLastAnnouncements)
  835. {
  836. while ($annoncement = mysql_fetch_array($resGetLastAnnouncements))
  837. {
  838. $keyTools = "valvas";
  839. $keyTime = $annoncement['publicationDate'];
  840. $keyCourse = $thisCourseSysCode;
  841. $digest[$$orderKey[0]][$$orderKey[1]][$$orderKey[2]][] = htmlspecialchars(substr(strip_tags($annoncement["content"]), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
  842. $nbDigestEntries ++; // summary has same order as advalvas
  843. }
  844. }
  845. }
  846. /*
  847. -----------------------------------------------------------
  848. Agenda
  849. -----------------------------------------------------------
  850. */
  851. $course_database = $mycours['db'];
  852. $course_tool_table = Database :: get_course_table(TOOL_LIST_TABLE,$course_database);
  853. $query = "SELECT visibility FROM $course_tool_table WHERE link = 'calendar/agenda.php' AND visibility = 1";
  854. $result = api_sql_query($query);
  855. $thisAgenda = $maxCourse - $nbDigestEntries; // new max entries for agenda
  856. if ($maxAgenda < $thisAgenda)
  857. $thisAgenda = $maxAgenda;
  858. // collect from agenda, but only if tool is visible for the course
  859. if ($result && $thisAgenda > 0 && mysql_num_rows($result) > 0)
  860. {
  861. $tableCal = $courseTablePrefix.$thisCourseDbName.$dbGlu."calendar_event";
  862. $sqlGetNextAgendaEvent = "SELECT start_date , title content, start_time
  863. FROM $tableCal
  864. WHERE start_date >= CURDATE()
  865. ORDER BY start_date, start_time
  866. LIMIT $maxAgenda";
  867. $resGetNextAgendaEvent = api_sql_query($sqlGetNextAgendaEvent, __FILE__, __LINE__);
  868. if ($resGetNextAgendaEvent)
  869. {
  870. while ($agendaEvent = mysql_fetch_array($resGetNextAgendaEvent))
  871. {
  872. $keyTools = 'agenda';
  873. $keyTime = $agendaEvent['start_date'];
  874. $keyCourse = $thisCourseSysCode;
  875. $digest[$$orderKey[0]][$$orderKey[1]][$$orderKey[2]][] = htmlspecialchars(substr(strip_tags($agendaEvent["content"]), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
  876. $nbDigestEntries ++; // summary has same order as advalvas
  877. }
  878. }
  879. }
  880. /*
  881. -----------------------------------------------------------
  882. Digest Display
  883. take collected data and display it
  884. -----------------------------------------------------------
  885. */
  886. $list[] = get_logged_user_course_html($mycours);
  887. } //end while mycourse...
  888. }
  889. if (is_array($list))
  890. {
  891. if(api_get_setting('use_session_mode')=='true' && !isset($_GET['nosession']))
  892. {
  893. $listActives = $listInactives = $listCourses = array();
  894. foreach($list as $key=>$value){
  895. if($value['active'])
  896. $listActives[] = $value;
  897. else if(!empty($value[2]))
  898. $listInactives[] = $value;
  899. }
  900. $old_user_category = 0;
  901. $userdefined_categories = get_user_course_categories();
  902. if(count($listActives)>0 && $display_actives){
  903. echo "<ul style=\"line-height: 20px;\">\n";
  904. foreach ($listActives as $key => $value)
  905. {
  906. if(!empty($value[2])){
  907. if($old_session != $value[2]){
  908. $old_session = $value[2];
  909. if($key != 0){
  910. echo "\n</ul>";
  911. }
  912. echo "\n\n\t<ul class=\"user_course_category\"><li>".$value[3]."</li></ul>\n";
  913. echo "<ul>";
  914. }
  915. }
  916. echo $value[1];
  917. }
  918. echo "\n</ul></ul><br /><br />\n";
  919. }
  920. if(count($listInactives)>0 && !$display_actives){
  921. echo "<ul style=\"line-height: 20px;\">";
  922. foreach ($listInactives as $key => $value)
  923. {
  924. if(!empty($value[2])){
  925. if($old_session != $value[2]){
  926. $old_session = $value[2];
  927. if($key != 0){
  928. echo "\n</ul>";
  929. }
  930. echo "\n\n\t<ul class=\"user_course_category\"><li>".$value[3]."</li></ul>\n";
  931. echo "<ul>";
  932. }
  933. }
  934. echo $value[1];
  935. }
  936. echo "\n</ul><br /><br />\n";
  937. }
  938. }
  939. else
  940. {
  941. $old_user_category = 0;
  942. $userdefined_categories = get_user_course_categories();
  943. echo "<ul>\n";
  944. foreach ($list as $key => $value)
  945. {
  946. if ($old_user_category<>$value[0])
  947. {
  948. if ($key<>0 OR $value[0]<>0) // there are courses in the previous category
  949. {
  950. echo "\n</ul>";
  951. }
  952. echo "\n\n\t<ul class=\"user_course_category\"><li>".$userdefined_categories[$value[0]]."</li></ul>\n";
  953. if ($key<>0 OR $value[0]<>0) // there are courses in the previous category
  954. {
  955. echo "<ul>";
  956. }
  957. $old_user_category=$value[0];
  958. }
  959. echo $value[1];
  960. }
  961. echo "\n</ul>\n";
  962. }
  963. }
  964. echo "</div>"; // end of content section
  965. // Register whether full admin or null admin course
  966. // by course through an array dbname x user status
  967. api_session_register('status');
  968. /*
  969. ==============================================================================
  970. RIGHT MENU
  971. ==============================================================================
  972. */
  973. echo "<div class=\"menu\">";
  974. // api_display_language_form(); // moved to the profile page.
  975. echo "<div class=\"menusection\">";
  976. echo "<span class=\"menusectioncaption\">".get_lang("MenuUser")."</span>";
  977. echo "<ul class=\"menulist\">";
  978. $display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION["studentview"] != "studentenview");
  979. if ($display_add_course_link)
  980. display_create_course_link();
  981. display_edit_course_list_links();
  982. display_digest($toolsList, $digest, $orderKey, $courses);
  983. echo "</ul>";
  984. echo "</div>";
  985. /*
  986. -----------------------------------------------------------------------------
  987. Plugins for banner section
  988. -----------------------------------------------------------------------------
  989. */
  990. api_plugin('mycourses_menu');
  991. echo "</div>"; // end of menu
  992. /*
  993. ==============================================================================
  994. FOOTER
  995. ==============================================================================
  996. */
  997. Display :: display_footer();
  998. ?>