_mod---choice---sl_choice_lib.php.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <!-- template designed by Marco Von Ballmoos -->
  6. <title>Docs for page sl_choice_lib.php</title>
  7. <link rel="stylesheet" href="../media/stylesheet.css" />
  8. <script src="../media/lib/classTree.js"></script>
  9. <script language="javascript" type="text/javascript">
  10. var imgPlus = new Image();
  11. var imgMinus = new Image();
  12. imgPlus.src = "../media/images/plus.png";
  13. imgMinus.src = "../media/images/minus.png";
  14. function showNode(Node){
  15. switch(navigator.family){
  16. case 'nn4':
  17. // Nav 4.x code fork...
  18. var oTable = document.layers["span" + Node];
  19. var oImg = document.layers["img" + Node];
  20. break;
  21. case 'ie4':
  22. // IE 4/5 code fork...
  23. var oTable = document.all["span" + Node];
  24. var oImg = document.all["img" + Node];
  25. break;
  26. case 'gecko':
  27. // Standards Compliant code fork...
  28. var oTable = document.getElementById("span" + Node);
  29. var oImg = document.getElementById("img" + Node);
  30. break;
  31. }
  32. oImg.src = imgMinus.src;
  33. oTable.style.display = "block";
  34. }
  35. function hideNode(Node){
  36. switch(navigator.family){
  37. case 'nn4':
  38. // Nav 4.x code fork...
  39. var oTable = document.layers["span" + Node];
  40. var oImg = document.layers["img" + Node];
  41. break;
  42. case 'ie4':
  43. // IE 4/5 code fork...
  44. var oTable = document.all["span" + Node];
  45. var oImg = document.all["img" + Node];
  46. break;
  47. case 'gecko':
  48. // Standards Compliant code fork...
  49. var oTable = document.getElementById("span" + Node);
  50. var oImg = document.getElementById("img" + Node);
  51. break;
  52. }
  53. oImg.src = imgPlus.src;
  54. oTable.style.display = "none";
  55. }
  56. function nodeIsVisible(Node){
  57. switch(navigator.family){
  58. case 'nn4':
  59. // Nav 4.x code fork...
  60. var oTable = document.layers["span" + Node];
  61. break;
  62. case 'ie4':
  63. // IE 4/5 code fork...
  64. var oTable = document.all["span" + Node];
  65. break;
  66. case 'gecko':
  67. // Standards Compliant code fork...
  68. var oTable = document.getElementById("span" + Node);
  69. break;
  70. }
  71. return (oTable && oTable.style.display == "block");
  72. }
  73. function toggleNodeVisibility(Node){
  74. if (nodeIsVisible(Node)){
  75. hideNode(Node);
  76. }else{
  77. showNode(Node);
  78. }
  79. }
  80. </script>
  81. </head>
  82. <body>
  83. <div class="page-body">
  84. <h2 class="file-name"><img src="../media/images/Page_logo.png" alt="File" style="vertical-align: middle">/mod/choice/sl_choice_lib.php</h2>
  85. <a name="sec-description"></a>
  86. <div class="info-box">
  87. <div class="info-box-title">Description</div>
  88. <div class="nav-bar">
  89. <span class="disabled">Description</span> |
  90. <a href="#sec-includes">Includes</a>
  91. | <a href="#sec-functions">Functions</a>
  92. </div>
  93. <div class="info-box-body">
  94. <!-- ========== Info from phpDoc block ========= -->
  95. <p class="short-description">Sloodle choice local library functions.</p>
  96. <p class="description"><p>Allows easier access to the Moodle choice data.</p></p>
  97. <ul class="tags">
  98. <li><span class="field">copyright:</span> Copyright (c) 2008 Sloodle (various contributors)</li>
  99. <li><span class="field">contributor:</span> Peter R. Bloomfield</li>
  100. <li><span class="field">filesource:</span> <a href="../__filesource/fsource_sloodlechoice__modchoicesl_choice_lib.php.html">Source Code for this file</a></li>
  101. <li><span class="field">license:</span> <a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU GPL v3</a></li>
  102. </ul>
  103. </div>
  104. </div>
  105. <a name="sec-includes"></a>
  106. <div class="info-box">
  107. <div class="info-box-title">Includes</div>
  108. <div class="nav-bar">
  109. <a href="#sec-description">Description</a> |
  110. <span class="disabled">Includes</span>
  111. | <a href="#sec-functions">Functions</a>
  112. </div>
  113. <div class="info-box-body">
  114. <a name="_$CFG->dirroot_/mod/choice/lib_php"><!-- --></a>
  115. <div class="oddrow">
  116. <div>
  117. <img src="../media/images/Page.png" alt=" " />
  118. <span class="include-title">
  119. <span class="include-type">require_once</span>
  120. (<span class="include-name">$CFG->dirroot.'/mod/choice/lib.php'</span>)
  121. (line <span class="line-number"><a href="../__filesource/fsource_sloodlechoice__modchoicesl_choice_lib.php.html#a18">18</a></span>)
  122. </span>
  123. </div>
  124. <!-- ========== Info from phpDoc block ========= -->
  125. </div>
  126. </div>
  127. </div>
  128. <a name="sec-functions"></a>
  129. <div class="info-box">
  130. <div class="info-box-title">Functions</div>
  131. <div class="nav-bar">
  132. <a href="#sec-description">Description</a> |
  133. <a href="#sec-includes">Includes</a>
  134. | <span class="disabled">Functions</span>
  135. </div>
  136. <div class="info-box-body">
  137. <a name="functionsloodle_get_choice" id="functionsloodle_get_choice"><!-- --></a>
  138. <div class="evenrow">
  139. <div>
  140. <img src="../media/images/Function.png" />
  141. <span class="method-title">sloodle_get_choice</span> (line <span class="line-number"><a href="../__filesource/fsource_sloodlechoice__modchoicesl_choice_lib.php.html#a89">89</a></span>)
  142. </div>
  143. <!-- ========== Info from phpDoc block ========= -->
  144. <p class="short-description">Gets a complete record of a particular choice instance.</p>
  145. <p class="description"><p>If successful, returns a database record of the choice, with the following items added: <ul><li>option[] - associates option IDs with option texts</li><li>maxanswers[] - associates option IDs with the maximum allowable number of answers for each one</li><li>selections[] - associates option IDs with the number of times each one has already been selected</li></ul></p></p>
  146. <ul class="tags">
  147. <li><span class="field">return:</span> If successful, a customized database object. Otherwise, boolean false.</li>
  148. <li><span class="field">see:</span> <a href="../sloodlechoice/_mod---choice---sl_choice_lib.php.html#functionsloodle_get_visible_choices_in_course">sloodle_get_visible_choices_in_course()</a></li>
  149. </ul>
  150. <div class="method-signature">
  151. <span class="method-result">mixed</span>
  152. <span class="method-name">
  153. sloodle_get_choice
  154. </span>
  155. (<span class="var-type">object</span>&nbsp;<span class="var-name">$course_module_instance</span>)
  156. </div>
  157. <ul class="parameters">
  158. <li>
  159. <span class="var-type">object</span>
  160. <span class="var-name">$course_module_instance</span><span class="var-description">: A course module instance database record</span> </li>
  161. </ul>
  162. </div>
  163. <a name="functionsloodle_get_num_users_not_answered_choice" id="functionsloodle_get_num_users_not_answered_choice"><!-- --></a>
  164. <div class="oddrow">
  165. <div>
  166. <img src="../media/images/Function.png" />
  167. <span class="method-title">sloodle_get_num_users_not_answered_choice</span> (line <span class="line-number"><a href="../__filesource/fsource_sloodlechoice__modchoicesl_choice_lib.php.html#a125">125</a></span>)
  168. </div>
  169. <!-- ========== Info from phpDoc block ========= -->
  170. <p class="short-description">Gets the number of users on the course who have not yet answered the specified choice.</p>
  171. <p class="description"><p><strong>Note:</strong> the count includes students and teachers.</p></p>
  172. <ul class="tags">
  173. <li><span class="field">return:</span> If successful, a positive integer. Otherwise, a string error message.</li>
  174. </ul>
  175. <div class="method-signature">
  176. <span class="method-result">mixed</span>
  177. <span class="method-name">
  178. sloodle_get_num_users_not_answered_choice
  179. </span>
  180. (<span class="var-type">object</span>&nbsp;<span class="var-name">$choice</span>)
  181. </div>
  182. <ul class="parameters">
  183. <li>
  184. <span class="var-type">object</span>
  185. <span class="var-name">$choice</span><span class="var-description">: A choice object from the {@link:sloodle_get_choice()} function</span> </li>
  186. </ul>
  187. </div>
  188. <a name="functionsloodle_get_visible_choices_in_course" id="functionsloodle_get_visible_choices_in_course"><!-- --></a>
  189. <div class="evenrow">
  190. <div>
  191. <img src="../media/images/Function.png" />
  192. <span class="method-title">sloodle_get_visible_choices_in_course</span> (line <span class="line-number"><a href="../__filesource/fsource_sloodlechoice__modchoicesl_choice_lib.php.html#a32">32</a></span>)
  193. </div>
  194. <!-- ========== Info from phpDoc block ========= -->
  195. <p class="short-description">Gets an array of available choices in the specified course.</p>
  196. <p class="description"><p>Choices which are hidden, or which are in a hidden section of the course, are ignored.</p></p>
  197. <ul class="tags">
  198. <li><span class="field">return:</span> If successful, a numeric array, associating module instance ID's with database record objects of the activity modules. Returns boolean false if an error occurs.</li>
  199. <li><span class="field">see:</span> <a href="../sloodlechoice/_mod---choice---sl_choice_lib.php.html#functionsloodle_get_choice">sloodle_get_choice()</a></li>
  200. <li><span class="field">see:</span> <a href="../sloodlechat/_mod---chat---sl_webintercom_lib.php.html#functionsloodle_get_visible_chatrooms_in_course">sloodle_get_visible_chatrooms_in_course()</a></li>
  201. <li><span class="field">see:</span> <a href="../sloodleglossary/_mod---glossary---sl_glossary_lib.php.html#functionsloodle_get_visible_glossaries_in_course">sloodle_get_visible_glossaries_in_course()</a></li>
  202. </ul>
  203. <div class="method-signature">
  204. <span class="method-result">mixed</span>
  205. <span class="method-name">
  206. sloodle_get_visible_choices_in_course
  207. </span>
  208. (<span class="var-type">int</span>&nbsp;<span class="var-name">$course_id</span>)
  209. </div>
  210. <ul class="parameters">
  211. <li>
  212. <span class="var-type">int</span>
  213. <span class="var-name">$course_id</span><span class="var-description">: Integer ID of a Moodle course</span> </li>
  214. </ul>
  215. </div>
  216. <a name="functionsloodle_select_choice_option" id="functionsloodle_select_choice_option"><!-- --></a>
  217. <div class="oddrow">
  218. <div>
  219. <img src="../media/images/Function.png" />
  220. <span class="method-title">sloodle_select_choice_option</span> (line <span class="line-number"><a href="../__filesource/fsource_sloodlechoice__modchoicesl_choice_lib.php.html#a170">170</a></span>)
  221. </div>
  222. <!-- ========== Info from phpDoc block ========= -->
  223. <p class="short-description">Select an option from a choice.</p>
  224. <p class="description"><p>The return will either be an integer or a string. If an integer, then it is a <a href="http://slisweb.sjsu.edu/sl/index.php/Sloodle_status_codes">status code</a>. The following status codes are typical responses: <ul><li>10011 = added new choice selection</li><li>10012 = updated existing choice selection</li><li>-10011 = User already made a selection, and re-selection is not allowed</li><li>-10012 = max number of selections for this choice already made</li><li>-10013 = choice is not yet open</li><li>-10014 = choice is already closed</li></ul> If a string, then it is an error message reporting that something went wrong.</p></p>
  225. <ul class="tags">
  226. <li><span class="field">return:</span> If successful, a positive integer. Otherwise, a string error message.</li>
  227. </ul>
  228. <div class="method-signature">
  229. <span class="method-result">mixed</span>
  230. <span class="method-name">
  231. sloodle_select_choice_option
  232. </span>
  233. (<span class="var-type">object</span>&nbsp;<span class="var-name">$choice</span>, <span class="var-type">int</span>&nbsp;<span class="var-name">$optionid</span>, <span class="var-type">int</span>&nbsp;<span class="var-name">$moodle_user_id</span>)
  234. </div>
  235. <ul class="parameters">
  236. <li>
  237. <span class="var-type">object</span>
  238. <span class="var-name">$choice</span><span class="var-description">: A choice object from the {@link:sloodle_get_choice()} function</span> </li>
  239. <li>
  240. <span class="var-type">int</span>
  241. <span class="var-name">$optionid</span><span class="var-description">: The integer ID of an option (note: these are unique across an entire site)</span> </li>
  242. <li>
  243. <span class="var-type">int</span>
  244. <span class="var-name">$moodle_user_id</span><span class="var-description">: The integer ID of the Moodle user making the selection</span> </li>
  245. </ul>
  246. </div>
  247. </div>
  248. </div>
  249. <p class="notes" id="credit">
  250. Documentation generated on Tue, 04 Mar 2008 15:08:36 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.0</a>
  251. </p>
  252. </div></body>
  253. </html>