r109083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109082‎ | r109083 | r109084 >
Date:00:11, 17 January 2012
Author:khorn
Status:ok (Comments)
Tags:
Comment:
Wired up the backend so the lookups work. Note: You still have to import the data dumps manually.
Modified paths:
  • /trunk/extensions/CongressLookup/CongressLookup.db.php (modified) (history)
  • /trunk/extensions/CongressLookup/SpecialCongressLookup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php
@@ -46,6 +46,10 @@
4747 $myRepresentative = CongressLookupDB::getRepresentative( $zip );
4848 $mySenators = CongressLookupDB::getSenators( $zip );
4949
 50+ //TODO: Change this so it looks like... anything.
 51+ $wgOut->addHTML( '<pre>' . print_r( $myRepresentative, true ) . '</pre>' );
 52+ $wgOut->addHTML( '<pre>' . print_r( $mySenators, true ) . '</pre>' );
 53+
5054 // TODO: stuffz.
5155 }
5256
Index: trunk/extensions/CongressLookup/CongressLookup.db.php
@@ -18,7 +18,40 @@
1919
2020 $row = $dbr->selectRow( 'cl_zip5', 'sz5_rep_id', array( 'sz5_zip' => $zip ) );
2121 if ( $row ) {
22 - // TODO: stuffz.
 22+ $rep_id = $row->sz5_rep_id;
 23+ $res = $dbr->select(
 24+ 'cl_house',
 25+ array(
 26+ 'sh_bioguideid',
 27+ 'sh_gender',
 28+ 'sh_name',
 29+ 'sh_title',
 30+ 'sh_state',
 31+ 'sh_district',
 32+ 'sh_phone',
 33+ 'sh_fax',
 34+ 'sh_contactform'
 35+ ),
 36+ array(
 37+ 'sh_id' => $rep_id,
 38+ ),
 39+ __METHOD__
 40+ );
 41+ foreach ( $res as $row ) {
 42+ $oneHouseRep = array(
 43+ 'bioguideid' => $row->sh_bioguideid,
 44+ 'gender' => $row->sh_gender,
 45+ 'name' => $row->sh_name,
 46+ 'title' => $row->sh_title,
 47+ 'state' => $row->sh_state,
 48+ 'district' => $row->sh_district,
 49+ 'phone' => $row->sh_phone,
 50+ 'fax' => $row->sh_fax,
 51+ 'contactform' => $row->sh_contactform
 52+ );
 53+ $repData[] = $oneHouseRep;
 54+ }
 55+ //$repData = $row;
2356 }
2457 return $repData;
2558 }
@@ -37,7 +70,7 @@
3871
3972 $row = $dbr->selectRow( 'cl_zip3', 'sz3_state', array( 'sz3_zip' => $zip ) );
4073 if ( $row ) {
41 - $state = $row->state;
 74+ $state = $row->sz3_state;
4275 $res = $dbr->select(
4376 'cl_senate',
4477 array(

Comments

#Comment by NeilK (talk | contribs)   09:17, 17 January 2012

this is ok, with later revisions which fix the escaping issues.

Status & tagging log