r108747 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108746‎ | r108747 | r108748 >
Date:19:46, 12 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on special:student
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudent.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialStudent.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialStudent.php
@@ -46,9 +46,20 @@
4747 $out->addWikiMsg( 'ep-student-none', $this->subPage );
4848 }
4949 else {
50 - $out->setPageTitle( wfMsgExt( 'ep-student-title', 'parsemag', $student->getUser()->getName() ) );
 50+ $out->setPageTitle( wfMsgExt( 'ep-student-title', 'parsemag', $student->getName() ) );
5151
5252 $this->displaySummary( $student );
 53+
 54+ $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-student-terms' ) ) );
 55+
 56+ $termIds = array_map(
 57+ function( EPTerm $term ) {
 58+ return $term->getId();
 59+ },
 60+ $student->getTerms( 'id' )
 61+ );
 62+
 63+ EPTerm::displayPager( $this->getContext(), array( 'id' => $termIds ) );
5364 }
5465 }
5566 }
@@ -65,6 +76,9 @@
6677 protected function getSummaryData( EPDBObject $student ) {
6778 $stats = array();
6879
 80+ $id = $student->getUser()->getId();
 81+ $stats['user'] = Linker::userLink( $id, $student->getName() ) . Linker::userToolLinks( $id, $student->getName() );
 82+
6983 $stats['first-enroll'] = htmlspecialchars( $this->getLanguage()->timeanddate( $student->getField( 'first_enroll' ), true ) );
7084 $stats['last-active'] = htmlspecialchars( $this->getLanguage()->timeanddate( $student->getField( 'last_active' ), true ) );
7185 $stats['active-enroll'] = wfMsgHtml( $student->getField( 'active_enroll' ) ? 'ep-student-actively-enrolled' : 'ep-student-no-active-enroll' );
Index: trunk/extensions/EducationProgram/includes/EPStudent.php
@@ -268,4 +268,15 @@
269269 return $this->user;
270270 }
271271
 272+ /**
 273+ * Returns the display name for the student.
 274+ *
 275+ * @since 0.1
 276+ *
 277+ * @return String
 278+ */
 279+ public function getName() {
 280+ return $this->getUser()->getRealName() === '' ? $this->user->getName() : $this->user->getRealName();
 281+ }
 282+
272283 }
Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -185,7 +185,7 @@
186186 }
187187
188188 foreach ( $this->getFields() as $field ) {
189 - if ( !array_key_exists( $field, $this->conds ) ) {
 189+ if ( !array_key_exists( $field, $this->conds ) || is_array( $this->conds[$field] ) ) {
190190 $fields[$field] = $field;
191191 }
192192 }
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -276,6 +276,8 @@
277277 'specialstudent-summary-active-enroll' => 'Enrollment status',
278278 'specialstudent-summary-last-active' => 'Last activity',
279279 'specialstudent-summary-first-enroll' => 'First enrollment',
 280+ 'specialstudent-summary-user' => 'User',
 281+ 'ep-student-terms' => 'Terms this student has enrolled in',
280282
281283 // Special:Enroll
282284 'ep-enroll-title' => 'Enroll for $1 at $2',

Status & tagging log