Index: trunk/extensions/Contest/Contest.i18n.php |
— | — | @@ -67,18 +67,41 @@ |
68 | 68 | // Special:Contest |
69 | 69 | 'contest-contest-title' => 'Contest: $1', |
70 | 70 | 'contest-contest-no-results' => 'There are no contestants to list.', |
| 71 | + 'contest-contest-name' => 'Name', |
| 72 | + 'contest-contest-status' => 'Status', |
| 73 | + 'contest-contest-submissioncount' => 'Amount of participants', |
| 74 | + 'contest-contest-contestants' => 'Contest contestants', |
| 75 | + |
| 76 | + // Contestant pager |
| 77 | + 'contest-contestant-id' => 'ID', |
| 78 | + 'contest-contestant-volunteer' => 'Interested in volunteering oportunities', |
| 79 | + 'contest-contestant-wmf' => 'Interested in job oportunities', |
| 80 | + 'contest-contestant-no' => 'No', |
| 81 | + 'contest-contestant-yes' => 'Yes', |
71 | 82 | ); |
72 | 83 | |
73 | 84 | /** Message documentation (Message documentation) |
74 | 85 | * @author Jeroen De Dauw |
75 | 86 | */ |
76 | 87 | $messages['qqq'] = array( |
77 | | - 'contest-special-name' => 'table header', |
78 | | - 'contest-special-status' => 'table header', |
79 | | - 'contest-special-submissioncount' => 'table header', |
80 | | - 'contest-special-edit' => 'table header', |
81 | | - 'contest-special-delete' => 'table header', |
| 88 | + 'contest-special-name' => 'Table column header', |
| 89 | + 'contest-special-status' => 'Table column header', |
| 90 | + 'contest-special-submissioncount' => 'Table column header', |
| 91 | + 'contest-special-edit' => 'Table column header', |
| 92 | + 'contest-special-delete' => 'Table column header', |
82 | 93 | |
83 | 94 | 'contest-edit-name' => 'form field label', |
84 | 95 | 'contest-edit-status' => 'form field label', |
| 96 | + |
| 97 | + 'contest-contest-title' => 'Page title', |
| 98 | + 'contest-contest-name' => 'Table row header', |
| 99 | + 'contest-contest-status' => 'Table row header', |
| 100 | + 'contest-contest-submissioncount' => 'Table row header', |
| 101 | + 'contest-contest-contestants' => 'Page section header', |
| 102 | + |
| 103 | + 'contest-contestant-id' => 'Table column header', |
| 104 | + 'contest-contestant-volunteer' => 'Table column header', |
| 105 | + 'contest-contestant-wmf' => 'Table column header', |
| 106 | + 'contest-contestant-no' => 'Table cell value', |
| 107 | + 'contest-contestant-yes' => 'Table cell value', |
85 | 108 | ); |
\ No newline at end of file |
Index: trunk/extensions/Contest/specials/SpecialContestPage.php |
— | — | @@ -81,4 +81,15 @@ |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | |
| 85 | + /** |
| 86 | + * Display navigation links. |
| 87 | + * |
| 88 | + * @since 0.1 |
| 89 | + * |
| 90 | + * @param array $links |
| 91 | + */ |
| 92 | + protected function displayNavigation( array $links ) { |
| 93 | + $this->getOutput()->addHTML( Html::rawElement( 'p', array(), $this->getLang()->pipeList( $links ) ) ); |
| 94 | + } |
| 95 | + |
85 | 96 | } |
Index: trunk/extensions/Contest/specials/SpecialContest.php |
— | — | @@ -48,12 +48,64 @@ |
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
| 52 | + /** |
| 53 | + * Display the general contest info. |
| 54 | + * |
| 55 | + * @since 0.1 |
| 56 | + * |
| 57 | + * @param Contest $contest |
| 58 | + */ |
52 | 59 | protected function showGeneralInfo( Contest $contest ) { |
53 | | - // TODO |
| 60 | + $out = $this->getOutput(); |
| 61 | + |
| 62 | + $out->addHTML( Html::openElement( 'table', array( 'class' => 'wikitable contest-summary' ) ) ); |
| 63 | + |
| 64 | + foreach ( $this->getSummaryData( $contest ) as $stat => $value ) { |
| 65 | + $out->addHTML( '<tr>' ); |
| 66 | + |
| 67 | + $out->addHTML( Html::element( |
| 68 | + 'th', |
| 69 | + array( 'class' => 'contest-summary-name' ), |
| 70 | + wfMsg( 'contest-contest-' . $stat ) |
| 71 | + ) ); |
| 72 | + |
| 73 | + $out->addHTML( Html::element( |
| 74 | + 'td', |
| 75 | + array( 'class' => 'contest-summary-value' ), |
| 76 | + $value |
| 77 | + ) ); |
| 78 | + |
| 79 | + $out->addHTML( '</tr>' ); |
| 80 | + } |
| 81 | + |
| 82 | + $out->addHTML( Html::closeElement( 'table' ) ); |
54 | 83 | } |
55 | 84 | |
| 85 | + /** |
| 86 | + * Gets the summary data. |
| 87 | + * |
| 88 | + * @since 0.1 |
| 89 | + * |
| 90 | + * @param Contest $contest |
| 91 | + * |
| 92 | + * @return array |
| 93 | + */ |
| 94 | + protected function getSummaryData( Contest $contest ) { |
| 95 | + $stats = array(); |
| 96 | + |
| 97 | + $stats['name'] = $contest->getField( 'name' ); |
| 98 | + $stats['status'] = Contest::getStatusMessage( $contest->getField( 'status' ) ); |
| 99 | + $stats['submissioncount'] = $this->getLang()->formatNum( $contest->getField( 'submission_count' ) ); |
| 100 | + |
| 101 | + return $stats; |
| 102 | + } |
| 103 | + |
56 | 104 | // TODO: list scores and comment counts as well |
57 | 105 | protected function showContestants( Contest $contest ) { |
| 106 | + $out = $this->getOutput(); |
| 107 | + |
| 108 | + $out->addHTML( Html::element( 'h3', array(), wfMsg( 'contest-contest-contestants' ) ) ); |
| 109 | + |
58 | 110 | $conds = array( |
59 | 111 | 'contestant_contest_id' => $contest->getId() |
60 | 112 | ); |
— | — | @@ -61,14 +113,14 @@ |
62 | 114 | $pager = new ContestantPager( $this, $conds ); |
63 | 115 | |
64 | 116 | if ( $pager->getNumRows() ) { |
65 | | - $this->getOutput()->addHTML( |
| 117 | + $out->addHTML( |
66 | 118 | $pager->getNavigationBar() . |
67 | 119 | $pager->getBody(). |
68 | 120 | $pager->getNavigationBar() |
69 | 121 | ); |
70 | 122 | } |
71 | 123 | else { |
72 | | - $this->getOutput()->addWikiMsg( 'contest-contest-no-results' ); |
| 124 | + $out->addWikiMsg( 'contest-contest-no-results' ); |
73 | 125 | } |
74 | 126 | } |
75 | 127 | |
Index: trunk/extensions/Contest/includes/ContestantPager.php |
— | — | @@ -41,6 +41,12 @@ |
42 | 42 | } |
43 | 43 | |
44 | 44 | public function formatValue( $name, $value ) { |
| 45 | + switch ( $name ) { |
| 46 | + case 'contestant_volunteer': case 'contestant_wmf': |
| 47 | + $value = wfMsg( 'contest-contestant-' . ( $value === '1' ? 'yes' : 'no' ) ); |
| 48 | + break; |
| 49 | + } |
| 50 | + |
45 | 51 | return $value; |
46 | 52 | } |
47 | 53 | |
— | — | @@ -82,7 +88,7 @@ |
83 | 89 | } |
84 | 90 | |
85 | 91 | function getTitle() { |
86 | | - return $this->page->getTitle(); |
| 92 | + return $this->page->getFullTitle(); |
87 | 93 | } |
88 | 94 | |
89 | 95 | } |