lp_content.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php //$id: $
  2. /**
  3. * Script that displays an error message when no content could be loaded
  4. * @package dokeos.learnpath
  5. * @author Yannick Warnier <ywarnier@beeznest.org>
  6. */
  7. /**
  8. * Nothing very interesting
  9. */
  10. $debug = 0;
  11. if($debug>0){error_log('New lp - In lp_content.php',0);}
  12. if(empty($lp_controller_touched)){
  13. if($debug>0){error_log('New lp - In lp_content.php - Redirecting to lp_controller',0);}
  14. header('location: lp_controller.php?action=content&lp_id='.$_REQUEST['lp_id'].'&item_id='.$_REQUEST['item_id']);
  15. }
  16. $_SESSION['oLP']->error = '';
  17. $lp_type = $_SESSION['oLP']->get_type();
  18. $lp_item_id = $_SESSION['oLP']->get_current_item_id();
  19. /**
  20. * Get a link to the corresponding document
  21. */
  22. $src = '';
  23. if($debug>0){error_log('New lp - In lp_content.php - Looking for file url',0);}
  24. switch($lp_type){
  25. case 1:
  26. $_SESSION['oLP']->stop_previous_item();
  27. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  28. if($prereq_check === true){
  29. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  30. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  31. }else{
  32. $src = 'blank.php?error=prerequisites';
  33. }
  34. break;
  35. case 2:
  36. case 3:
  37. //save old if asset
  38. $_SESSION['oLP']->stop_previous_item(); //save status manually if asset
  39. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  40. if($prereq_check === true){
  41. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  42. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  43. }else{
  44. $src = 'blank.php';
  45. }
  46. break;
  47. case 4:
  48. break;
  49. }
  50. if($debug>0){error_log('New lp - In lp_content.php - File url is '.$src,0);}
  51. $_SESSION['oLP']->set_previous_item($lp_item_id);
  52. // Define the 'doc.inc.php' as language file
  53. $nameTools = $_SESSION['oLP']->get_name();
  54. $interbreadcrumb[]= array ("url"=>"./lp_list.php", "name"=> get_lang('Doc'));
  55. //update global setting to avoid displaying right menu
  56. $save_setting = get_setting("show_navigation_menu");
  57. global $_setting;
  58. $_setting['show_navigation_menu'] = false;
  59. if($debug>0){error_log('New LP - In lp_content.php - Loading '.$src,0);}
  60. header("Location: ".urldecode($src));