Source for file CourseGroup.class.php

Documentation is available at CourseGroup.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/coursemanagement/CourseGroup.php");
  4.  
  5. /**
  6. * CourseGroup manages a set of CanonicalCourses. CourseGroups have a
  7. * CourseGroupType which characterizes the group. CourseGroups can be used to
  8. * model prerequisites, corequisites, majors, minors, sequences, etc.
  9. *
  10. * <p>
  11. * OSID Version: 2.0
  12. * </p>
  13. *
  14. * @package harmoni.osid_v2.coursemanagement
  15. *
  16. * @copyright Copyright &copy; 2005, Middlebury College
  17. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  18. *
  19. * @version $Id: CourseGroup.class.php,v 1.9 2007/09/04 20:25:39 adamfranco Exp $
  20. */
  21. class HarmoniCourseGroup
  22. extends CourseGroup
  23. {
  24. /**
  25. * @variable object $_node the node representing this group.
  26. * @access private
  27. ***/
  28. var $_node;
  29. /**
  30. * The constructor.
  31. * @access private
  32. * @param object Node $id
  33. * @return void
  34. */
  35. function HarmoniCourseGroup($node)
  36. {
  37. $this->_node =$node;
  38. }
  39.  
  40. /**
  41. * Update the display name for this CourseGroup.
  42. *
  43. * @param string $displayName
  44. *
  45. * @throws object CourseManagementException An exception
  46. * with one of the following messages defined in
  47. * org.osid.coursemanagement.CourseManagementException may be
  48. * thrown: {@link }
  49. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  50. * OPERATION_FAILED}, {@link }
  51. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  52. * PERMISSION_DENIED}, {@link }
  53. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  54. * CONFIGURATION_ERROR}, {@link }
  55. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  56. * UNIMPLEMENTED}, {@link }
  57. * org.osid.coursemanagement.CourseManagementException#NULL_ARGUMENT
  58. * NULL_ARGUMENT}
  59. *
  60. * @access public
  61. */
  62. function updateDisplayName ( $displayName ) {
  63. $this->_node->updateDisplayName($displayName);
  64. }
  65.  
  66. /**
  67. * Get the display name for this CourseGroup.
  68. *
  69. * @return string
  70. *
  71. * @throws object CourseManagementException An exception
  72. * with one of the following messages defined in
  73. * org.osid.coursemanagement.CourseManagementException may be
  74. * thrown: {@link }
  75. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  76. * OPERATION_FAILED}, {@link }
  77. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  78. * PERMISSION_DENIED}, {@link }
  79. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  80. * CONFIGURATION_ERROR}, {@link }
  81. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  82. * UNIMPLEMENTED}
  83. *
  84. * @access public
  85. */
  86. function getDisplayName () {
  87. return $this->_node->getDisplayName();
  88. }
  89.  
  90. /**
  91. * Get the unique Id for this CourseGroup.
  92. *
  93. * @return object Id
  94. *
  95. * @throws object CourseManagementException An exception
  96. * with one of the following messages defined in
  97. * org.osid.coursemanagement.CourseManagementException may be
  98. * thrown: {@link }
  99. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  100. * OPERATION_FAILED}, {@link }
  101. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  102. * PERMISSION_DENIED}, {@link }
  103. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  104. * CONFIGURATION_ERROR}, {@link }
  105. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  106. * UNIMPLEMENTED}
  107. *
  108. * @access public
  109. */
  110. function getId () {
  111. return $this->_node->getId();
  112. }
  113.  
  114. /**
  115. * Get the Type for this CourseGroup.
  116. *
  117. * @return object Type
  118. *
  119. * @throws object CourseManagementException An exception
  120. * with one of the following messages defined in
  121. * org.osid.coursemanagement.CourseManagementException may be
  122. * thrown: {@link }
  123. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  124. * OPERATION_FAILED}, {@link }
  125. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  126. * PERMISSION_DENIED}, {@link }
  127. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  128. * CONFIGURATION_ERROR}, {@link }
  129. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  130. * UNIMPLEMENTED}
  131. *
  132. * @access public
  133. */
  134. function getType () {
  135. return $this->_node->getType();
  136. }
  137.  
  138. /**
  139. * Add a CanonicalCourse to this CourseGroup. Order may be preserved,
  140. * depending on CourseGroupType.
  141. *
  142. * @param object Id $canonicalCourseId
  143. *
  144. * @throws object CourseManagementException An exception
  145. * with one of the following messages defined in
  146. * org.osid.coursemanagement.CourseManagementException may be
  147. * thrown: {@link }
  148. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  149. * OPERATION_FAILED}, {@link }
  150. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  151. * PERMISSION_DENIED}, {@link }
  152. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  153. * CONFIGURATION_ERROR}, {@link }
  154. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  155. * UNIMPLEMENTED}, {@link }
  156. * org.osid.coursemanagement.CourseManagementException#NULL_ARGUMENT
  157. * NULL_ARGUMENT}, {@link }
  158. * org.osid.coursemanagement.CourseManagementException#UNKNOWN_ID
  159. * UNKNOWN_ID}, {@link }
  160. * org.osid.coursemanagement.CourseManagementException#ALREADY_ADDED
  161. * ALREADY_ADDED}
  162. *
  163. * @access public
  164. */
  165. function addCourse ( $canonicalCourseId ) {
  166. $cm=Services::getService("CourseManagement");
  167. $course =$cm->getCanonicalCourse($canonicalCourseId);
  168. $course->_node->addParent($this->_node->getId());
  169. }
  170.  
  171. /**
  172. * Remove a CanonicalCourse from the CourseGroup.
  173. *
  174. * @param object Id $canonicalCourseId
  175. *
  176. * @throws object CourseManagementException An exception
  177. * with one of the following messages defined in
  178. * org.osid.coursemanagement.CourseManagementException may be
  179. * thrown: {@link }
  180. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  181. * OPERATION_FAILED}, {@link }
  182. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  183. * PERMISSION_DENIED}, {@link }
  184. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  185. * CONFIGURATION_ERROR}, {@link }
  186. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  187. * UNIMPLEMENTED}, {@link }
  188. * org.osid.coursemanagement.CourseManagementException#NULL_ARGUMENT
  189. * NULL_ARGUMENT}, {@link }
  190. * org.osid.coursemanagement.CourseManagementException#UNKNOWN_ID
  191. * UNKNOWN_ID}
  192. *
  193. * @access public
  194. */
  195. function removeCourse ( $canonicalCourseId ) {
  196. $cm=Services::getService("CourseManagement");
  197. $course =$cm->getCanonicalCourse($canonicalCourseId);
  198. $course->_node->removeParent($this->_node->getId());
  199. }
  200.  
  201. /**
  202. * Get all the CanonicalCourses in this CourseGroup. Note that different
  203. * CourseGroupType imply different ordering. For example, if the
  204. * CourseGroupType indicates prerequisites order would need be guaranteed;
  205. * if corequisites order might not need to be guaranteed.
  206. *
  207. * @return object CanonicalCourseIterator
  208. *
  209. * @throws object CourseManagementException An exception
  210. * with one of the following messages defined in
  211. * org.osid.coursemanagement.CourseManagementException may be
  212. * thrown: {@link }
  213. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  214. * OPERATION_FAILED}, {@link }
  215. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  216. * PERMISSION_DENIED}, {@link }
  217. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  218. * CONFIGURATION_ERROR}, {@link }
  219. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  220. * UNIMPLEMENTED}
  221. *
  222. * @access public
  223. */
  224. function getCourses () {
  225. $cm=Services::getService("CourseManagement");
  226. $nodeiterator =$this->_node->getChildren();
  227. $arrayOfCourses = array();
  228. while($nodeiterator->hasNextNode()){
  229. $node=$nodeiterator->nextNode();
  230. $arrayOfCourses[] =$cm->getCanonicalCourse($node->getId());
  231. }
  232. $ret = new HarmoniCanonicalCourseIterator($arrayOfCourses);
  233. return $ret;
  234. }
  235. }
  236.  
  237. ?>

Documentation generated on Wed, 19 Sep 2007 10:22:14 -0400 by phpDocumentor 1.3.0RC3