resourcelinker.php 42 KB

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