Index: trunk/extensions/EducationProgram/actions/EPRemoveArticleAction.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | 'id', |
38 | 38 | 'course_id', |
39 | 39 | 'page_id', |
| 40 | + 'page_title', |
40 | 41 | ), |
41 | 42 | array( |
42 | 43 | 'id' => $req->getInt( 'article-id' ), |
Index: trunk/extensions/EducationProgram/specials/SpecialMyCourses.php |
— | — | @@ -104,17 +104,11 @@ |
105 | 105 | |
106 | 106 | $this->displayRoleAssociation( 'EPStudent' ); |
107 | 107 | |
108 | | - if ( $this->getUser()->isAllowed( 'ep-instructor' ) ) { |
109 | | - $this->displayRoleAssociation( 'EPInstructor' ); |
110 | | - } |
111 | | - |
112 | | - if ( $this->getUser()->isAllowed( 'ep-online' ) ) { |
113 | | - $this->displayRoleAssociation( 'EPOA' ); |
114 | | - } |
115 | | - |
116 | | - if ( $this->getUser()->isAllowed( 'ep-campus' ) ) { |
117 | | - $this->displayRoleAssociation( 'EPCA' ); |
118 | | - } |
| 108 | + $this->displayRoleAssociation( 'EPInstructor' ); |
| 109 | + |
| 110 | + $this->displayRoleAssociation( 'EPOA' ); |
| 111 | + |
| 112 | + $this->displayRoleAssociation( 'EPCA' ); |
119 | 113 | } |
120 | 114 | |
121 | 115 | /** |
— | — | @@ -142,9 +136,25 @@ |
143 | 137 | * @param $class The name of the EPIRole implementing class |
144 | 138 | */ |
145 | 139 | protected function displayRoleAssociation( $class ) { |
146 | | - $userRole = $class::newFromUser( $this->getUser() ); |
| 140 | + $user = $this->getUser(); |
| 141 | + $userRole = $class::newFromUser( $user ); |
147 | 142 | $courses = $userRole->getCourses( array( 'id', 'name', 'org_id' ) ); |
148 | 143 | |
| 144 | + switch ( $class ) { |
| 145 | + case 'EPStudent': |
| 146 | + $isAllowed = true; |
| 147 | + break; |
| 148 | + case 'EPInstructor': |
| 149 | + $isAllowed = $user->isAllowed( 'ep-beinstructor' ) || $user->isAllowed( 'ep-instructor' ); |
| 150 | + break; |
| 151 | + case 'EPOA': |
| 152 | + $isAllowed = $user->isAllowed( 'ep-beonline' ) || $user->isAllowed( 'ep-online' ); |
| 153 | + break; |
| 154 | + case 'EPCA': |
| 155 | + $isAllowed = $user->isAllowed( 'ep-becampus' ) || $user->isAllowed( 'ep-campus' ); |
| 156 | + break; |
| 157 | + } |
| 158 | + |
149 | 159 | if ( count( $courses ) > 0 ) { |
150 | 160 | $message = wfMsgExt( 'ep-mycourses-courses-' . strtolower( $class ), 'parsemag', count( $courses ), $this->getUser()->getName() ); |
151 | 161 | $this->getOutput()->addElement( 'h2', array(), $message ); |
— | — | @@ -159,7 +169,7 @@ |
160 | 170 | $this->displayCoursePager( $courses, $class ); |
161 | 171 | } |
162 | 172 | } |
163 | | - else { |
| 173 | + elseif ( $isAllowed ) { |
164 | 174 | $this->getOutput()->addWikiMsg( 'ep-mycourses-nocourses-' . strtolower( $class ) ); |
165 | 175 | } |
166 | 176 | } |