Source for file CourseGradeRecord.class.php

Documentation is available at CourseGradeRecord.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/coursemanagement/CourseGradeRecord.php");
  4.  
  5. /**
  6. * CourseGradeRecord manages the CourseGrade of a specific CourseGradeType for
  7. * an Agent and a CourseOffering.
  8. *
  9. * <p>
  10. * OSID Version: 2.0
  11. * </p>
  12. *
  13. * @package harmoni.osid_v2.coursemanagement
  14. *
  15. * @copyright Copyright &copy; 2005, Middlebury College
  16. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  17. *
  18. * @version $Id: CourseGradeRecord.class.php,v 1.9 2007/09/04 20:25:39 adamfranco Exp $
  19. */
  20. class HarmoniCourseGradeRecord
  21. extends CourseGradeRecord
  22. {
  23. /**
  24. * @variable object $_id the unique id for this HarmoniCourseGradeRecord.
  25. * @access private
  26. * @variable object $_table the HarmoniCourseGradeRecord table.
  27. * @access private
  28. ***/
  29. var $_id;
  30. var $_table;
  31. /**
  32. * The constructor.
  33. *
  34. * @param object Id $id
  35. *
  36. * @access public
  37. * @return void
  38. */
  39. function HarmoniCourseGradeRecord($id)
  40. {
  41. $this->_id = $id;
  42. $this->_table = 'cm_grade_rec';
  43. }
  44. /**
  45. * Update the grade for this CourseGradeRecord.
  46. *
  47. * @param object mixed $courseGrade (original type: java.io.Serializable)
  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 updateCourseGrade ( $courseGrade ) {
  67. $this->_setField('grade',$courseGrade);
  68. }
  69.  
  70. /**
  71. * Update the display name for this CourseGradeRecord.
  72. *
  73. * @param string $displayName
  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}, {@link }
  87. * org.osid.coursemanagement.CourseManagementException#NULL_ARGUMENT
  88. * NULL_ARGUMENT}
  89. *
  90. * @access public
  91. */
  92. function updateDisplayName ( $displayName ) {
  93. $this->_setField('name',$displayName);
  94. }
  95.  
  96. /**
  97. * Get the grade for this CourseGradeRecord.
  98. *
  99. * @return object mixed (original type: java.io.Serializable)
  100. *
  101. * @throws object CourseManagementException An exception
  102. * with one of the following messages defined in
  103. * org.osid.coursemanagement.CourseManagementException may be
  104. * thrown: {@link }
  105. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  106. * OPERATION_FAILED}, {@link }
  107. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  108. * PERMISSION_DENIED}, {@link }
  109. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  110. * CONFIGURATION_ERROR}, {@link }
  111. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  112. * UNIMPLEMENTED}
  113. *
  114. * @access public
  115. */
  116. function getCourseGrade () {
  117. $grade = $this->_getField('grade');
  118. return $grade;
  119. }
  120.  
  121. /**
  122. * Get the display name for this CourseGradeRecord.
  123. *
  124. * @return string
  125. *
  126. * @throws object CourseManagementException An exception
  127. * with one of the following messages defined in
  128. * org.osid.coursemanagement.CourseManagementException may be
  129. * thrown: {@link }
  130. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  131. * OPERATION_FAILED}, {@link }
  132. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  133. * PERMISSION_DENIED}, {@link }
  134. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  135. * CONFIGURATION_ERROR}, {@link }
  136. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  137. * UNIMPLEMENTED}
  138. *
  139. * @access public
  140. */
  141. function getDisplayName () {
  142. return $this->_getField('name');
  143. }
  144.  
  145. /**
  146. * Get the unique Id for this CourseGradeRecord.
  147. *
  148. * @return object Id
  149. *
  150. * @throws object CourseManagementException An exception
  151. * with one of the following messages defined in
  152. * org.osid.coursemanagement.CourseManagementException may be
  153. * thrown: {@link }
  154. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  155. * OPERATION_FAILED}, {@link }
  156. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  157. * PERMISSION_DENIED}, {@link }
  158. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  159. * CONFIGURATION_ERROR}, {@link }
  160. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  161. * UNIMPLEMENTED}
  162. *
  163. * @access public
  164. */
  165. function getId () {
  166. return $this->_id;
  167. }
  168.  
  169. /**
  170. * Get the Agent (student) associated with this CourseGradeRecord.
  171. *
  172. * @return object Id
  173. *
  174. * @throws object CourseManagementException An exception
  175. * with one of the following messages defined in
  176. * org.osid.coursemanagement.CourseManagementException may be
  177. * thrown: {@link }
  178. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  179. * OPERATION_FAILED}, {@link }
  180. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  181. * PERMISSION_DENIED}, {@link }
  182. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  183. * CONFIGURATION_ERROR}, {@link }
  184. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  185. * UNIMPLEMENTED}
  186. *
  187. * @access public
  188. */
  189. function getAgent () {
  190. $IdManager = Services::getService("Id");
  191. $id = $IdManager->getId($this->_getField('fk_student_id'));
  192. $AgentManager = Services::getService("Agent");
  193. return $AgentManager->getAgent($id);
  194. }
  195.  
  196. /**
  197. * Get the CourseGradeType for the GradeRecord's Offering. GradingType is defined in
  198. * the grading OSID. These Types are meaningful to the implementation and
  199. * applications and are not specified by the OSID.
  200. *
  201. * @return object Type
  202. *
  203. * @throws object CourseManagementException An exception
  204. * with one of the following messages defined in
  205. * org.osid.coursemanagement.CourseManagementException may be
  206. * thrown: {@link }
  207. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  208. * OPERATION_FAILED}, {@link }
  209. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  210. * PERMISSION_DENIED}, {@link }
  211. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  212. * CONFIGURATION_ERROR}, {@link }
  213. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  214. * UNIMPLEMENTED}
  215. *
  216. * @access public
  217. */
  218. function getType () {
  219. //@TODO could be sped up with an innerjoin
  220. $course =$this->getCourseOffering();
  221. return $course->getCourseGradeType();
  222. }
  223. /**
  224. * Calls getType(), which may be the proper name.
  225. *
  226. * @return object Type
  227. *
  228. * @throws object CourseManagementException An exception
  229. * with one of the following messages defined in
  230. * org.osid.coursemanagement.CourseManagementException may be
  231. * thrown: {@link }
  232. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  233. * OPERATION_FAILED}, {@link }
  234. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  235. * PERMISSION_DENIED}, {@link }
  236. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  237. * CONFIGURATION_ERROR}, {@link }
  238. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  239. * UNIMPLEMENTED}
  240. *
  241. * @access public
  242. */
  243. function getCourseGradeType () {
  244. return $this->getType();
  245. }
  246.  
  247. /**
  248. * Get the unique Id for the CourseOffering for this CourseGradeRecord..
  249. *
  250. * @return object Id
  251. *
  252. * @throws object CourseManagementException An exception
  253. * with one of the following messages defined in
  254. * org.osid.coursemanagement.CourseManagementException may be
  255. * thrown: {@link }
  256. * org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  257. * OPERATION_FAILED}, {@link }
  258. * org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  259. * PERMISSION_DENIED}, {@link }
  260. * org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  261. * CONFIGURATION_ERROR}, {@link }
  262. * org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  263. * UNIMPLEMENTED}
  264. *
  265. * @access public
  266. */
  267. function getCourseOffering () {
  268. $idstring = $this->_getField('fk_cm_offer');
  269. $idManager = Services::getService("Id");
  270. $cm = Services::getService("CourseManagement");
  271. $id =$idManager->getId($idstring);
  272. return $cm->getCourseOffering($id);
  273. }
  274. function _typeToIndex($typename, $type)
  275. {
  276. $cm=Services::getService("CourseManagement");
  277. return $cm->_typeToIndex($typename, $type);
  278. }
  279. function _getTypes($typename)
  280. {
  281. $cm=Services::getService("CourseManagement");
  282. return $cm->_getTypes($typename);
  283. }
  284. function _getField($key)
  285. {
  286. $cm=Services::getService("CourseManagement");
  287. return $cm->_getField($this->_id,$this->_table,$key);
  288. }
  289. function _getType($typename){
  290. $cm=Services::getService("CourseManagement");
  291. return $cm->_getType($this->_id,$this->_table,$typename);
  292. }
  293. function _setField($key, $value)
  294. {
  295. $cm=Services::getService("CourseManagement");
  296. return $cm->_setField($this->_id,$this->_table,$key, $value);
  297. }
  298. }
  299.  
  300. ?>

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