r109003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109002‎ | r109003 | r109004 >
Date:21:53, 15 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some work on instructor management
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPDBObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPInstructor.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -121,13 +121,13 @@
122122 );
123123 }
124124
125 - $instructors = $course->getInstructors;
 125+ $instructors = $course->getInstructors();
126126
127127 if ( count( $instructors ) > 0 ) {
128128 $stats['instructors'] = '<ul>';
129129
130 - foreach ( $instructors as /* User */ $instructor ) {
131 - // TODO
 130+ foreach ( $instructors as /* EPInstructor */ $instructor ) {
 131+ $instructor->getUserLink() . $instructor->getToolLinks( $this->getContext() );
132132 }
133133
134134 $stats['instructors'] = '</ul>';
Index: trunk/extensions/EducationProgram/includes/EPDBObject.php
@@ -560,6 +560,10 @@
561561 if ( is_string( $value ) ) {
562562 $value = unserialize( $value );
563563 }
 564+
 565+ if ( !is_array( $value ) ) {
 566+ $value = array();
 567+ }
564568 break;
565569 case 'id':
566570 if ( is_string( $value ) ) {
Index: trunk/extensions/EducationProgram/includes/EPInstructor.php
@@ -131,7 +131,7 @@
132132 );
133133 }
134134
135 - return '<span class="mw-usertoollinks">(' . $context->getLanguage()->pipeList( $links ) . ')</span>';
 135+ return ' <span class="mw-usertoollinks">(' . $context->getLanguage()->pipeList( $links ) . ')</span>';
136136 }
137137
138138 }
Index: trunk/extensions/EducationProgram/includes/EPCourse.php
@@ -23,10 +23,10 @@
2424 protected $org = false;
2525
2626 /**
27 - * Field for caching the instructors their user objects.
 27+ * Field for caching the instructors.
2828 *
2929 * @since 0.1
30 - * @var {array of User}|false
 30+ * @var {array of EPInstructor}|false
3131 */
3232 protected $instructors = false;
3333
@@ -339,18 +339,18 @@
340340 }
341341
342342 /**
343 - * Returns the instructors as a list of User objects.
 343+ * Returns the instructors as a list of EPInstructor objects.
344344 *
345345 * @since 0.1
346346 *
347 - * @return array of User
 347+ * @return array of EPInstructor
348348 */
349349 public function getInstructors() {
350350 if ( $this->instructors === false ) {
351351 $this->instructors = array();
352352
353353 foreach ( $this->getField( 'instructors' ) as $userId ) {
354 - $this->instructors[] = User::newFromId( $userId );
 354+ $this->instructors[] = EPInstructor::newFromId( $userId );
355355 }
356356 }
357357
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -188,15 +188,18 @@
189189 $wgLogHeaders['instructor'] = 'log-header-instructor';
190190 }
191191
192 -$wgAvailableRights[] = 'ep-org'; // Manage orgs
193 -$wgAvailableRights[] = 'ep-course'; // Manage courses
194 -$wgAvailableRights[] = 'ep-term'; // Manage terms
195 -$wgAvailableRights[] = 'ep-token'; // See enrollment tokens
196 -$wgAvailableRights[] = 'ep-enroll'; // Enroll as a student
197 -$wgAvailableRights[] = 'ep-remstudent'; // Dissasociate students from terms
198 -$wgAvailableRights[] = 'ep-online'; // Add or remove online ambassadors from terms
199 -$wgAvailableRights[] = 'ep-campus'; // Add or remove campus ambassadors from terms
200 -$wgAvailableRights[] = 'ep-instructor'; // Add or remove instructors from courses
 192+$wgAvailableRights[] = 'ep-org'; // Manage orgs
 193+$wgAvailableRights[] = 'ep-course'; // Manage courses
 194+$wgAvailableRights[] = 'ep-term'; // Manage terms
 195+$wgAvailableRights[] = 'ep-token'; // See enrollment tokens
 196+$wgAvailableRights[] = 'ep-enroll'; // Enroll as a student
 197+$wgAvailableRights[] = 'ep-remstudent'; // Dissasociate students from terms
 198+$wgAvailableRights[] = 'ep-online'; // Add or remove online ambassadors from terms
 199+$wgAvailableRights[] = 'ep-campus'; // Add or remove campus ambassadors from terms
 200+$wgAvailableRights[] = 'ep-instructor'; // Add or remove instructors from courses
 201+$wgAvailableRights[] = 'ep-beonline'; // Add or remove yourself as online ambassador from terms
 202+$wgAvailableRights[] = 'ep-becampus'; // Add or remove yourself as campus ambassador from terms
 203+$wgAvailableRights[] = 'ep-beinstructor'; // Add or remove yourself as instructor from courses
