Harmoni PHP Cross Reference Developer Tools

Source: /core/oki2/coursemanagement/CourseGroup.class.php - 242 lines - 8290 bytes - Summary - Text - Print

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

title

Description

title

Description

title

Description

title

title

Body