r109074 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109073‎ | r109074 | r109075 >
Date:23:03, 16 January 2012
Author:kaldari
Status:ok
Tags:
Comment:
a bit more CongressLookupness
Modified paths:
  • /trunk/extensions/CongressLookup/CongressLookup.db.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/CongressLookup.db.php
@@ -10,6 +10,7 @@
1111 * @return array
1212 */
1313 public static function getRepresentative( $zip ) {
 14+ $repData = array();
1415 $dbr = wfGetDB( DB_SLAVE );
1516
1617 $zip = self::trimZip( $zip, 5 ); // Trim it to 5 digit
@@ -19,6 +20,7 @@
2021 if ( $row ) {
2122 // TODO: stuffz.
2223 }
 24+ return $repData;
2325 }
2426
2527 /**
@@ -27,6 +29,7 @@
2830 * @return array
2931 */
3032 public static function getSenators( $zip ) {
 33+ $senatorData = array();
3134 $dbr = wfGetDB( DB_SLAVE );
3235
3336 $zip = self::trimZip( $zip, 3 ); // Trim it to 3 digit
@@ -34,8 +37,29 @@
3538
3639 $row = $dbr->selectRow( 'cl_zip3', 'sz3_state', array( 'sz3_zip' => $zip ) );
3740 if ( $row ) {
38 - // TODO: stuffz.
 41+ $state = $row->state;
 42+ $res = $dbr->select(
 43+ 'cl_senate',
 44+ array(
 45+ 'ss_bioguideid',
 46+ 'ss_gender',
 47+ 'ss_name',
 48+ 'ss_title',
 49+ 'ss_state',
 50+ 'ss_phone',
 51+ 'ss_fax',
 52+ 'ss_contactform'
 53+ ),
 54+ array(
 55+ 'ss_state' => $state,
 56+ ),
 57+ __METHOD__
 58+ );
 59+ foreach ( $res as $row ) {
 60+ // TODO: stuffz.
 61+ }
3962 }
 63+ return $senatorData;
4064 }
4165
4266 /**

Status & tagging log