soap_course.php 7.5 KB

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