From 0625c71c0c97110f13357b2be2988ce43e96bb47 Mon Sep 17 00:00:00 2001 From: Imanol Losada Date: Mon, 9 Mar 2015 10:18:16 -0500 Subject: [PATCH 1/2] Add 'split_users_upload_directory' setting when creating the certificate path (1.9.x) - refs BT#9022 --- main/cron/add_gradebook_certificates.php | 8 +++++--- main/webservices/registration.soap.php | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/main/cron/add_gradebook_certificates.php b/main/cron/add_gradebook_certificates.php index e3f1d4070b..816e047a2a 100644 --- a/main/cron/add_gradebook_certificates.php +++ b/main/cron/add_gradebook_certificates.php @@ -1,7 +1,5 @@ */ +require_once __DIR__.'/../inc/global.inc.php'; +require_once api_get_path(LIBRARY_PATH).'database.lib.php'; +require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php'; + /** * Get all categories and users ids from gradebook * @return array Categories and users ids diff --git a/main/webservices/registration.soap.php b/main/webservices/registration.soap.php index 9f7c938f41..78e88ef494 100755 --- a/main/webservices/registration.soap.php +++ b/main/webservices/registration.soap.php @@ -5605,8 +5605,11 @@ function WSCertificatesList($startingDate = '', $endingDate = '') $queryResult = Database::query($query); $basePath = api_get_path(WEB_CODE_PATH).'upload/users/'; while ($row = Database::fetch_array($queryResult)) { - $row['path_certificate'] = $basePath.substr((string) $row['user_id'], 0, 1) - .'/'.$row['user_id'].'/certificate'.$row['path_certificate']; + $certificatePath = $basePath; + if (api_get_setting('split_users_upload_directory') === 'true') { + $certificatePath .= substr((string) $row['user_id'], 0, 1).'/'; + } + $row['path_certificate'] = $certificatePath.$row['user_id'].'/certificate'.$row['path_certificate']; $result[] = $row; } return $result; From 0fd3188cf207a78ebce50cee148d1caa19de0218 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 13 Mar 2015 15:03:41 +0100 Subject: [PATCH 2/2] Fix LP export to PDF see BT#9559 --- main/newscorm/learnpath.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 50f058a41f..244d64cd6b 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -9498,6 +9498,7 @@ EOD; $lp_id = intval($lp_id); $files_to_export = array(); $course_data = api_get_course_info($this->cc); + $sessionId = api_get_session_id(); if (!empty($course_data)) { $scorm_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/scorm/'.$this->path; @@ -9509,6 +9510,10 @@ EOD; case 'document': //Getting documents from a LP with chamilo documents $file_data = DocumentManager::get_document_data_by_id($item->path, $this->cc); + // Try loading document from the base course. + if (empty($file_data) && !empty($sessionId)) { + $file_data = DocumentManager::get_document_data_by_id($item->path, $this->cc, false, 0); + } $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path']; if (file_exists($file_path)) { $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);