/**
  * verify the input file
  * instantiate the schema and table objects
  *
  * @param string $datafile
  * @param string $directory
  * @return boolean
  */
 function init($datafile = 'fjsdj', $directory = '/tests/datasets/mdb2schema/')
 {
     if (!parent::init()) {
         return false;
     }
     if (!$directory) {
         $directory = '/tests/datasets/mdb2schema/';
     }
     $this->directory = $directory;
     if (substr_count($this->directory, MAX_PATH) < 1) {
         $this->directory = MAX_PATH . $this->directory;
     }
     $this->datafile = $datafile;
     if (!file_exists($this->directory . $this->datafile)) {
         return false;
     }
     $this->oSchema =& MDB2_Schema::factory($this->oDbh);
     if (PEAR::isError($this->oSchema)) {
         return false;
     }
     $this->oTable = new OA_DB_Table();
     if (PEAR::isError($this->oTable)) {
         return false;
     }
     return true;
 }
 /**
  * demonstration / default
  *
  * A method to generate data for testing.
  * can be overriden by child clases
  *
  * insertion order is important
  *
  * agency
  * client
  * affiliate
  * campaign
  * banner
  * zone
  * ad_zone_assoc
  *
  * @access private
  */
 function generateTestData($linkAdZone = false)
 {
     if (!parent::init()) {
         return false;
     }
     // Add an agency record
     $aAgency['name'] = 'Test Agency';
     $aAgency['contact'] = 'Test Contact';
     $aAgency['email'] = '*****@*****.**';
     $this->aIds['agency'][1] = $this->_insertAgency($aAgency);
     // Add a client record (advertiser)
     $aClient['agencyid'] = $this->aIds['agency'][1];
     $aClient['clientname'] = 'Test Client';
     $aClient['email'] = '*****@*****.**';
     $this->aIds['clients'][1] = $this->_insertClients($aClient);
     // Add an affiliate (publisher) record
     $aAffiliate['agencyid'] = $this->aIds['agency'][1];
     $aAffiliate['name'] = 'Test Publisher';
     $aAffiliate['mnemonic'] = 'ABC';
     $aAffiliate['contact'] = 'Affiliate Contact';
     $aAffiliate['email'] = '*****@*****.**';
     $aAffiliate['website'] = 'www.example.com';
     $this->aIds['affiliates'][1] = $this->_insertAffiliates($aAffiliate);
     // Populate campaigns table
     $aCampaign['campaignname'] = 'Test Campaign';
     $aCampaign['clientid'] = $this->aIds['clients'][1];
     $aCampaign['views'] = 500;
     $aCampaign['clicks'] = 0;
     $aCampaign['conversions'] = 401;
     $this->aIds['campaigns'][1] = $this->_insertCampaigns($aCampaign);
     // Add a text banner
     $aBanners['campaignid'] = $this->aIds['campaigns'][1];
     $aBanners['contenttype'] = 'txt';
     $aBanners['storagetype'] = 'txt';
     $aBanners['width'] = 468;
     $aBanners['height'] = 60;
     $aBanners['url'] = 'http://www.example.com';
     $aBanners['alt'] = 'Test Campaign - Text Banner';
     $aBanners['compiledlimitation'] = 'phpAds_aclCheckDate(\'20050502\', \'!=\') and phpAds_aclCheckClientIP(\'2.22.22.2\', \'!=\') and phpAds_aclCheckLanguage(\'(sq)|(eu)|(fo)|(fi)\', \'!=\')';
     $this->aIds['banners'][1] = $this->_insertBanners($aBanners);
     //  Add a HTML banner
     $aBanners['campaignid'] = $this->aIds['campaigns'][1];
     $aBanners['storagetype'] = 'html';
     $aBanners['width'] = 468;
     $aBanners['height'] = 60;
     $aBanners['url'] = 'http://www.example.com';
     $aBanners['description'] = 'Test HTML Banner';
     $aBanners['htmltemplate'] = '<p>Hello OpenX!</p>';
     $aBanners['htmlcache'] = '<a href="{clickurl}" target="{target}"><h1>Hello OpenX!</h1></a>';
     $this->aIds['banners'][2] = $this->_insertBanners($aBanners);
     // Add zone record
     $aZone['affiliateid'] = $this->aIds['affiliates'][1];
     $aZone['zonename'] = 'Default Zone - Text';
     $aZone['description'] = '';
     $aZone['delivery'] = 3;
     $aZone['zonetype'] = 3;
     $aZone['category'] = '';
     $aZone['width'] = 468;
     $aZone['height'] = 60;
     $this->aIds['zones'][1] = $this->_insertZones($aZone);
     // Add zone record
     $aZone['affiliateid'] = $this->aIds['affiliates'][1];
     $aZone['zonename'] = 'Default Zone - Email/Newsletter';
     $aZone['description'] = '';
     $aZone['delivery'] = 4;
     $aZone['zonetype'] = 3;
     $aZone['category'] = '';
     $aZone['width'] = 468;
     $aZone['height'] = 60;
     $this->aIds['zones'][2] = $this->_insertZones($aZone);
     if ($linkAdZone) {
         $this->linkAdZone();
     }
     return true;
 }