Index: trunk/extensions/Survey/specials/SpecialSurveys.php |
— | — | @@ -52,18 +52,9 @@ |
53 | 53 | protected function displaySurveys() { |
54 | 54 | $this->displayAddNewControl(); |
55 | 55 | |
56 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 56 | + $surveys = Survey::select( array( 'id', 'name', 'enabled' ) ); |
57 | 57 | |
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 ) { |
68 | 59 | $this->displaySurveysTable( $surveys ); |
69 | 60 | } |
70 | 61 | |
— | — | @@ -113,9 +104,9 @@ |
114 | 105 | * |
115 | 106 | * @since 0.1 |
116 | 107 | * |
117 | | - * @param ResultWrapper $surveys |
| 108 | + * @param array $surveys |
118 | 109 | */ |
119 | | - protected function displaySurveysTable( ResultWrapper $surveys ) { |
| 110 | + protected function displaySurveysTable( array /* of Survey */ $surveys ) { |
120 | 111 | $out = $this->getOutput(); |
121 | 112 | |
122 | 113 | $out->addHTML( Html::element( 'h2', array(), wfMsg( 'surveys-special-existing' ) ) ); |
— | — | @@ -143,17 +134,17 @@ |
144 | 135 | Html::element( |
145 | 136 | 'a', |
146 | 137 | array( |
147 | | - 'href' => SpecialPage::getTitleFor( 'TakeSurvey', $survey->survey_name )->getLocalURL() |
| 138 | + 'href' => SpecialPage::getTitleFor( 'TakeSurvey', $survey->getField( 'name' ) )->getLocalURL() |
148 | 139 | ), |
149 | | - $survey->survey_name |
| 140 | + $survey->getField( 'name' ) |
150 | 141 | ) . |
151 | 142 | '</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' ) ) ) . |
153 | 144 | '<td>' . |
154 | 145 | Html::element( |
155 | 146 | 'a', |
156 | 147 | array( |
157 | | - 'href' => SpecialPage::getTitleFor( 'Survey', $survey->survey_name )->getLocalURL() |
| 148 | + 'href' => SpecialPage::getTitleFor( 'Survey', $survey->getField( 'name' ) )->getLocalURL() |
158 | 149 | ), |
159 | 150 | wfMsg( 'surveys-special-edit' ) |
160 | 151 | ) . |
— | — | @@ -164,7 +155,7 @@ |
165 | 156 | array( |
166 | 157 | 'href' => '#', |
167 | 158 | 'class' => 'survey-delete', |
168 | | - 'data-survey-id' => $survey->survey_id, |
| 159 | + 'data-survey-id' => $survey->getId(), |
169 | 160 | 'data-survey-token' => $GLOBALS['wgUser']->editToken( 'deletesurvey' ) |
170 | 161 | ), |
171 | 162 | wfMsg( 'surveys-special-delete' ) |