lp_impress.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. *
  5. * @package chamilo.learnpath
  6. */
  7. /**
  8. * Code
  9. */
  10. $_SESSION['whereami'] = 'lp/impress';
  11. $this_section = SECTION_COURSES;
  12. /* Libraries */
  13. require_once 'back_compat.inc.php';
  14. //To prevent the template class
  15. $show_learnpath = true;
  16. api_protect_course_script();
  17. /*
  18. * Only activate impress if you're the admin
  19. */
  20. if (!api_is_platform_admin()) {
  21. exit;
  22. }
  23. $lp_id = intval($_GET['lp_id']);
  24. // Check if the learning path is visible for student - (LP requisites)
  25. if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
  26. api_not_allowed();
  27. }
  28. //Checking visibility (eye icon)
  29. $visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
  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();
  35. }
  36. $debug = 0;
  37. if ($debug) { error_log('------ Entering lp_impress.php -------'); }
  38. $course_code = api_get_course_id();
  39. $course_id = api_get_course_int_id();
  40. //$htmlHeadXtra[] = api_get_js('impress/impress.js'); //added in the template
  41. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/impress/impress-demo.css');
  42. $list = $_SESSION['oLP']->get_toc();
  43. $html = '';
  44. $step = 1;
  45. foreach ($list as $toc) {
  46. $x = 1000*$step;
  47. //data-scale="'.$step.'"
  48. //data-x="850" data-y="3000" data-rotate="90" data-scale="5"
  49. $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500" >';
  50. $html .= '<h2>'.$toc['title'].'</h2>';
  51. $src = $_SESSION['oLP']->get_link('http', $toc['id']);
  52. //just showing the src in a iframe ...
  53. $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="'.$src.'"></iframe>';
  54. $html .= "</div>\n";
  55. $step ++;
  56. }
  57. //Setting the template
  58. //$tpl = new Template($tool_name, false, false, true);
  59. $tpl = new Template($tool_name);
  60. $tpl->assign('html', $html);
  61. $content = $tpl->fetch('default/learnpath/impress.tpl');
  62. $tpl->assign('content', $content);
  63. $tpl->display_one_col_template();