lp_impress.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
  16. api_not_allowed();
  17. }
  18. //Checking visibility (eye icon)
  19. $visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
  20. if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
  21. api_not_allowed();
  22. }
  23. if (empty($_SESSION['oLP'])) {
  24. api_not_allowed(true);
  25. }
  26. $debug = 0;
  27. if ($debug) { error_log('------ Entering lp_impress.php -------'); }
  28. $course_code = api_get_course_id();
  29. $course_id = api_get_course_int_id();
  30. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/impress/impress-demo.css');
  31. $list = $_SESSION['oLP']->get_toc();
  32. $is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
  33. if ($is_allowed_to_edit) {
  34. echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
  35. global $interbreadcrumb;
  36. $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
  37. $interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
  38. $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
  39. echo return_breadcrumb($interbreadcrumb, null, null);
  40. echo '</div>';
  41. }
  42. $html = '';
  43. $step = 1;
  44. foreach ($list as $toc) {
  45. $x = 1000*$step;
  46. //data-scale="'.$step.'"
  47. //data-x="850" data-y="3000" data-rotate="90" data-scale="5"
  48. $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500" >';
  49. $html .= '<div class="impress-content">';
  50. $src = $_SESSION['oLP']->get_link('http', $toc['id']);
  51. if ($toc['type'] !== 'dokeos_chapter') {
  52. //just showing the src in a iframe ...
  53. $html .= '<h2>'.$toc['title'].'</h2>';
  54. $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
  55. }else{
  56. $html .= "<div class='impress-title'>";
  57. $html .= '<h1>'.$toc['title'].'</h1>';
  58. $html .= "</div>";
  59. }
  60. $html .= "</div>";
  61. $html .= "</div>";
  62. $step ++;
  63. }
  64. //Setting the template
  65. $tpl = new Template($tool_name, false, false, true);
  66. $tpl->assign('html', $html);
  67. $content = $tpl->fetch('default/learnpath/impress.tpl');
  68. $tpl->assign('content', $content);
  69. $tpl->display_one_col_template();