201204
202205 $wgGroupPermissions['*']['ep-enroll'] = true;
203206 $wgGroupPermissions['*']['ep-org'] = false;
@@ -207,6 +210,9 @@
208211 $wgGroupPermissions['*']['ep-online'] = false;
209212 $wgGroupPermissions['*']['ep-campus'] = false;
210213 $wgGroupPermissions['*']['ep-instructor'] = false;
 214+$wgGroupPermissions['*']['ep-beonline'] = false;
 215+$wgGroupPermissions['*']['ep-becampus'] = false;
 216+$wgGroupPermissions['*']['ep-beinstructor'] = false;
211217
212218 $wgGroupPermissions['epstaff']['ep-org'] = true;
213219 $wgGroupPermissions['epstaff']['ep-course'] = true;
@@ -217,6 +223,9 @@
218224 $wgGroupPermissions['epstaff']['ep-online'] = true;
219225 $wgGroupPermissions['epstaff']['ep-campus'] = true;
220226 $wgGroupPermissions['epstaff']['ep-instructor'] = true;
 227+$wgGroupPermissions['epstaff']['ep-beonline'] = true;
 228+$wgGroupPermissions['epstaff']['ep-becampus'] = true;
 229+$wgGroupPermissions['epstaff']['ep-beinstructor'] = true;
221230
222231 $wgGroupPermissions['epadmin']['ep-org'] = true;
223232 $wgGroupPermissions['epadmin']['ep-course'] = true;
@@ -227,16 +236,21 @@
228237 $wgGroupPermissions['epadmin']['ep-online'] = true;
229238 $wgGroupPermissions['epadmin']['ep-campus'] = true;
230239 $wgGroupPermissions['epadmin']['ep-instructor'] = true;
 240+$wgGroupPermissions['epadmin']['ep-beonline'] = true;
 241+$wgGroupPermissions['epadmin']['ep-becampus'] = true;
 242+$wgGroupPermissions['epadmin']['ep-beinstructor'] = true;
231243
232244 $wgGroupPermissions['eponlineamb']['ep-org'] = true;
233245 $wgGroupPermissions['eponlineamb']['ep-course'] = true;
234246 $wgGroupPermissions['eponlineamb']['ep-term'] = true;
235247 $wgGroupPermissions['eponlineamb']['ep-token'] = true;
 248+$wgGroupPermissions['eponlineamb']['ep-beonline'] = true;
236249
237250 $wgGroupPermissions['epcampamb']['ep-org'] = true;
238251 $wgGroupPermissions['epcampamb']['ep-course'] = true;
239252 $wgGroupPermissions['epcampamb']['ep-term'] = true;
240253 $wgGroupPermissions['epcampamb']['ep-token'] = true;
 254+$wgGroupPermissions['epcampamb']['ep-becampus'] = true;
241255
242256 $wgGroupPermissions['epinstructor']['ep-org'] = true;
243257 $wgGroupPermissions['epinstructor']['ep-course'] = true;
@@ -245,6 +259,7 @@
246260 $wgGroupPermissions['epinstructor']['ep-remstudent'] = true;
247261 $wgGroupPermissions['epinstructor']['ep-online'] = true;
248262 $wgGroupPermissions['epinstructor']['ep-campus'] = true;
 263+$wgGroupPermissions['epinstructor']['ep-beinstructor'] = true;
249264
250265 $wgGroupPermissions['epstaff']['userrights'] = false;
251266 $wgAddGroups['epstaff'] = array( 'epstaff', 'epadmin', 'eponlineamb', 'epcampamb', 'epinstructor' );

Status & tagging log