Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | |
36 | 36 | $out = $this->getOutput(); |
37 | 37 | |
38 | | - // TODO: AUTH |
| 38 | + // TODO |
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialEditCourse.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | } , |
42 | 42 | ); |
43 | 43 | |
44 | | - $orgOptions = EPOrg::getOrgOptions( array() ); // TODO |
| 44 | + $orgOptions = EPOrg::getOrgOptions(); |
45 | 45 | |
46 | 46 | $fields['org_id'] = array ( |
47 | 47 | 'type' => 'select', |
Index: trunk/extensions/EducationProgram/specials/SpecialTerm.php |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | htmlspecialchars( $course ) |
111 | 111 | ); |
112 | 112 | |
113 | | - $stats['year'] = htmlspecialchars( $term->getField( 'year' ) ); // TODO: how to properly i18n this? |
| 113 | + $stats['year'] = htmlspecialchars( $this->getLanguage()->formatNum( $term->getField( 'year' ), true ) ); |
114 | 114 | $stats['start'] = htmlspecialchars( $this->getLanguage()->timeanddate( $term->getField( 'start' ), true ) ); |
115 | 115 | $stats['end'] = htmlspecialchars( $this->getLanguage()->timeanddate( $term->getField( 'end' ), true ) ); |
116 | 116 | |
Index: trunk/extensions/EducationProgram/specials/SpecialEditTerm.php |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | protected function getFormFields() { |
34 | 34 | $fields = parent::getFormFields(); |
35 | 35 | |
36 | | - $courseOptions = EPCourse::getCourseOptions( array() ); // TODO |
| 36 | + $courseOptions = EPCourse::getCourseOptions(); |
37 | 37 | |
38 | 38 | $fields['course_id'] = array ( |
39 | 39 | 'type' => 'select', |
Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -171,13 +171,17 @@ |
172 | 172 | * |
173 | 173 | * @since 0.1 |
174 | 174 | * |
175 | | - * @param array $orgs |
| 175 | + * @param array|null $orgs |
176 | 176 | * |
177 | 177 | * @return array |
178 | 178 | */ |
179 | | - public static function getOrgOptions( array /* EPOrg */ $orgs ) { |
| 179 | + public static function getOrgOptions( array /* EPOrg */ $orgs = null ) { |
180 | 180 | $options = array(); |
181 | 181 | |
| 182 | + if ( is_null( $orgs ) ) { |
| 183 | + $orgs = EPOrg::select( array( 'name', 'id' ) ); |
| 184 | + } |
| 185 | + |
182 | 186 | foreach ( $orgs as /* EPOrg */ $org ) { |
183 | 187 | $options[$org->getField( 'name' )] = $org->getId(); |
184 | 188 | } |
Index: trunk/extensions/EducationProgram/includes/EPTerm.php |
— | — | @@ -364,7 +364,7 @@ |
365 | 365 | array_key_exists( 'course', $args ) ? $args['course'] : false |
366 | 366 | ); |
367 | 367 | |
368 | | - $select->addOptions( EPCourse::getCourseOptions( array() ) ); // TODO |
| 368 | + $select->addOptions( EPCourse::getCourseOptions() ); |
369 | 369 | $out->addHTML( $select->getHTML() ); |
370 | 370 | |
371 | 371 | $out->addHTML( ' ' . Xml::inputLabel( wfMsg( 'ep-terms-newyear' ), 'newyear', 'newyear', 10 ) ); |
— | — | @@ -392,9 +392,7 @@ |
393 | 393 | * @param array $args |
394 | 394 | */ |
395 | 395 | public static function displayAddNewRegion( IContextSource $context, array $args = array() ) { |
396 | | - $courses = array(); // TODO |
397 | | - |
398 | | - if ( count( $courses ) > 0 ) { |
| 396 | + if ( EPCourse::has() ) { |
399 | 397 | EPTerm::displayAddNewControl( $context, $args ); |
400 | 398 | } |
401 | 399 | elseif ( $context->getUser()->isAllowed( 'ep-course' ) ) { |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -182,13 +182,17 @@ |
183 | 183 | * |
184 | 184 | * @since 0.1 |
185 | 185 | * |
186 | | - * @param array $courses |
| 186 | + * @param array|null $courses |
187 | 187 | * |
188 | 188 | * @return array |
189 | 189 | */ |
190 | | - public static function getCourseOptions( array /* EPCourse */ $courses ) { |
| 190 | + public static function getCourseOptions( array /* EPCourse */ $courses = null ) { |
191 | 191 | $options = array(); |
192 | 192 | |
| 193 | + if ( is_null( $courses ) ) { |
| 194 | + $courses = EPCourse::select( array( 'name', 'id' ) ); |
| 195 | + } |
| 196 | + |
193 | 197 | foreach ( $courses as /* EPCourse */ $course ) { |
194 | 198 | $options[$course->getField( 'name' )] = $course->getId(); |
195 | 199 | } |
— | — | @@ -238,7 +242,7 @@ |
239 | 243 | array_key_exists( 'org', $args ) ? $args['org'] : false |
240 | 244 | ); |
241 | 245 | |
242 | | - $select->addOptions( EPOrg::getOrgOptions( array() ) ); // TODO |
| 246 | + $select->addOptions( EPOrg::getOrgOptions() ); |
243 | 247 | $out->addHTML( $select->getHTML() ); |
244 | 248 | |
245 | 249 | $out->addHTML( ' ' ); |
— | — | @@ -276,15 +280,10 @@ |
277 | 281 | * @param array $args |
278 | 282 | */ |
279 | 283 | public static function displayAddNewRegion( IContextSource $context, array $args = array() ) { |
280 | | - $orgs = array(); // TODO |
281 | | - |
282 | | - if ( count( $orgs ) > 0 ) { |
| 284 | + if ( EPOrg::has() ) { |
283 | 285 | EPCourse::displayAddNewControl( $context, $args ); |
284 | 286 | } |
285 | | - elseif ( $context->getUser()->isAllowed( 'epadmin' ) ) { |
286 | | - $context->getOutput()->addWikiMsg( 'ep-courses-noorgs' ); |
287 | | - } |
288 | | - elseif ( $context->getUser()->isAllowed( 'epmentor' ) ) { |
| 287 | + elseif ( $context->getUser()->isAllowed( 'ep-org' ) ) { |
289 | 288 | $context->getOutput()->addWikiMsg( 'ep-courses-addorgfirst' ); |
290 | 289 | } |
291 | 290 | } |