lp_view.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. <?php // $Id: lp_view.php,v 1.33 2006/09/12 10:20:46 yannoo Exp $
  2. /**
  3. ==============================================================================
  4. * This file was origially the copy of document.php, but many modifications happened since then ;
  5. * the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
  6. * will be automatically created for it, and the files will be uncompressed there for example ;
  7. *
  8. * @package dokeos.learnpath
  9. * @author Yannick Warnier <ywarnier@beeznest.org> - redesign
  10. * @author Denes Nagy, principal author
  11. * @author Isthvan Mandak, several new features
  12. * @author Roan Embrechts, code improvements and refactoring
  13. * @license GNU/GPL - See Dokeos license directory for details
  14. ==============================================================================
  15. */
  16. /**
  17. * Script
  18. */
  19. /*
  20. ==============================================================================
  21. INIT SECTION
  22. ==============================================================================
  23. */
  24. $_SESSION['whereami'] = 'lp/view';
  25. $this_section=SECTION_COURSES;
  26. if($lp_controller_touched!=1){
  27. header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
  28. }
  29. /*
  30. -----------------------------------------------------------
  31. Libraries
  32. -----------------------------------------------------------
  33. */
  34. require_once('back_compat.inc.php');
  35. //require_once('../learnpath/learnpath_functions.inc.php');
  36. require_once('scorm.lib.php');
  37. require_once('learnpath.class.php');
  38. require_once('learnpathItem.class.php');
  39. //require_once('lp_comm.common.php'); //xajax functions
  40. if ($is_allowed_in_course == false) api_not_allowed();
  41. /*
  42. -----------------------------------------------------------
  43. Variables
  44. -----------------------------------------------------------
  45. */
  46. //$charset = 'UTF-8';
  47. //$charset = 'ISO-8859-1';
  48. // we set the encoding of the lp
  49. if (!empty($_SESSION['oLP']->encoding)) {
  50. $charset = $_SESSION['oLP']->encoding;
  51. } else {
  52. $charset = api_get_system_encoding();
  53. }
  54. if (empty($charset)) {
  55. $charset = 'ISO-8859-1';
  56. }
  57. $oLearnpath = false;
  58. $course_code = api_get_course_id();
  59. $user_id = api_get_user_id();
  60. $platform_theme = api_get_setting('stylesheets'); // plataform's css
  61. $my_style=$platform_theme;
  62. //escape external variables
  63. /*
  64. -----------------------------------------------------------
  65. Header
  66. -----------------------------------------------------------
  67. */
  68. //$htmlHeadXtra[] = '<script type="text/javascript" src="lp_view.lib.js"></script>';
  69. //$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/')."\n";
  70. $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
  71. $htmlHeadXtra[] = '<script language="javascript">
  72. function cleanlog(){
  73. if(document.getElementById){
  74. document.getElementById("log_content").innerHTML = "";
  75. }
  76. }
  77. </script>';
  78. $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
  79. var dokeos_xajax_handler = window.oxajax;
  80. </script>';
  81. $_SESSION['oLP']->error = '';
  82. $lp_type = $_SESSION['oLP']->get_type();
  83. $lp_item_id = $_SESSION['oLP']->get_current_item_id();
  84. //$lp_item_id = learnpath::escape_string($_GET['item_id']);
  85. //$_SESSION['oLP']->set_current_item($lp_item_id); // already done by lp_controller.php
  86. //Prepare variables for the test tool (just in case) - honestly, this should disappear later on
  87. $_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
  88. $_SESSION['scorm_item_id'] = $lp_item_id;
  89. $_SESSION['lp_mode'] = $_SESSION['oLP']->mode;
  90. //reinit exercises variables to avoid spacename clashes (see exercise tool)
  91. if(isset($exerciseResult) or isset($_SESSION['exerciseResult']))
  92. {
  93. api_session_unregister($exerciseResult);
  94. }
  95. unset($_SESSION['objExercise']);
  96. unset($_SESSION['questionList']);
  97. /**
  98. * Get a link to the corresponding document
  99. */
  100. if (!isset($src))
  101. {
  102. $src = '';
  103. switch($lp_type)
  104. {
  105. case 1:
  106. $_SESSION['oLP']->stop_previous_item();
  107. $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
  108. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  109. if($prereq_check === true){
  110. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  111. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  112. }else{
  113. $src = 'blank.php?error=prerequisites';
  114. }
  115. break;
  116. case 2:
  117. //save old if asset
  118. $_SESSION['oLP']->stop_previous_item(); //save status manually if asset
  119. $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
  120. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  121. if($prereq_check === true){
  122. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  123. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  124. }else{
  125. $src = 'blank.php?error=prerequisites';
  126. }
  127. break;
  128. case 3:
  129. //aicc
  130. $_SESSION['oLP']->stop_previous_item(); //save status manually if asset
  131. $htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
  132. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  133. if($prereq_check === true){
  134. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  135. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  136. }else{
  137. $src = 'blank.php';
  138. }
  139. break;
  140. case 4:
  141. break;
  142. }
  143. }
  144. $list = $_SESSION['oLP']->get_toc();
  145. $type_quiz = false;
  146. foreach($list as $toc) {
  147. if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz') ) {
  148. $type_quiz = true;
  149. }
  150. }
  151. $autostart = 'true';
  152. // update status,total_time from lp_item_view table when you finish the exercises in learning path
  153. if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) {
  154. global $src;
  155. $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db();
  156. $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  157. $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
  158. $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
  159. $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
  160. $safe_item_id = Database::escape_string($_GET['lp_item_id']);
  161. $safe_id = Database::escape_string($_GET['lp_id']);
  162. $safe_exe_id = Database::escape_string($_REQUEST['exeId']);
  163. if ($safe_id == strval(intval($safe_id)) && $safe_item_id == strval(intval($safe_item_id))) {
  164. $sql = 'SELECT start_date,exe_date,exe_result,exe_weighting FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.(int)$safe_exe_id;
  165. $res = Database::query($sql,__FILE__,__LINE__);
  166. $row_dates = Database::fetch_array($res);
  167. $time_start_date = convert_mysql_date($row_dates['start_date']);
  168. $time_exe_date = convert_mysql_date($row_dates['exe_date']);
  169. $mytime = ((int)$time_exe_date-(int)$time_start_date);
  170. $score = (float)$row_dates['exe_result'];
  171. $max_score = (float)$row_dates['exe_weighting'];
  172. $sql_upd_status = "UPDATE $TBL_LP_ITEM_VIEW SET status = 'completed' WHERE lp_item_id = '".(int)$safe_item_id."'
  173. AND lp_view_id = (SELECT lp_view.id FROM $TBL_LP_VIEW lp_view WHERE user_id = '".(int)$_SESSION['oLP']->user_id."' AND lp_id='".(int)$safe_id."')";
  174. Database::query($sql_upd_status,__FILE__,__LINE__);
  175. $sql_upd_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE id = '".(int)$safe_item_id."'";
  176. Database::query($sql_upd_max_score,__FILE__,__LINE__);
  177. $sql_last_attempt = "SELECT id FROM $TBL_LP_ITEM_VIEW WHERE lp_item_id = '$safe_item_id' AND lp_view_id = '".$_SESSION['oLP']->lp_view_id."' order by id desc limit 1";
  178. $res_last_attempt = Database::query($sql_last_attempt,__FILE__,__LINE__);
  179. $row_last_attempt = Database::fetch_row($res_last_attempt);
  180. if (Database::num_rows($res_last_attempt)>0) {
  181. $sql_upd_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score,total_time = $mytime WHERE id='".$row_last_attempt[0]."'";
  182. Database::query($sql_upd_score,__FILE__,__LINE__);
  183. }
  184. }
  185. if(intval($_GET['fb_type']) > 0) {
  186. $src = 'blank.php?msg=exerciseFinished';
  187. } else {
  188. $src = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?id='.Security::remove_XSS($_REQUEST['exeId']).'&origin=learnpath&learnpath_id='.Security::remove_XSS($_GET['lp_id']).'&learnpath_item_id='.Security::remove_XSS($_GET['lp_id']).'&fb_type='.Security::remove_XSS($_GET['fb_type']);
  189. }
  190. $autostart = 'false';
  191. }
  192. $_SESSION['oLP']->set_previous_item($lp_item_id);
  193. $nameTools = Security :: remove_XSS(api_convert_encoding($_SESSION['oLP']->get_name(), $charset, api_get_system_encoding()));
  194. $save_setting = api_get_setting("show_navigation_menu");
  195. global $_setting;
  196. $_setting['show_navigation_menu'] = 'false';
  197. $scorm_css_header=true;
  198. $lp_theme_css=$_SESSION['oLP']->get_theme(); //sets the css theme of the LP this call is also use at the frames (toc, nav, message)
  199. if($_SESSION['oLP']->mode == 'fullscreen') {
  200. $htmlHeadXtra[] = "<script>window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');</script>";
  201. include_once('../inc/reduced_header.inc.php');
  202. //set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
  203. $_SESSION['loaded_lp_view'] = true;
  204. ?>
  205. <input type="hidden" id="old_item" name ="old_item" value="0"/>
  206. <input type="hidden" id="current_item_id" name ="current_item_id" value="0" />
  207. <div id="learningPathMain" style="width:100%;height:100%;" >
  208. <div id="learningPathLeftZone" style="float:left;width:280px;height:100%">
  209. <!-- header -->
  210. <div id="header">
  211. <div id="learningPathHeader" style="font-size:14px;">
  212. <table>
  213. <tr>
  214. <td>
  215. <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
  216. <img src="../img/lp_arrow.gif" />
  217. </a>
  218. </td>
  219. <td>
  220. <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
  221. <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
  222. </td>
  223. </tr>
  224. </table>
  225. </div>
  226. </div>
  227. <!-- end header -->
  228. <!-- Image preview Layout -->
  229. <div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px">
  230. <?php $image = '../img/lp_author_background.gif'; ?>
  231. <div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
  232. <div style="width:100; float:left;height:105;margin:5px">
  233. <span>
  234. <?php if ($_SESSION['oLP']->get_preview_image()!=''): ?>
  235. <img width="115" height="100" src="<?php echo api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image(); ?>">
  236. <?php
  237. else
  238. : echo Display :: display_icon('unknown_250_100.jpg', ' ');
  239. endif;
  240. ?>
  241. </span>
  242. </div>
  243. <div id="nav_id" name="nav_name" class="lp_nav" style="margin-left:105;height:90">
  244. <?php
  245. $display_mode = $_SESSION['oLP']->mode;
  246. $scorm_css_header = true;
  247. $lp_theme_css = $_SESSION['oLP']->get_theme();
  248. //Setting up the CSS theme if exists
  249. if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
  250. global $lp_theme_css;
  251. } else {
  252. $lp_theme_css = $my_style;
  253. }
  254. $progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
  255. $navigation_bar = $_SESSION['oLP']->get_navigation_bar();
  256. $mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
  257. $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
  258. $show_audioplayer = false;
  259. // getting all the information about the item
  260. $sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
  261. $res_media= Database::query($sql, __FILE__, __LINE__);
  262. if(Database::num_rows($res_media) > 0){
  263. while($row_media= Database::fetch_array($res_media)) {
  264. if(!empty($row_media['audio'])) {$show_audioplayer = true; break;}
  265. }
  266. }
  267. ?>
  268. <div id="lp_navigation_elem" class="lp_navigation_elem" style="padding-left:130px;margin-top:9px;">
  269. <div style="padding-top:20px;padding-bottom:50px;" ><?php echo $navigation_bar; ?></div>
  270. <div style="height:20px"><?php echo $progress_bar; ?></div>
  271. </div>
  272. </div>
  273. </div>
  274. </div>
  275. <!-- end image preview Layout -->
  276. <div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
  277. <?php echo $_SESSION['oLP']->get_author() ?>
  278. </div>
  279. <!-- media player layaout -->
  280. <?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
  281. <div id="media" <?php echo $style_media ?>>
  282. <?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
  283. </div>
  284. <!-- end media player layaout -->
  285. <!-- toc layout -->
  286. <div id="toc_id" name="toc_name" style="padding:0;margin-top:20px;height:60%;width:100%">
  287. <div id="learningPathToc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
  288. <!-- log message layout -->
  289. <div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:50px;overflow:auto;margin:15px">
  290. <div id="log_content"></div>
  291. <div style="color: white;" onClick="cleanlog();">.</div>
  292. </div>
  293. <!-- end log message layout -->
  294. </div>
  295. </div>
  296. <!-- end toc layout -->
  297. </div>
  298. <!-- end left Zone -->
  299. <!-- right Zone -->
  300. <div id="learningPathRightZone" style="margin-left:282px;border : 0pt solid blue;height:100%">
  301. <iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>
  302. </div>
  303. <!-- end right Zone -->
  304. </div>
  305. <script language="JavaScript" type="text/javascript">
  306. // Need to be called after the <head> to be sure window.oxajax is defined
  307. var dokeos_xajax_handler = window.oxajax;
  308. </script>
  309. <script language="JavaScript" type="text/javascript">
  310. <!--
  311. var leftZoneHeightOccupied = 0;
  312. var rightZoneHeightOccupied = 0;
  313. var initialLeftZoneHeight = 0;
  314. var initialRightZoneHeight = 0;
  315. var updateContentHeight = function() {
  316. winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
  317. newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
  318. newRightZoneHeight = winHeight - rightZoneHeightOccupied;
  319. if (newLeftZoneHeight <= initialLeftZoneHeight) {
  320. newLeftZoneHeight = initialLeftZoneHeight;
  321. newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
  322. }
  323. if (newRightZoneHeight <= initialRightZoneHeight) {
  324. newRightZoneHeight = initialRightZoneHeight;
  325. newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
  326. }
  327. document.getElementById('learningPathToc').style.height = newLeftZoneHeight + 'px';
  328. document.getElementById('learningPathRightZone').style.height = newRightZoneHeight + 'px';
  329. document.getElementById('content_id_blank').style.height = newRightZoneHeight + 'px';
  330. if (document.body.clientHeight > winHeight) {
  331. document.body.style.overflow = 'auto';
  332. } else {
  333. document.body.style.overflow = 'hidden';
  334. }
  335. };
  336. window.onload = function() {
  337. screen_height = screen.height;
  338. screen_width = screen.height;
  339. document.getElementById('learningPathLeftZone').style.height = "100%";
  340. document.getElementById('learningPathToc').style.height = "60%";
  341. document.getElementById('learningPathToc').style.width = "100%";
  342. document.getElementById('learningPathRightZone').style.height = "100%"
  343. document.getElementById('content_id').style.height = "100%" ;
  344. if (screen_height <= 600) {
  345. document.getElementById('inner_lp_toc').style.height = "100px" ;
  346. document.getElementById('learningPathLeftZone').style.height = "415px";
  347. }
  348. initialLeftZoneHeight = document.getElementById('learningPathToc').offsetHeight;
  349. initialRightZoneHeight = document.getElementById('learningPathRightZone').offsetHeight;
  350. docHeight = document.body.clientHeight;
  351. leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
  352. rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
  353. document.body.style.overflow = 'hidden';
  354. updateContentHeight();
  355. }
  356. window.onresize = updateContentHeight;
  357. -->
  358. </script>
  359. <?php
  360. }
  361. else
  362. {
  363. include_once('../inc/reduced_header.inc.php');
  364. //$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
  365. //check if audio recorder needs to be in studentview
  366. $course_id=$_SESSION["_course"]["id"];
  367. if($_SESSION["status"][$course_id]==5)
  368. {
  369. $audio_recorder_studentview = true;
  370. }
  371. else
  372. {
  373. $audio_recorder_studentview = false;
  374. }
  375. //set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
  376. $_SESSION['loaded_lp_view'] = true;
  377. ?>
  378. <input type="hidden" id="old_item" name ="old_item" value="0"/>
  379. <input type="hidden" id="current_item_id" name ="current_item_id" value="0" />
  380. <div id="learningPathMain" style="width:100%;height:100%;" >
  381. <div id="learningPathLeftZone" style="float:left;width:280px;height:100%">
  382. <!-- header -->
  383. <div id="header">
  384. <div id="learningPathHeader" style="font-size:14px;">
  385. <table>
  386. <tr>
  387. <td>
  388. <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a>
  389. </td>
  390. <td>
  391. <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
  392. <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
  393. </td>
  394. </tr>
  395. </table>
  396. </div>
  397. </div>
  398. <!-- end header -->
  399. <!-- Image preview Layout -->
  400. <div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
  401. <?php $image = '../img/lp_author_background.gif'; ?>
  402. <div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
  403. <div style="width:100; float:left;height:105;margin:5px">
  404. <span style="width:104px; height:96px; float:left; vertical-align:bottom;">
  405. <center><?php if ($_SESSION['oLP']->get_preview_image()!=''): ?>
  406. <?php
  407. $picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
  408. if($picture['1'] < 96) $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" ';
  409. $size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
  410. $flie = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
  411. echo '<img '.$size.' src="'.$flie.'">';
  412. ?>
  413. <?php
  414. else
  415. : echo Display :: display_icon('unknown_250_100.jpg', ' ');
  416. endif;
  417. ?></center>
  418. </span>
  419. </div>
  420. <div id="nav_id" name="nav_name" class="lp_nav" style="margin-left:105;height:90">
  421. <?php
  422. $display_mode = $_SESSION['oLP']->mode;
  423. $scorm_css_header = true;
  424. $lp_theme_css = $_SESSION['oLP']->get_theme();
  425. //Setting up the CSS theme if exists
  426. if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
  427. global $lp_theme_css;
  428. } else {
  429. $lp_theme_css = $my_style;
  430. }
  431. $progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
  432. $navigation_bar = $_SESSION['oLP']->get_navigation_bar();
  433. $mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
  434. $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
  435. $show_audioplayer = false;
  436. // getting all the information about the item
  437. $sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
  438. $res_media= Database::query($sql, __FILE__, __LINE__);
  439. if(Database::num_rows($res_media) > 0){
  440. while($row_media= Database::fetch_array($res_media)) {
  441. if(!empty($row_media['audio'])) {$show_audioplayer = true; break;}
  442. }
  443. }
  444. ?>
  445. <div id="lp_navigation_elem" class="lp_navigation_elem" style="padding-left:130px;margin-top:9px;">
  446. <div style="padding-top:15px;padding-bottom:50px;" ><?php echo $navigation_bar; ?></div>
  447. <div style="height:20px"><?php echo $progress_bar; ?></div>
  448. </div>
  449. </div>
  450. </div>
  451. </div>
  452. <!-- end image preview Layout -->
  453. <div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
  454. <?php echo $_SESSION['oLP']->get_author() ?>
  455. </div>
  456. <!-- media player layaout -->
  457. <?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
  458. <div id="media" <?php echo $style_media ?>>
  459. <?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
  460. </div>
  461. <!-- end media player layaout -->
  462. <!-- toc layout -->
  463. <div id="toc_id" name="toc_name" style="padding:0;margin-top:20px;height:60%;width:100%">
  464. <div id="learningPathToc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
  465. <!-- log message layout -->
  466. <div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:50px;overflow:auto;margin:15px">
  467. <div id="log_content"></div>
  468. <div style="color: white;" onClick="cleanlog();">.</div>
  469. </div>
  470. <!-- end log message layout -->
  471. </div>
  472. </div>
  473. <!-- end toc layout -->
  474. </div>
  475. <!-- end left Zone -->
  476. <!-- right Zone -->
  477. <div id="learningPathRightZone" style="margin-left:282px;height:100%">
  478. <iframe id="content_id" name="content_name" src="<?php echo $src; ?>" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>
  479. </div>
  480. <!-- end right Zone -->
  481. </div>
  482. <script language="JavaScript" type="text/javascript">
  483. // Need to be called after the <head> to be sure window.oxajax is defined
  484. var dokeos_xajax_handler = window.oxajax;
  485. </script>
  486. <script language="JavaScript" type="text/javascript">
  487. <!--
  488. var leftZoneHeightOccupied = 0;
  489. var rightZoneHeightOccupied = 0;
  490. var initialLeftZoneHeight = 0;
  491. var initialRightZoneHeight = 0;
  492. var updateContentHeight = function() {
  493. winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
  494. newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
  495. newRightZoneHeight = winHeight - rightZoneHeightOccupied;
  496. if (newLeftZoneHeight <= initialLeftZoneHeight) {
  497. newLeftZoneHeight = initialLeftZoneHeight;
  498. newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
  499. }
  500. if (newRightZoneHeight <= initialRightZoneHeight) {
  501. newRightZoneHeight = initialRightZoneHeight;
  502. newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
  503. }
  504. document.getElementById('learningPathToc').style.height = newLeftZoneHeight + 'px';
  505. document.getElementById('learningPathRightZone').style.height = newRightZoneHeight + 'px';
  506. document.getElementById('content_id').style.height = newRightZoneHeight + 'px';
  507. if (document.body.clientHeight > winHeight) {
  508. document.body.style.overflow = 'auto';
  509. } else {
  510. document.body.style.overflow = 'hidden';
  511. }
  512. };
  513. window.onload = function() {
  514. screen_height = screen.height;
  515. screen_width = screen.height;
  516. document.getElementById('learningPathLeftZone').style.height = "100%";
  517. document.getElementById('learningPathToc').style.height = "60%";
  518. document.getElementById('learningPathToc').style.width = "100%";
  519. document.getElementById('learningPathRightZone').style.height = "100%"
  520. document.getElementById('content_id').style.height = "100%" ;
  521. if (screen_height <= 600) {
  522. document.getElementById('inner_lp_toc').style.height = "100px" ;
  523. document.getElementById('learningPathLeftZone').style.height = "415px";
  524. }
  525. initialLeftZoneHeight = document.getElementById('learningPathToc').offsetHeight;
  526. initialRightZoneHeight = document.getElementById('learningPathRightZone').offsetHeight;
  527. docHeight = document.body.clientHeight;
  528. leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
  529. rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
  530. document.body.style.overflow = 'hidden';
  531. updateContentHeight();
  532. }
  533. window.onresize = updateContentHeight;
  534. -->
  535. </script>
  536. <?php
  537. /*
  538. ==============================================================================
  539. FOOTER
  540. ==============================================================================
  541. */
  542. //Display::display_footer();
  543. }
  544. //restore global setting
  545. $_setting['show_navigation_menu'] = $save_setting;
  546. ?>