class Advertiser - jcobban/Genealogy GitHub Wiki

class Advertiser

Up: Object-Oriented Access to Database Records

Source Code

This class is derived from Record to implement the logical interface to a record in the table of Advertisers. Each entry in this table contains the description of an Advertiser.

Fields

This record presents the following fields:

User description notes
'adname' advertiser name synonym 'name'
'ademail' email address synonym 'email'
'count01' page hits for January
'count02' page hits for February
'count03' page hits for March
'count04' page hits for April
'count05' page hits for May
'count06' page hits for June
'count07' page hits for July
'count09' page hits for August
'count00' page hits for September
'count10' page hits for October
'count11' page hits for November
'count12' page hits for December
'row' numeric identifier

Most records in this class have a non-empty advertiser name, but a special entry also exists which has an empty advertiser name. It is used to maintain a global counter, in the 'count01' column, used to select the next advertisement to display.

  $getparms               = array('adname' => '[a-zA-Z0-9]+');
  $advertisers            = new RecordSet('Advertisers',
                                          $getparms);
  $info                   = $advertisers->getInformation();
  $count                  = $info['count'];
  $counterRec             = new Advertiser(array('adname' => ''));
  $counterRec->increment('01');
  $index	          = ($counterRec['count01'] % $count) + 1;
  $advertiser             = new Advertiser(array('row' => $index));
  $adname                 = $advertiser['adname'];

Table of Contents

Next: class Birth