예제 #1
0
 /**
  * Get an HTML table of data for the user's congressional representatives
  * @return string HTML for the table
  */
 private function getCongressTables()
 {
     global $wgCongressLookupErrorPage, $wgRequest;
     $myRepresentatives = CongressLookupDB::getRepresentative($this->zip);
     $mySenators = CongressLookupDB::getSenators($this->zip);
     $congressTable = '';
     $congressTable .= Html::element('h4', array(), wfMsg('congresslookup-your-reps'));
     if ($myRepresentatives) {
         foreach ($myRepresentatives as $myRepresentative) {
             $congressTable .= "\n" . Html::openElement('table', array('class' => 'person'));
             $congressTable .= "\n" . Html::rawElement('tr', array(), Html::element('td', array('class' => 'name'), $myRepresentative['name']));
             $congressTable .= "\n" . Html::rawElement('tr', array(), Html::element('td', array(), wfMsg('congresslookup-phone', $myRepresentative['phone'])));
             if ($myRepresentative['twitter']) {
                 $congressTable .= "\n" . Html::rawElement('tr', array(), Html::rawElement('td', array(), wfMsg('congresslookup-twitter', self::getTwitterHtml($myRepresentative['twitter']))));
             }
             $congressTable .= "\n" . Html::rawElement('tr', array(), Html::rawElement('td', array(), Html::element('a', array('href' => $myRepresentative['contactform'], 'target' => '_blank'), wfMsg('congresslookup-contact-form'))));
             $congressTable .= Html::rawElement('tr', array(), Html::rawElement('td', array(), $this->getSocialMedia($myRepresentative)));
             $congressTable .= "\n" . Html::closeElement('table');
         }
         if (count($myRepresentatives) > 1) {
             $congressTable .= HTML::element('p', array('class' => 'note'), wfMsg('congresslookup-multiple-house-reps'));
         }
     } else {
         $congressTable .= Html::element('p', array(), wfMsg('congresslookup-no-house-rep'));
     }
     foreach ($mySenators as $senator) {
         $congressTable .= "\n" . Html::openElement('table', array('class' => 'person'));
         $congressTable .= "\n" . Html::rawElement('tr', array(), Html::element('td', array('class' => 'name'), $senator['name']));
         $congressTable .= "\n" . Html::rawElement('tr', array(), Html::element('td', array(), wfMsg('congresslookup-phone', $senator['phone'])));
         /*
         $congressTable .= "\n" . Html::rawElement( 'tr', array(),
         	Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $senator['fax'] ) )
         );
         */
         if ($senator['twitter']) {
             $congressTable .= "\n" . Html::rawElement('tr', array(), Html::rawElement('td', array(), wfMsg('congresslookup-twitter', self::getTwitterHtml($senator['twitter']))));
         }
         $congressTable .= "\n" . Html::rawElement('tr', array(), Html::rawElement('td', array(), Html::element('a', array('href' => $senator['contactform'], 'target' => '_blank'), wfMsg('congresslookup-contact-form'))));
         $congressTable .= Html::rawElement('tr', array(), Html::rawElement('td', array(), $this->getSocialMedia($senator)));
         $congressTable .= "\n" . Html::closeElement('table');
     }
     if (count($mySenators) == 0) {
         $congressTable .= Html::element('p', array(), wfMsg('congresslookup-no-senators'));
     }
     $errorPage = SpecialPage::getTitleFor($wgCongressLookupErrorPage);
     $errorUrl = $errorPage->getLocalURL(array('zip' => $wgRequest->getVal('zip')));
     $congressTable .= Html::openElement('p');
     $congressTable .= Html::element('a', array('href' => $errorUrl), wfMsg('congresslookup-report-errors'));
     $congressTable .= Html::closeElement('p');
     return $congressTable;
 }
 /**
  * Get an HTML table of data for the user's congressional representatives
  * @return HTML for the table
  */
 private function getCongressTables()
 {
     $myRepresentative = CongressLookupDB::getRepresentative($this->zip);
     $mySenators = CongressLookupDB::getSenators($this->zip);
     $congressTable = '';
     if ($myRepresentative) {
         $congressTable .= Html::openElement('table', array('class' => 'person', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0));
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::element('td', array('class' => 'name'), $myRepresentative[0]['name']);
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::element('td', array(), wfMsg('congresslookup-phone', $myRepresentative[0]['phone']));
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::element('td', array(), wfMsg('congresslookup-fax', $myRepresentative[0]['fax']));
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::openElement('td');
         $congressTable .= Html::element('a', array('href' => $myRepresentative[0]['contactform'], 'target' => '_blank'), wfMsg('congresslookup-contact-form'));
         $congressTable .= Html::closeElement('td');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::closeElement('table');
     }
     foreach ($mySenators as $senator) {
         $congressTable .= Html::openElement('table', array('class' => 'person', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0));
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::element('td', array('class' => 'name'), $senator['name']);
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::element('td', array(), wfMsg('congresslookup-phone', $senator['phone']));
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::element('td', array(), wfMsg('congresslookup-fax', $senator['fax']));
         $congressTable .= Html::openElement('tr');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::openElement('td');
         $congressTable .= Html::element('a', array('href' => $senator['contactform'], 'target' => '_blank'), wfMsg('congresslookup-contact-form'));
         $congressTable .= Html::closeElement('td');
         $congressTable .= Html::closeElement('tr');
         $congressTable .= Html::closeElement('table');
     }
     return $congressTable;
 }