cm_webservice_courses.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.webservices
  5. */
  6. require_once __DIR__.'/../inc/global.inc.php';
  7. $libpath = api_get_path(LIBRARY_PATH);
  8. require_once __DIR__.'/cm_webservice.php';
  9. /**
  10. * Description of cm_soap_inbox
  11. *
  12. * @author marcosousa
  13. */
  14. class WSCMCourses extends WSCM
  15. {
  16. public function get_courses_code($username, $password)
  17. {
  18. if ($this->verifyUserPass($username, $password) == "valid") {
  19. $user_id = UserManager::get_user_id_from_username($username);
  20. $listOfCourses = UserManager::get_personal_session_course_list($user_id);
  21. $courses_id = "#";
  22. foreach ($listOfCourses as $course) {
  23. $courses_id .= $course['code']."#";
  24. }
  25. return $courses_id;
  26. } else {
  27. return get_lang('InvalidId');
  28. }
  29. }
  30. public function get_course_title($username, $password, $course_code)
  31. {
  32. if ($this->verifyUserPass($username, $password) == "valid") {
  33. $course_info = CourseManager::get_course_information($course_code);
  34. return $course_info['title'];
  35. } else {
  36. return get_lang('InvalidId');
  37. }
  38. }
  39. }