|
|
|
|
@ -110,6 +110,7 @@ $server->wsdl->addComplexType( |
|
|
|
|
), |
|
|
|
|
'file_data' => array('name' => 'file', 'type' => 'xsd:string'), |
|
|
|
|
'filename' => array('name' => 'filename', 'type' => 'xsd:string'), |
|
|
|
|
'lp_name' => array('name' => 'lp_name', 'type' => 'xsd:string'), |
|
|
|
|
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string'), |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
@ -142,6 +143,8 @@ function WSImportLP($params) |
|
|
|
|
$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null; |
|
|
|
|
$sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null; |
|
|
|
|
|
|
|
|
|
$lpName = $params['lp_name']; |
|
|
|
|
|
|
|
|
|
$courseCode = CourseManager::get_course_id_from_original_id( |
|
|
|
|
$courseIdValue, |
|
|
|
|
$courseIdName |
|
|
|
|
@ -173,7 +176,7 @@ function WSImportLP($params) |
|
|
|
|
$maker = 'Scorm'; |
|
|
|
|
$maxScore = ''; //$_REQUEST['use_max_score'] |
|
|
|
|
|
|
|
|
|
$oScorm = new scorm(); |
|
|
|
|
$oScorm = new scorm($courseCode); |
|
|
|
|
$fileData = base64_decode($params['file_data']); |
|
|
|
|
|
|
|
|
|
$uniqueFile = uniqid(); |
|
|
|
|
@ -184,7 +187,7 @@ function WSImportLP($params) |
|
|
|
|
|
|
|
|
|
$fileInfo = array( |
|
|
|
|
'tmp_name' => $filePath, |
|
|
|
|
'name' => $fileName |
|
|
|
|
'name' => $fileName, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
|
|
|
|
@ -203,7 +206,7 @@ function WSImportLP($params) |
|
|
|
|
$maxScore, |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$oScorm->set_name($lpName); |
|
|
|
|
$oScorm->set_proximity($proximity, $courseId); |
|
|
|
|
$oScorm->set_maker($maker, $courseId); |
|
|
|
|
//$oScorm->set_jslib('scorm_api.php'); |
|
|
|
|
@ -329,7 +332,7 @@ function WSGetLpList($params) |
|
|
|
|
foreach ($flatList as $id => $lp) { |
|
|
|
|
$result[] = array( |
|
|
|
|
'id' => $id, |
|
|
|
|
'name' => $lp['lp_name'] |
|
|
|
|
'name' => $lp['lp_name'], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -399,14 +402,16 @@ function WSDeleteLp($params) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$courseInfo = api_get_course_info($courseCode); |
|
|
|
|
//$courseId = $courseInfo['real_id']; |
|
|
|
|
$courseId = $courseInfo['real_id']; |
|
|
|
|
|
|
|
|
|
if (empty($courseInfo)) { |
|
|
|
|
if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
|
|
|
return 'Course not found'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*$sessionId = 0; |
|
|
|
|
$sessionId = 0; |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
if (!empty($sessionIdName) && !empty($sessionIdValue)) { |
|
|
|
|
$sessionId = SessionManager::get_session_id_from_original_id( |
|
|
|
|
$sessionIdValue, |
|
|
|
|
@ -424,7 +429,54 @@ function WSDeleteLp($params) |
|
|
|
|
$lp = new learnpath($courseInfo['code'], $lpId, null); |
|
|
|
|
if ($lp) { |
|
|
|
|
if ($debug) error_log("LP deleted $lpId"); |
|
|
|
|
|
|
|
|
|
$course_dir = $courseInfo['directory'] . '/document'; |
|
|
|
|
$sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
|
|
|
$base_work_dir = $sys_course_path . $course_dir; |
|
|
|
|
|
|
|
|
|
$items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId); |
|
|
|
|
|
|
|
|
|
if (!empty($items)) { |
|
|
|
|
/** @var $item learnpathItem */ |
|
|
|
|
foreach ($items as $itemId) { |
|
|
|
|
$item = new learnpathItem($itemId, null, $courseId); |
|
|
|
|
|
|
|
|
|
if ($item) { |
|
|
|
|
$documentId = $item->get_path(); |
|
|
|
|
|
|
|
|
|
if ($debug) error_log("lp item id found #$itemId"); |
|
|
|
|
|
|
|
|
|
$documentInfo = DocumentManager::get_document_data_by_id( |
|
|
|
|
$documentId, |
|
|
|
|
$courseInfo['code'], |
|
|
|
|
false, |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!empty($documentInfo)) { |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log("Document id deleted #$documentId"); |
|
|
|
|
} |
|
|
|
|
DocumentManager::delete_document( |
|
|
|
|
$courseInfo, |
|
|
|
|
null, |
|
|
|
|
$base_work_dir, |
|
|
|
|
$sessionId, |
|
|
|
|
$documentId |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log("No document found for id #$documentId"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($debug) error_log("Document not found #$itemId"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$lp->delete($courseInfo, $lpId, 'remove'); |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -453,7 +505,7 @@ $server->wsdl->addComplexType( |
|
|
|
|
'SOAP-ENC:Array', |
|
|
|
|
array(), |
|
|
|
|
array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:lpItem[]')), |
|
|
|
|
'tns:lpItemList' |
|
|
|
|
'tns:lpItem' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$server->wsdl->addComplexType( |
|
|
|
|
|