Skip to content

Commit

Permalink
Replace userid value
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Jan 21, 2016
1 parent 240fb5e commit c647943
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 9 additions & 3 deletions main/newscorm/scorm.class.php
Expand Up @@ -273,14 +273,20 @@ private function detect_manifest_encoding(& $xml)
*
* @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);
}
$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);
Expand Down Expand Up @@ -322,15 +328,15 @@ public function import_manifest($courseCode, $userMaxScore = 1, $sessionId = 0)
TOOL_LEARNPATH,
$this->lp_id,
'LearnpathAdded',
api_get_user_id()
$userId
);

api_item_property_update(
$courseInfo,
TOOL_LEARNPATH,
$this->lp_id,
'visible',
api_get_user_id()
$userId
);
}

Expand Down
6 changes: 5 additions & 1 deletion main/webservices/lp.php
Expand Up @@ -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);

Expand All @@ -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');
Expand Down

0 comments on commit c647943

Please sign in to comment.