Adding impress option when changing of default_view_mode see #4595

skala
Julio Montoya 12 years ago
parent c4be90be51
commit 8ebcd6dbb6
  1. 22
      main/newscorm/learnpath.class.php
  2. 4
      main/newscorm/lp_controller.php
  3. 21
      main/newscorm/lp_impress.php
  4. 19
      main/newscorm/lp_list.php
  5. 9
      main/newscorm/lp_view.php

@ -4492,13 +4492,21 @@ class learnpath {
$res = Database::query($sql);
if (Database :: num_rows($res) > 0) {
$row = Database :: fetch_array($res);
$view_mode = $row['default_view_mod'];
if ($view_mode == 'fullscreen') {
$view_mode = 'embedded';
} elseif ($view_mode == 'embedded') {
$view_mode = 'embedframe';
} elseif ($view_mode == 'embedframe') {
$view_mode = 'fullscreen';
$default_view_mode = $row['default_view_mod'];
$view_mode = $default_view_mode;
switch ($default_view_mode) {
case 'fullscreen':
$view_mode = 'embedded';
break;
case 'embedded':
$view_mode = 'embedframe';
break;
case 'embedframe':
$view_mode = 'impress';
break;
case 'impress':
$view_mode = 'fullscreen';
break;
}
$sql = "UPDATE $lp_table SET default_view_mod = '$view_mode' WHERE c_id = ".$course_id." AND id = " . $this->get_id();
$res = Database::query($sql);

@ -866,7 +866,6 @@ switch ($action) {
}
require 'lp_list.php';
break;
case 'mode':
// Switch between fullscreen and embedded mode.
if ($debug > 0) error_log('New LP - mode change triggered', 0);
@ -877,10 +876,11 @@ switch ($action) {
$_SESSION['oLP']->mode = 'embedded';
} elseif ($mode == 'embedframe') {
$_SESSION['oLP']->mode = 'embedframe';
} elseif ($mode == 'impress') {
$_SESSION['oLP']->mode = 'impress';
}
require 'lp_view.php';
break;
case 'switch_view_mode':
if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }

@ -9,31 +9,22 @@
* Code
*/
require_once 'back_compat.inc.php';
$_SESSION['whereami'] = 'lp/impress';
$this_section = SECTION_COURSES;
/* Libraries */
require_once 'back_compat.inc.php';
//To prevent the template class
$show_learnpath = true;
api_protect_course_script();
/*
* Only activate impress if you're the admin
*/
if (!api_is_platform_admin()) {
exit;
}
$lp_id = intval($_GET['lp_id']);
// Check if the learning path is visible for student - (LP requisites)
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
api_not_allowed();
}
}
//Checking visibility (eye icon)
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
@ -65,11 +56,11 @@ foreach ($list as $toc) {
//data-x="850" data-y="3000" data-rotate="90" data-scale="5"
$html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500" >';
$html .= '<h2>'.$toc['title'].'</h2>';
$src = $_SESSION['oLP']->get_link('http', $toc['id']);
//just showing the src in a iframe ...
$html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="'.$src.'"></iframe>';
$html .= "</div>\n";
$step ++;
}

@ -360,16 +360,23 @@ if (!empty($flat_list)) {
/* FUll screen VIEW */
if ($current_session == $details['lp_session']) {
/* Default view mode settings (fullscreen/embedded) */
if ($details['lp_view_mode'] == 'fullscreen') {
switch($details['lp_view_mode']) {
case 'fullscreen':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
Display::return_icon('view_fullscreen.png', get_lang('ViewModeFullScreen'),'',ICON_SIZE_SMALL).'</a>';
} elseif ($details['lp_view_mode'] == 'embedded') {
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
break;
case 'embedded':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
Display::return_icon('view_left_right.png', get_lang('ViewModeEmbedded'),'',ICON_SIZE_SMALL).'</a>';
} elseif ($details['lp_view_mode'] == 'embedframe') {
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
break;
case 'embedframe':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
Display::return_icon('view_nofullscreen.png', get_lang('ViewModeEmbedFrame'),'',ICON_SIZE_SMALL).'</a>';
break;
case 'impress':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
Display::return_icon('window_list_slide.png', get_lang('ViewModeImpress'),'',ICON_SIZE_SMALL).'</a>';
break;
}
} else {
if ($details['lp_view_mode'] == 'fullscreen'){

@ -97,10 +97,17 @@ if ($_SESSION['oLP']->mode == 'embedframe' || $_SESSION['oLP']->get_hide_toc_fra
</script>';
}
//Impress js
if ($_SESSION['oLP']->mode == 'impress') {
$lp_id = $_SESSION['oLP']->get_id();
$url = api_get_path(WEB_CODE_PATH)."newscorm/lp_impress.php?lp_id=$lp_id&".api_get_cidreq();
header("Location: $url");
exit;
}
// Prepare variables for the test tool (just in case) - honestly, this should disappear later on.
$_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
$_SESSION['scorm_item_id'] = $lp_item_id;
$_SESSION['lp_mode'] = $_SESSION['oLP']->mode;
// Reinit exercises variables to avoid spacename clashes (see exercise tool)
if (isset($exerciseResult) || isset($_SESSION['exerciseResult'])) {

Loading…
Cancel
Save