lp_view.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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 src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
  69. if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
  70. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
  71. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
  72. }
  73. $htmlHeadXtra[] = '<script language="javascript" type="text/javascript">
  74. $(document).ready(function (){
  75. $("div#log_content_cleaner").bind("click", function(){
  76. $("div#log_content").empty();
  77. });
  78. });
  79. </script>';
  80. $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
  81. var dokeos_xajax_handler = window.oxajax;
  82. </script>';
  83. $_SESSION['oLP']->error = '';
  84. $lp_type = $_SESSION['oLP']->get_type();
  85. $lp_item_id = $_SESSION['oLP']->get_current_item_id();
  86. //$lp_item_id = learnpath::escape_string($_GET['item_id']);
  87. //$_SESSION['oLP']->set_current_item($lp_item_id); // already done by lp_controller.php
  88. //Prepare variables for the test tool (just in case) - honestly, this should disappear later on
  89. $_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
  90. $_SESSION['scorm_item_id'] = $lp_item_id;
  91. $_SESSION['lp_mode'] = $_SESSION['oLP']->mode;
  92. //reinit exercises variables to avoid spacename clashes (see exercise tool)
  93. if(isset($exerciseResult) or isset($_SESSION['exerciseResult'])) {
  94. api_session_unregister($exerciseResult);
  95. }
  96. unset($_SESSION['objExercise']);
  97. unset($_SESSION['questionList']);
  98. /**
  99. * Get a link to the corresponding document
  100. */
  101. if (!isset($src)) {
  102. $src = '';
  103. switch($lp_type) {
  104. case 1:
  105. $_SESSION['oLP']->stop_previous_item();
  106. $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
  107. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  108. if($prereq_check === true){
  109. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  110. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  111. }else{
  112. $src = 'blank.php?error=prerequisites';
  113. }
  114. break;
  115. case 2:
  116. //save old if asset
  117. $_SESSION['oLP']->stop_previous_item(); //save status manually if asset
  118. $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
  119. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  120. if($prereq_check === true){
  121. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  122. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  123. }else{
  124. $src = 'blank.php?error=prerequisites';
  125. }
  126. break;
  127. case 3:
  128. //aicc
  129. $_SESSION['oLP']->stop_previous_item(); //save status manually if asset
  130. $htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
  131. $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
  132. if($prereq_check === true){
  133. $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
  134. $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
  135. }else{
  136. $src = 'blank.php';
  137. }
  138. break;
  139. case 4:
  140. break;
  141. }
  142. }
  143. $list = $_SESSION['oLP']->get_toc();
  144. $type_quiz = false;
  145. foreach($list as $toc) {
  146. if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz') ) {
  147. $type_quiz = true;
  148. }
  149. }
  150. $autostart = 'true';
  151. // update status,total_time from lp_item_view table when you finish the exercises in learning path
  152. if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) {
  153. global $src;
  154. $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db();
  155. $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  156. $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
  157. $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
  158. $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
  159. $safe_item_id = Database::escape_string($_GET['lp_item_id']);
  160. $safe_id = Database::escape_string($_GET['lp_id']);
  161. $safe_exe_id = Database::escape_string($_REQUEST['exeId']);
  162. if ($safe_id == strval(intval($safe_id)) && $safe_item_id == strval(intval($safe_item_id))) {
  163. $sql = 'SELECT start_date,exe_date,exe_result,exe_weighting FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.(int)$safe_exe_id;
  164. $res = Database::query($sql,__FILE__,__LINE__);
  165. $row_dates = Database::fetch_array($res);
  166. $time_start_date = convert_mysql_date($row_dates['start_date']);
  167. $time_exe_date = convert_mysql_date($row_dates['exe_date']);
  168. $mytime = ((int)$time_exe_date-(int)$time_start_date);
  169. $score = (float)$row_dates['exe_result'];
  170. $max_score = (float)$row_dates['exe_weighting'];
  171. $sql_upd_status = "UPDATE $TBL_LP_ITEM_VIEW SET status = 'completed' WHERE lp_item_id = '".(int)$safe_item_id."'
  172. 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."')";
  173. Database::query($sql_upd_status,__FILE__,__LINE__);
  174. $sql_upd_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE id = '".(int)$safe_item_id."'";
  175. Database::query($sql_upd_max_score,__FILE__,__LINE__);
  176. $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";
  177. $res_last_attempt = Database::query($sql_last_attempt,__FILE__,__LINE__);
  178. $row_last_attempt = Database::fetch_row($res_last_attempt);
  179. if (Database::num_rows($res_last_attempt)>0) {
  180. $sql_upd_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score,total_time = $mytime WHERE id='".$row_last_attempt[0]."'";
  181. Database::query($sql_upd_score,__FILE__,__LINE__);
  182. }
  183. }
  184. if(intval($_GET['fb_type']) > 0) {
  185. $src = 'blank.php?msg=exerciseFinished';
  186. } else {
  187. $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']);
  188. }
  189. $autostart = 'false';
  190. }
  191. $_SESSION['oLP']->set_previous_item($lp_item_id);
  192. $nameTools = Security :: remove_XSS(api_convert_encoding($_SESSION['oLP']->get_name(), $charset, api_get_system_encoding()));
  193. $save_setting = api_get_setting("show_navigation_menu");
  194. global $_setting;
  195. $_setting['show_navigation_menu'] = 'false';
  196. $scorm_css_header=true;
  197. $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)
  198. if($_SESSION['oLP']->mode == 'fullscreen') {
  199. $htmlHeadXtra[] = "<script>window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');</script>";
  200. include_once('../inc/reduced_header.inc.php');
  201. //set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
  202. $_SESSION['loaded_lp_view'] = true;
  203. ?>
  204. <body>
  205. <div id="learning_path_main" style="width:100%;height:100%;" >
  206. <div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
  207. <!-- header -->
  208. <div id="header">
  209. <div id="learning_path_header" style="font-size:14px;">
  210. <table>
  211. <tr>
  212. <td>
  213. <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
  214. <img src="../img/lp_arrow.gif" />
  215. </a>
  216. </td>
  217. <td>
  218. <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
  219. <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
  220. </td>
  221. </tr>
  222. </table>
  223. </div>
  224. </div>
  225. <!-- end header -->
  226. <!-- Image preview Layout -->
  227. <div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px">
  228. <?php $image = '../img/lp_author_background.gif'; ?>
  229. <div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
  230. <div style="width:100; float:left;height:105;margin:5px">
  231. <span>
  232. <?php
  233. if ($_SESSION['oLP']->get_preview_image()!='') {
  234. echo '<img width="115px" height="100px" src="'.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image().'">';
  235. } else {
  236. echo Display :: display_icon('unknown_250_100.jpg', ' ');
  237. }; ?>
  238. </span>
  239. </div>
  240. <div id="nav_id" name="nav_name" class="lp_nav" style="margin-left:105;height:90">
  241. <?php
  242. $display_mode = $_SESSION['oLP']->mode;
  243. $scorm_css_header = true;
  244. $lp_theme_css = $_SESSION['oLP']->get_theme();
  245. //Setting up the CSS theme if exists
  246. if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
  247. global $lp_theme_css;
  248. } else {
  249. $lp_theme_css = $my_style;
  250. }
  251. $progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
  252. $navigation_bar = $_SESSION['oLP']->get_navigation_bar();
  253. $mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
  254. $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
  255. $show_audioplayer = false;
  256. // getting all the information about the item
  257. $sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
  258. $res_media= Database::query($sql, __FILE__, __LINE__);
  259. if (Database::num_rows($res_media) > 0) {
  260. while ($row_media= Database::fetch_array($res_media)) {
  261. if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
  262. }
  263. }
  264. ?>
  265. <div id="lp_navigation_elem" class="lp_navigation_elem" style="padding-left:130px;margin-top:9px;">
  266. <div style="padding-top:20px;padding-bottom:50px;" ><?php echo $navigation_bar; ?></div>
  267. <div style="height:20px"><?php echo $progress_bar; ?></div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. <!-- end image preview Layout -->
  273. <div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
  274. <?php echo $_SESSION['oLP']->get_author() ?>
  275. </div>
  276. <!-- media player layaout -->
  277. <?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
  278. <div id="media" <?php echo $style_media ?>>
  279. <?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
  280. </div>
  281. <!-- end media player layaout -->
  282. <!-- toc layout -->
  283. <div id="toc_id" name="toc_name" style="padding:0;margin-top:20px;height:60%;width:100%">
  284. <div id="learning_path_toc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
  285. <!-- log message layout -->
  286. <div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:50px;overflow:auto;margin:15px">
  287. <div id="log_content"></div>
  288. <div id="log_content_cleaner" style="color: white;">.</div>
  289. </div>
  290. <!-- end log message layout -->
  291. </div>
  292. </div>
  293. <!-- end toc layout -->
  294. </div>
  295. <!-- end left Zone -->
  296. <!-- right Zone -->
  297. <div id="learning_path_right_zone" style="margin-left:282px;border : 0pt solid blue;height:100%">
  298. <iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>
  299. </div>
  300. <!-- end right Zone -->
  301. </div>
  302. <script language="JavaScript" type="text/javascript">
  303. <!--
  304. var leftZoneHeightOccupied = 0;
  305. var rightZoneHeightOccupied = 0;
  306. var initialLeftZoneHeight = 0;
  307. var initialRightZoneHeight = 0;
  308. var updateContentHeight = function() {
  309. winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
  310. newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
  311. newRightZoneHeight = winHeight - rightZoneHeightOccupied;
  312. if (newLeftZoneHeight <= initialLeftZoneHeight) {
  313. newLeftZoneHeight = initialLeftZoneHeight;
  314. newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
  315. }
  316. if (newRightZoneHeight <= initialRightZoneHeight) {
  317. newRightZoneHeight = initialRightZoneHeight;
  318. newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
  319. }
  320. document.getElementById('learning_path_toc').style.height = newLeftZoneHeight + 'px';
  321. document.getElementById('learning_path_right_zone').style.height = newRightZoneHeight + 'px';
  322. document.getElementById('content_id_blank').style.height = newRightZoneHeight + 'px';
  323. if (document.body.clientHeight > winHeight) {
  324. document.body.style.overflow = 'auto';
  325. } else {
  326. document.body.style.overflow = 'hidden';
  327. }
  328. };
  329. window.onload = function() {
  330. screen_height = screen.height;
  331. screen_width = screen.height;
  332. document.getElementById('learning_path_left_zone').style.height = "100%";
  333. document.getElementById('learning_path_toc').style.height = "60%";
  334. document.getElementById('learning_path_toc').style.width = "100%";
  335. document.getElementById('learning_path_right_zone').style.height = "100%"
  336. document.getElementById('content_id').style.height = "100%" ;
  337. if (screen_height <= 600) {
  338. document.getElementById('inner_lp_toc').style.height = "100px" ;
  339. document.getElementById('learning_path_left_zone').style.height = "415px";
  340. }
  341. initialLeftZoneHeight = document.getElementById('learning_path_toc').offsetHeight;
  342. initialRightZoneHeight = document.getElementById('learning_path_right_zone').offsetHeight;
  343. docHeight = document.body.clientHeight;
  344. leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
  345. rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
  346. document.body.style.overflow = 'hidden';
  347. updateContentHeight();
  348. }
  349. window.onresize = updateContentHeight;
  350. -->
  351. </script>
  352. </body>
  353. <?php
  354. } else {
  355. //not fullscreen mode
  356. include_once('../inc/reduced_header.inc.php');
  357. //$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
  358. //check if audio recorder needs to be in studentview
  359. $course_id=$_SESSION["_course"]["id"];
  360. if ($_SESSION["status"][$course_id]==5) {
  361. $audio_recorder_studentview = true;
  362. } else {
  363. $audio_recorder_studentview = false;
  364. }
  365. //set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
  366. $_SESSION['loaded_lp_view'] = true;
  367. ?>
  368. <body>
  369. <div id="learning_path_main" style="width:100%;height:100%;" >
  370. <div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
  371. <!-- header -->
  372. <div id="header">
  373. <div id="learning_path_header" style="font-size:14px;">
  374. <table>
  375. <tr>
  376. <td>
  377. <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>
  378. </td>
  379. <td>
  380. <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
  381. <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
  382. </td>
  383. </tr>
  384. </table>
  385. </div>
  386. </div>
  387. <!-- end header -->
  388. <!-- Image preview Layout -->
  389. <div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
  390. <?php $image = '../img/lp_author_background.gif'; ?>
  391. <div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
  392. <div style="width:100; float:left;height:105;margin:5px">
  393. <span style="width:104px; height:96px; float:left; vertical-align:bottom;">
  394. <center>
  395. <?php
  396. if ($_SESSION['oLP']->get_preview_image()!='') {
  397. $picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
  398. if($picture['1'] < 96) { $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" '; }
  399. $size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
  400. $my_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
  401. echo '<img '.$size.' src="'.$my_path.'">';
  402. } else {
  403. echo Display :: display_icon('unknown_250_100.jpg', ' ');
  404. }
  405. ?>
  406. </center>
  407. </span>
  408. </div>
  409. <div id="nav_id" name="nav_name" class="lp_nav" style="margin-left:105;height:90">
  410. <?php
  411. $display_mode = $_SESSION['oLP']->mode;
  412. $scorm_css_header = true;
  413. $lp_theme_css = $_SESSION['oLP']->get_theme();
  414. //Setting up the CSS theme if exists
  415. if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
  416. global $lp_theme_css;
  417. } else {
  418. $lp_theme_css = $my_style;
  419. }
  420. $progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
  421. $navigation_bar = $_SESSION['oLP']->get_navigation_bar();
  422. $mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
  423. $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
  424. $show_audioplayer = false;
  425. // getting all the information about the item
  426. $sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
  427. $res_media= Database::query($sql, __FILE__, __LINE__);
  428. if (Database::num_rows($res_media) > 0) {
  429. while ($row_media= Database::fetch_array($res_media)) {
  430. if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
  431. }
  432. }
  433. ?>
  434. <div id="lp_navigation_elem" class="lp_navigation_elem" style="padding-left:130px;margin-top:9px;">
  435. <div style="padding-top:15px;padding-bottom:50px;" ><?php echo $navigation_bar; ?></div>
  436. <div style="height:20px"><?php echo $progress_bar; ?></div>
  437. </div>
  438. </div>
  439. </div>
  440. </div>
  441. <!-- end image preview Layout -->
  442. <div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
  443. <?php echo $_SESSION['oLP']->get_author() ?>
  444. </div>
  445. <!-- media player layaout -->
  446. <?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
  447. <div id="media" <?php echo $style_media ?>>
  448. <?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
  449. </div>
  450. <!-- end media player layaout -->
  451. <!-- toc layout -->
  452. <div id="toc_id" name="toc_name" style="padding:0;margin-top:20px;height:60%;width:100%">
  453. <div id="learning_path_toc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
  454. <?php if (!empty($_SESSION['oLP']->scorm_debug)) { //only show log ?>
  455. <!-- log message layout -->
  456. <div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:150px;overflow:auto;margin:4px">
  457. <div id="log_content"></div>
  458. <div id="log_content_cleaner" style="color: white;">.</div>
  459. </div>
  460. <!-- end log message layout -->
  461. <?php } ?>
  462. </div>
  463. </div>
  464. <!-- end toc layout -->
  465. </div>
  466. <!-- end left Zone -->
  467. <!-- right Zone -->
  468. <div id="learning_path_right_zone" style="margin-left:282px;height:100%">
  469. <iframe id="content_id" name="content_name" src="<?php echo $src; ?>" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>
  470. </div>
  471. <!-- end right Zone -->
  472. </div>
  473. <script language="JavaScript" type="text/javascript">
  474. <!--
  475. var leftZoneHeightOccupied = 0;
  476. var rightZoneHeightOccupied = 0;
  477. var initialLeftZoneHeight = 0;
  478. var initialRightZoneHeight = 0;
  479. var updateContentHeight = function() {
  480. winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
  481. newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
  482. newRightZoneHeight = winHeight - rightZoneHeightOccupied;
  483. if (newLeftZoneHeight <= initialLeftZoneHeight) {
  484. newLeftZoneHeight = initialLeftZoneHeight;
  485. newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
  486. }
  487. if (newRightZoneHeight <= initialRightZoneHeight) {
  488. newRightZoneHeight = initialRightZoneHeight;
  489. newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
  490. }
  491. document.getElementById('learning_path_toc').style.height = newLeftZoneHeight + 'px';
  492. document.getElementById('learning_path_right_zone').style.height = newRightZoneHeight + 'px';
  493. document.getElementById('content_id').style.height = newRightZoneHeight + 'px';
  494. if (document.body.clientHeight > winHeight) {
  495. document.body.style.overflow = 'auto';
  496. } else {
  497. document.body.style.overflow = 'hidden';
  498. }
  499. };
  500. window.onload = function() {
  501. screen_height = screen.height;
  502. screen_width = screen.height;
  503. document.getElementById('learning_path_left_zone').style.height = "100%";
  504. document.getElementById('learning_path_toc').style.height = "60%";
  505. document.getElementById('learning_path_toc').style.width = "100%";
  506. document.getElementById('learning_path_right_zone').style.height = "100%"
  507. document.getElementById('content_id').style.height = "100%" ;
  508. if (screen_height <= 600) {
  509. document.getElementById('inner_lp_toc').style.height = "100px" ;
  510. document.getElementById('learning_path_left_zone').style.height = "415px";
  511. }
  512. initialLeftZoneHeight = document.getElementById('learning_path_toc').offsetHeight;
  513. initialRightZoneHeight = document.getElementById('learning_path_right_zone').offsetHeight;
  514. docHeight = document.body.clientHeight;
  515. leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
  516. rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
  517. document.body.style.overflow = 'hidden';
  518. updateContentHeight();
  519. //loads the glossary library
  520. <?php
  521. if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
  522. if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
  523. ?>
  524. $.frameReady(function(){
  525. // $("<div>I am a div courses</div>").prependTo("body");
  526. }, "top.content_name",
  527. { load: [
  528. {type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.js"},
  529. {type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"},
  530. {type:"script", id:"_fr3", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>fckeditor/editor/plugins/glossary/fck_glossary_manual.js"}
  531. ] }
  532. );
  533. <?php
  534. } elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
  535. ?>
  536. $.frameReady(function(){
  537. // $("<div>I am a div courses</div>").prependTo("body");
  538. }, "top.content_name",
  539. { load: [
  540. {type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.js"},
  541. {type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"},
  542. {type:"script", id:"_fr3", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
  543. ] }
  544. );
  545. <?php
  546. }
  547. }
  548. ?>
  549. }
  550. window.onresize = updateContentHeight;
  551. -->
  552. </script>
  553. </body>
  554. <?php
  555. /*
  556. ==============================================================================
  557. FOOTER
  558. ==============================================================================
  559. */
  560. //Display::display_footer();
  561. }
  562. //restore global setting
  563. $_setting['show_navigation_menu'] = $save_setting;