r106880 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106879‎ | r106880 | r106881 >
Date:22:19, 20 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
work on term pager
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTermPager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPTermPager.php
@@ -32,7 +32,11 @@
3333 */
3434 public function getFieldNames() {
3535 return parent::getFieldNameList( array(
36 - // TODO
 36+ 'id',
 37+ 'course_id',
 38+ 'year',
 39+ 'start',
 40+ 'end',
3741 ) );
3842 }
3943
@@ -41,7 +45,7 @@
4246 * @see TablePager::getRowClass()
4347 */
4448 function getRowClass( $row ) {
45 - return 'ep-course-row';
 49+ return 'ep-term-row';
4650 }
4751
4852 /**
@@ -49,7 +53,7 @@
5054 * @see TablePager::getTableClass()
5155 */
5256 public function getTableClass(){
53 - return 'TablePager ep-courses';
 57+ return 'TablePager ep-terms';
5458 }
5559
5660 /**
@@ -58,16 +62,32 @@
5963 */
6064 public function getFormattedValue( $name, $value ) {
6165 switch ( $name ) {
62 - case '': // TODO
63 - $value = $value;
 66+ case 'id':
 67+ $value = Linker::linkKnown(
 68+ SpecialPage::getTitleFor( 'Term', $value ),
 69+ $value
 70+ );
6471 break;
 72+ case 'course_id':
 73+ $value = EPCourse::selectRow( 'name', array( 'id' => $value ) )->getField( 'name' );
 74+
 75+ $value = Linker::linkKnown(
 76+ SpecialPage::getTitleFor( 'Course', $value ),
 77+ $value
 78+ );
 79+ break;
 80+ case 'year':
 81+ break;
 82+ case 'start': case 'end':
 83+ $value = $this->getLanguage()->date( $value );
 84+ break;
6585 }
6686
6787 return $value;
6888 }
6989
7090 function getDefaultSort() {
71 - return ''; // TODO
 91+ return 'asc';
7292 }
7393
7494 /**
@@ -75,7 +95,39 @@
7696 * @see EPPager::getSortableFields()
7797 */
7898 protected function getSortableFields() {
79 - return array();
 99+ return array(
 100+ 'id',
 101+ 'year',
 102+ 'start',
 103+ 'end',
 104+ );
80105 }
 106+
 107+ /**
 108+ * (non-PHPdoc)
 109+ * @see EPPager::getFilterOptions()
 110+ */
 111+ protected function getFilterOptions() {
 112+ return array(
 113+ 'course_id' => array(
 114+ 'type' => 'select',
 115+ 'options' => array_merge(
 116+ array( '' => '' ),
 117+ EPCourse::getCourseOptions( EPCourse::select( array( 'name', 'id' ) ) )
 118+ ),
 119+ 'value' => '',
 120+ 'datatype' => 'int',
 121+ ),
 122+ 'year' => array(
 123+ 'type' => 'select',
 124+ 'options' => array_merge(
 125+ array( '' => '' ),
 126+ array() // TODO
 127+ ),
 128+ 'value' => '',
 129+ 'datatype' => 'int',
 130+ ),
 131+ );
 132+ }
81133
82134 }
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -104,6 +104,15 @@
105105 'epcoursepager-header-org-id' => 'Institution',
106106 'epcoursepager-filter-org-id' => 'Institution',
107107
 108+ // Term pager
 109+ 'eptermpager-header-id' => 'Id',
 110+ 'eptermpager-header-course-id' => 'Course',
 111+ 'eptermpager-header-year' => 'Year',
 112+ 'eptermpager-header-start' => 'Start',
 113+ 'eptermpager-header-end' => 'End',
 114+ 'eptermpager-filter-course-id' => 'Course',
 115+ 'eptermpager-filter-year' => 'Year',
 116+
108117 // Special:EditInstitution
109118 'editinstitution-text' => 'Enter the institution details below and click submit to save your changes.',
110119 'educationprogram-org-edit-name' => 'Institution name',

Status & tagging log