resourcelinker.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @author Patrick Cool, original code
  5. * @author Denes Nagy - many bugfixes and improvements, adjusted for learning path
  6. * @author Roan Embrechts - refactoring, code cleaning
  7. * @package chamilo.resourcelinker
  8. * @todo reorganise code,
  9. * use Database API instead of creating table names locally.
  10. */
  11. /**
  12. * Code
  13. */
  14. /* INIT SECTION */
  15. // Flag to allow for anonymous user - needs to be set before global.inc.php.
  16. $use_anonymous = true;
  17. // Name of the language file that needs to be included.
  18. $language_file = 'resourcelinker';
  19. require_once 'back_compat.inc.php';
  20. $this_section = SECTION_COURSES;
  21. api_protect_course_script();
  22. /* Libraries */
  23. include 'resourcelinker.inc.php';
  24. /* Constants and variables */
  25. $link_table = Database :: get_course_table(TABLE_LINK);
  26. $item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
  27. //$tbl_learnpath_main = Database :: get_course_table(TABLE_LEARNPATH_MAIN);
  28. //$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
  29. //$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
  30. $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
  31. $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
  32. $action = $_REQUEST['action'];
  33. $add = $_REQUEST['add'];
  34. $chapter_id = $_REQUEST['parent_item_id'];
  35. $content = $_REQUEST['content'];
  36. // Note by Patrick Cool: This has been solved belowd. This piece of code hacking produced too much errors.
  37. /*
  38. if (empty($content)) {
  39. // Adds a default to the item-type selection.
  40. $content = 'Document';
  41. }
  42. */
  43. $folder = $_REQUEST['folder'];
  44. $id = $_REQUEST['id'];
  45. $learnpath_id = $_REQUEST['lp_id'];
  46. $originalresource = $_REQUEST['originalresource'];
  47. $show_resources = $_REQUEST['show_resources'];
  48. $source_forum = $_REQUEST['source_forum'];
  49. $source_id = $_REQUEST['source_id'];
  50. $target = $_REQUEST['target'];
  51. $external_link = $_REQUEST['external_link'];
  52. $from_learnpath = $_SESSION['from_learnpath'];
  53. // This variable controls wether the link to add a chapter in a module or
  54. // another chapter is shown. This allows to create multi-level learnpaths,
  55. // but export features are not ready for this, yet, so use at your own risks
  56. // default : false -> do not display link
  57. // This setting should be moved to the platform configuration page in time...
  58. $multi_level_learnpath = true;
  59. /* MAIN CODE */
  60. if ($from_learnpath == 'yes') {
  61. // Start from clear every time in LearnPath Builder.
  62. $_SESSION['addedresource'] = null;
  63. $_SESSION['addedresourceid'] = null;
  64. $_SESSION['addedresourceassigned'] = null;
  65. unset ($_SESSION['addedresource']);
  66. unset ($_SESSION['addedresourceid']);
  67. unset ($_SESSION['addedresourceassigned']);
  68. }
  69. $course_id = api_get_course_int_id();
  70. // Process a new chapter?
  71. if (!empty ($_POST['add_chapter']) && !empty ($_POST['title'])) {
  72. $title = $_POST['title'];
  73. $description = '';
  74. /*if (!empty ($_POST['description'])) {
  75. $description = $_POST['description'];
  76. }*/
  77. // Get max display_order so far in this parent chapter.
  78. $sql = "SELECT MAX(display_order) as maxi FROM $tbl_lp_item " .
  79. "WHERE lp_id = $learnpath_id ".
  80. " AND parent_item_id = $chapter_id";
  81. $res = Database::query($sql);
  82. $row = Database::fetch_array($res);
  83. $lastorder_item = $row['maxi'];
  84. if (empty($lastorder_item)) {
  85. $lastorder_item = 0;
  86. $previous = 0;
  87. } else {
  88. $sql = "SELECT id FROM $tbl_lp_item " .
  89. "WHERE lp_id = $learnpath_id AND parent_item_id=$chapter_id AND display_order = $lastorder_item";
  90. $result = Database::query($sql);
  91. $row = Database::fetch_array($result);
  92. $previous = $row['id'];
  93. }
  94. $order = $lastorder_item + 1;
  95. $sql = "INSERT INTO $tbl_lp_item "."(c_id, lp_id,item_type,title,parent_item_id,previous_item_id, next_item_id, display_order) " .
  96. "VALUES "."($course_id, $learnpath_id,'dokeos_chapter','$title', $chapter_id, $previous, 0, $order )";
  97. //error_log('New LP - Inserting new resource: '.$sql, 0);
  98. $res = Database::query($sql);
  99. $my_id = Database::insert_id($res);
  100. if ($previous > 0) {
  101. $sql = "UPDATE $tbl_lp_item SET next_item_id = $my_id WHERE id=$previous";
  102. $res = Database::query($sql);
  103. }
  104. if ($res !== false) {
  105. $title = '';
  106. $description = '';
  107. }
  108. $resource_added = true;
  109. }
  110. // This if when a external link is submitted.
  111. if (!empty ($_POST['external_link_submit'])) {
  112. if ($external_link == '' || $external_link == 'http://') {
  113. $InvalidURL = 1;
  114. } else {
  115. $add = true;
  116. if ($add_2_links != 'niet toevoegen') {
  117. // Add external link to the links table.
  118. $pos = strpos($external_link, 'ttp:');
  119. if ($pos == '') {
  120. $external_link = 'http://'.$external_link;
  121. }
  122. $sql = "INSERT INTO $link_table (c_id, url, title, category_id) VALUES ($course_id, '$external_link','$external_link','$add_2_links')";
  123. $result = Database::query($sql);
  124. $addedresource[] = "Link";
  125. $addedresourceid[] = Database::insert_id();
  126. $_SESSION['addedresource'] = $addedresource;
  127. $_SESSION['addedresourceid'] = $addedresourceid;
  128. } else {
  129. // Do not add external link to the links table.
  130. $addedresource[] = "Externallink";
  131. $addedresourceid[] = $external_link;
  132. $_SESSION['addedresource'] = $addedresource;
  133. $_SESSION['addedresourceid'] = $addedresourceid;
  134. }
  135. }
  136. }
  137. // Loading the session variables into local array.
  138. $addedresource = $_SESSION['addedresource'];
  139. $addedresourceid = $_SESSION['addedresourceid'];
  140. // This is when a resource was added to the session.
  141. if ($add) {
  142. // Adding the new variable to the local array.
  143. if (empty($_POST['external_link_submit'])) {
  144. // That case is already arranged, see upwards.
  145. $addedresource[] = $content;
  146. $addedresourceid[] = $add;
  147. }
  148. $addedresourceassigned[] = 0;
  149. // Loading the local array into the session variable.
  150. $_SESSION['addedresource'] = $addedresource;
  151. $_SESSION['addedresourceid'] = $addedresourceid;
  152. // We assign to chapters immediately!
  153. $resource_added = false;
  154. if ($from_learnpath == 'yes') {
  155. $i = 0;
  156. // Calculating the last order of the items of this chapter.
  157. $sql = "SELECT MAX(display_order) as maxi FROM $tbl_lp_item " .
  158. "WHERE lp_id = $learnpath_id AND parent_item_id=$chapter_id";
  159. $result = Database::query($sql);
  160. $row = Database::fetch_array($result);
  161. $lastorder_item = $row['maxi'];
  162. if (empty($lastorder_item)) {
  163. $lastorder_item = 0;
  164. $previous = 0;
  165. } else {
  166. $sql = "SELECT id FROM $tbl_lp_item " .
  167. "WHERE lp_id = $learnpath_id AND parent_item_id=$chapter_id AND display_order = $lastorder_item";
  168. //error_log('New LP - resourcelinker.php - '.$sql, 0);
  169. $result = Database::query($sql);
  170. $row = Database::fetch_array($result);
  171. $previous = $row['id'];
  172. }
  173. $lastorder = $lastorder_item + 1;
  174. foreach ($addedresource as $addedresource_item) {
  175. // In the case we added a chapter, add this into the chapters list with the correct parent_id.
  176. if ($addedresource_item == 'Chap') {
  177. $sql = "INSERT INTO $tbl_lp_item " .
  178. "(c_id, lp_id,item_type,title,parent_item_id,previous_item_id,next_item_id,display_order) " .
  179. "VALUES ($course_id, ".$learnpath_id.",'dokeos_chapter','".$learnpath_chapter_name."',".$chapter_id.",$previous,0,".$lastorder.")";
  180. //error_log('New LP - Inserting new resource: '.$sql, 0);
  181. $res = Database::query($sql);
  182. $my_id = Database::insert_id($res);
  183. if ($previous > 0) {
  184. $sql = "UPDATE $tbl_lp_item SET next_item_id = $my_id WHERE id=$previous";
  185. $res = Database::query($sql);
  186. }
  187. }
  188. if (!$addedresourceassigned[$i]) {
  189. // Not to assign it twice
  190. switch ($addedresource_item) {
  191. case 'Assignment':
  192. case 'Ass':
  193. //set tool type
  194. $addedresource_item = 'Assignments';
  195. $title = get_lang('Assignments');
  196. break;
  197. case 'Drop':
  198. //$addedresource_item = 'Dropbox';
  199. $addedresource_item = TOOL_DROPBOX;
  200. $title = get_lang('Dropbox');
  201. break;
  202. case 'Intro':
  203. $addedresource_item = 'Introduction_text';
  204. //$addedresource_item = TOOL_INTRO;
  205. $title = get_lang('IntroductionText');
  206. break;
  207. case 'Course_desc':
  208. //$addedresource_item = 'Course_description';
  209. $addedresource_item = TOOL_COURSE_DESCRIPTION;
  210. $title = get_lang('CourseDescription');
  211. break;
  212. case 'Group':
  213. //$addedresource_item = 'Groups';
  214. $addedresource_item = TOOL_GROUP;
  215. $title = get_lang('Groups');
  216. break;
  217. case 'User':
  218. //$addedresource_item = 'Users';
  219. $addedresource_item = TOOL_USER;
  220. $title = get_lang('Users');
  221. break;
  222. case 'Link':
  223. /*
  224. if ($target == '') {
  225. $target = '_self';
  226. }
  227. */
  228. //$addedresource_item .= ' '.$target;
  229. //error_log('New LP - resourcelinker.php - In Link addition: '.$external_link);
  230. $addedresource_item = TOOL_LINK;
  231. $title = $external_link;
  232. break;
  233. case 'Document':
  234. $addedresource_item = TOOL_DOCUMENT;
  235. //get title from tool-type table
  236. $tooltable = Database::get_course_table(TABLE_DOCUMENT);
  237. $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
  238. $myrow=Database::fetch_array($result);
  239. $title = $myrow['title'];
  240. break;
  241. case 'Exercise':
  242. $addedresource_item = TOOL_QUIZ;
  243. //get title from tool-type table
  244. $tooltable = Database::get_course_table(TABLE_QUIZ_TEST);
  245. $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
  246. $myrow=Database::fetch_array($result);
  247. $title = $myrow['title'];
  248. break;
  249. case 'Forum':
  250. $addedresource_item = TOOL_FORUM;
  251. //TODO
  252. break;
  253. case 'Agenda':
  254. $addedresource_item = TOOL_CALENDAR_EVENT;
  255. //get title from tool-type table
  256. $tooltable = Database::get_course_table(TABLE_AGENDA);
  257. $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
  258. $myrow=Database::fetch_array($result);
  259. $title = $myrow['title'];
  260. break;
  261. case 'Ad_Valvas':
  262. $addedresource_item = TOOL_ANNOUNCEMENT;
  263. //get title from tool-type table
  264. $tooltable = Database::get_course_table(TABLE_ANNOUNCEMENT);
  265. $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
  266. $myrow=Database::fetch_array($result);
  267. $title = $myrow['title'];
  268. break;
  269. }
  270. $sql = "INSERT INTO $tbl_lp_item (c_id, lp_id, title, parent_item_id, item_type, ref, previous_item_id, next_item_id, display_order) " .
  271. "VALUES ($course_id, $learnpath_id, '$title','$chapter_id', '$addedresource_item','$addedresourceid[$i]',$previous,0,'".$lastorder."')";
  272. //error_log('New LP - Inserting new resource: '.$sql, 0);
  273. $result = Database::query($sql);
  274. $my_id = Database::insert_id($result);
  275. if ($previous > 0) {
  276. $sql = "UPDATE $tbl_lp_item SET next_item_id = $my_id WHERE id = $previous";
  277. //error_log($sql, 0);
  278. $res = Database::query($sql);
  279. }
  280. $addedresourceassigned[$i] = 1;
  281. $resource_added = true;
  282. }
  283. $i ++;
  284. $lastorder ++;
  285. }
  286. //$_SESSION['addedresource']=null;
  287. //$_SESSION['addedresourceid']=null;
  288. // cleaning up the session once again
  289. $_SESSION['addedresource'] = null;
  290. $_SESSION['addedresourceid'] = null;
  291. $_SESSION['addedresourceassigned'] = null;
  292. unset ($_SESSION['addedresource']);
  293. unset ($_SESSION['addedresourceid']);
  294. unset ($_SESSION['addedresourceassigned']);
  295. }
  296. }
  297. /*
  298. BREADCRUMBS
  299. This part is to allow going back to the tool where you came from
  300. in a previous version I used the table tool_list, but since the forum can access the
  301. resource_linker from two different pages (newtopic.php and editpost.php) and this is different
  302. from the link field in tool_list, I decide to hardcode this stuff here.
  303. By doing this, you can easily control which pages can access the toollinker and which not.
  304. */
  305. if (isset($_SESSION['gradebook'])) {
  306. $gradebook = $_SESSION['gradebook'];
  307. }
  308. if (!empty($gradebook) && $gradebook == 'view') {
  309. $interbreadcrumb[] = array (
  310. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  311. 'name' => get_lang('ToolGradebook')
  312. );
  313. }
  314. if ($_GET['source_id']) {
  315. switch ($_GET['source_id']) {
  316. case '1': // coming from Agenda
  317. if ($action == 'edit') {
  318. $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
  319. }
  320. elseif ($action == 'add') {
  321. $url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
  322. } else {
  323. $url = "../calendar/agenda.php?action=add";
  324. }
  325. $originaltoolname = get_lang('Agenda');
  326. $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
  327. session_unregister('from_learnpath');
  328. unset ($from_learnpath);
  329. break;
  330. case '2': // coming from forum: new topic
  331. $url = "../phpbb/newtopic.php?forum=$source_forum&md5=$md5";
  332. $originaltoolname = get_lang('ForumAddNewTopic');
  333. $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
  334. session_unregister('from_learnpath');
  335. unset ($from_learnpath);
  336. break;
  337. case '3': // coming from forum: edit topic
  338. $url = "../phpbb/editpost.php?post_id=$post_id&topic=$topic&forum=$forum&md5=$md5&originalresource=no";
  339. $originaltoolname = get_lang('ForumEditTopic');
  340. $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
  341. session_unregister('from_learnpath');
  342. unset ($from_learnpath);
  343. break;
  344. case '4': // coming from exercises: edit topic
  345. $url = "../exercice/admin.php?modifyAnswers=$modifyAnswers";
  346. $originaltoolname = get_lang('ExerciseAnswers');
  347. $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
  348. session_unregister('from_learnpath');
  349. unset ($from_learnpath);
  350. break;
  351. case '5': // coming from learning path
  352. $from_learnpath = 'yes';
  353. api_session_register('from_learnpath');
  354. break;
  355. case '6': // coming from forum: reply
  356. $url = "../phpbb/reply.php?topic=$topic&forum=$forum&parentid=$parentid";
  357. $url = $_SESSION['origintoolurl'];
  358. $originaltoolname = get_lang('ForumReply');
  359. $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
  360. session_unregister('from_learnpath');
  361. unset ($from_learnpath);
  362. break;
  363. /* add Frederik.Vermeire@pandora.be */
  364. case '7': // coming from Ad_Valvas
  365. if ($action == 'edit') {
  366. $url = "../announcements/announcements.php?action=edit&id=49&originalresource=$originalresource";
  367. } elseif ($action == 'add') {
  368. $url = "../announcements/announcements.php?action=add&originalresource=$originalresource";
  369. } else {
  370. $url = "../announcements/announcements.php?action=add";
  371. }
  372. $originaltoolname = get_lang('AdValvas');
  373. $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
  374. session_unregister('from_learnpath');
  375. unset ($from_learnpath);
  376. break;
  377. /* end add Frederik.Vermeire@pandora.be */
  378. }
  379. // We do not come from the learning path. We store the name of the tool & url in a session.
  380. if ($from_learnpath != 'yes') {
  381. if (!$_SESSION['origintoolurl'] || $_SESSION['origintoolurl'] != $interbreadcrumb['url']) {
  382. $_SESSION['origintoolurl'] = $breadcrumbelement['url'];
  383. $_SESSION['origintoolname'] = $breadcrumbelement['name'];
  384. $interbreadcrumb = '';
  385. }
  386. }
  387. }
  388. // This part of the code is the actual breadcrumb mechanism. If we do not come from the learning path we use
  389. // the information from the session. Else we use the information of the learningpath itself.
  390. if ($from_learnpath != 'yes') {
  391. $nameTools = get_lang('Attachment');
  392. $interbreadcrumb[] = array ('url' => $_SESSION['origintoolurl'], 'name' => $_SESSION['origintoolname']);
  393. } else {
  394. $learnpath_select_query = " SELECT * FROM $tbl_lp
  395. WHERE id=$learnpath_id";
  396. $sql_result = Database::query($learnpath_select_query);
  397. $therow = Database::fetch_array($sql_result);
  398. $learnpath_chapter_query = " SELECT * FROM $tbl_lp_item
  399. WHERE (lp_id = '$learnpath_id' and id = '$chapter_id')";
  400. $sql_result = Database::query($learnpath_chapter_query);
  401. $therow2 = Database::fetch_array($sql_result);
  402. $from_learnpath = 'yes';
  403. session_register('from_learnpath');
  404. $interbreadcrumb[] = array ('url' => "../newscorm/lp_controller.php?action=list", 'name' => get_lang('LearningPath'));
  405. $interbreadcrumb[] = array ('url' => "../newscorm/lp_controller.php?action=admin_view&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
  406. $interbreadcrumb[] = array ('url' => api_get_self()."?action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no", 'name' => "{$therow2['title']}");
  407. }
  408. $htmlHeadXtra[] = '<script type="text/javascript">
  409. /* <![CDATA[ */
  410. function targetfunc(input)
  411. {
  412. window.location=window.location+"&amp;target="+document.learnpath_link.target.value;
  413. }
  414. /* ]]> */
  415. </script>';
  416. Display :: display_header($nameTools);
  417. echo "<h3>".$nameTools;
  418. if ($from_learnpath == 'yes') {
  419. echo get_lang('AddResource')." - {$therow2['title']}";
  420. }
  421. echo "</h3>";
  422. // We retrieve the tools that are active.
  423. // We use this to check which resources a student may add (only the modules that are active).
  424. // See http://www.dokeos.com/forum/viewtopic.php?t=4858
  425. $active_modules = array();
  426. $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  427. $sql_select_active = "SELECT * FROM $tool_table WHERE visibility='1'";
  428. $result_select_active = Database::query($sql_select_active);
  429. while ($row=Database::fetch_array($result_select_active)) {
  430. $active_modules[] = $row['name'];
  431. }
  432. ?>
  433. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  434. <tr>
  435. <td width="300" valign="top" style='padding-right:15px;'>
  436. <table width="300" border="0" cellspacing="0" cellpadding="0" style='border-right:1px solid grey;'>
  437. <?php if ($from_learnpath != 'yes') { ?>
  438. <tr>
  439. <td width="26%"><b><?php echo get_lang('CourseResources'); ?></b></td>
  440. </tr>
  441. <?php
  442. if (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules)) {
  443. ?>
  444. <tr>
  445. <td><?php echo "<a href=\"".api_get_self()."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Documents')."</a>"; ?></td>
  446. </tr>
  447. <?php
  448. }
  449. if (api_is_allowed_to_edit() || in_array(TOOL_CALENDAR_EVENT, $active_modules)) {
  450. ?>
  451. <tr>
  452. <td><?php echo "<a href=\"".api_get_self()."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Agenda')."</a>"; ?></td>
  453. </tr>
  454. <?php
  455. }
  456. if (api_is_allowed_to_edit() || in_array(TOOL_ANNOUNCEMENT, $active_modules)) {
  457. ?>
  458. <tr>
  459. <td><?php echo "<a href=\"".api_get_self()."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('AdValvas')."</a>"; ?></td>
  460. </tr>
  461. <?php
  462. }
  463. if (api_is_allowed_to_edit() || in_array(TOOL_BB_FORUM, $active_modules)) {
  464. ?>
  465. <tr>
  466. <td><?php echo "<a href=\"".api_get_self()."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Forum')."</a>"; ?></td>
  467. </tr>
  468. <?php
  469. }
  470. if (api_is_allowed_to_edit() || in_array(TOOL_LINK, $active_modules)) {
  471. ?>
  472. <tr>
  473. <td><?php echo "<a href=\"".api_get_self()."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Links')."</a>"; ?></td>
  474. </tr>
  475. <?php
  476. }
  477. if (api_is_allowed_to_edit() || in_array(TOOL_QUIZ, $active_modules)) {
  478. ?>
  479. <tr>
  480. <td><?php echo "<a href=\"".api_get_self()."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Exercise')."</a>"; ?></td>
  481. </tr>
  482. <?php
  483. }
  484. } else {
  485. ?>
  486. <!--tr>
  487. <td width="26%"><b><?php echo get_lang('ExportableCourseResources'); ?></b></td>
  488. </tr-->
  489. <?php if ($multi_level_learnpath === true ) { ?>
  490. <tr>
  491. <td><?php echo "<a href=\"".api_get_self()."?content=chapter&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Chapter')."</a>"; ?></td>
  492. </tr>
  493. <?php } ?>
  494. <tr>
  495. <td><?php echo "<a href=\"".api_get_self()."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Document')."</a>"; ?></td>
  496. </tr>
  497. <tr>
  498. <td><?php echo "<a href=\"".api_get_self()."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Exercise')."</a>"; ?></td>
  499. </tr>
  500. <tr>
  501. <td><?php echo "<a href=\"".api_get_self()."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Link')."</a>"; ?></td>
  502. </tr>
  503. <tr>
  504. <td><?php echo "<a href=\"".api_get_self()."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Forum')."</a>"; ?></td>
  505. </tr>
  506. <tr>
  507. <td><?php echo "<a href=\"".api_get_self()."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Agenda')."</a>"; ?></td>
  508. </tr>
  509. <tr>
  510. <td><?php echo "<a href=\"".api_get_self()."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('AdValvas')."</a>"; ?></td>
  511. </tr>
  512. <!--tr>
  513. <td><?php echo "<a href=\"".api_get_self()."?content=Course_description&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('CourseDescription')."</a>"; ?></td>
  514. </tr-->
  515. <!--tr>
  516. <td><?php echo "<a href=\"".api_get_self()."?content=Introduction_text&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('IntroductionText')."</a>"; ?></td>
  517. </tr-->
  518. <!--tr>
  519. <td>&nbsp;</td>
  520. </tr-->
  521. <!--tr>
  522. <td width="26%"><b><?php echo get_lang('DokeosRelatedCourseMaterial'); ?></b></td>
  523. </tr-->
  524. <tr>
  525. <td><?php echo "<a href=\"".api_get_self()."?content=Dropbox&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Dropbox')."</a>"; ?></td>
  526. </tr>
  527. <tr>
  528. <td><?php echo "<a href=\"".api_get_self()."?content=Assignment&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Assignments')."</a>"; ?></td>
  529. </tr>
  530. <tr>
  531. <td><?php echo "<a href=\"".api_get_self()."?content=Groups&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Groups')."</a>"; ?></td>
  532. </tr>
  533. <tr>
  534. <td><?php echo "<a href=\"".api_get_self()."?content=Users&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Users')."</a>"; ?></td>
  535. </tr>
  536. <?php
  537. }
  538. ?>
  539. <!--tr>
  540. <td>&nbsp;</td>
  541. </tr-->
  542. <!--tr>
  543. <td><b><?php echo get_lang('ExternalResources'); ?></b></td>
  544. </tr-->
  545. <tr>
  546. <td><?php echo "<a href=\"".api_get_self()."?content=Externallink&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('ExternalLink')."</a>"; ?></td>
  547. </tr>
  548. <?php
  549. if ($from_learnpath != 'yes') {
  550. echo "<tr><td>&nbsp;</td></tr>";
  551. echo "<tr><td><b>".get_lang('ResourcesAdded')." (";
  552. echo count($addedresource);
  553. echo ")</b></td></tr>";
  554. echo "<tr><td nowrap><a href=\"".api_get_self()."?showresources=true&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('ShowDelete')."</a>";
  555. echo "</td></tr>";
  556. }
  557. ?>
  558. <tr>
  559. <td>&nbsp;</td>
  560. </tr>
  561. <!--<tr>
  562. <td><b><?php echo get_lang('BackTo'); ?></b></td>
  563. </tr>//-->
  564. <tr>
  565. <td>
  566. <?php
  567. if ($from_learnpath != 'yes') {
  568. echo "<form method=\"post\" action=\"{$_SESSION['origintoolurl']}\" style=\"margin: 0px;\"><input type=\"submit\" value=\"".' '.get_lang('Ok').' '."\"></form>";
  569. } else {
  570. echo "<form method=\"get\" action=\"lp_controller.php\" style=\"margin: 0px;\"><input type=\"hidden\" name=\"lp_id\" value=\"".htmlentities($learnpath_id)."\"><input type=\"hidden\" name=\"action\" value=\"admin_view\"><input type=\"submit\" value=\"".' '.get_lang('Ok').' '."\"></form>";
  571. }
  572. ?>
  573. </td>
  574. </tr>
  575. <tr>
  576. <td>&nbsp;</td>
  577. </tr>
  578. </table>
  579. </td>
  580. <td valign="top">
  581. <?php
  582. if ($resource_added) {
  583. Display :: display_normal_message(get_lang('ResourceAdded'));
  584. }
  585. if ($InvalidURL) {
  586. Display :: display_normal_message(get_lang('GiveURL'));
  587. }
  588. if ($from_learnpath != 'yes') {
  589. echo count($addedresource)." ".strtolower(get_lang('ResourcesAdded'))."<br />";
  590. }
  591. //echo "<hr />";
  592. // Agenda items -->
  593. if ($content == 'Agenda') {
  594. $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
  595. $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
  596. $sql = "SELECT agenda.*, toolitemproperties.*
  597. FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
  598. WHERE agenda.id = toolitemproperties.ref
  599. AND toolitemproperties.tool='".TOOL_CALENDAR_EVENT."'
  600. AND toolitemproperties.to_group_id='0'
  601. AND toolitemproperties.visibility='1'";
  602. $result = Database::query($sql);
  603. while ($myrow = Database::fetch_array($result)) {
  604. echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
  605. echo "<img src='../img/agenda.gif' alt='agenda'>";
  606. echo api_convert_and_format_date($myrow['start_date'], null, date_default_timezone_get())."<br />";
  607. echo "<b>".$myrow['title']."</b></td></tr><tr><td>";
  608. echo $myrow['content']."<br />";
  609. showorhide_addresourcelink($content, $myrow['id']);
  610. echo "</td></tr></table><br />";
  611. }
  612. } // end if ($_GET['resource'] == 'Agenda')
  613. /* Chapter */
  614. if ($content == 'chapter') {
  615. echo '<table><form name="add_chapter" action="'.'" method="POST">'."\n";
  616. echo ' <tr><td>'.get_lang('Title').'</td><td><input type="text" name="title" value="'.$title.'"></input></td></tr>'."\n";
  617. echo ' <tr><td>'.get_lang('Description').'</td><td><input type="text" name="description" value="'.$description.'"></input></td></tr>'."\n";
  618. echo ' <tr><td></td><td><input type="submit" name="add_chapter" value="'.get_lang('AddIt').'"/></td></tr>'."\n";
  619. echo '</form></table>'."\n";
  620. //echo "<hr />";
  621. }
  622. /* Documents */
  623. // We show the documents in the following cases
  624. // 1. the link to add documenets in the resource linker was clicked
  625. // 2. we come to the resource linker for the first time (documents = default). In this case it can only be shown if
  626. // a. one is a teacher (documents can be shown even if the tool is inactive)
  627. // b. one is a student AND the documents tool is active. Student cannot add documents if the documents tool is inactive (teacher can do this)
  628. if ($content == 'Document' || (empty($content) && (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules))) && !$_GET['showresources']) {
  629. // setting variables for file locations
  630. $baseServDir = $_configuration['root_sys'];
  631. $courseDir = $_course['path'].'/document';
  632. $baseWorkDir = $baseServDir.$courseDir;
  633. // showing the link to move one folder up (when not in the root folder)
  634. show_folder_up();
  635. // showing the blue bar with the path in it when we are not in the root
  636. if (get_levels($folder)) {
  637. echo "<table width=\"100%\"><tr><td bgcolor=\"#4171B5\">";
  638. echo "<img src=\"../img/opendir.gif\" alt='directory'><font color=\"#ffffff\"><b>";
  639. echo $folder."</b></font></td></tr></table>";
  640. }
  641. // Showing the documents and subfolders of the folder we are in.
  642. show_documents($folder);
  643. //echo "<hr />";
  644. }
  645. /* Ad Valvas */
  646. if ($content == 'Ad_Valvas') {
  647. $tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
  648. $sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
  649. //error_log($sql, 0);
  650. $result = Database::query($sql);
  651. while ($myrow = Database::fetch_array($result)) {
  652. echo "<table width=\"100%\"><tr><td>";
  653. echo "<img src='../img/valves.gif' alt='advalvas'>";
  654. echo api_convert_and_format_date($myrow['end_date'], DATE_FORMAT_LONG, date_default_timezone_get());
  655. echo "</td></tr><tr><td>";
  656. echo $myrow['title']."<br />";
  657. showorhide_addresourcelink($content, $myrow['id']);
  658. echo "</td></tr></table>";
  659. }
  660. }
  661. /* Forums */
  662. if ($content == 'Forum') {
  663. $TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
  664. $TBL_CATAGORIES = Database::get_course_table(TABLE_FORUM_CATEGORY);
  665. $TBL_FORUMTOPICS = Database::get_course_table(TABLE_FORUM_THREAD);
  666. $tbl_posts = Database::get_course_table(TABLE_FORUM_POST);
  667. echo "<table width='100%'>";
  668. // Displaying the categories and the forums.
  669. if (!$forum and !$thread) {
  670. $sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.forum_category=categories.cat_id ORDER BY forums.forum_category DESC";
  671. //error_log($sql, 0);
  672. $result = Database::query($sql);
  673. while ($myrow = Database::fetch_array($result)) {
  674. if ($myrow['cat_title'] !== $old_cat_title) {
  675. echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow['cat_title']."</b></font></td></tr>";
  676. }
  677. $old_cat_title = $myrow['cat_title'];
  678. echo "<tr><td><img src='../img/forum.gif'><a href='".api_get_self()."?content=Forum&category=".$myrow['cat_id']."&forum=".$myrow['forum_id']."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".$myrow['forum_name']."</td><td>";
  679. showorhide_addresourcelink('Forum', $myrow['forum_id']);
  680. echo "</td></tr>";
  681. }
  682. }
  683. // Displaying all the threads of one forum.
  684. if ($forum) {
  685. // Displaying the category title.
  686. $sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
  687. $result = Database::query($sql);
  688. $myrow = Database::fetch_array($result);
  689. echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow['cat_title']."</b></font></td></tr>";
  690. // Displaying the forum title.
  691. $sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
  692. $result = Database::query($sql);
  693. $myrow = Database::fetch_array($result);
  694. echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow['forum_name']."</b></td></tr>";
  695. if (!$thread) {
  696. // Displaying all the threads of this forum.
  697. $sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
  698. $result = Database::query($sql);
  699. while ($myrow = Database::fetch_array($result)) {
  700. echo "<tr><td><a href='".api_get_self()."?content=Forum&category=$category&forum=1&thread=".$myrow['topic_id']."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".$myrow['topic_title']."</a> (".$myrow['prenom']." ".$myrow['nom'].")</td><td>";
  701. showorhide_addresourcelink("Thread", $myrow['topic_id']);
  702. echo "</td></tr>";
  703. }
  704. } else {
  705. // Displaying all the replies.
  706. $sql = "SELECT * FROM ".$tbl_posts." post WHERE post.topic_id=$thread ORDER BY post.post_id ASC";
  707. $result = Database::query($sql);
  708. while ($myrow = Database::fetch_array($result)) {
  709. echo "<tr><td><b>".$myrow['post_title']."</b><br />";
  710. echo $myrow['post_text']."</td>";
  711. echo "<td>";
  712. showorhide_addresourcelink('Post', $myrow['post_id']);
  713. echo "</td></tr><tr><td colspan='2'><hr noshade></td></tr>";
  714. }
  715. }
  716. }
  717. echo "</table>";
  718. }
  719. /* Links */
  720. if ($content == 'Link') {
  721. // Including the links language file.
  722. include "../lang/$language/link.inc.php";
  723. // Including the links functions file.
  724. require_once api_get_path(LIBRARY_PATH).'link.lib.php';
  725. $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
  726. if (($learnpath_id != '') and ($content == 'Link')) {
  727. echo "<form name='learnpath_link'><table>";
  728. echo "<tr></td><td align='left'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target' onchange='javascript: targetfunc();'><option value='_self' ";
  729. if ($target == '_self') {
  730. echo "selected";
  731. }
  732. echo ">".get_lang('SameWindow')."</option><option value='_blank'";
  733. if ($target == '_blank') {
  734. echo "selected";
  735. }
  736. echo ">".get_lang('NewWindow')."</option></select></td></tr></table></form>";
  737. }
  738. // Showing the links that are in the root (having no category).
  739. $sql = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE (l.category_id=0 or l.category_id IS NULL) AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1'";
  740. $result = Database::query($sql);
  741. if (Database::num_rows($result) > 0) {
  742. echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
  743. while ($myrow = Database::fetch_array($result)) {
  744. echo "<img src='../img/links.gif'>".$myrow['title'];
  745. echo "<br />";
  746. showorhide_addresourcelink($content, $myrow['id']);
  747. echo "<br /><br />";
  748. }
  749. }
  750. // Showing the categories and the links in it.
  751. $sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
  752. $resultcategories = Database::query($sqlcategories) or die;
  753. while ($myrow = @ Database::fetch_array($resultcategories)) {
  754. $sql_links = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE l.category_id='".$myrow['id']."' AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1' ORDER BY l.display_order DESC";
  755. echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow['category_title']."</i></td></tr></table>";
  756. $result_links = Database::query($sql_links);
  757. while ($myrow = Database::fetch_array($result_links)) {
  758. echo "<img src='../img/links.gif' />".$myrow['title'];
  759. echo "<br />";
  760. showorhide_addresourcelink($content, $myrow['id']);
  761. echo "<br /><br />";
  762. }
  763. }
  764. }
  765. /* Exercise */
  766. if (($content == 'Exercise') || ($content == 'HotPotatoes')) {
  767. $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
  768. $result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY id ASC");
  769. while ($myrow = Database::fetch_array($result)) {
  770. echo "<img src='../img/quiz.gif'>".$myrow['title']."<br />";
  771. showorhide_addresourcelink($content, $myrow["id"]);
  772. echo "<br /><br />";
  773. }
  774. if ($from_learnpath == 'yes') {
  775. $uploadPath = '/HotPotatoes_files';
  776. $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
  777. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  778. $sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY id ASC";
  779. $result = Database::query($sql);
  780. while ($myrow = Database::fetch_array($result)) {
  781. $path = $myrow['path'];
  782. echo "<img src='../img/jqz.jpg'>".GetQuizName($path, $documentPath)."<br />";
  783. showorhide_addresourcelink('HotPotatoes', $myrow['id']);
  784. echo "<br /><br />";
  785. }
  786. }
  787. }
  788. /* External Links */
  789. if ($content == 'Externallink') {
  790. ?>
  791. <form name="form1" method="post" action="">
  792. <table width="80%" border="0" cellspacing="0" cellpadding="0">
  793. <tr>
  794. <td align="right"><?php echo get_lang('ExternalLink'); ?> : &nbsp;</td>
  795. <td align="left"><input name="external_link" type="text" id="external_link" value="http://"></td>
  796. <?php
  797. if ($learnpath_id != '') {
  798. echo "</tr><tr><td align='right'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target'><option value='_self'>".get_lang('SameWindow')."</option><option value='_blank'>".get_lang('NewWindow')."</option></select></td>";
  799. }
  800. ?>
  801. </tr>
  802. <tr>
  803. <td><?php if ($is_allowedToEdit) {echo get_lang('AddToLinks');} ?></td>
  804. <td>
  805. <?php if ($is_allowedToEdit){?>
  806. <select name="add_2_links" id="add_2_links">
  807. <option value="niet toevoegen" selected="selected">-<?php echo get_lang('DontAdd'); ?>-</option>
  808. <option value="0"><?php echo get_lang('MainCategory'); ?></option>
  809. <?php
  810. $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
  811. $sql = "SELECT * FROM $tbl_categories ORDER BY display_order ASC";
  812. echo $sql;
  813. $result = Database::query($sql);
  814. while ($row = Database::fetch_array($result)) {
  815. echo "<option value='".$row['id']."'>".$row['category_title']."</option>";
  816. }
  817. ?>
  818. </select><?php } ?></td>
  819. </tr>
  820. <tr>
  821. <td>&nbsp;</td>
  822. <td><input name="external_link_submit" type="submit" id="external_link_submit" value="<?php echo get_lang('AddIt'); ?>"></td>
  823. </tr>
  824. <tr>
  825. <td>&nbsp;</td>
  826. <td>&nbsp;</td>
  827. </tr>
  828. <tr>
  829. <td colspan="2">&nbsp;</td>
  830. </tr>
  831. </table>
  832. </form>
  833. <?php
  834. }
  835. /* Assignments */
  836. if ($content == 'Assignment') {
  837. echo "<a href=".api_get_self()."?content=Ass&add=Ass&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no>".get_lang('AddAssignmentPage')."</a>";
  838. }
  839. /* Dropbox */
  840. if ($content == 'Dropbox') {
  841. echo "<a href='".api_get_self()."?content=Drop&add=Drop&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('DropboxAdd')."</a>";
  842. }
  843. /* Introduction text */
  844. if ($content == 'Introduction_text') {
  845. echo "<a href='".api_get_self()."?content=Intro&add=Intro&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('IntroductionTextAdd')."</a>";
  846. }
  847. /* Course description */
  848. if ($content == 'Course_description') {
  849. echo "<a href='".api_get_self()."?content=Course_desc&add=Course_desc&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('CourseDescriptionAdd')."</a>";
  850. }
  851. /* Groups */
  852. if ($content == 'Groups') {
  853. echo "<a href='".api_get_self()."?content=Group&add=Group&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('GroupsAdd')."</a>";
  854. }
  855. /* Users */
  856. if ($content == 'Users') {
  857. echo "<a href='".api_get_self()."?content=User&add=User&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('UsersAdd')."</a>";
  858. }
  859. if ($showresources) {
  860. //echo "<h4>".get_lang('ResourceAdded')."</h4>";
  861. display_resources(1);
  862. }
  863. echo "</td></tr></table>";
  864. /* FOOTER */
  865. Display :: display_footer();