https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106958
Revision: 106958 Author: jeroendedauw Date: 2011-12-21 17:12:23 +0000 (Wed, 21 Dec 2011) Log Message: ----------- Follow up to r106955; added hack to have a colum for the links and added edit links Modified Paths: -------------- trunk/extensions/EducationProgram/includes/EPCoursePager.php trunk/extensions/EducationProgram/includes/EPOrgPager.php trunk/extensions/EducationProgram/includes/EPPager.php trunk/extensions/EducationProgram/includes/EPTermPager.php Modified: trunk/extensions/EducationProgram/includes/EPCoursePager.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPCoursePager.php 2011-12-21 17:06:00 UTC (rev 106957) +++ trunk/extensions/EducationProgram/includes/EPCoursePager.php 2011-12-21 17:12:23 UTC (rev 106958) @@ -31,10 +31,13 @@ * @see TablePager::getFieldNames() */ public function getFieldNames() { - return parent::getFieldNameList( array( + $fields = parent::getFieldNameList( array( 'name', 'org_id', - ) ); + ) ); + + $fields[0] = ''; // This is a hack to get an extra colum for the control links. + return $fields; } /** @@ -109,5 +112,22 @@ ), ); } + + /** + * (non-PHPdoc) + * @see EPPager::getControlLinks() + */ + protected function getControlLinks( EPDBObject $item ) { + $links = parent::getControlLinks( $item ); + + $links[] = $value = Linker::linkKnown( + SpecialPage::getTitleFor( 'EditCourse', $item->getField( 'name' ) ), + wfMsg( 'edit' ) + ); + + // TODO + + return $links; + } } Modified: trunk/extensions/EducationProgram/includes/EPOrgPager.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPOrgPager.php 2011-12-21 17:06:00 UTC (rev 106957) +++ trunk/extensions/EducationProgram/includes/EPOrgPager.php 2011-12-21 17:12:23 UTC (rev 106958) @@ -31,11 +31,14 @@ * @see TablePager::getFieldNames() */ public function getFieldNames() { - return parent::getFieldNameList( array( + $fields = parent::getFieldNameList( array( 'name', 'city', 'country', - ) ); + ) ); + + $fields[0] = ''; // This is a hack to get an extra colum for the control links. + return $fields; } /** Modified: trunk/extensions/EducationProgram/includes/EPPager.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPPager.php 2011-12-21 17:06:00 UTC (rev 106957) +++ trunk/extensions/EducationProgram/includes/EPPager.php 2011-12-21 17:12:23 UTC (rev 106958) @@ -111,7 +111,13 @@ $cells = array(); foreach ( $this->getFieldNames() as $field => $name ) { - $value = isset( $row->$field ) ? $row->$field : null; + if ( $field === 0 ) { + $value = $this->getLanguage()->pipeList( $this->getControlLinks( $this->currentObject ) ); + } + else { + $value = isset( $row->$field ) ? $row->$field : null; + } + $formatted = strval( $this->formatValue( $field, $value ) ); if ( $formatted == '' ) { @@ -123,14 +129,6 @@ $links = $this->getControlLinks( $this->currentObject ); - if ( count( $links ) > 0 ) { - $cells[] = Html::rawElement( - 'td', - $this->getCellAttrs( $field, $value ), - Html::rawElement( 'p', array(), $this->getLanguage()->pipeList( $links ) ) - ); - } - return Html::rawElement( 'tr', $this->getRowAttrs( $row ), implode( '', $cells ) ) . "\n"; } Modified: trunk/extensions/EducationProgram/includes/EPTermPager.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPTermPager.php 2011-12-21 17:06:00 UTC (rev 106957) +++ trunk/extensions/EducationProgram/includes/EPTermPager.php 2011-12-21 17:12:23 UTC (rev 106958) @@ -31,13 +31,16 @@ * @see TablePager::getFieldNames() */ public function getFieldNames() { - return parent::getFieldNameList( array( + $fields = parent::getFieldNameList( array( 'id', 'course_id', 'year', 'start', 'end', - ) ); + ) ); + + $fields[0] = ''; // This is a hack to get an extra colum for the control links. + return $fields; } /** @@ -130,5 +133,22 @@ ), ); } + + /** + * (non-PHPdoc) + * @see EPPager::getControlLinks() + */ + protected function getControlLinks( EPDBObject $item ) { + $links = parent::getControlLinks( $item ); + + $links[] = $value = Linker::linkKnown( + SpecialPage::getTitleFor( 'EditTerm', $item->getId() ), + wfMsg( 'edit' ) + ); + + // TODO + + return $links; + } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs