Example #1
0
 public function __construct($config, $ping_request_list, $PublisherInfoID, $PublisherWebsiteID, $FloorPrice, $PublisherAdZoneID, $AdName, $WebDomain, $ImpressionType)
 {
     $this->config = $config;
     $this->ping_request_list = $ping_request_list;
     $this->PublisherInfoID = $PublisherInfoID;
     $this->PublisherWebsiteID = $PublisherWebsiteID;
     $this->FloorPrice = floatval($FloorPrice);
     $this->PublisherAdZoneID = $PublisherAdZoneID;
     $this->AdName = $AdName;
     $this->WebDomain = $WebDomain;
     $this->ImpressionType = $ImpressionType;
     $this->is_second_price_auction = $this->config['settings']['rtb']['second_price_auction'];
     $this->publisher_markup_rate = \util\Markup::getPublisherMarkupRate($this->PublisherWebsiteID, $this->PublisherInfoID, $this->config);
     $this->private_exchange_publisher_markup_rate = \util\Markup::getPrivateExchangePublisherMarkupRate($this->PublisherWebsiteID, $this->PublisherInfoID, $this->config);
 }
Example #2
0
 public function privateexchangeAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     $PrivateExchangeRtbChannelDailyStatsRollUpPxFilterFactory = \_factory\PrivateExchangeRtbChannelDailyStatsRollUpPxFilter::get_instance();
     $params = array();
     if ($this->auth->isSuperAdmin($this->config_handle)) {
         $params["ParentID"] = $this->auth->getEffectiveIdentityID();
     } else {
         $params["ParentID"] = $this->auth->getUserID();
     }
     $PrivateExchangeRtbChannelDailyStatsRollUpPxFilterList = $PrivateExchangeRtbChannelDailyStatsRollUpPxFilterFactory->get($params);
     $insertion_order_id = $this->getRequest()->getQuery('insertion-order-id');
     if ($insertion_order_id != null) {
         $insertion_order_id = intval($insertion_order_id);
         $markup_rate = \util\Markup::getMarkupRateByInsertionOrderIDAndUserID($insertion_order_id, $this->auth->getEffectiveIdentityID(), $this->config_handle);
     } else {
         $user_markup = \util\Markup::getMarkupForUser($this->auth->getEffectiveIdentityID(), $this->config_handle, false);
         if ($user_markup != null) {
             $markup_rate = $user_markup->MarkupRate;
         } else {
             $markup_rate = $this->config_handle['system']['default_demand_markup_rate'];
         }
     }
     $data = array();
     $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance();
     foreach ($PrivateExchangeRtbChannelDailyStatsRollUpPxFilterList as $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter) {
         $site_id = $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->PublisherWebsiteID;
         $site_name = $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->RtbChannelSiteName;
         if (strlen($site_name) > 20) {
             $site_name = substr($site_name, 0, 20) . '…';
         }
         $publisher_name = $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->PublisherName;
         if (strlen($publisher_name) > 20) {
             $publisher_name = substr($publisher_name, 0, 20) . '…';
         }
         $label_name = $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->WebDomain . " - " . $site_name . " - " . $publisher_name;
         $adusted_floor_price = "";
         if ($PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->BidFloor) {
             $floor_price = floatval($PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->BidFloor);
             $params = array();
             $params["PublisherWebsiteID"] = $site_id;
             $PublisherWebsite = $PublisherWebsiteFactory->get_row_cached($this->config_handle, $params);
             if ($PublisherWebsite == null) {
                 continue;
             }
             // floor should be marked up by the private exchange domain admin rate for this publisher and website
             $px_markup_rate_for_publisher = \util\Markup::getPrivateExchangePublisherMarkupRate($site_id, $PublisherWebsite->DomainOwnerID, $this->config_handle);
             $mark_up = $floor_price * floatval($px_markup_rate_for_publisher);
             $adusted_floor_price = floatval($floor_price) + floatval($mark_up);
             // floor should be marked up by the global exchange rate for this publisher and website
             $exchange_markup_rate_for_publisher = \util\Markup::getPublisherMarkupRate($site_id, $PublisherWebsite->DomainOwnerID, $this->config_handle);
             $mark_up = $adusted_floor_price * floatval($exchange_markup_rate_for_publisher);
             $adusted_floor_price = floatval($adusted_floor_price) + floatval($mark_up);
             // floor should be marked up by the IO markup rate
             // Approximation: actual implementation is mark-down in buyrtb\workflows\OpenRTBWorkflow
             $mark_up = $adusted_floor_price * floatval($markup_rate);
             $adusted_floor_price = floatval($adusted_floor_price) + floatval($mark_up);
             $adusted_floor_price = sprintf("%1.2f", $adusted_floor_price);
         }
         $row = array(" " => '<input type="checkbox" labelname="' . rawurlencode($label_name) . '" class="ckssp" name="ckssp[]" value="' . rawurlencode($PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->PublisherWebsiteID . '::' . $label_name) . '" />', "Site ID" => $site_id, "Domain" => $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->WebDomain, "Name" => $site_name, "IAB Cat" => $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->IABCategory, "Daily Imps" => number_format($PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->ImpressionsOfferedCounter), "Average CPM" => $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->BidTotalAverage, "Floor" => $adusted_floor_price, "Exchange" => $PrivateExchangeRtbChannelDailyStatsRollUpPxFilter->BuySidePartnerName);
         $data[] = $row;
     }
     $this->setJsonHeader();
     return $this->getResponse()->setContent(json_encode(array("data" => $data)));
 }