soap_course.php 6.6 KB

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