resourcelinker.php 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  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 '../inc/global.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 iid = ".$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. } 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. Session::write('from_learnpath', $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(
  405. 'url' => "../newscorm/lp_controller.php?action=list",
  406. 'name' => get_lang('LearningPath')
  407. );
  408. $interbreadcrumb[] = array(
  409. 'url' => "../newscorm/lp_controller.php?action=admin_view&lp_id=$learnpath_id",
  410. 'name' => stripslashes("{$therow['name']}")
  411. );
  412. $interbreadcrumb[] = array(
  413. 'url' => api_get_self()."?action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no",
  414. 'name' => "{$therow2['title']}"
  415. );
  416. }
  417. $htmlHeadXtra[] = '<script type="text/javascript">
  418. /* <![CDATA[ */
  419. function targetfunc(input)
  420. {
  421. window.location=window.location+"&amp;target="+document.learnpath_link.target.value;
  422. }
  423. /* ]]> */
  424. </script>';
  425. Display :: display_header($nameTools);
  426. echo "<h3>".$nameTools;
  427. if ($from_learnpath == 'yes') {
  428. echo get_lang('AddResource')." - {$therow2['title']}";
  429. }
  430. echo "</h3>";
  431. // We retrieve the tools that are active.
  432. // We use this to check which resources a student may add (only the modules that are active).
  433. // See http://www.dokeos.com/forum/viewtopic.php?t=4858
  434. $active_modules = array();
  435. $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  436. $sql_select_active = "SELECT * FROM $tool_table WHERE visibility='1'";
  437. $result_select_active = Database::query($sql_select_active);
  438. while ($row = Database::fetch_array($result_select_active)) {
  439. $active_modules[] = $row['name'];
  440. }
  441. ?>
  442. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  443. <tr>
  444. <td width="300" valign="top" style='padding-right:15px;'>
  445. <table width="300" border="0" cellspacing="0" cellpadding="0" style='border-right:1px solid grey;'>
  446. <?php if ($from_learnpath != 'yes') { ?>
  447. <tr>
  448. <td width="26%"><b><?php echo get_lang('CourseResources'); ?></b></td>
  449. </tr>
  450. <?php
  451. if (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules)) {
  452. ?>
  453. <tr>
  454. <td><?php echo "<a href=\"".api_get_self(
  455. )."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  456. 'Documents'
  457. )."</a>"; ?></td>
  458. </tr>
  459. <?php
  460. }
  461. if (api_is_allowed_to_edit() || in_array(TOOL_CALENDAR_EVENT, $active_modules)) {
  462. ?>
  463. <tr>
  464. <td><?php echo "<a href=\"".api_get_self(
  465. )."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  466. 'Agenda'
  467. )."</a>"; ?></td>
  468. </tr>
  469. <?php
  470. }
  471. if (api_is_allowed_to_edit() || in_array(TOOL_ANNOUNCEMENT, $active_modules)) {
  472. ?>
  473. <tr>
  474. <td><?php echo "<a href=\"".api_get_self(
  475. )."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  476. 'AdValvas'
  477. )."</a>"; ?></td>
  478. </tr>
  479. <?php
  480. }
  481. if (api_is_allowed_to_edit() || in_array(TOOL_BB_FORUM, $active_modules)) {
  482. ?>
  483. <tr>
  484. <td><?php echo "<a href=\"".api_get_self(
  485. )."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  486. 'Forum'
  487. )."</a>"; ?></td>
  488. </tr>
  489. <?php
  490. }
  491. if (api_is_allowed_to_edit() || in_array(TOOL_LINK, $active_modules)) {
  492. ?>
  493. <tr>
  494. <td><?php echo "<a href=\"".api_get_self(
  495. )."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  496. 'Links'
  497. )."</a>"; ?></td>
  498. </tr>
  499. <?php
  500. }
  501. if (api_is_allowed_to_edit() || in_array(TOOL_QUIZ, $active_modules)) {
  502. ?>
  503. <tr>
  504. <td><?php echo "<a href=\"".api_get_self(
  505. )."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  506. 'Exercise'
  507. )."</a>"; ?></td>
  508. </tr>
  509. <?php
  510. }
  511. } else {
  512. ?>
  513. <!--tr>
  514. <td width="26%"><b><?php echo get_lang('ExportableCourseResources'); ?></b></td>
  515. </tr-->
  516. <?php if ($multi_level_learnpath === true) { ?>
  517. <tr>
  518. <td><?php echo "<a href=\"".api_get_self(
  519. )."?content=chapter&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  520. 'Chapter'
  521. )."</a>"; ?></td>
  522. </tr>
  523. <?php } ?>
  524. <tr>
  525. <td><?php echo "<a href=\"".api_get_self(
  526. )."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  527. 'Document'
  528. )."</a>"; ?></td>
  529. </tr>
  530. <tr>
  531. <td><?php echo "<a href=\"".api_get_self(
  532. )."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  533. 'Exercise'
  534. )."</a>"; ?></td>
  535. </tr>
  536. <tr>
  537. <td><?php echo "<a href=\"".api_get_self(
  538. )."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  539. 'Link'
  540. )."</a>"; ?></td>
  541. </tr>
  542. <tr>
  543. <td><?php echo "<a href=\"".api_get_self(
  544. )."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  545. 'Forum'
  546. )."</a>"; ?></td>
  547. </tr>
  548. <tr>
  549. <td><?php echo "<a href=\"".api_get_self(
  550. )."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  551. 'Agenda'
  552. )."</a>"; ?></td>
  553. </tr>
  554. <tr>
  555. <td><?php echo "<a href=\"".api_get_self(
  556. )."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  557. 'AdValvas'
  558. )."</a>"; ?></td>
  559. </tr>
  560. <!--tr>
  561. <td><?php echo "<a href=\"".api_get_self(
  562. )."?content=Course_description&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  563. 'CourseDescription'
  564. )."</a>"; ?></td>
  565. </tr-->
  566. <!--tr>
  567. <td><?php echo "<a href=\"".api_get_self(
  568. )."?content=Introduction_text&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  569. 'IntroductionText'
  570. )."</a>"; ?></td>
  571. </tr-->
  572. <!--tr>
  573. <td>&nbsp;</td>
  574. </tr-->
  575. <!--tr>
  576. <td width="26%"><b><?php echo get_lang('DokeosRelatedCourseMaterial'); ?></b></td>
  577. </tr-->
  578. <tr>
  579. <td><?php echo "<a href=\"".api_get_self(
  580. )."?content=Dropbox&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  581. 'Dropbox'
  582. )."</a>"; ?></td>
  583. </tr>
  584. <tr>
  585. <td><?php echo "<a href=\"".api_get_self(
  586. )."?content=Assignment&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  587. 'Assignments'
  588. )."</a>"; ?></td>
  589. </tr>
  590. <tr>
  591. <td><?php echo "<a href=\"".api_get_self(
  592. )."?content=Groups&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  593. 'Groups'
  594. )."</a>"; ?></td>
  595. </tr>
  596. <tr>
  597. <td><?php echo "<a href=\"".api_get_self(
  598. )."?content=Users&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  599. 'Users'
  600. )."</a>"; ?></td>
  601. </tr>
  602. <?php
  603. }
  604. ?>
  605. <!--tr>
  606. <td>&nbsp;</td>
  607. </tr-->
  608. <!--tr>
  609. <td><b><?php echo get_lang('ExternalResources'); ?></b></td>
  610. </tr-->
  611. <tr>
  612. <td><?php echo "<a href=\"".api_get_self(
  613. )."?content=Externallink&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  614. 'ExternalLink'
  615. )."</a>"; ?></td>
  616. </tr>
  617. <?php
  618. if ($from_learnpath != 'yes') {
  619. echo "<tr><td>&nbsp;</td></tr>";
  620. echo "<tr><td><b>".get_lang('ResourcesAdded')." (";
  621. echo count($addedresource);
  622. echo ")</b></td></tr>";
  623. echo "<tr><td nowrap><a href=\"".api_get_self(
  624. )."?showresources=true&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang(
  625. 'ShowDelete'
  626. )."</a>";
  627. echo "</td></tr>";
  628. }
  629. ?>
  630. <tr>
  631. <td>&nbsp;</td>
  632. </tr>
  633. <!--<tr>
  634. <td><b><?php echo get_lang('BackTo'); ?></b></td>
  635. </tr>//-->
  636. <tr>
  637. <td>
  638. <?php
  639. if ($from_learnpath != 'yes') {
  640. echo "<form method=\"post\" action=\"{$_SESSION['origintoolurl']}\" style=\"margin: 0px;\"><input type=\"submit\" value=\"".' '.get_lang(
  641. 'Ok'
  642. ).' '."\"></form>";
  643. } else {
  644. echo "<form method=\"get\" action=\"lp_controller.php\" style=\"margin: 0px;\"><input type=\"hidden\" name=\"lp_id\" value=\"".htmlentities(
  645. $learnpath_id
  646. )."\"><input type=\"hidden\" name=\"action\" value=\"admin_view\"><input type=\"submit\" value=\"".' '.get_lang(
  647. 'Ok'
  648. ).' '."\"></form>";
  649. }
  650. ?>
  651. </td>
  652. </tr>
  653. <tr>
  654. <td>&nbsp;</td>
  655. </tr>
  656. </table>
  657. </td>
  658. <td valign="top">
  659. <?php
  660. if ($resource_added) {
  661. Display :: display_normal_message(get_lang('ResourceAdded'));
  662. }
  663. if ($InvalidURL) {
  664. Display :: display_normal_message(get_lang('GiveURL'));
  665. }
  666. if ($from_learnpath != 'yes') {
  667. echo count($addedresource)." ".strtolower(get_lang('ResourcesAdded'))."<br />";
  668. }
  669. //echo "<hr />";
  670. // Agenda items -->
  671. if ($content == 'Agenda') {
  672. $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
  673. $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
  674. $sql = "SELECT agenda.*, toolitemproperties.*
  675. FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
  676. WHERE agenda.id = toolitemproperties.ref
  677. AND toolitemproperties.tool='".TOOL_CALENDAR_EVENT."'
  678. AND toolitemproperties.to_group_id='0'
  679. AND toolitemproperties.visibility='1'";
  680. $result = Database::query($sql);
  681. while ($myrow = Database::fetch_array($result)) {
  682. echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
  683. echo "<img src='../img/agenda.gif' alt='agenda'>";
  684. echo api_convert_and_format_date($myrow['start_date'], null, date_default_timezone_get())."<br />";
  685. echo "<b>".$myrow['title']."</b></td></tr><tr><td>";
  686. echo $myrow['content']."<br />";
  687. showorhide_addresourcelink($content, $myrow['id']);
  688. echo "</td></tr></table><br />";
  689. }
  690. } // end if ($_GET['resource'] == 'Agenda')
  691. /* Chapter */
  692. if ($content == 'chapter') {
  693. echo '<table><form name="add_chapter" action="'.'" method="POST">'."\n";
  694. echo ' <tr><td>'.get_lang(
  695. 'Title'
  696. ).'</td><td><input type="text" name="title" value="'.$title.'"></input></td></tr>'."\n";
  697. echo ' <tr><td>'.get_lang(
  698. 'Description'
  699. ).'</td><td><input type="text" name="description" value="'.$description.'"></input></td></tr>'."\n";
  700. echo ' <tr><td></td><td><input type="submit" name="add_chapter" value="'.get_lang('AddIt').'"/></td></tr>'."\n";
  701. echo '</form></table>'."\n";
  702. //echo "<hr />";
  703. }
  704. /* Documents */
  705. // We show the documents in the following cases
  706. // 1. the link to add documenets in the resource linker was clicked
  707. // 2. we come to the resource linker for the first time (documents = default). In this case it can only be shown if
  708. // a. one is a teacher (documents can be shown even if the tool is inactive)
  709. // 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)
  710. if ($content == 'Document' || (empty($content) && (api_is_allowed_to_edit() || in_array(
  711. TOOL_DOCUMENT,
  712. $active_modules
  713. ))) && !$_GET['showresources']
  714. ) {
  715. // setting variables for file locations
  716. $baseServDir = api_get_path(SYS_PATH);
  717. $courseDir = $_course['path'].'/document';
  718. $baseWorkDir = $baseServDir.$courseDir;
  719. // showing the link to move one folder up (when not in the root folder)
  720. show_folder_up();
  721. // showing the blue bar with the path in it when we are not in the root
  722. if (FileManager::get_levels($folder)) {
  723. echo "<table width=\"100%\"><tr><td bgcolor=\"#4171B5\">";
  724. echo "<img src=\"../img/opendir.gif\" alt='directory'><font color=\"#ffffff\"><b>";
  725. echo $folder."</b></font></td></tr></table>";
  726. }
  727. // Showing the documents and subfolders of the folder we are in.
  728. show_documents($folder);
  729. //echo "<hr />";
  730. }
  731. /* Ad Valvas */
  732. if ($content == 'Ad_Valvas') {
  733. $tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
  734. $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";
  735. //error_log($sql, 0);
  736. $result = Database::query($sql);
  737. while ($myrow = Database::fetch_array($result)) {
  738. echo "<table width=\"100%\"><tr><td>";
  739. echo "<img src='../img/valves.gif' alt='advalvas'>";
  740. echo api_convert_and_format_date($myrow['end_date'], DATE_FORMAT_LONG, date_default_timezone_get());
  741. echo "</td></tr><tr><td>";
  742. echo $myrow['title']."<br />";
  743. showorhide_addresourcelink($content, $myrow['id']);
  744. echo "</td></tr></table>";
  745. }
  746. }
  747. /* Forums */
  748. if ($content == 'Forum') {
  749. $TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
  750. $TBL_CATAGORIES = Database::get_course_table(TABLE_FORUM_CATEGORY);
  751. $TBL_FORUMTOPICS = Database::get_course_table(TABLE_FORUM_THREAD);
  752. $tbl_posts = Database::get_course_table(TABLE_FORUM_POST);
  753. echo "<table width='100%'>";
  754. // Displaying the categories and the forums.
  755. if (!$forum and !$thread) {
  756. $sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.forum_category=categories.cat_id ORDER BY forums.forum_category DESC";
  757. //error_log($sql, 0);
  758. $result = Database::query($sql);
  759. while ($myrow = Database::fetch_array($result)) {
  760. if ($myrow['cat_title'] !== $old_cat_title) {
  761. echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow['cat_title']."</b></font></td></tr>";
  762. }
  763. $old_cat_title = $myrow['cat_title'];
  764. echo "<tr><td><img src='../img/forum.gif'><a href='".api_get_self(
  765. )."?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>";
  766. showorhide_addresourcelink('Forum', $myrow['forum_id']);
  767. echo "</td></tr>";
  768. }
  769. }
  770. // Displaying all the threads of one forum.
  771. if ($forum) {
  772. // Displaying the category title.
  773. $sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
  774. $result = Database::query($sql);
  775. $myrow = Database::fetch_array($result);
  776. echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow['cat_title']."</b></font></td></tr>";
  777. // Displaying the forum title.
  778. $sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
  779. $result = Database::query($sql);
  780. $myrow = Database::fetch_array($result);
  781. echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow['forum_name']."</b></td></tr>";
  782. if (!$thread) {
  783. // Displaying all the threads of this forum.
  784. $sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
  785. $result = Database::query($sql);
  786. while ($myrow = Database::fetch_array($result)) {
  787. echo "<tr><td><a href='".api_get_self(
  788. )."?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>";
  789. showorhide_addresourcelink("Thread", $myrow['topic_id']);
  790. echo "</td></tr>";
  791. }
  792. } else {
  793. // Displaying all the replies.
  794. $sql = "SELECT * FROM ".$tbl_posts." post WHERE post.topic_id=$thread ORDER BY post.post_id ASC";
  795. $result = Database::query($sql);
  796. while ($myrow = Database::fetch_array($result)) {
  797. echo "<tr><td><b>".$myrow['post_title']."</b><br />";
  798. echo $myrow['post_text']."</td>";
  799. echo "<td>";
  800. showorhide_addresourcelink('Post', $myrow['post_id']);
  801. echo "</td></tr><tr><td colspan='2'><hr noshade></td></tr>";
  802. }
  803. }
  804. }
  805. echo "</table>";
  806. }
  807. /* Links */
  808. if ($content == 'Link') {
  809. // Including the links language file.
  810. include "../lang/$language/link.inc.php";
  811. // Including the links functions file.
  812. require_once api_get_path(LIBRARY_PATH).'link.lib.php';
  813. $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
  814. if (($learnpath_id != '') and ($content == 'Link')) {
  815. echo "<form name='learnpath_link'><table>";
  816. echo "<tr></td><td align='left'>".get_lang(
  817. 'LinkTarget'
  818. )." :</td><td align='left'><select name='target' onchange='javascript: targetfunc();'><option value='_self' ";
  819. if ($target == '_self') {
  820. echo "selected";
  821. }
  822. echo ">".get_lang('SameWindow')."</option><option value='_blank'";
  823. if ($target == '_blank') {
  824. echo "selected";
  825. }
  826. echo ">".get_lang('NewWindow')."</option></select></td></tr></table></form>";
  827. }
  828. // Showing the links that are in the root (having no category).
  829. $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'";
  830. $result = Database::query($sql);
  831. if (Database::num_rows($result) > 0) {
  832. echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
  833. while ($myrow = Database::fetch_array($result)) {
  834. echo "<img src='../img/links.gif'>".$myrow['title'];
  835. echo "<br />";
  836. showorhide_addresourcelink($content, $myrow['id']);
  837. echo "<br /><br />";
  838. }
  839. }
  840. // Showing the categories and the links in it.
  841. $sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
  842. $resultcategories = Database::query($sqlcategories) or die;
  843. while ($myrow = @ Database::fetch_array($resultcategories)) {
  844. $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";
  845. echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow['category_title']."</i></td></tr></table>";
  846. $result_links = Database::query($sql_links);
  847. while ($myrow = Database::fetch_array($result_links)) {
  848. echo "<img src='../img/links.gif' />".$myrow['title'];
  849. echo "<br />";
  850. showorhide_addresourcelink($content, $myrow['id']);
  851. echo "<br /><br />";
  852. }
  853. }
  854. }
  855. /* Exercise */
  856. if (($content == 'Exercise') || ($content == 'HotPotatoes')) {
  857. $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
  858. $result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY iid ASC");
  859. while ($myrow = Database::fetch_array($result)) {
  860. echo "<img src='../img/quiz.gif'>".$myrow['title']."<br />";
  861. showorhide_addresourcelink($content, $myrow["id"]);
  862. echo "<br /><br />";
  863. }
  864. if ($from_learnpath == 'yes') {
  865. $uploadPath = '/HotPotatoes_files';
  866. $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
  867. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  868. $sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY iid ASC";
  869. $result = Database::query($sql);
  870. while ($myrow = Database::fetch_array($result)) {
  871. $path = $myrow['path'];
  872. echo "<img src='../img/jqz.jpg'>".GetQuizName($path, $documentPath)."<br />";
  873. showorhide_addresourcelink('HotPotatoes', $myrow['id']);
  874. echo "<br /><br />";
  875. }
  876. }
  877. }
  878. /* External Links */
  879. if ($content == 'Externallink') {
  880. ?>
  881. <form name="form1" method="post" action="">
  882. <table width="80%" border="0" cellspacing="0" cellpadding="0">
  883. <tr>
  884. <td align="right"><?php echo get_lang('ExternalLink'); ?> : &nbsp;</td>
  885. <td align="left"><input name="external_link" type="text" id="external_link" value="http://"></td>
  886. <?php
  887. if ($learnpath_id != '') {
  888. echo "</tr><tr><td align='right'>".get_lang(
  889. 'LinkTarget'
  890. )." :</td><td align='left'><select name='target'><option value='_self'>".get_lang(
  891. 'SameWindow'
  892. )."</option><option value='_blank'>".get_lang('NewWindow')."</option></select></td>";
  893. }
  894. ?>
  895. </tr>
  896. <tr>
  897. <td><?php if ($is_allowedToEdit) {
  898. echo get_lang('AddToLinks');
  899. } ?></td>
  900. <td>
  901. <?php if ($is_allowedToEdit) { ?>
  902. <select name="add_2_links" id="add_2_links">
  903. <option value="niet toevoegen" selected="selected">-<?php echo get_lang('DontAdd'); ?>-</option>
  904. <option value="0"><?php echo get_lang('MainCategory'); ?></option>
  905. <?php
  906. $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
  907. $sql = "SELECT * FROM $tbl_categories ORDER BY display_order ASC";
  908. echo $sql;
  909. $result = Database::query($sql);
  910. while ($row = Database::fetch_array($result)) {
  911. echo "<option value='".$row['id']."'>".$row['category_title']."</option>";
  912. }
  913. ?>
  914. </select><?php } ?></td>
  915. </tr>
  916. <tr>
  917. <td>&nbsp;</td>
  918. <td><input name="external_link_submit" type="submit" id="external_link_submit"
  919. value="<?php echo get_lang('AddIt'); ?>"></td>
  920. </tr>
  921. <tr>
  922. <td>&nbsp;</td>
  923. <td>&nbsp;</td>
  924. </tr>
  925. <tr>
  926. <td colspan="2">&nbsp;</td>
  927. </tr>
  928. </table>
  929. </form>
  930. <?php
  931. }
  932. /* Assignments */
  933. if ($content == 'Assignment') {
  934. echo "<a href=".api_get_self(
  935. )."?content=Ass&add=Ass&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no>".get_lang(
  936. 'AddAssignmentPage'
  937. )."</a>";
  938. }
  939. /* Dropbox */
  940. if ($content == 'Dropbox') {
  941. echo "<a href='".api_get_self(
  942. )."?content=Drop&add=Drop&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang(
  943. 'DropboxAdd'
  944. )."</a>";
  945. }
  946. /* Introduction text */
  947. if ($content == 'Introduction_text') {
  948. echo "<a href='".api_get_self(
  949. )."?content=Intro&add=Intro&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang(
  950. 'IntroductionTextAdd'
  951. )."</a>";
  952. }
  953. /* Course description */
  954. if ($content == 'Course_description') {
  955. echo "<a href='".api_get_self(
  956. )."?content=Course_desc&add=Course_desc&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang(
  957. 'CourseDescriptionAdd'
  958. )."</a>";
  959. }
  960. /* Groups */
  961. if ($content == 'Groups') {
  962. echo "<a href='".api_get_self(
  963. )."?content=Group&add=Group&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang(
  964. 'GroupsAdd'
  965. )."</a>";
  966. }
  967. /* Users */
  968. if ($content == 'Users') {
  969. echo "<a href='".api_get_self(
  970. )."?content=User&add=User&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang(
  971. 'UsersAdd'
  972. )."</a>";
  973. }
  974. if ($showresources) {
  975. //echo "<h4>".get_lang('ResourceAdded')."</h4>";
  976. display_resources(1);
  977. }
  978. echo "</td></tr></table>";
  979. /* FOOTER */
  980. Display :: display_footer();