[svn r18737] Fixing the mp3 player when viewing or editing in a LP (see FS#3685)

skala
Julio Montoya 17 years ago
parent bead21c6b0
commit 3cd90b4fc0
  1. 40
      main/gradebook/gradebook_flatview.php
  2. 38
      main/newscorm/learnpath.class.php
  3. 10
      main/newscorm/lp_controller.php
  4. 40
      main/newscorm/lp_nav.php
  5. 11
      main/newscorm/lp_view.php
  6. 13
      main/newscorm/scorm_api.php

@ -22,11 +22,6 @@
Mail: info@dokeos.com
==============================================================================
*/
function func1() {
echo 'Hello from 1';
exit;
}
$language_file= 'gradebook';
//$cidReset= true;
require_once ('../inc/global.inc.php');
@ -50,25 +45,6 @@ if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
}
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script language="JavaScript">
/*
jQuery(function($) {
$("#contentArea").load("test.php");
});
$().ajaxSend(function(r,s){
$("#contentLoading").show();
});
$().ajaxStop(function(r,s){
$("#contentLoading").fadeOut("fast");
});
$.get("gradebook_flatview.php",{\'func\':\'1\'},function(data){
alert(data);
});
*/
</script>';
$interbreadcrumb[]= array (
'url' => $_SESSION['gradebook_dest'],
@ -214,27 +190,23 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false') {
echo '</div>';*/
// main graph
//@todo load images in with jquery
//@todo load images with jquery
echo '<div id="contentArea" style="text-align:center;" >';
$image_file = $flatviewtable->display_graph();
echo '<img src="'.$image_file.'">';
$flatviewtable->display();
$flatviewtable->display_graph_by_resource();
$image_file = $flatviewtable->display_graph();
echo '<img src="'.$image_file.'">';
$flatviewtable->display();
$flatviewtable->display_graph_by_resource();
echo '</div>';
}
Display :: display_footer();
function get_printable_data($users,$alleval, $alllinks) {
$datagen = new FlatViewDataGenerator ($users,$alleval, $alllinks);
$offset = (isset($_GET['offset'])?$_GET['offset']:'0');
$count = (($offset+10) > $datagen->get_total_items_count()) ?
($datagen->get_total_items_count()-$offset) : 10;
$header_names = $datagen->get_header_names($offset,$count);
$data_array = $datagen->get_data(FlatViewDataGenerator :: FVDG_SORT_LASTNAME,0,null,$offset,$count,true);
$data_array = $datagen->get_data(FlatViewDataGenerator :: FVDG_SORT_LASTNAME,0,null,$offset,$count,true);
$newarray = array();
foreach ($data_array as $data) {
$newarray[] = array_slice($data, 1);

@ -561,8 +561,7 @@ class learnpath {
if (!empty($_FILES['mp3']['name'])) {
// create the audio folder if it does not exist yet
global $_course;
$filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
$filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
if(!is_dir($filepath.'audio')) {
$perm = api_get_setting('permissions_for_new_directories');
$perm = octdec(!empty($perm)?$perm:'0770');
@ -572,8 +571,7 @@ class learnpath {
}
// upload the file in the documents tool
include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
$file_path = handle_uploaded_document($_course, $_FILES['mp3'],api_get_path('SYS_COURSE_PATH').$_course['path'].'/document','/audio',api_get_user_id(),'','','','','',false);
// getting the filename only
@ -815,7 +813,7 @@ class learnpath {
$sql_del_view = "DELETE FROM $lp_view WHERE lp_id = ".$this->lp_id;
//if($this->debug>2){error_log('New LP - Deleting views bound to lp '.$this->lp_id.': '.$sql_del_view,0);}
$res_del_view = api_sql_query($sql_del_view, __FILE__, __LINE__);
$this->toggle_publish($this->lp_id,'i');
$this->toggle_publish($this->lp_id,'i');
//if($this->debug>2){error_log('New LP - Deleting lp '.$this->lp_id.' of type '.$this->type,0);}
if($this->type == 2 OR $this->type==3){
//this is a scorm learning path, delete the files as well
@ -955,20 +953,25 @@ class learnpath {
function edit_item($id, $parent, $previous, $title, $description, $prerequisites=0, $audio=NULL, $max_time_allowed=0) {
if($this->debug > 0){error_log('New LP - In learnpath::edit_item()', 0);}
if(empty($max_time_allowed)) { $max_time_allowed = 0;}
if(empty($id) or ($id != strval(intval($id))) or empty($title)){ return false; }
$tbl_lp_item = Database::get_course_table('lp_item');
$sql_select = "
SELECT *
FROM " . $tbl_lp_item . "
WHERE id = " . $id;
$tbl_lp_item = Database::get_course_table('lp_item');
$sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE id = " . $id;
$res_select = api_sql_query($sql_select, __FILE__, __LINE__);
$row_select = Database::fetch_array($res_select);
$audio_update_sql = '';
if (is_array($audio) && !empty($audio['tmp_name']) && $audio['error']===0) {
$audio_update_sql = '';
if (is_array($audio) && !empty($audio['tmp_name']) && $audio['error']===0) {
// create the audio folder if it does not exist yet
global $_course;
$filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
if(!is_dir($filepath.'audio')) {
$perm = api_get_setting('permissions_for_new_directories');
$perm = octdec(!empty($perm)?$perm:'0770');
mkdir($filepath.'audio',$perm);
$audio_id=add_document($_course,'/audio','folder',0,'audio');
api_item_property_update($_course, TOOL_DOCUMENT, $audio_id, 'FolderCreated', api_get_user_id());
}
//upload file in documents
$pi = pathinfo($audio['name']);
if ($pi['extension'] == 'mp3') {
@ -978,14 +981,13 @@ class learnpath {
$path = substr($path,7);
//update reference in lp_item - audio path is the path from inside de document/audio/ dir
$audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
}
}
}
$same_parent = ($row_select['parent_item_id'] == $parent) ? true : false;
$same_previous = ($row_select['previous_item_id'] == $previous) ? true : false;
if($same_parent && $same_previous)
{
if($same_parent && $same_previous) {
//only update title and description
$sql_update = "
UPDATE " . $tbl_lp_item . "

@ -356,8 +356,10 @@ switch($action)
if(isset($_POST['submit_button']) && !empty($_POST['title'])) {
//$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites']);
//todo mp3 edit
$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites'],'', $_POST['maxTimeAllowed']);
//todo mp3 edit
$audio = array();
if (isset($_FILES['mp3'])) $audio = $_FILES['mp3'];
$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites'],$audio, $_POST['maxTimeAllowed']);
if(isset($_POST['content_lp'])) {
$_SESSION['oLP']->edit_document($_course);
@ -720,12 +722,12 @@ switch($action)
require('lp_list.php');
}
else
{
{
if($debug > 0){error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0);}
if ( !empty($_REQUEST['item_id']) )
{
$_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
}
}
require('lp_view.php');
}
break;

@ -18,27 +18,20 @@ require_once('back_compat.inc.php');
require_once('learnpath.class.php');
require_once('scorm.class.php');
require_once('aicc.class.php');
//error_log('New LP - Loaded lp_nav: '.$_SERVER['REQUEST_URI'],0);
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.parent.oxajax;
</script>';
$progress_bar = '';
$navigation_bar = '';
$display_mode = '';
if(isset($_SESSION['lpobject']))
{
if(isset($_SESSION['lpobject'])) {
//if($debug>0) //error_log('New LP - in lp_nav.php - SESSION[lpobject] is defined',0);
$oLP = unserialize($_SESSION['lpobject']);
if(is_object($oLP))
{
if(is_object($oLP)) {
$_SESSION['oLP'] = $oLP;
}
else
{
} else {
//error_log('New LP - in lp_nav.php - SESSION[lpobject] is not object - dying',0);
die('Could not instanciate lp object');
}
@ -49,35 +42,28 @@ if(isset($_SESSION['lpobject']))
//Setting up the CSS theme if exists
include_once('../inc/reduced_header.inc.php');
if (!empty($lp_theme_css) && !empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1 )
{
if (!empty($lp_theme_css) && !empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1 ) {
global $lp_theme_css;
}
else
{
} else {
$lp_theme_css=$my_style;
}
}
//$progress_bar = $_SESSION['oLP']->get_progress_bar();
$progress_bar = $_SESSION['oLP']->get_progress_bar('',-1,'',true);
$navigation_bar = $_SESSION['oLP']->get_navigation_bar();
$progress_bar = $_SESSION['oLP']->get_progress_bar('',-1,'',true);
$navigation_bar = $_SESSION['oLP']->get_navigation_bar();
$mediaplayer = $_SESSION['oLP']->get_mediaplayer();
}
session_write_close();
?>
<body>
<body>
<div class="lp_navigation_elem">
<table>
<tr>
<td colspan="2"><?php echo $mediaplayer; ?></td>
</tr>
<tr valign="middle">
<td><?php echo $progress_bar; ?></td>
<td><?php echo $navigation_bar; ?></td>
</tr>
<tr>
<td colspan="2"><?php echo $mediaplayer; ?></td>
</tr>
</tr>
</table>
</div>
</body>

@ -172,6 +172,12 @@ if($_SESSION['oLP']->mode == 'fullscreen')
else
{
include_once('../inc/reduced_header.inc.php');
//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
$_SESSION['loaded_lp_view'] = true;
/*
* Audio recorder funcionality deprecated
*
$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
//check if audio recorder needs to be in studentview
$course_id=$_SESSION["_course"]["id"];
@ -183,8 +189,7 @@ else
{
$audio_recorder_studentview = false;
}
//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
$_SESSION['loaded_lp_view'] = true;
$audio_record_width='';
$show_audioplayer=false;
if ($displayAudioRecorder)
@ -200,7 +205,7 @@ else
$show_audioplayer=true;
}
}
*/
?>
<frameset cols="270,*">
<frameset rows="60,270,105,30,480,20">

@ -1,4 +1,4 @@
<?php // $Id: scorm_api.php 17337 2008-12-16 21:29:29Z yannoo $
<?php // $Id: scorm_api.php 18737 2009-02-27 15:40:32Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
@ -1019,13 +1019,12 @@ function switch_item(current_item, next_item){
if(lms_lp_type==1 || lms_item_type=='asset'){
xajax_start_timer();
}
//(4) refresh the audiorecorder if needed
if(frames['audiorecorder_name']){
frames['audiorecorder_name'].location.reload();
//(4) refresh the audio player if needed
if(frames['nav_name']){
frames['nav_name'].location.reload();
}
return true;
}
/**

Loading…
Cancel
Save