<?php require_once dirname(__FILE__) . '/../database/PPCEntityDAO.php'; $dao = new AdgroupDAO(); $adgroups = $dao->loadAll($_REQUEST["campaignId"]); $campaignDAO = new CampaignDAO(); $campaign = $campaignDAO->load($_REQUEST["campaignId"]); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Ad Groups</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <h2>Ad Groups</h2> <h3><?php print "{$campaign->engine} >> {$campaign->name}"; ?> </h3> <table> <thead> <tr> <th>Ad Group</th> </tr> </thead> <tbody> <?php foreach ($adgroups as $adgroup) { ?> <tr>
<?php include_once '../database/PPCEntityDAO.php'; $d = new CampaignDAO(); //$c = new Campaign(); //$d->saveCampaigns(array($c)); $c = $d->load(1); //print_r($c); //print $c->campaignBidRule->id; //$r1 = $c->campaignBidRule; $r1 = new BidRule(); $r1->cost_threshold = 1; $r1->decrease_days = 2; $r1->decrease_percent = 3; $r1->increase_days = 4; $r1->increase_percent = 5; $c->campaignBidRule = $r1; $r2 = new BidRule(); $r2->cost_threshold = 6; $r2->decrease_days = 7; $r2->decrease_percent = 8; $r2->increase_days = 9; $r2->increase_percent = 10; $c->adgroupBidRule = $r2; $r3 = new BidRule(); $r3->cost_threshold = 11; $r3->decrease_days = 12; $r3->decrease_percent = 13; $r3->increase_days = 14; $r3->increase_percent = 15; $c->keywordBidRule = $r3;
function instantiateAdgroup($row) { $adgroup = new Adgroup(); $adgroup->id = $row["id"]; $campaignDAO = new CampaignDAO(); $adgroup->campaign = $campaignDAO->load($row["campaign_id"]); $adgroup->adgroupId = $row["adgroup_id"]; $adgroup->name = $row["adgroup_name"]; $adgroup->searchMaxCpc = $row["search_max_cpc"]; $adgroup->currentBid = $row["content_max_cpc"]; $adgroup->newBid = $row["new_content_max_cpc"]; $adgroup->currentStatus = $row["status"]; $adgroup->newStatus = $row["new_status"]; $adgroup->defaultUrl = $row["default_url"]; $dao = new BidRuleDAO(); if (isset($row["adgroup_bid_rule_id"]) && $row["adgroup_bid_rule_id"] > 0) { $adgroup->adgroupBidRule = $dao->load($row["adgroup_bid_rule_id"]); } if (isset($row["keyword_bid_rule_id"]) && $row["keyword_bid_rule_id"] > 0) { $adgroup->keywordBidRule = $dao->load($row["keyword_bid_rule_id"]); } return $adgroup; }