Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php |
— | — | @@ -108,5 +108,22 @@ |
109 | 109 | ), |
110 | 110 | ); |
111 | 111 | } |
| 112 | + |
| 113 | + /** |
| 114 | + * (non-PHPdoc) |
| 115 | + * @see EPPager::getControlLinks() |
| 116 | + */ |
| 117 | + protected function getControlLinks( EPDBObject $item ) { |
| 118 | + $links = parent::getControlLinks( $item ); |
| 119 | + |
| 120 | + $links[] = $value = Linker::linkKnown( |
| 121 | + SpecialPage::getTitleFor( 'EditInstitution', $item->getField( 'name' ) ), |
| 122 | + wfMsg( 'edit' ) |
| 123 | + ); |
| 124 | + |
| 125 | + // TODO |
| 126 | + |
| 127 | + return $links; |
| 128 | + } |
112 | 129 | |
113 | 130 | } |
Index: trunk/extensions/EducationProgram/includes/EPPager.php |
— | — | @@ -106,8 +106,32 @@ |
107 | 107 | */ |
108 | 108 | function formatRow( $row ) { |
109 | 109 | $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
110 | | - $this->currentReview = $c::newFromDBResult( $row ); |
111 | | - return parent::formatRow( $row ); |
| 110 | + $this->currentObject = $c::newFromDBResult( $row ); |
| 111 | + |
| 112 | + $cells = array(); |
| 113 | + |
| 114 | + foreach ( $this->getFieldNames() as $field => $name ) { |
| 115 | + $value = isset( $row->$field ) ? $row->$field : null; |
| 116 | + $formatted = strval( $this->formatValue( $field, $value ) ); |
| 117 | + |
| 118 | + if ( $formatted == '' ) { |
| 119 | + $formatted = ' '; |
| 120 | + } |
| 121 | + |
| 122 | + $cells[] = Html::rawElement( 'td', $this->getCellAttrs( $field, $value ), $formatted ); |
| 123 | + } |
| 124 | + |
| 125 | + $links = $this->getControlLinks( $this->currentObject ); |
| 126 | + |
| 127 | + if ( count( $links ) > 0 ) { |
| 128 | + $cells[] = Html::rawElement( |
| 129 | + 'td', |
| 130 | + $this->getCellAttrs( $field, $value ), |
| 131 | + Html::rawElement( 'p', array(), $this->getLanguage()->pipeList( $links ) ) |
| 132 | + ); |
| 133 | + } |
| 134 | + |
| 135 | + return Html::rawElement( 'tr', $this->getRowAttrs( $row ), implode( '', $cells ) ) . "\n"; |
112 | 136 | } |
113 | 137 | |
114 | 138 | /** |
— | — | @@ -334,11 +358,26 @@ |
335 | 359 | /** |
336 | 360 | * Similar to TablePager::formatValue, but passes along the name of the field without prefix. |
337 | 361 | * |
| 362 | + * @since 0.1 |
| 363 | + * |
338 | 364 | * @param string $name |
339 | 365 | * @param string $value |
340 | 366 | * |
341 | 367 | * @return string |
342 | 368 | */ |
343 | 369 | protected abstract function getFormattedValue( $name, $value ); |
| 370 | + |
| 371 | + /** |
| 372 | + * Returns a list of (escaped, html) links to add in an adittional column. |
| 373 | + * |
| 374 | + * @since 0.1 |
| 375 | + * |
| 376 | + * @param EPDBObject $item |
| 377 | + * |
| 378 | + * @return array |
| 379 | + */ |
| 380 | + protected function getControlLinks( EPDBObject $item ) { |
| 381 | + return array(); |
| 382 | + } |
344 | 383 | |
345 | 384 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | |
137 | 137 | // Special:EditTerm |
138 | 138 | 'editterm-add-legend' => 'Add term', |
139 | | - 'ep-term-edit-legend' => 'Edit term', |
| 139 | + 'editterm-edit-legend' => 'Edit term', |
140 | 140 | 'ep-term-edit-year' => 'Year', |
141 | 141 | 'ep-term-edit-course' => 'Course', |
142 | 142 | 'ep-term-edit-start' => 'Start date', |