lp_impress.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. *
  5. * @package chamilo.learnpath
  6. */
  7. require_once '../inc/global.inc.php';
  8. $_SESSION['whereami'] = 'lp/impress';
  9. $this_section = SECTION_COURSES;
  10. //To prevent the template class
  11. $show_learnpath = true;
  12. api_protect_course_script();
  13. $lp_id = intval($_GET['lp_id']);
  14. // Check if the learning path is visible for student - (LP requisites)
  15. if (!api_is_allowed_to_edit(null, true) &&
  16. !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())
  17. ) {
  18. api_not_allowed();
  19. }
  20. //Checking visibility (eye icon)
  21. $visibility = api_get_item_visibility(
  22. api_get_course_info(),
  23. TOOL_LEARNPATH,
  24. $lp_id,
  25. $action,
  26. api_get_user_id(),
  27. api_get_session_id()
  28. );
  29. if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
  30. api_not_allowed();
  31. }
  32. if (empty($_SESSION['oLP'])) {
  33. api_not_allowed(true);
  34. }
  35. $debug = 0;
  36. if ($debug) { error_log('------ Entering lp_impress.php -------'); }
  37. $course_code = api_get_course_id();
  38. $course_id = api_get_course_int_id();
  39. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/impress/impress-demo.css');
  40. $list = $_SESSION['oLP']->get_toc();
  41. $is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
  42. if ($is_allowed_to_edit) {
  43. echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
  44. global $interbreadcrumb;
  45. $interbreadcrumb[] = array(
  46. 'url' => 'lp_controller.php?action=list&isStudentView=false',
  47. 'name' => get_lang('LearningPaths'),
  48. );
  49. $interbreadcrumb[] = array(
  50. 'url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false",
  51. 'name' => $_SESSION['oLP']->get_name(),
  52. );
  53. $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
  54. echo return_breadcrumb($interbreadcrumb, null, null);
  55. echo '</div>';
  56. }
  57. $html = '';
  58. $step = 1;
  59. foreach ($list as $toc) {
  60. $x = 1000*$step;
  61. $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500" >';
  62. $html .= '<div class="impress-content">';
  63. $src = $_SESSION['oLP']->get_link('http', $toc['id']);
  64. if ($toc['type'] !== 'dokeos_chapter') {
  65. //just showing the src in a iframe ...
  66. $html .= '<h2>'.$toc['title'].'</h2>';
  67. $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
  68. }else{
  69. $html .= "<div class='impress-title'>";
  70. $html .= '<h1>'.$toc['title'].'</h1>';
  71. $html .= "</div>";
  72. }
  73. $html .= "</div>";
  74. $html .= "</div>";
  75. $step ++;
  76. }
  77. //Setting the template
  78. $tpl = new Template($tool_name, false, false, true);
  79. $tpl->assign('html', $html);
  80. $content = $tpl->fetch('default/learnpath/impress.tpl');
  81. $tpl->assign('content', $content);
  82. $tpl->display_one_col_template();