r107989 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107988‎ | r107989 | r107990 >
Date:07:19, 4 January 2012
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
work on student management
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudentPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialAmbassadors.php (added) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php
@@ -30,4 +30,5 @@
3131 'EditInstitution' => array( 'EditInstitution' ),
3232 'EditTerm' => array( 'EditTerm' ),
3333 'Enroll' => array( 'Enroll' ),
 34+ 'Ambassadors' => array( 'Ambassadors' ),
3435 );
Index: trunk/extensions/EducationProgram/specials/SpecialAmbassadors.php
@@ -0,0 +1,46 @@
 2+<?php
 3+
 4+/**
 5+ * Page listing all mentors in a pager with filter control.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file SpecialAmbassadors.php
 10+ * @ingroup EducationProgram
 11+ *
 12+ * @licence GNU GPL v3 or later
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+class SpecialAmbassadors extends SpecialEPPage {
 16+
 17+ /**
 18+ * Constructor.
 19+ *
 20+ * @since 0.1
 21+ */
 22+ public function __construct() {
 23+ parent::__construct( 'Ambassadors' );
 24+ }
 25+
 26+ /**
 27+ * Main method.
 28+ *
 29+ * @since 0.1
 30+ *
 31+ * @param string|null $subPage
 32+ */
 33+ public function execute( $subPage ) {
 34+ parent::execute( $subPage );
 35+
 36+ if ( $this->subPage === '' ) {
 37+ $this->displayNavigation();
 38+ EPMentor::displayAddNewControl( $this->getContext() );
 39+ EPMentor::displayPager( $this->getContext() );
 40+ }
 41+ else {
 42+ // TODO
 43+ //$this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institution', $this->subPage )->getLocalURL() );
 44+ }
 45+ }
 46+
 47+}
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -144,7 +144,7 @@
145145 }
146146
147147 $this->getOutput()->addHTML(
148 - Html::rawElement( 'p', array(), $this->getLang()->pipeList( $links ) )
 148+ Html::rawElement( 'p', array(), $this->getLanguage()->pipeList( $links ) )
149149 );
150150 }
151151
@@ -161,6 +161,11 @@
162162 wfMsg( 'ep-nav-courses' ) => SpecialPage::getTitleFor( 'Courses' ),
163163 wfMsg( 'ep-nav-terms' ) => SpecialPage::getTitleFor( 'Terms' ),
164164 );
 165+
 166+ if ( $this->getUser()->isAllowed( 'epmentor' ) ) {
 167+ $items[wfMsg( 'ep-nav-students' )] = SpecialPage::getTitleFor( 'Students' );
 168+ $items[wfMsg( 'ep-nav-mentors' )] = SpecialPage::getTitleFor( 'Ambassadors' );
 169+ }
165170
166171 if ( $this->getUser()->isAllowed( 'epmentor' ) || EPStudent::has( array( 'user_id' => $this->getUser()->getId() ) ) ) {
167172 $items[wfMsg( 'ep-nav-mycourses' )] = SpecialPage::getTitleFor( 'MyCourses' );
Index: trunk/extensions/EducationProgram/includes/EPStudentPager.php
@@ -26,14 +26,15 @@
2727 parent::__construct( $context, $conds, 'EPStudent' );
2828 }
2929
30 - /**
 30+ /**
3131 * (non-PHPdoc)
3232 * @see EPPager::getFields()
3333 */
3434 public function getFields() {
3535 return array(
36 - // TODO
37 - );
 36+ 'id',
 37+ 'user_id',
 38+ );
3839 }
3940
4041 /**
@@ -58,9 +59,16 @@
5960 */
6061 protected function getFormattedValue( $name, $value ) {
6162 switch ( $name ) {
62 - case '': // TODO
 63+ case 'id':
6364 $value = $value;
6465 break;
 66+ case 'user_id':
 67+ $user = User::newFromId( $value );
 68+ $name = $user->getRealName() === '' ? $user->getName() : $user->getRealName();
 69+
 70+ $value = Linker::userLink( $value, $name ) . Linker::userToolLinks( $value, $name );
 71+
 72+ break;
6573 }
6674
6775 return $value;
@@ -71,6 +79,16 @@
7280 * @see EPPager::getSortableFields()
7381 */
7482 protected function getSortableFields() {
 83+ return array(
 84+ 'id',
 85+ );
 86+ }
 87+
 88+ /**
 89+ * (non-PHPdoc)
 90+ * @see EPPager::getMultipleItemActions()
 91+ */
 92+ protected function getMultipleItemActions() {
7593 return array();
7694 }
7795
Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -165,9 +165,7 @@
166166
167167 $cells[] = Html::rawElement( 'td', $this->getCellAttrs( $field, $value ), $formatted );
168168 }
169 -
170 - $links = $this->getControlLinks( $this->currentObject );
171 -
 169+
172170 return Html::rawElement( 'tr', $this->getRowAttrs( $row ), implode( '', $cells ) ) . "\n";
173171 }
174172
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -24,6 +24,14 @@
2525 'ep-item-summary' => 'Summary',
2626 'ep-toplink' => 'My courses',
2727
 28+ // Navigation links
 29+ 'ep-nav-orgs' => 'Institution list',
 30+ 'ep-nav-courses' => 'Courses list',
 31+ 'ep-nav-terms' => 'Terms list',
 32+ 'ep-nav-mycourses' => 'My courses',
 33+ 'ep-nav-students' => 'Student list',
 34+ 'ep-nav-mentors' => 'Ambassador list',
 35+
2836 // Preferences
2937 'prefs-education' => 'Education',
3038 'ep-prefs-showtoplink' => 'Show a link to [[Special:MyCourses|your courses]] at the top of every page.',
@@ -131,6 +139,10 @@
132140 'eptermpager-filter-course-id' => 'Course',
133141 'eptermpager-filter-year' => 'Year',
134142
 143+ // Student pager
 144+ 'epstudentpager-header-user-id' => 'User',
 145+ 'epstudentpager-header-id' => 'Id',
 146+
135147 // Special:EditInstitution
136148 'editinstitution-text' => 'Enter the institution details below and click submit to save your changes.',
137149 'educationprogram-org-edit-name' => 'Institution name',
@@ -229,12 +241,6 @@
230242 'ep-mycourses-course-title' => 'My courses: $1 at $2',
231243 'specialmycourses-summary-name' => 'Course name',
232244 'specialmycourses-summary-org' => 'Institution name',
233 -
234 - // Navigation links
235 - 'ep-nav-orgs' => 'Institution list',
236 - 'ep-nav-courses' => 'Courses list',
237 - 'ep-nav-terms' => 'Terms list',
238 - 'ep-nav-mycourses' => 'My courses',
239245 );
240246
241247 /** Message documentation (Message documentation)

Status & tagging log