r110764 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110763‎ | r110764 | r110765 >
Date:18:01, 6 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
adding adittional pager for listing articles per student
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPArticleTable.php (added) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -99,6 +99,7 @@
100100 $wgAutoloadClasses['EPRoleObject'] = dirname( __FILE__ ) . '/includes/EPRoleObject.php';
101101 $wgAutoloadClasses['EPArticle'] = dirname( __FILE__ ) . '/includes/EPArticle.php';
102102 $wgAutoloadClasses['EPArticlePager'] = dirname( __FILE__ ) . '/includes/EPArticlePager.php';
 103+$wgAutoloadClasses['EPArticleTable'] = dirname( __FILE__ ) . '/includes/EPArticleTable.php';
103104
104105 $wgAutoloadClasses['CoursePage'] = dirname( __FILE__ ) . '/pages/CoursePage.php';
105106 $wgAutoloadClasses['EPPage'] = dirname( __FILE__ ) . '/pages/EPPage.php';
Index: trunk/extensions/EducationProgram/includes/EPArticleTable.php
@@ -0,0 +1,102 @@
 2+<?php
 3+
 4+/**
 5+ * Pager that lists articles per student and for each article the associated reviewers, if any.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file EPArticleTable.php
 10+ * @ingroup EductaionProgram
 11+ *
 12+ * @licence GNU GPL v3 or later
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+class EPArticleTable extends EPPager {
 16+
 17+ /**
 18+ * Constructor.
 19+ *
 20+ * @param IContextSource $context
 21+ * @param array $conds
 22+ */
 23+ public function __construct( IContextSource $context, array $conds = array() ) {
 24+ $this->mDefaultDirection = true;
 25+
 26+ // when MW 1.19 becomes min, we want to pass an IContextSource $context here.
 27+ parent::__construct( $context, $conds, 'EPStudent' );
 28+ }
 29+
 30+ /**
 31+ * (non-PHPdoc)
 32+ * @see EPPager::getFields()
 33+ */
 34+ public function getFields() {
 35+ return array(
 36+ 'id',
 37+ 'user_id',
 38+ );
 39+ }
 40+
 41+ /**
 42+ * (non-PHPdoc)
 43+ * @see TablePager::getRowClass()
 44+ */
 45+ function getRowClass( $row ) {
 46+ return 'ep-student-row';
 47+ }
 48+
 49+ /**
 50+ * (non-PHPdoc)
 51+ * @see TablePager::getTableClass()
 52+ */
 53+ public function getTableClass() {
 54+ return 'TablePager ep-students';
 55+ }
 56+
 57+ /**
 58+ * (non-PHPdoc)
 59+ * @see EPPager::getFormattedValue()
 60+ */
 61+ protected function getFormattedValue( $name, $value ) {
 62+ switch ( $name ) {
 63+ case 'user_id':
 64+ $user = User::newFromId( $value );
 65+ $name = $user->getRealName() === '' ? $user->getName() : $user->getRealName();
 66+
 67+ $value = Linker::userLink( $value, $name ) . Linker::userToolLinks( $value, $name );
 68+ break;
 69+ }
 70+
 71+ return $value;
 72+ }
 73+
 74+ /**
 75+ * (non-PHPdoc)
 76+ * @see EPPager::getSortableFields()
 77+ */
 78+ protected function getSortableFields() {
 79+ return array(
 80+ );
 81+ }
 82+
 83+ /**
 84+ * (non-PHPdoc)
 85+ * @see EPPager::hasActionsColumn()
 86+ */
 87+ protected function hasActionsColumn() {
 88+ return false;
 89+ }
 90+
 91+ /**
 92+ * (non-PHPdoc)
 93+ * @see EPPager::getFieldNames()
 94+ */
 95+ public function getFieldNames() {
 96+ $fields = parent::getFieldNames();
 97+
 98+ //$fields['_courses_current'] = 'current-courses';
 99+
 100+ return $fields;
 101+ }
 102+
 103+}

Status & tagging log