/**
  * (non-PHPdoc)
  * @see BaseExample::run()
  */
 public function run()
 {
     $values = $this->formValues;
     printf('<h2>Creating placement with name "%s" under campaign ID %s</h2>', $values['placement_name'], $values['campaign_id']);
     // Retrieve the campaign.
     $campaign = $this->service->campaigns->get($values['user_profile_id'], $values['campaign_id']);
     $placement = new Google_Service_Dfareporting_Placement();
     $placement->setCampaignId($values['campaign_id']);
     $placement->setCompatibility('WEB');
     $placement->setName($values['placement_name']);
     $placement->setPaymentSource('PLACEMENT_AGENCY_PAID');
     $placement->setSiteId($values['site_id']);
     $placement->setTagFormats(array('PLACEMENT_TAG_STANDARD'));
     // Set the size of the placement.
     $size = new Google_Service_Dfareporting_Size();
     $size->setId($values['size_id']);
     $placement->setSize($size);
     // Set the pricing schedule for the placement.
     $pricing_schedule = new Google_Service_Dfareporting_PricingSchedule();
     $pricing_schedule->setEndDate($campaign->getEndDate());
     $pricing_schedule->setPricingType('PRICING_TYPE_CPM');
     $pricing_schedule->setStartDate($campaign->getStartDate());
     $placement->setPricingSchedule($pricing_schedule);
     // Insert the placement.
     $result = $this->service->placements->insert($values['user_profile_id'], $placement);
     $this->printResultsTable('Placement created.', array($result));
 }
 /**
  * (non-PHPdoc)
  * @see BaseExample::run()
  */
 public function run()
 {
     $values = $this->formValues;
     printf('<h2>Creating placement group with name "%s" under campaign ID %s</h2>', $values['group_name'], $values['campaign_id']);
     // Retrieve the campaign.
     $campaign = $this->service->campaigns->get($values['user_profile_id'], $values['campaign_id']);
     $group = new Google_Service_Dfareporting_PlacementGroup();
     $group->setCampaignId($values['campaign_id']);
     $group->setName($values['group_name']);
     $group->setPlacementGroupType('PLACEMENT_PACKAGE');
     $group->setSiteId($values['site_id']);
     // Set the pricing schedule for the placement group.
     $pricing_schedule = new Google_Service_Dfareporting_PricingSchedule();
     $pricing_schedule->setEndDate($campaign->getEndDate());
     $pricing_schedule->setPricingType('PRICING_TYPE_CPM');
     $pricing_schedule->setStartDate($campaign->getStartDate());
     $group->setPricingSchedule($pricing_schedule);
     // Insert the placement group.
     $result = $this->service->placementGroups->insert($values['user_profile_id'], $group);
     $this->printResultsTable('Placement group created.', array($result));
 }