Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php |
— | — | @@ -31,11 +31,14 @@ |
32 | 32 | * @see TablePager::getFieldNames() |
33 | 33 | */ |
34 | 34 | public function getFieldNames() { |
35 | | - return parent::getFieldNameList( array( |
| 35 | + $fields = parent::getFieldNameList( array( |
36 | 36 | 'name', |
37 | 37 | 'city', |
38 | 38 | 'country', |
39 | | - ) ); |
| 39 | + ) ); |
| 40 | + |
| 41 | + $fields[0] = ''; // This is a hack to get an extra colum for the control links. |
| 42 | + return $fields; |
40 | 43 | } |
41 | 44 | |
42 | 45 | /** |
Index: trunk/extensions/EducationProgram/includes/EPTermPager.php |
— | — | @@ -31,13 +31,16 @@ |
32 | 32 | * @see TablePager::getFieldNames() |
33 | 33 | */ |
34 | 34 | public function getFieldNames() { |
35 | | - return parent::getFieldNameList( array( |
| 35 | + $fields = parent::getFieldNameList( array( |
36 | 36 | 'id', |
37 | 37 | 'course_id', |
38 | 38 | 'year', |
39 | 39 | 'start', |
40 | 40 | 'end', |
41 | | - ) ); |
| 41 | + ) ); |
| 42 | + |
| 43 | + $fields[0] = ''; // This is a hack to get an extra colum for the control links. |
| 44 | + return $fields; |
42 | 45 | } |
43 | 46 | |
44 | 47 | /** |
— | — | @@ -130,5 +133,22 @@ |
131 | 134 | ), |
132 | 135 | ); |
133 | 136 | } |
| 137 | + |
| 138 | + /** |
| 139 | + * (non-PHPdoc) |
| 140 | + * @see EPPager::getControlLinks() |
| 141 | + */ |
| 142 | + protected function getControlLinks( EPDBObject $item ) { |
| 143 | + $links = parent::getControlLinks( $item ); |
| 144 | + |
| 145 | + $links[] = $value = Linker::linkKnown( |
| 146 | + SpecialPage::getTitleFor( 'EditTerm', $item->getId() ), |
| 147 | + wfMsg( 'edit' ) |
| 148 | + ); |
| 149 | + |
| 150 | + // TODO |
| 151 | + |
| 152 | + return $links; |
| 153 | + } |
134 | 154 | |
135 | 155 | } |
Index: trunk/extensions/EducationProgram/includes/EPPager.php |
— | — | @@ -111,7 +111,13 @@ |
112 | 112 | $cells = array(); |
113 | 113 | |
114 | 114 | foreach ( $this->getFieldNames() as $field => $name ) { |
115 | | - $value = isset( $row->$field ) ? $row->$field : null; |
| 115 | + if ( $field === 0 ) { |
| 116 | + $value = $this->getLanguage()->pipeList( $this->getControlLinks( $this->currentObject ) ); |
| 117 | + } |
| 118 | + else { |
| 119 | + $value = isset( $row->$field ) ? $row->$field : null; |
| 120 | + } |
| 121 | + |
116 | 122 | $formatted = strval( $this->formatValue( $field, $value ) ); |
117 | 123 | |
118 | 124 | if ( $formatted == '' ) { |
— | — | @@ -123,14 +129,6 @@ |
124 | 130 | |
125 | 131 | $links = $this->getControlLinks( $this->currentObject ); |
126 | 132 | |
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 | 133 | return Html::rawElement( 'tr', $this->getRowAttrs( $row ), implode( '', $cells ) ) . "\n"; |
136 | 134 | } |
137 | 135 | |
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php |
— | — | @@ -31,10 +31,13 @@ |
32 | 32 | * @see TablePager::getFieldNames() |
33 | 33 | */ |
34 | 34 | public function getFieldNames() { |
35 | | - return parent::getFieldNameList( array( |
| 35 | + $fields = parent::getFieldNameList( array( |
36 | 36 | 'name', |
37 | 37 | 'org_id', |
38 | | - ) ); |
| 38 | + ) ); |
| 39 | + |
| 40 | + $fields[0] = ''; // This is a hack to get an extra colum for the control links. |
| 41 | + return $fields; |
39 | 42 | } |
40 | 43 | |
41 | 44 | /** |
— | — | @@ -109,5 +112,22 @@ |
110 | 113 | ), |
111 | 114 | ); |
112 | 115 | } |
| 116 | + |
| 117 | + /** |
| 118 | + * (non-PHPdoc) |
| 119 | + * @see EPPager::getControlLinks() |
| 120 | + */ |
| 121 | + protected function getControlLinks( EPDBObject $item ) { |
| 122 | + $links = parent::getControlLinks( $item ); |
| 123 | + |
| 124 | + $links[] = $value = Linker::linkKnown( |
| 125 | + SpecialPage::getTitleFor( 'EditCourse', $item->getField( 'name' ) ), |
| 126 | + wfMsg( 'edit' ) |
| 127 | + ); |
| 128 | + |
| 129 | + // TODO |
| 130 | + |
| 131 | + return $links; |
| 132 | + } |
113 | 133 | |
114 | 134 | } |