cm_soap_course.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.webservices
  5. */
  6. require_once __DIR__.'/cm_webservice_course.php';
  7. require_once __DIR__.'/cm_soap.php';
  8. /**
  9. * Configures the WSCourse SOAP service.
  10. */
  11. $s = WSCMSoapServer::singleton();
  12. $s->wsdl->addComplexType(
  13. 'course_id',
  14. 'complexType',
  15. 'struct',
  16. 'all',
  17. '',
  18. [
  19. 'course_id_field_name' => ['name' => 'course_id_field_name', 'type' => 'xsd:string'],
  20. 'course_id_value' => ['name' => 'course_id_value', 'type' => 'xsd:string'],
  21. ]
  22. );
  23. $s->wsdl->addComplexType(
  24. 'course_result',
  25. 'complexType',
  26. 'struct',
  27. 'all',
  28. '',
  29. [
  30. 'course_id_value' => ['name' => 'course_id_value', 'type' => 'xsd:string'],
  31. 'result' => ['name' => 'result', 'type' => 'tns:result'],
  32. ]
  33. );
  34. $s->wsdl->addComplexType(
  35. 'course_result_array',
  36. 'complexType',
  37. 'array',
  38. '',
  39. 'SOAP-ENC:Array',
  40. [],
  41. [['ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_result[]']],
  42. 'tns:course_result'
  43. );
  44. $s->register(
  45. 'WSCMCourse.DeleteCourse',
  46. ['secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string']
  47. );
  48. $s->register(
  49. 'WSCMCourse.DeleteCourses',
  50. ['secret_key' => 'xsd:string', 'courses' => 'tns:course_id[]'],
  51. ['return' => 'tns:course_result_array']
  52. );
  53. $s->register(
  54. 'WSCMCourse.CreateCourse',
  55. [
  56. 'secret_key' => 'xsd:string',
  57. 'title' => 'xsd:string',
  58. 'category_code' => 'xsd:string',
  59. 'wanted_code' => 'xsd:string',
  60. 'tutor_name' => 'xsd:string',
  61. 'course_admin_user_id_field_name' => 'xsd:string',
  62. 'course_admin_user_id_value' => 'xsd:string',
  63. 'language' => 'xsd:string',
  64. 'course_id_field_name' => 'xsd:string',
  65. 'course_id_value' => 'xsd:string',
  66. 'extras' => 'tns:extra_field[]',
  67. ],
  68. ['return' => 'xsd:int']
  69. );
  70. $s->wsdl->addComplexType(
  71. 'course_create',
  72. 'complexType',
  73. 'struct',
  74. 'all',
  75. '',
  76. [
  77. 'title' => ['name' => 'title', 'type' => 'xsd:string'],
  78. 'category_code' => ['name' => 'category_code', 'type' => 'xsd:string'],
  79. 'wanted_code' => ['name' => 'wanted_code', 'type' => 'xsd:int'],
  80. 'tutor_name' => ['name' => 'tutor_name', 'type' => 'xsd:string'],
  81. 'course_admin_user_id_field_name' => ['name' => 'course_admin_user_id_field_name', 'type' => 'xsd:string'],
  82. 'course_admin_user_id_value' => ['name' => 'course_admin_user_id_value', 'type' => 'xsd:string'],
  83. 'language' => ['name' => 'language', 'type' => 'xsd:string'],
  84. 'course_id_field_name' => ['name' => 'course_id_field_name', 'type' => 'xsd:string'],
  85. 'course_id_value' => ['name' => 'course_id_value', 'type' => 'xsd:string'],
  86. 'extras' => ['name' => 'extras', 'type' => 'tns:extra_field[]'],
  87. ]
  88. );
  89. $s->wsdl->addComplexType(
  90. 'course_create_result',
  91. 'complexType',
  92. 'struct',
  93. 'all',
  94. '',
  95. [
  96. 'course_id_value' => ['name' => 'course_id_value', 'type' => 'xsd:string'],
  97. 'course_id_generated' => ['name' => 'course_id_generated', 'type' => 'xsd:int'],
  98. 'result' => ['name' => 'result', 'type' => 'tns:result'],
  99. ]
  100. );
  101. $s->wsdl->addComplexType(
  102. 'course_create_result_array',
  103. 'complexType',
  104. 'array',
  105. '',
  106. 'SOAP-ENC:Array',
  107. [],
  108. [['ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_create_result[]']],
  109. 'tns:course_create_result'
  110. );
  111. $s->register(
  112. 'WSCMCourse.CreateCourses',
  113. [
  114. 'secret_key' => 'xsd:string',
  115. 'courses' => 'tns:course_create[]',
  116. ],
  117. ['return' => 'tns:course_create_result_array']
  118. );
  119. $s->register(
  120. 'WSCMCourse.EditCourse',
  121. [
  122. 'secret_key' => 'xsd:string',
  123. 'course_id_field_name' => 'xsd:string',
  124. 'course_id_value' => 'xsd:string',
  125. 'title' => 'xsd:string',
  126. 'category_code' => 'xsd:string',
  127. 'department_name' => 'xsd:string',
  128. 'department_url' => 'xsd:string',
  129. 'language' => 'xsd:string',
  130. 'visibility' => 'xsd:int',
  131. 'subscribe' => 'xsd:int',
  132. 'unsubscribe' => 'xsd:int',
  133. 'visual_code' => 'xsd:string',
  134. 'extras' => 'tns:extra_field[]',
  135. ]
  136. );
  137. $s->wsdl->addComplexType(
  138. 'course',
  139. 'complexType',
  140. 'struct',
  141. 'all',
  142. '',
  143. [
  144. 'id' => ['name' => 'id', 'type' => 'xsd:int'],
  145. 'code' => ['name' => 'code', 'type' => 'xsd:string'],
  146. 'title' => ['name' => 'title', 'type' => 'xsd:string'],
  147. 'language' => ['name' => 'language', 'type' => 'xsd:string'],
  148. 'visibility' => ['name' => 'visibility', 'type' => 'xsd:int'],
  149. 'category_name' => ['name' => 'category_name', 'type' => 'xsd:string'],
  150. 'number_students' => ['name' => 'number_students', 'type' => 'xsd:int'],
  151. 'external_course_id' => ['name' => 'external_course_id', 'type' => 'xsd:string'],
  152. ]
  153. );
  154. $s->wsdl->addComplexType(
  155. 'course_array',
  156. 'complexType',
  157. 'array',
  158. '',
  159. 'SOAP-ENC:Array',
  160. [],
  161. [['ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course[]']],
  162. 'tns:course'
  163. );
  164. $s->register(
  165. 'WSCMCourse.ListCourses',
  166. [
  167. 'secret_key' => 'xsd:string',
  168. 'course_id_field_name' => 'xsd:string',
  169. ],
  170. ['return' => 'tns:course_array']
  171. );
  172. $s->register(
  173. 'WSCMCourse.SubscribeUserToCourse',
  174. [
  175. 'secret_key' => 'xsd:string',
  176. 'course_id_field_name' => 'xsd:string',
  177. 'course_id_value' => 'xsd:string',
  178. 'user_id_field_name' => 'xsd:string',
  179. 'user_id_value' => 'xsd:string',
  180. 'status' => 'xsd:int',
  181. ]
  182. );
  183. $s->register(
  184. 'WSCMCourse.UnsubscribeUserFromCourse',
  185. [
  186. 'secret_key' => 'xsd:string',
  187. 'course_id_field_name' => 'xsd:string',
  188. 'course_id_value' => 'xsd:string',
  189. 'user_id_field_name' => 'xsd:string',
  190. 'user_id_value' => 'xsd:string',
  191. ]
  192. );
  193. $s->wsdl->addComplexType(
  194. 'course_description',
  195. 'complexType',
  196. 'struct',
  197. 'all',
  198. '',
  199. [
  200. 'course_desc_id' => ['name' => 'course_desc_id', 'type' => 'xsd:int'],
  201. 'course_desc_title' => ['name' => 'course_desc_title', 'type' => 'xsd:string'],
  202. 'course_desc_content' => ['name' => 'course_desc_content', 'type' => 'xsd:string'],
  203. ]
  204. );
  205. $s->wsdl->addComplexType(
  206. 'course_description_array',
  207. 'complexType',
  208. 'array',
  209. '',
  210. 'SOAP-ENC:Array',
  211. [],
  212. [['ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_description[]']],
  213. 'tns:course_description'
  214. );
  215. $s->register(
  216. 'WSCMCourse.GetCourseDescriptions',
  217. [
  218. 'secret_key' => 'xsd:string',
  219. 'course_id_field_name' => 'xsd:string',
  220. 'course_id_value' => 'xsd:string',
  221. ],
  222. ['return' => 'tns:course_description_array']
  223. );
  224. $s->register(
  225. 'WSCMCourse.EditCourseDescription',
  226. [
  227. 'secret_key' => 'xsd:string',
  228. 'course_id_field_name' => 'xsd:string',
  229. 'course_id_value' => 'xsd:string',
  230. 'course_desc_id' => 'xsd:int',
  231. 'course_desc_title' => 'xsd:string',
  232. 'course_desc_content' => 'xsd:string',
  233. ]
  234. );
  235. $s->register(
  236. 'WSCMCourse.unreadMessage',
  237. [
  238. 'username' => 'xsd:string',
  239. 'password' => 'xsd:string',
  240. ],
  241. ['return' => 'xsd:string'],
  242. 'urn:WSCMService',
  243. '',
  244. '',
  245. '',
  246. 'Retorna a quantidade de mensagens nao lidas na caixa de entrada do usuario.'
  247. );
  248. $s->register(
  249. 'WSCMCourse.getIdMessage',
  250. [
  251. 'username' => 'xsd:string',
  252. 'password' => 'xsd:string',
  253. ],
  254. ['return' => 'xsd:string'],
  255. 'urn:WSCMService',
  256. '',
  257. '',
  258. '',
  259. 'Retorna o ID das mensagens.'
  260. );
  261. $s->register(
  262. 'WSCMCourse.nada',
  263. ['username' => 'xsd:string', 'password' => 'xsd:string'],
  264. ['return' => 'xsd:string']
  265. );