Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | * @param array $conds |
22 | 22 | */ |
23 | 23 | public function __construct( IContextSource $context, array $conds = array() ) { |
24 | | - parent::__construct( $context, $conds, 'EPOrg' ); |
| 24 | + parent::__construct( $context, $conds, EPOrgs::singleton() ); |
25 | 25 | $this->context->getOutput()->addModules( 'ep.pager.org' ); |
26 | 26 | } |
27 | 27 | |
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | */ |
32 | 32 | public function __construct( IContextSource $context, array $conds = array(), $readOnlyMode = false ) { |
33 | 33 | $this->readOnlyMode = $readOnlyMode; |
34 | | - parent::__construct( $context, $conds, 'EPCourse' ); |
| 34 | + parent::__construct( $context, $conds, EPCourses::singleton() ); |
35 | 35 | |
36 | 36 | $this->context->getOutput()->addModules( 'ep.pager.course' ); |
37 | 37 | } |
Index: trunk/extensions/EducationProgram/includes/EPPager.php |
— | — | @@ -22,11 +22,10 @@ |
23 | 23 | protected $conds; |
24 | 24 | |
25 | 25 | /** |
26 | | - * Name of the class deriving from DBTable. |
27 | 26 | * @since 0.1 |
28 | | - * @var string |
| 27 | + * @var DBTable |
29 | 28 | */ |
30 | | - protected $tableClass; |
| 29 | + protected $table; |
31 | 30 | |
32 | 31 | /** |
33 | 32 | * DBDataObject object constructed from $this->currentRow. |
— | — | @@ -47,11 +46,11 @@ |
48 | 47 | * |
49 | 48 | * @param IContextSource $context |
50 | 49 | * @param array $conds |
51 | | - * @param string $tableClass |
| 50 | + * @param DBTable $table |
52 | 51 | */ |
53 | | - public function __construct( IContextSource $context, array $conds, $tableClass ) { |
| 52 | + public function __construct( IContextSource $context, array $conds, DBTable $table ) { |
54 | 53 | $this->conds = $conds; |
55 | | - $this->tableClass = $tableClass; |
| 54 | + $this->table = $table; |
56 | 55 | $this->context = $context; |
57 | 56 | |
58 | 57 | $this->mDefaultDirection = true; |
— | — | @@ -66,8 +65,7 @@ |
67 | 66 | * @see TablePager::formatRow() |
68 | 67 | */ |
69 | 68 | function formatRow( $row ) { |
70 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
71 | | - $this->currentObject = $c::newFromDBResult( $row ); |
| 69 | + $this->currentObject = $this->table->newFromDBResult( $row ); |
72 | 70 | |
73 | 71 | $cells = array(); |
74 | 72 | |
— | — | @@ -89,7 +87,7 @@ |
90 | 88 | $value = $this->getLanguage()->pipeList( $this->getControlLinks( $this->currentObject ) ); |
91 | 89 | } |
92 | 90 | else { |
93 | | - $prefixedField = $c::getPrefixedField( $field ); |
| 91 | + $prefixedField = $this->table->getPrefixedField( $field ); |
94 | 92 | $value = isset( $row->$prefixedField ) ? $row->$prefixedField : null; |
95 | 93 | } |
96 | 94 | |
— | — | @@ -222,11 +220,10 @@ |
223 | 221 | * @see IndexPager::getQueryInfo() |
224 | 222 | */ |
225 | 223 | function getQueryInfo() { |
226 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
227 | 224 | return array( |
228 | | - 'tables' => array( $c::getDBTable() ), |
229 | | - 'fields' => $c::getPrefixedFields( $c::getFieldNames() ), |
230 | | - 'conds' => $c::getPrefixedValues( $this->getConditions() ), |
| 225 | + 'tables' => array( $this->table->getDBTable() ), |
| 226 | + 'fields' => $this->table->getPrefixedFields( $this->table->getFieldNames() ), |
| 227 | + 'conds' => $this->table->getPrefixedValues( $this->getConditions() ), |
231 | 228 | ); |
232 | 229 | } |
233 | 230 | |
— | — | @@ -258,16 +255,14 @@ |
259 | 256 | * @see TablePager::isFieldSortable() |
260 | 257 | */ |
261 | 258 | function isFieldSortable( $name ) { |
262 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
263 | 259 | return in_array( |
264 | 260 | $name, |
265 | | - $c::getPrefixedFields( $this->getSortableFields() ) |
| 261 | + $this->table->getPrefixedFields( $this->getSortableFields() ) |
266 | 262 | ); |
267 | 263 | } |
268 | 264 | |
269 | 265 | function getDefaultSort() { |
270 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
271 | | - return $c::getPrefixedField( 'id' ); |
| 266 | + return $this->table->getPrefixedField( 'id' ); |
272 | 267 | } |
273 | 268 | |
274 | 269 | /** |
— | — | @@ -319,8 +314,7 @@ |
320 | 315 | return $current && ( $data['value'] === '' || is_null( $data['value'] ) ); |
321 | 316 | } , true ); |
322 | 317 | |
323 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
324 | | - if ( $noFiltersSet || !$c::has() ) { |
| 318 | + if ( $noFiltersSet || !$this->table->has() ) { |
325 | 319 | return ''; |
326 | 320 | } |
327 | 321 | } |
— | — | @@ -426,7 +420,7 @@ |
427 | 421 | * @return string |
428 | 422 | */ |
429 | 423 | protected function getMsg( $messageKey ) { |
430 | | - return wfMsg( strtolower( $this->className ) . 'pager-' . str_replace( '_', '-', $messageKey ) ); |
| 424 | + return wfMsg( strtolower( $this->table->getDataObjectClass() ) . 'pager-' . str_replace( '_', '-', $messageKey ) ); |
431 | 425 | } |
432 | 426 | |
433 | 427 | /** |
— | — | @@ -505,8 +499,7 @@ |
506 | 500 | |
507 | 501 | # Make table header |
508 | 502 | foreach ( $fields as $field => $name ) { |
509 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
510 | | - $prefixedField = $c::getPrefixedField( $field ); |
| 503 | + $prefixedField = $this->table->getPrefixedField( $field ); |
511 | 504 | $name = $name === '' ? '' : $this->getMsg( 'header-' . $name ); |
512 | 505 | |
513 | 506 | if ( $field === '_select' ) { |