r96268 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96267‎ | r96268 | r96269 >
Date:01:50, 5 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r96266
Modified paths:
  • /trunk/extensions/Survey/specials/SpecialSurveys.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/specials/SpecialSurveys.php
@@ -52,18 +52,9 @@
5353 protected function displaySurveys() {
5454 $this->displayAddNewControl();
5555
56 - $dbr = wfGetDB( DB_SLAVE );
 56+ $surveys = Survey::select( array( 'id', 'name', 'enabled' ) );
5757
58 - $surveys = $dbr->select(
59 - 'surveys',
60 - array(
61 - 'survey_id',
62 - 'survey_name',
63 - 'survey_enabled',
64 - )
65 - );
66 -
67 - if ( $surveys->numRows() > 0 ) {
 58+ if ( count( $surveys ) > 0 ) {
6859 $this->displaySurveysTable( $surveys );
6960 }
7061
@@ -113,9 +104,9 @@
114105 *
115106 * @since 0.1
116107 *
117 - * @param ResultWrapper $surveys
 108+ * @param array $surveys
118109 */
119 - protected function displaySurveysTable( ResultWrapper $surveys ) {
 110+ protected function displaySurveysTable( array /* of Survey */ $surveys ) {
120111 $out = $this->getOutput();
121112
122113 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'surveys-special-existing' ) ) );
@@ -143,17 +134,17 @@
144135 Html::element(
145136 'a',
146137 array(
147 - 'href' => SpecialPage::getTitleFor( 'TakeSurvey', $survey->survey_name )->getLocalURL()
 138+ 'href' => SpecialPage::getTitleFor( 'TakeSurvey', $survey->getField( 'name' ) )->getLocalURL()
148139 ),
149 - $survey->survey_name
 140+ $survey->getField( 'name' )
150141 ) .
151142 '</td>' .
152 - Html::element( 'td', array(), wfMsg( 'surveys-special-' . ( $survey->survey_enabled ? 'enabled' : 'disabled' ) ) ) .
 143+ Html::element( 'td', array(), wfMsg( 'surveys-special-' . ( $survey->getField( 'enabled' ) ? 'enabled' : 'disabled' ) ) ) .
153144 '<td>' .
154145 Html::element(
155146 'a',
156147 array(
157 - 'href' => SpecialPage::getTitleFor( 'Survey', $survey->survey_name )->getLocalURL()
 148+ 'href' => SpecialPage::getTitleFor( 'Survey', $survey->getField( 'name' ) )->getLocalURL()
158149 ),
159150 wfMsg( 'surveys-special-edit' )
160151 ) .
@@ -164,7 +155,7 @@
165156 array(
166157 'href' => '#',
167158 'class' => 'survey-delete',
168 - 'data-survey-id' => $survey->survey_id,
 159+ 'data-survey-id' => $survey->getId(),
169160 'data-survey-token' => $GLOBALS['wgUser']->editToken( 'deletesurvey' )
170161 ),
171162 wfMsg( 'surveys-special-delete' )

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96266work on db object classesjeroendedauw01:45, 5 September 2011

Status & tagging log