Improvements to report webservices - still not functional, apparently

skala
Yannick Warnier 14 years ago
parent bb052e442b
commit a2e52081e0
  1. 39
      main/webservices/soap_report.php
  2. 53
      main/webservices/webservice_report.php

@ -68,25 +68,50 @@ $s->wsdl->addComplexType(
);
$s->register(
'WSReport.get_time_spent_on_platform',
'WSReport.GetTimeSpentOnPlatform',
array('secret_key' => 'xsd:string', 'user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string'),
array('return' => 'tns:user_result_array')
array('return' => 'xsd:string')
);
$s->register(
'WSReport.get_time_spent_on_course',
'WSReport.GetTimeSpentOnCourse',
array('secret_key' => 'xsd:string', 'user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string'),
array('return' => 'tns:user_result_array')
array('return' => 'xsd:string')
);
$s->register(
'WSReport.get_time_spent_on_course_in_session',
'WSReport.GetTimeSpentOnCourseInSession',
array('secret_key' => 'xsd:string', 'user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string', 'session_id_field_name' => 'xsd:string', 'session_id_value' => 'xsd:string'),
array('return' => 'tns:user_result_array')
array('return' => 'xsd:string')
);
$s->register(
'WSReport.get_time_spent_on_learnpath_in_course',
'WSReport.GetTimeSpentOnLearnpathInCourse',
array('secret_key' => 'xsd:string', 'user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string', 'learnpath_id' => 'xsd:string'),
array('return' => 'xsd:string')
);
$s->register(
'WSReport.GetLearnpathsByCourse',
array('user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string', 'learnpath_id' => 'xsd:string'),
array('return' => 'tns:user_result_array')
);
$s->register(
'WSReport.GetLearnpathProgress',
array('user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string', 'learnpath_id' => 'xsd:string'),
array('return' => 'xsd:string')
);
$s->register(
'WSReport.GetLearnpathScoreSingleItem',
array('user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string', 'learnpath_id' => 'xsd:string'),
array('return' => 'xsd:string')
);
$s->register(
'WSReport.GetLearnpathStatusSingleItem',
//array('secret_key' => 'xsd:string'),
array('secret_key' => 'xsd:string', 'user_id_field_name' => 'xsd:string', 'user_id_value' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string', 'learnpath_id' => 'xsd:string'),
array('return' => 'xsd:string')
);

@ -23,7 +23,7 @@ class WSReport extends WS {
* @param string User id value
* @return array Array of results
*/
protected function get_time_spent_on_platform($user_id_field_name, $user_id_value) {
protected function GetTimeSpentOnPlatform($user_id_field_name, $user_id_value) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
@ -41,7 +41,7 @@ class WSReport extends WS {
* @param string Course id value
* @return array Array of results
*/
protected function get_time_spent_on_course($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value) {
protected function GetTimeSpentOnCourse($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
@ -64,7 +64,7 @@ class WSReport extends WS {
* @param string Course id value
* @return array Array of results
*/
protected function get_time_spent_on_course_in_session($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
protected function GetTimeSpentOnCourseInSession($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
@ -90,7 +90,7 @@ class WSReport extends WS {
* @param string Course id value
* @return array Array of id=>title of learning paths
*/
protected function get_learnpaths_by_course($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $lp_id) {
protected function GetLearnpathsByCourse($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $lp_id) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
@ -119,7 +119,7 @@ class WSReport extends WS {
* @param string Learnpath ID
* @return double Between 0 and 100 (% of progress)
*/
protected function get_user_learnpath_progress($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) {
protected function GetLearnpathProgress($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
@ -145,7 +145,7 @@ class WSReport extends WS {
* @param string Learnpath ID
* @return double Generally between 0 and 100
*/
protected function get_user_learnpath_score_single_item($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) {
protected function GetLearnpathScoreSingleItem($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
@ -165,29 +165,34 @@ class WSReport extends WS {
* Gets status obtained in the given learning path by the given user,
* assuming there is only one item (SCO) in the learning path
*
* @param string User id field name
* @param string Secret key
* @param string User id field name (use chamilo_user_id if none)
* @param string User id value
* @param string Course id field name
* @param string Course id field name (use chamilo_course_id if none)
* @param string Course id value
* @param string Learnpath ID
* @return string "not attempted", "passed", "completed", "failed", "incomplete"
*/
protected function get_user_learnpath_status_single_item($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
}
$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
if($course_id instanceof WSError) {
return $course_id;
protected function GetLearnpathStatusSingleItem($secret_key, $user_id_field_name = 'chamilo_user_id', $user_id_value, $course_id_field_name = 'chamilo_course_id', $course_id_value, $learnpath_id) {
return null;
$verifKey = $this->verifyKey($secret_key);
if($verifKey instanceof WSError) {
$this->handleError($verifKey);
} else {
$course_code = CourseManager::get_course_code_from_course_id($course_id);
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
}
$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
if($course_id instanceof WSError) {
return $course_id;
} else {
$course_code = CourseManager::get_course_code_from_course_id($course_id);
}
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
$lp = new learnpath($course_code, $learnpath_id, $user_id);
error_log('Ready to return status for '.$course_code.'-'.$learnpath_id.'-'.$user_id.': '.$lp->items[0]['status']);
return $lp->items[0]['status'];
}
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
$lp = new learnpath($course_code, $learnpath_id, $user_id);
//return $lp['progress'];
return 'failed';
//return 'passed';
//return 'incomplete';
}
}
}

Loading…
Cancel
Save