r107768 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107767‎ | r107768 | r107769 >
Date:09:19, 1 January 2012
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
work on student workflow
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudent.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitutions.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialStudents.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialTerm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -88,13 +88,15 @@
8989 protected function getSummaryData( EPDBObject $course ) {
9090 $stats = array();
9191
92 - $stats['name'] = $course->getField( 'name' );
93 - $stats['org'] = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) );
 92+ $stats['name'] = htmlspecialchars( $course->getField( 'name' ) );
9493
95 - foreach ( $stats as &$stat ) {
96 - $stat = htmlspecialchars( $stat );
97 - }
 94+ $org = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) );
9895
 96+ $stats['org'] = Linker::linkKnown(
 97+ SpecialPage::getTitleFor( 'Institution', $org ),
 98+ htmlspecialchars( $org )
 99+ );
 100+
99101 return $stats;
100102 }
101103
Index: trunk/extensions/EducationProgram/specials/SpecialTerm.php
@@ -88,16 +88,24 @@
8989 protected function getSummaryData( EPDBObject $term ) {
9090 $stats = array();
9191
92 - $stats['org'] = EPOrg::selectFieldsRow( 'name', array( 'id' => $term->getField( 'org_id' ) ) );
93 - $stats['course'] = EPCourse::selectFieldsRow( 'name', array( 'id' => $term->getField( 'course_id' ) ) );
94 - $stats['year'] = $term->getField( 'year' ); // TODO: how to properly i18n this?
95 - $stats['start'] = $this->getLanguage()->timeanddate( $term->getField( 'start' ), true );
96 - $stats['end'] = $this->getLanguage()->timeanddate( $term->getField( 'end' ), true );
 92+ $org = EPOrg::selectFieldsRow( 'name', array( 'id' => $term->getField( 'org_id' ) ) );
9793
98 - foreach ( $stats as &$stat ) {
99 - $stat = htmlspecialchars( $stat );
100 - }
 94+ $stats['org'] = Linker::linkKnown(
 95+ SpecialPage::getTitleFor( 'Institution', $org ),
 96+ htmlspecialchars( $org )
 97+ );
10198
 99+ $course = EPCourse::selectFieldsRow( 'name', array( 'id' => $term->getField( 'course_id' ) ) );
 100+
 101+ $stats['course'] = Linker::linkKnown(
 102+ SpecialPage::getTitleFor( 'Course', $course ),
 103+ htmlspecialchars( $course )
 104+ );
 105+
 106+ $stats['year'] = htmlspecialchars( $term->getField( 'year' ) ); // TODO: how to properly i18n this?
 107+ $stats['start'] = htmlspecialchars( $this->getLanguage()->timeanddate( $term->getField( 'start' ), true ) );
 108+ $stats['end'] = htmlspecialchars( $this->getLanguage()->timeanddate( $term->getField( 'end' ), true ) );
 109+
102110 if ( $term->useCanManage( $this->getUser() ) ) {
103111 $stats['token'] = Linker::linkKnown(
104112 SpecialPage::getTitleFor( 'Enroll', $term->getId() . '/' . $term->getField( 'token' ) ),
Index: trunk/extensions/EducationProgram/specials/SpecialStudents.php
@@ -1,7 +1,7 @@
22 <?php
33
44 /**
5 - *
 5+ * Page listing all students in a pager with filter control.
66 *
77 * @since 0.1
88 *
@@ -27,14 +27,20 @@
2828 *
2929 * @since 0.1
3030 *
31 - * @param string $arg
 31+ * @param string $subPage
3232 */
3333 public function execute( $subPage ) {
3434 parent::execute( $subPage );
3535
3636 $out = $this->getOutput();
3737
38 - // TODO: AUTH
 38+ if ( $this->subPage === '' ) {
 39+ $this->displayNavigation();
 40+ EPStudent::displayPager( $this->getContext() );
 41+ }
 42+ else {
 43+ $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Student', $this->subPage )->getLocalURL() );
 44+ }
3945 }
4046
4147 }
Index: trunk/extensions/EducationProgram/specials/SpecialInstitutions.php
@@ -1,8 +1,8 @@
22 <?php
33
44 /**
5 - * Page listing all insitutions in a pager with filter control.
6 - * Also has a form for adding new items for those with matching priviliges.
 5+ * Page listing all institutions in a pager with filter control.
 6+ * Also has a form for adding new items for those with matching privileges.
77 *
88 * @since 0.1
99 *
@@ -28,7 +28,7 @@
2929 *
3030 * @since 0.1
3131 *
32 - * @param string|null $arg
 32+ * @param string|null $subPage
3333 */
3434 public function execute( $subPage ) {
3535 parent::execute( $subPage );
Index: trunk/extensions/EducationProgram/includes/EPStudent.php
@@ -208,5 +208,31 @@
209209 public function hasTerm( array $conditions = array() ) {
210210 return count( $this->getTerms( 'id', $conditions ) ) > 0;
211211 }
 212+
 213+ /**
 214+ * Display a pager with students.
 215+ *
 216+ * @since 0.1
 217+ *
 218+ * @param IContextSource $context
 219+ * @param array $conditions
 220+ */
 221+ public static function displayPager( IContextSource $context, array $conditions = array() ) {
 222+ $pager = new EPStudentPager( $context, $conditions );
 223+
 224+ if ( $pager->getNumRows() ) {
 225+ $context->getOutput()->addHTML(
 226+ $pager->getFilterControl() .
 227+ $pager->getNavigationBar() .
 228+ $pager->getBody() .
 229+ $pager->getNavigationBar() .
 230+ $pager->getMultipleItemControl()
 231+ );
 232+ }
 233+ else {
 234+ $context->getOutput()->addHTML( $pager->getFilterControl( true ) );
 235+ $context->getOutput()->addWikiMsg( 'ep-students-noresults' );
 236+ }
 237+ }
212238
213239 }
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -101,6 +101,9 @@
102102 'ep-terms-nocourses' => 'There are no courses yet. You need to [[Special:Courses|add a course]] before you can create any terms.',
103103 'ep-terms-addcoursefirst' => 'The institutions you are a mentor for do not have any courses associated with them. You need to [[Special:Courses|add a course]] before you can create any terms.',
104104
 105+ // Special:Students
 106+ 'ep-students-noresults' => 'There are no students to list.',
 107+
105108 // Pager
106109 'ep-pager-showonly' => 'Show only items with',
107110 'ep-pager-clear' => 'Clear filters',

Status & tagging log