resourcelinker.php 42 KB

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