Index: trunk/extensions/EducationProgram/actions/ViewCourseAction.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | $course->getStudents( 'id' ) |
56 | 56 | ); |
57 | 57 | |
58 | | - if ( count( $studentIds ) > 0 ) { |
| 58 | + if ( !empty( $studentIds ) ) { |
59 | 59 | $out->addElement( 'h2', array(), wfMsg( 'ep-course-students' ) ); |
60 | 60 | |
61 | 61 | $pager = new EPArticleTable( |
— | — | @@ -131,7 +131,10 @@ |
132 | 132 | protected function getRoleList( EPCourse $course, $roleName ) { |
133 | 133 | $users = $course->getUserWithRole( $roleName ); |
134 | 134 | |
135 | | - if ( count( $users ) > 0 ) { |
| 135 | + if ( empty( $users ) ) { |
| 136 | + $html = wfMsgHtml( 'ep-course-no-' . $roleName ); |
| 137 | + } |
| 138 | + else { |
136 | 139 | $instList = array(); |
137 | 140 | |
138 | 141 | foreach ( $users as /* EPIRole */ $user ) { |
— | — | @@ -145,9 +148,6 @@ |
146 | 149 | $html = '<ul><li>' . implode( '</li><li>', $instList ) . '</li></ul>'; |
147 | 150 | } |
148 | 151 | } |
149 | | - else { |
150 | | - $html = wfMsgHtml( 'ep-course-no-' . $roleName ); |
151 | | - } |
152 | 152 | |
153 | 153 | return Html::rawElement( |
154 | 154 | 'div', |
— | — | @@ -204,13 +204,13 @@ |
205 | 205 | ); |
206 | 206 | } |
207 | 207 | |
208 | | - if ( count( $links ) > 0 ) { |
| 208 | + if ( empty( $links ) ) { |
| 209 | + return ''; |
| 210 | + } |
| 211 | + else { |
209 | 212 | $this->getOutput()->addModules( 'ep.enlist' ); |
210 | 213 | return '<br />' . $this->getLanguage()->pipeList( $links ); |
211 | 214 | } |
212 | | - else { |
213 | | - return ''; |
214 | | - } |
215 | 215 | } |
216 | 216 | |
217 | 217 | } |
Index: trunk/extensions/EducationProgram/actions/EPViewAction.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | ) ); |
57 | 57 | |
58 | 58 | if ( $rev === false ) { |
59 | | - // TODO |
| 59 | + // TODO high |
60 | 60 | } |
61 | 61 | else { |
62 | 62 | $object = $rev->getObject(); |
Index: trunk/extensions/EducationProgram/actions/EPRemoveStudentAction.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | 'format' => 'json', |
35 | 35 | 'courseid' => $this->getRequest()->getInt( 'course-id' ), |
36 | 36 | 'userid' => $this->getRequest()->getInt( 'user-id' ), |
37 | | - 'reason' => '', // TODO |
| 37 | + 'reason' => '', // TODO high |
38 | 38 | 'role' => 'student' |
39 | 39 | ), true ), true ); |
40 | 40 | |
Index: trunk/extensions/EducationProgram/specials/SpecialMyCourses.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | $course = EPCourses::singleton()->selectRow( null, array( 'name' => $this->subPage ) ); |
49 | 49 | |
50 | 50 | if ( $course === false ) { |
51 | | - // TODO |
| 51 | + // TODO high |
52 | 52 | } |
53 | 53 | else { |
54 | 54 | $this->displayCourse( $course ); |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | break; |
157 | 157 | } |
158 | 158 | |
159 | | - if ( count( $courses ) > 0 ) { |
| 159 | + if ( !empty( $courses ) ) { |
160 | 160 | $message = wfMsgExt( 'ep-mycourses-courses-' . strtolower( $class ), 'parsemag', count( $courses ), $this->getUser()->getName() ); |
161 | 161 | $this->getOutput()->addElement( 'h2', array(), $message ); |
162 | 162 | |
Index: trunk/extensions/EducationProgram/specials/SpecialStudent.php |
— | — | @@ -57,13 +57,13 @@ |
58 | 58 | $student->getCourses( 'id' ) |
59 | 59 | ); |
60 | 60 | |
61 | | - if ( count( $courseIds ) > 0 ) { |
| 61 | + if ( empty( $courseIds ) ) { |
| 62 | + // TODO: high |
| 63 | + } |
| 64 | + else { |
62 | 65 | $out->addElement( 'h2', array(), wfMsg( 'ep-student-courses' ) ); |
63 | 66 | EPCourse::displayPager( $this->getContext(), array( 'id' => $courseIds ) ); |
64 | 67 | } |
65 | | - else { |
66 | | - // TODO |
67 | | - } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
Index: trunk/extensions/EducationProgram/includes/DBDataObject.php |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | $fields = array_diff( $fields, array_keys( $this->fields ) ); |
129 | 129 | } |
130 | 130 | |
131 | | - if ( count( $fields ) > 0 ) { |
| 131 | + if ( !empty( $fields ) ) { |
132 | 132 | $result = $this->table->rawSelectRow( |
133 | 133 | $this->table->getPrefixedFields( $fields ), |
134 | 134 | array( $this->table->getPrefixedField( 'id' ) => $this->getId() ), |
Index: trunk/extensions/EducationProgram/includes/EPPageTable.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | |
78 | 78 | $success = true; |
79 | 79 | |
80 | | - if ( count( $objects ) > 0 ) { |
| 80 | + if ( !empty( $objects ) ) { |
81 | 81 | $revAction->setDelete( true ); |
82 | 82 | |
83 | 83 | foreach ( $objects as /* EPPageObject */ $object ) { |
Index: trunk/extensions/EducationProgram/includes/EPRoleObject.php |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | |
165 | 165 | $field = $fieldMap[$this->getRoleName()]; |
166 | 166 | |
167 | | - if ( count( $courseIds ) > 0 ) { |
| 167 | + if ( !empty( $courseIds ) ) { |
168 | 168 | EPOrgs::singleton()->updateSummaryFields( $field, array( 'id' => array_unique( $courseIds ) ) ); |
169 | 169 | EPCourses::singleton()->updateSummaryFields( $field, array( 'id' => $courseIds ) ); |
170 | 170 | } |
Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | $courseRevAction = new EPRevisionAction(); |
119 | 119 | |
120 | 120 | $courseRevAction->setUser( $revAction->getUser() ); |
121 | | - $courseRevAction->setComment( '' ); // TODO |
| 121 | + $courseRevAction->setComment( $revAction->getComment() ); |
122 | 122 | |
123 | 123 | foreach ( $this->getField( 'courses' ) as $courseId ) { |
124 | 124 | $courseRevision = EPRevisions::singleton()->getLatestRevision( array( |
Index: trunk/extensions/EducationProgram/includes/EPRevisionedObject.php |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | array( 'LIMIT' => 1 ) |
262 | 262 | ); |
263 | 263 | |
264 | | - return count( $objects ) > 0 ? $objects[0] : false; |
| 264 | + return empty( $objects ) ? false : $objects[0]; |
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | $changedSummaries[] = $countMap[$usersField]; |
182 | 182 | } |
183 | 183 | |
184 | | - if ( count( $removedIds ) > 0 ) { |
| 184 | + if ( !empty( $removedIds ) ) { |
185 | 185 | $dbw->delete( 'ep_users_per_course', array( |
186 | 186 | 'upc_course_id' => $this->getId(), |
187 | 187 | 'upc_user_id' => $removedIds, |
— | — | @@ -579,7 +579,10 @@ |
580 | 580 | $users = $this->getField( $field ); |
581 | 581 | $addedUsers = array_diff( (array)$newUsers, $users ); |
582 | 582 | |
583 | | - if ( count( $addedUsers ) > 0 ) { |
| 583 | + if ( empty( $addedUsers ) ) { |
| 584 | + return 0; |
| 585 | + } |
| 586 | + else { |
584 | 587 | $this->setField( $field, array_merge( $users, $addedUsers ) ); |
585 | 588 | |
586 | 589 | $success = true; |
— | — | @@ -597,9 +600,6 @@ |
598 | 601 | |
599 | 602 | return $success ? count( $addedUsers ) : false; |
600 | 603 | } |
601 | | - else { |
602 | | - return 0; |
603 | | - } |
604 | 604 | } |
605 | 605 | |
606 | 606 | /** |
— | — | @@ -630,7 +630,10 @@ |
631 | 631 | |
632 | 632 | $removedUsers = array_intersect( $sadUsers, $this->getField( $field ) ); |
633 | 633 | |
634 | | - if ( count( $removedUsers ) > 0 ) { |
| 634 | + if ( empty( $removedUsers ) ) { |
| 635 | + return 0; |
| 636 | + } |
| 637 | + else { |
635 | 638 | $this->setField( $field, array_diff( $this->getField( $field ), $sadUsers ) ); |
636 | 639 | |
637 | 640 | if ( $role === 'student' ) { |
— | — | @@ -658,9 +661,6 @@ |
659 | 662 | |
660 | 663 | return $success ? count( $removedUsers ) : false; |
661 | 664 | } |
662 | | - else { |
663 | | - return 0; |
664 | | - } |
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
Index: trunk/extensions/EducationProgram/api/ApiDeleteEducation.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | $class = self::$typeMap[$params['type']]; |
59 | 59 | |
60 | | - if ( count( $params['ids'] ) > 0 ) { |
| 60 | + if ( !empty( $params['ids'] ) ) { |
61 | 61 | $revAction = new EPRevisionAction(); |
62 | 62 | |
63 | 63 | $revAction->setUser( $this->getUser() ); |
Index: trunk/extensions/EducationProgram/resources/ep.articletable.js |
— | — | @@ -262,7 +262,7 @@ |
263 | 263 | |
264 | 264 | $( '.ep-rem-article' ).click( removeArticle ); |
265 | 265 | |
266 | | - $( '#addarticlename' ).autocomplete( { // TODO |
| 266 | + $( '#addarticlename' ).autocomplete( { |
267 | 267 | source: function( request, response ) { |
268 | 268 | $.getJSON( |
269 | 269 | wgScriptPath + '/api.php', |