Fixing lp_view due the recent HTML5 changes see #4400

skala
Julio Montoya 13 years ago
parent 59cf4be5ba
commit 0100794d39
  1. 9
      main/css/base.css
  2. 2
      main/css/base_chamilo.css
  3. 8
      main/document/document.inc.php
  4. 7
      main/inc/lib/display.lib.php
  5. 3
      main/inc/lib/main_api.lib.php
  6. 14
      main/inc/lib/template.lib.php
  7. 19
      main/newscorm/learnpath.class.php
  8. 2
      main/newscorm/lp_controller.php
  9. 160
      main/newscorm/lp_view.php
  10. 10
      main/template/default/layout/main_header.tpl
  11. 2
      main/template/default/layout/show_footer.tpl
  12. 4
      main/template/default/layout/show_header.tpl

@ -104,6 +104,15 @@ form .formw input {
padding: 19px 0px 19px 0px;
}
#progress_bar img {
height:26px;
}
#lp_navigation_elem .buttons,
#lp_navigation_elem #progress_bar {
width:130px;
}
* {
/* outline :none; */
}

@ -1677,7 +1677,7 @@ Document title
/* actions */
.actions_lp {
background:#F8F8F8;
height:29px;
height: 40px;
padding-left: -17px;
margin: 5px 2px 1px 12px;
vertical-align:middle;

@ -294,12 +294,12 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
preg_match('/htm$/i', urldecode($url)) //|| (preg_match('/wav$/', urldecode($url)) && api_get_setting('enable_nanogong') == 'true')
) {
$url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid;
return '<a href="'.$url.'" class="yoxview" title="'.$tooltip_title_alt.'" target="yoxview"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).'</a>';
return '<a href="'.$url.'" class="yoxview" title="'.$tooltip_title_alt.'" target="yoxview"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
} else {
return '<a href="'.$url.'" class="yoxview" title="'.$tooltip_title_alt.'" target="yoxview"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).'</a>';
return '<a href="'.$url.'" class="yoxview" title="'.$tooltip_title_alt.'" target="yoxview"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
}
} else {
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).'</a>';
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
}
} else {
if ($filetype == 'file') {
@ -429,7 +429,7 @@ function build_document_icon_tag($type, $path) {
}
}
return Display::return_icon($icon, $basename, array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22));
return Display::return_icon($icon, $basename, array());
}
/**

@ -67,13 +67,14 @@ class Display {
/**
* Displays the reduced page header (without banner)
*/
public static function display_reduced_header () {
public static function display_reduced_header() {
global $_plugins, $lp_theme_css, $mycoursetheme, $user_theme, $platform_theme;
global $httpHeadXtra, $htmlHeadXtra, $htmlIncHeadXtra, $_course, $_user, $text_dir, $plugins, $_user, $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF, $language_interface;
global $menu_navigation;
global $show_learnpath;
//require api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
self::$global_template = new Template($tool_name, false);
self::$global_template->show_header = false;
self::$global_template = new Template($tool_name, false, false, $show_learnpath);
echo self::$global_template ->show_header_template();
}

@ -5435,8 +5435,7 @@ function api_browser_support($format="") {
* @author Juan Carlos Raña Trabado
*/
function api_check_browscap() {
$setting = ini_get('browscap');
$setting = ini_get('browscap');
if ($setting) {
$browser = get_browser($_SERVER['HTTP_USER_AGENT'], true);
if (strpos($setting, 'browscap.ini') && !empty($browser)) {

@ -21,11 +21,12 @@ class Template extends Smarty {
var $show_footer;
var $help;
var $menu_navigation = array();
var $show_learnpath = false;
function __construct($title = '', $show_header = true, $show_footer = true) {
function __construct($title = '', $show_header = true, $show_footer = true, $show_learnpath = false) {
parent::__construct();
$this->title = $title;
$this->show_learnpath = $show_learnpath;
//Smarty 3 configuration
$this->setTemplateDir(api_get_path(SYS_CODE_PATH).'template/');
$this->setCompileDir(api_get_path(SYS_ARCHIVE_PATH));
@ -277,7 +278,7 @@ class Template extends Smarty {
$navigation = return_navigation_array();
$this->menu_navigation = $navigation['menu_navigation'];
global $_configuration, $show_learn_path;
global $_configuration;
$this->assign('system_charset', api_get_system_encoding());
@ -333,7 +334,7 @@ class Template extends Smarty {
'bootstrap/bootstrap-dropdown.js',
'bootstrap/bootstrap-collapse.js'
);
if (api_get_setting('allow_global_chat') == 'true') {
if (!api_is_anonymous()) {
$js_files[] = 'chat/js/chat.js';
@ -353,7 +354,7 @@ class Template extends Smarty {
foreach($js_files as $js_file) {
$js_file_to_string .= api_get_js($js_file);
}
//Extra CSS files
$css_files = array (
@ -362,8 +363,9 @@ class Template extends Smarty {
api_get_path(WEB_LIBRARY_PATH).'javascript/dtree/dtree.css',
);
if ($show_learn_path) {
if ($this->show_learnpath) {
$css_files[] = api_get_path(WEB_CSS_PATH).$this->theme.'/learnpath.css';
$css_files[] = api_get_path(WEB_CSS_PATH).$this->theme.'/scorm.css';
}
if (api_get_setting('allow_global_chat') == 'true') {

@ -1658,7 +1658,6 @@ class learnpath {
* @return string The HTML string to use as a navigation bar
*/
public function get_navigation_bar() {
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_navigation_bar()', 0);
}
@ -2099,18 +2098,18 @@ class learnpath {
$progress_height = '16';
$size = str_replace('%', '', $percentage);
$output ='<div style="width:135px">' .
'<img id="progress_img_limit_left" src="' . $css_path . 'bar_1.gif" width="1" height="' . $progress_height . '">' .
'<img id="progress_img_full" src="' . $css_path . 'bar_1u.gif" width="' . $size * $factor . 'px" height="' . $progress_height . '" id="full_portion">' .
'<img id="progress_img_limit_middle" src="' . $css_path . 'bar_1m.gif" width="1" height="' . $progress_height . '">';
$output ='<div>' .
'<img id="progress_img_limit_left" src="' . $css_path . 'bar_1.gif" width="1px" height="' . $progress_height . '">' .
'<img id="progress_img_full" src="' . $css_path . 'bar_1u.gif" width="' . $size * $factor . 'px" height="' . $progress_height . 'px" id="full_portion">' .
'<img id="progress_img_limit_middle" src="' . $css_path . 'bar_1m.gif" width="1px" height="' . $progress_height . '">';
if ($percentage <= 98) {
$output .= '<img id="progress_img_empty" src="' . $css_path . 'bar_1r.gif" width="' . (100 - $size) * $factor . 'px" height="' . $progress_height . '" id="empty_portion">';
$output .= '<img id="progress_img_empty" src="' . $css_path . 'bar_1r.gif" width="' . (100 - $size) * $factor . 'px" height="' . $progress_height . 'px" id="empty_portion">';
} else {
$output .= '<img id="progress_img_empty" src="' . $css_path . 'bar_1r.gif" width="0" height="' . $progress_height . '" id="empty_portion">';
//$output .= '<img id="progress_img_empty" src="' . $css_path . 'bar_1r.gif" width="0px" height="' . $progress_height . '" id="empty_portion">';
}
$output .= '<img id="progress_bar_img_limit_right" src="' . $css_path . 'bar_1.gif" width="1" height="' . $progress_height . '"></div>' .
$output .= '<img id="progress_bar_img_limit_right" src="' . $css_path . 'bar_1.gif" width="1px" height="' . $progress_height . '"></div>' .
'<div class="progresstext" id="progress_text">' . $text . '</div>';
return $output;
@ -2784,9 +2783,9 @@ class learnpath {
}
// The anchor will let us center the TOC on the currently viewed item &^D
if ($item['type'] != 'dokeos_module' && $item['type'] != 'dokeos_chapter') {
$html .= '<a name="atoc_' . $item['id'] . '" />';
if ($item['type'] != 'dokeos_module' && $item['type'] != 'dokeos_chapter') {
$html .= '<div class="' . $style_item . '" style="padding-left: ' . ($item['level'] * 1.5) . 'em; padding-right:' . ($item['level'] / 2) . 'em" title="' . $item['description'] . '" >';
$html .= '<a name="atoc_' . $item['id'] . '" />';
} else {
$html .= '<div class="' . $style_item . '" style="padding-left: ' . ($item['level'] * 2) . 'em; padding-right:' . ($item['level'] * 1.5) . 'em" title="' . $item['description'] . '" >';
}

@ -101,7 +101,7 @@ $lp_found = false;
if (isset($_SESSION['lpobject'])) {
if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
$oLP = unserialize($_SESSION['lpobject']);
if (is_object($oLP)) {
if (isset($oLP) && is_object($oLP)) {
if ($debug > 0) error_log('New LP - oLP is object', 0);
if ($myrefresh == 1 OR (empty($oLP->cc)) OR $oLP->cc != api_get_course_id() OR $oLP->lp_view_session_id != $session_id) {
if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);

@ -30,10 +30,11 @@ require_once 'scorm.lib.php';
require_once 'learnpath.class.php';
require_once 'learnpathItem.class.php';
//To prevent the template class
$show_learnpath = true;
api_protect_course_script();
//if (!$is_allowed_in_course) api_not_allowed();
$oLearnpath = false;
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
@ -93,7 +94,7 @@ if (isset($exerciseResult) || isset($_SESSION['exerciseResult'])) {
unset($_SESSION['objExercise']);
unset($_SESSION['questionList']);
///// additional APIs
// additional APIs
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
chamilo_courseCode = "'.$course_code.'";
</script>';
@ -183,7 +184,7 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
//$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$safe_item_id = Database::escape_string($_GET['lp_item_id']);
$safe_id = $lp_id;
@ -245,7 +246,8 @@ if ($_SESSION['oLP']->mode == 'fullscreen') {
}
// Not in fullscreen mode.
require_once '../inc/reduced_header.inc.php';
//require_once '../inc/reduced_header.inc.php';
Display::display_reduced_header($nameTools);
//$displayAudioRecorder = (api_get_setting('service_visio', 'active') == 'true') ? true : false;
// Check if audio recorder needs to be in studentview.
//$course_id = $_SESSION['_course']['id'];
@ -264,89 +266,96 @@ if ($_SESSION['oLP']->mode == 'embedframe' ||$_SESSION['oLP']->get_hide_toc_fram
$display_none = ';display:none;';
$margin_left = '12px';
}
//Media player code
$display_mode = $_SESSION['oLP']->mode;
$scorm_css_header = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
// Setting up the CSS theme if exists.
if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css;
} else {
$lp_theme_css = $my_style;
}
$progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
$navigation_bar = $_SESSION['oLP']->get_navigation_bar();
$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$show_audioplayer = false;
// Getting all the information about the item.
$sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id."'";
$res_media= Database::query($sql);
if (Database::num_rows($res_media) > 0) {
while ($row_media= Database::fetch_array($res_media)) {
if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
}
}
?>
<body dir="<?php echo api_get_text_direction(); ?>">
<div id="learning_path_left_zone" style="float:left;width:280px;height:100%<?php echo $display_none;?>">
<!-- header -->
<div id="header">
<div id="learning_path_header" style="font-size:14px;">
<table>
<tr>
<td>
<a href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a>
</td>
<td>
<a class="link" href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();">
<?php echo get_lang('CourseHomepageLink'); ?></a>
</td>
</tr>
</table>
</div>
<div id="learning_path_left_zone" style="float:left;width:280px;height:100%<?php echo $display_none;?>">
<!-- header -->
<div id="header">
<div id="learning_path_header" style="font-size:14px;">
<table>
<tr>
<td>
<a href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();">
<img src="../img/lp_arrow.gif" />
</a>
</td>
<td>
<a class="link" href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();">
<?php echo get_lang('CourseHomepageLink'); ?></a>
</td>
</tr>
</table>
</div>
</div>
<!-- end header -->
<!-- Image preview Layout -->
<!-- hub 26-50-2010 for lp toc height
<div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
-->
<div id="author_image" name="author_image" class="lp_author_image" style="width:100%;margin-left:5px;">
<?php $image = '../img/lp_author_background.gif'; ?>
<div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
<div style="width:100; float:left;height:105;margin:5px">
<span style="width:104px; height:96px; float:left; vertical-align:bottom;">
<center>
<?php
if ($_SESSION['oLP']->get_preview_image()!='') {
$picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
if($picture['1'] < 96) { $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" '; }
$size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
$my_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
echo '<img '.$size.' src="'.$my_path.'">';
} else {
echo Display :: display_icon('unknown_250_100.jpg', ' ');
}
?>
</center>
</span>
</div>
<div id="nav_id" name="nav_name" class="lp_nav" style="margin-left:105;height:90">
<?php
$display_mode = $_SESSION['oLP']->mode;
$scorm_css_header = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
// Setting up the CSS theme if exists.
if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css;
<div id="author_image" name="author_image" class="row-fluid">
<div class="span12">
<div class="row-fluid well2">
<div class="span4">
<?php
if ($_SESSION['oLP']->get_preview_image()!='') {
$picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
if($picture['1'] < 96) { $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" '; }
$size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
$my_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
echo '<img src="'.$my_path.'">';
} else {
$lp_theme_css = $my_style;
}
$progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
$navigation_bar = $_SESSION['oLP']->get_navigation_bar();
$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$show_audioplayer = false;
// Getting all the information about the item.
$sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id."'";
$res_media= Database::query($sql);
if (Database::num_rows($res_media) > 0) {
while ($row_media= Database::fetch_array($res_media)) {
if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
}
echo Display :: display_icon('unknown_250_100.jpg');
}
?>
<div id="lp_navigation_elem" class="lp_navigation_elem" style="padding-left:130px;margin-top:9px;">
<div style="padding-top:15px;padding-bottom:50px;" ><?php echo $navigation_bar; ?></div>
<div id="progress_bar" style="height:20px"><?php echo $progress_bar; ?></div>
?>
</div>
<div id="lp_navigation_elem" class="span8">
<div class="row">
<div class="span7">
<?php echo $navigation_bar; ?>
</div>
</div>
<div class="row">
<div id="progress_bar" class="span7">
<?php echo $progress_bar; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end image preview Layout -->
<div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
<?php echo $_SESSION['oLP']->get_author(); ?>
@ -452,7 +461,6 @@ if ($_SESSION['oLP']->mode == 'embedframe' ||$_SESSION['oLP']->get_hide_toc_fram
window.onresize = updateContentHeight;
-->
</script>
</body>
<?php
// Restore a global setting.
$_setting['show_navigation_menu'] = $save_setting;

@ -3,12 +3,13 @@
<!--[if IE 7]> <html lang="{$document_language}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="{$document_language}" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{$document_language}" class="no-js"> <!--<![endif]-->
<head>
{include file="default/layout/head.tpl"}
<head>
{include file="default/layout/head.tpl"}
</head>
<body dir="{$text_direction}" class="{$section_name}">
<noscript>{"NoJavascript"|get_lang}</noscript>
{if $show_header}
<div class="skip">
<ul>
<li><a href="#menu">{"WCAGGoMenu"|get_lang}</a></li>
@ -51,4 +52,5 @@
{* breadcrumb *}
{$breadcrumb}
<div id="submain-content" class="row">
<div id="submain-content" class="row">
{/if}

@ -2,5 +2,7 @@
show_header and show_footer templates are only called when using the Display::display_header and Display::display_footer
for backward compatibility we suppose that the default layout is one column which means ausing a div with class span12
*}
{if $show_header}
</div>
{/if}
{include file="default/layout/main_footer.tpl"}

@ -3,4 +3,6 @@
for backward compatibility we suppose that the default layout is one column which means ausing a div with class span12
*}
{include file="default/layout/main_header.tpl"}
<div class="span12">
{if $show_header}
<div class="span12">
{/if}
Loading…
Cancel
Save