Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -20,6 +20,11 @@ |
21 | 21 | $messages['en'] = array( |
22 | 22 | 'educationprogram-desc' => '', // TODO |
23 | 23 | |
| 24 | + |
| 25 | + // Misc |
| 26 | + 'ep-item-summary' => 'Summary', |
| 27 | + 'ep-toplink' => 'My courses', |
| 28 | + |
24 | 29 | // Rights |
25 | 30 | 'right-epadmin' => 'Manage the education program', |
26 | 31 | 'right-epstudent' => 'Enroll in the education program', |
— | — | @@ -214,9 +219,6 @@ |
215 | 220 | 'ep-nav-courses' => 'Courses list', |
216 | 221 | 'ep-nav-terms' => 'Terms list', |
217 | 222 | 'ep-nav-mycourses' => 'My courses', |
218 | | - |
219 | | - // Misc |
220 | | - 'ep-item-summary' => 'Summary', |
221 | 223 | ); |
222 | 224 | |
223 | 225 | /** Message documentation (Message documentation) |
Index: trunk/extensions/EducationProgram/EducationProgram.settings.php |
— | — | @@ -28,6 +28,7 @@ |
29 | 29 | */ |
30 | 30 | protected static function getDefaultSettings() { |
31 | 31 | return array( |
| 32 | + 'enableTopLink' => true |
32 | 33 | ); |
33 | 34 | } |
34 | 35 | |
Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | $egEPSettings = array(); |
221 | 221 | |
222 | 222 | # The default value for the user preferences. |
223 | | -//$wgDefaultUserOptions[''] = false; |
| 223 | +$wgDefaultUserOptions['ep_showtoplink'] = false; |
224 | 224 | |
225 | 225 | // TODO: put somewhere decent + document |
226 | 226 | function efEpGetCountryOptions( $langCode ) { |
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
— | — | @@ -63,7 +63,24 @@ |
64 | 64 | * @return true |
65 | 65 | */ |
66 | 66 | public static function onPersonalUrls( array &$personal_urls, Title &$title ) { |
| 67 | + if ( EPSettings::get( 'enableTopLink' ) ) { |
| 68 | + global $wgUser; |
67 | 69 | |
| 70 | + // Find the watchlist item and replace it by the my contests link and itself. |
| 71 | + if ( $wgUser->isLoggedIn() && $wgUser->getOption( 'ep_showtoplink' ) ) { |
| 72 | + $url = SpecialPage::getTitleFor( 'MyCourses' )->getLinkUrl(); |
| 73 | + $myCourses = array( |
| 74 | + 'text' => wfMsg( 'ep-toplink' ), |
| 75 | + 'href' => $url, |
| 76 | + 'active' => ( $url == $title->getLinkUrl() ) |
| 77 | + ); |
| 78 | + |
| 79 | + $insertUrls = array( 'mycourses' => $myCourses ); |
| 80 | + |
| 81 | + $personal_urls = wfArrayInsertAfter( $personal_urls, $insertUrls, 'preferences' ); |
| 82 | + } |
| 83 | + } |
| 84 | + |
68 | 85 | return true; |
69 | 86 | } |
70 | 87 | |
— | — | @@ -79,7 +96,7 @@ |
80 | 97 | * @return true |
81 | 98 | */ |
82 | 99 | public static function onGetPreferences( User $user, array &$preferences ) { |
83 | | - |
| 100 | + |
84 | 101 | return true; |
85 | 102 | } |
86 | 103 | |