r107742 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107741‎ | r107742 | r107743 >
Date:21:30, 31 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
Follow up to r107740; docs++
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPStudent.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPStudent.php
@@ -22,14 +22,6 @@
2323 protected $terms = false;
2424
2525 /**
26 - * Cached array of the EPCourse objects.
27 - *
28 - * @since 0.1
29 - * @var array|false
30 - */
31 - protected $courses = false;
32 -
33 - /**
3426 * @see parent::getFieldTypes
3527 *
3628 * @since 0.1
@@ -119,15 +111,15 @@
120112 }
121113
122114 /**
 115+ * Returns the courses this student is linked to (via terms).
123116 *
124 - *
125117 * @since 0.1
126118 *
127 - * @param null $fields
 119+ * @param string|null|array $fields
128120 * @param array $conditions
129121 * @param array $termConditions
130122 *
131 - * @return array
 123+ * @return array of EPCourse
132124 */
133125 public function getCourses( $fields = null, array $conditions = array(), array $termConditions = array() ) {
134126 $courseIds = array_reduce(
@@ -141,17 +133,37 @@
142134 return array();
143135 }
144136
145 - $conditions['id'] = $courseIds;
 137+ $conditions['id'] = array_unique( $courseIds );
146138
147139 return EPCourse::select( $fields, array( 'id' => $conditions ) );
148140 }
149141
 142+ /**
 143+ * Returns the courses this student is currently enrolled in.
 144+ *
 145+ * @since 0.1
 146+ *
 147+ * @param string|null|array $fields
 148+ * @param array $conditions
 149+ *
 150+ * @return array of EPCourse
 151+ */
150152 public function getCurrentCourses( $fields = null, array $conditions = array() ) {
151153 return $this->getCourses( $fields, $conditions, array(
152154 'end >= ' . wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() )
153155 ) );
154156 }
155157
 158+ /**
 159+ * Returns the courses this student was previously enrolled in.
 160+ *
 161+ * @since 0.1
 162+ *
 163+ * @param string|null|array $fields
 164+ * @param array $conditions
 165+ *
 166+ * @return array of EPCourse
 167+ */
156168 public function getPassedCourses( $fields = null, array $conditions = array() ) {
157169 return $this->getCourses( $fields, $conditions, array(
158170 'end < ' . wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() )

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107740work on student workflowjeroendedauw21:17, 31 December 2011

Status & tagging log