Index: trunk/extensions/EducationProgram/maintenance/importWEPData.php |
— | — | @@ -72,9 +72,9 @@ |
73 | 73 | $courseIds = $this->insertCourses( $courses, $orgs ); |
74 | 74 | echo "Inserted courses\n"; |
75 | 75 | |
76 | | -// echo "Inserting students ...\n"; |
77 | | -// $this->insertStudents( $students, $courseIds ); |
78 | | -// echo "Inserted students\n"; |
| 76 | + echo "Inserting students ...\n"; |
| 77 | + $this->insertStudents( $students, $courseIds ); |
| 78 | + echo "Inserted students\n"; |
79 | 79 | |
80 | 80 | echo "Import completed!\n\n"; |
81 | 81 | } |
— | — | @@ -131,6 +131,8 @@ |
132 | 132 | try{ |
133 | 133 | $course->save(); |
134 | 134 | $courseIds[$name] = $course->getId(); |
| 135 | + $name = str_replace( '_', ' ', $name ); |
| 136 | + echo "Inserted course '$name'.\n"; |
135 | 137 | } |
136 | 138 | catch ( Exception $ex ) { |
137 | 139 | echo "Failed to insert course '$name'.\n"; |
— | — | @@ -193,7 +195,7 @@ |
194 | 196 | } |
195 | 197 | |
196 | 198 | if ( $student->associateWithCourses( $courses ) ) { |
197 | | - echo "Imported student $name\n"; |
| 199 | + echo "Inserted student '$name'\t\t and associated with courses: " . str_replace( '_', ' ', implode( ', ', $courseNames ) ) . "\n"; |
198 | 200 | } |
199 | 201 | else { |
200 | 202 | echo "Failed to insert student '$name'. (failed to associate courses)\n"; |
Index: trunk/extensions/EducationProgram/specials/SpecialStudent.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | else { |
42 | 42 | $this->displayNavigation(); |
43 | 43 | |
44 | | - $student = EPStudent::selectRow( null, array( 'id' => $this->subPage ) ); |
| 44 | + $student = EPStudents::singleton()->selectRow( null, array( 'id' => $this->subPage ) ); |
45 | 45 | |
46 | 46 | if ( $student === false ) { |
47 | 47 | $out->addWikiMsg( 'ep-student-none', $this->subPage ); |
— | — | @@ -50,8 +50,6 @@ |
51 | 51 | |
52 | 52 | $this->displaySummary( $student ); |
53 | 53 | |
54 | | - $out->addElement( 'h2', array(), wfMsg( 'ep-student-courses' ) ); |
55 | | - |
56 | 54 | $courseIds = array_map( |
57 | 55 | function( EPCourse $course ) { |
58 | 56 | return $course->getId(); |
— | — | @@ -59,7 +57,13 @@ |
60 | 58 | $student->getCourses( 'id' ) |
61 | 59 | ); |
62 | 60 | |
63 | | - EPCourse::displayPager( $this->getContext(), array( 'id' => $courseIds ) ); |
| 61 | + if ( count( $courseIds ) > 0 ) { |
| 62 | + $out->addElement( 'h2', array(), wfMsg( 'ep-student-courses' ) ); |
| 63 | + EPCourse::displayPager( $this->getContext(), array( 'id' => $courseIds ) ); |
| 64 | + } |
| 65 | + else { |
| 66 | + // TODO |
| 67 | + } |
64 | 68 | } |
65 | 69 | } |
66 | 70 | } |
Index: trunk/extensions/EducationProgram/includes/EPRoleObject.php |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | foreach ( $courses as /* EPCourse */ $course ) { |
144 | 144 | $courseIds[] = $course->getId(); |
145 | 145 | $course->setUpdateSummaries( false ); |
146 | | - $course->enlistUsers( $this->getField( 'user_id' ), $this->getRoleName() ); |
| 146 | + $success = $course->enlistUsers( $this->getField( 'user_id' ), $this->getRoleName() ) && $success; |
147 | 147 | $course->setUpdateSummaries( true ); |
148 | 148 | } |
149 | 149 | |
Index: trunk/extensions/EducationProgram/includes/EPPageObject.php |
— | — | @@ -65,5 +65,17 @@ |
66 | 66 | return $this->table->getLogInfoForTitle( $this->getTitle() ); |
67 | 67 | } |
68 | 68 | } |
| 69 | + |
| 70 | + /** |
| 71 | + * (non-PHPdoc) |
| 72 | + * @see DBDataObject::setField() |
| 73 | + */ |
| 74 | + public function setField( $name, $value ) { |
| 75 | + if ( $name === $this->table->getIdentifierField() ) { |
| 76 | + $value = str_replace( '_', ' ', $value ); |
| 77 | + } |
| 78 | + |
| 79 | + parent::setField( $name, $value ); |
| 80 | + } |
69 | 81 | |
70 | 82 | } |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -535,6 +535,9 @@ |
536 | 536 | if ( $name === 'instructors' ) { |
537 | 537 | $this->instructors = false; |
538 | 538 | } |
| 539 | + elseif ( $name === 'mc' ) { |
| 540 | + $value = str_replace( '_', ' ', $value ); |
| 541 | + } |
539 | 542 | |
540 | 543 | parent::setField( $name, $value ); |
541 | 544 | } |