Replace userid value

1.10.x
jmontoyaa 9 years ago
parent 240fb5e6a4
commit c6479435d6
  1. 12
      main/newscorm/scorm.class.php
  2. 6
      main/webservices/lp.php

@ -273,7 +273,7 @@ class scorm extends learnpath
*
* @return bool Returns -1 on error
*/
public function import_manifest($courseCode, $userMaxScore = 1, $sessionId = 0)
public function import_manifest($courseCode, $userMaxScore = 1, $sessionId = 0, $userId = 0)
{
if ($this->debug > 0) {
error_log('New LP - Entered import_manifest('.$courseCode.')', 0);
@ -281,6 +281,12 @@ class scorm extends learnpath
$courseInfo = api_get_course_info($courseCode);
$courseId = $courseInfo['real_id'];
if (empty($userId)) {
$userId = api_get_user_id();
} else {
$userId = intval($userId);
}
// Get table names.
$new_lp = Database::get_course_table(TABLE_LP_MAIN);
$new_lp_item = Database::get_course_table(TABLE_LP_ITEM);
@ -322,7 +328,7 @@ class scorm extends learnpath
TOOL_LEARNPATH,
$this->lp_id,
'LearnpathAdded',
api_get_user_id()
$userId
);
api_item_property_update(
@ -330,7 +336,7 @@ class scorm extends learnpath
TOOL_LEARNPATH,
$this->lp_id,
'visible',
api_get_user_id()
$userId
);
}

@ -174,6 +174,7 @@ function WSImportLP($params)
$fileData = base64_decode($params['file_data']);
$uniqueFile = uniqid();
$userId = 1; // admin
$filePath = api_get_path(SYS_ARCHIVE_PATH) . $uniqueFile;
file_put_contents($filePath, $fileData);
@ -198,12 +199,15 @@ function WSImportLP($params)
$oScorm->import_manifest(
$courseInfo['code'],
$maxScore,
$sessionId
$sessionId,
$userId
);
$oScorm->set_name($lpName);
$oScorm->set_proximity($proximity, $courseId);
$oScorm->set_maker($maker, $courseId);
//$oScorm->set_jslib('scorm_api.php');
if ($debug) error_log('scorm was added');
return 1;
} else {
if ($debug) error_log('manifest data empty');

Loading…
Cancel
Save