|
|
|
|
@ -562,7 +562,6 @@ class learnpath { |
|
|
|
|
// 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'); |
|
|
|
|
@ -573,7 +572,6 @@ class learnpath { |
|
|
|
|
|
|
|
|
|
// upload the file in the documents tool |
|
|
|
|
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 |
|
|
|
|
@ -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; |
|
|
|
|
$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) { |
|
|
|
|
// 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') { |
|
|
|
|
@ -984,8 +987,7 @@ class learnpath { |
|
|
|
|
$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 . " |
|
|
|
|
|