Caravel CMS PHP Cross Reference Content Management Systems

Source: /apps/Weather/Weather.php - 52 lines - 1604 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /**
   4  * Name:      Weather.php
   5  * App:       Weather
   6  * Desc:      Allows the user to search by city and state for weather.
   7  * Creator:   Jason Yoder <jasonay@goshen.edu>
   8  */
   9  
  10  class Weather extends App
  11      {
  12        var $orgName;
  13        var $messages = array();
  14              
  15          function getContent()
  16                  {
  17                  return("<a href='http://www.wunderground.com/US/".
  18                  strtoupper($this->settingsVars['State'])."/".ucfirst(strtolower($this->settingsVars['City'])).
  19                  ".html'><img border=0 style='height: 108px;' src=\"http://banners.wunderground.com/banner/infobox_both/language/www/US/".
  20                  strtoupper($this->settingsVars['State'])."/".ucfirst(strtolower($this->settingsVars['City'])).".gif\"></a>");
  21                  }
  22          function onSave()
  23                  {
  24                  $this->settingsVars['State'] = $this->httpVars['State'];
  25                  $this->settingsVars['City'] = $this->httpVars['City'];
  26                  $this->saveSettings($this->settingsVars);
  27                  } 
  28          function getConfig()
  29          {
  30          $f = FormWidget::init();
  31          $f->section();
  32  
  33          $states = array();
  34          foreach( getCodes('state') as $abb => $state )
  35            {
  36                $states[$abb] = $state;
  37            }
  38  
  39          $f->field('State (abbreviation)');
  40          $f->dropdown('State', $states, $this->settingsVars['State'] );
  41          
  42          $f->field('City');
  43          $f->text('City', $this->settingsVars['City'] , 10 );
  44  
  45          $f->endSection();
  46          $f->defaultButtons();
  47  
  48          return $f->get();
  49          }
  50  
  51      }   
  52  ?>

title

Description

title

Description

title

Description

title

title

Body