cm_webservice_courses.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. require_once(dirname(__FILE__).'/../inc/global.inc.php');
  3. $libpath = api_get_path(LIBRARY_PATH);
  4. require_once $libpath.'usermanager.lib.php';
  5. require_once $libpath.'course.lib.php';
  6. require_once(dirname(__FILE__).'/cm_webservice.php');
  7. /**
  8. * Description of cm_soap_inbox
  9. *
  10. * @author marcosousa
  11. */
  12. class WSCMCourses extends WSCM {
  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. */