cm_webservice_courses.php 1.4 KB

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