soap_course.php 7.2 KB

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