lp_impress.php 2.6 KB

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