Пример #1
0
 public static function getNetworkLossCorrectionRateForPublisherWebsite($publisher_website_id, $config, $cached = true)
 {
     $PublisherWebsiteImpressionsNetworkLossFactory = \_factory\PublisherWebsiteImpressionsNetworkLoss::get_instance();
     $params = array();
     $params["PublisherWebsiteID"] = $publisher_website_id;
     if ($cached === true) {
         $publisher_website_impressions_network_loss = $PublisherWebsiteImpressionsNetworkLossFactory->get_row_cached($config, $params);
     } else {
         $publisher_website_impressions_network_loss = $PublisherWebsiteImpressionsNetworkLossFactory->get_row($params);
     }
     return $publisher_website_impressions_network_loss;
 }
 public function changedomainimpressionsnetworklossAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if ($this->is_admin == false) {
         die("You do not have permission to access this page");
     }
     $publisher_website_id = $this->getRequest()->getQuery('impressionsnetworklossdomainid');
     $publisher_website_impressions_network_loss = $this->getRequest()->getQuery('domain-impressions-network-loss');
     $PublisherWebsiteImpressionsNetworkLossFactory = \_factory\PublisherWebsiteImpressionsNetworkLoss::get_instance();
     $params = array();
     $params["PublisherWebsiteID"] = $publisher_website_id;
     $PublisherWebsiteImpressionsNetworkLoss = $PublisherWebsiteImpressionsNetworkLossFactory->get_row($params);
     $publisher_website_impressions_network_loss = floatval($publisher_website_impressions_network_loss) / 100;
     if ($publisher_website_impressions_network_loss <= 0) {
         die("Domain Impressions Network Loss can not be less than or equal to zero percent");
     }
     if ($publisher_website_impressions_network_loss >= 1) {
         die("Domain Impressions Network Loss can not be greater than or equal to one hundred percent");
     }
     $publisher_website_impressions_network_loss = sprintf("%1.2f", $publisher_website_impressions_network_loss);
     $_PublisherWebsiteImpressionsNetworkLoss = new \model\PublisherWebsiteImpressionsNetworkLoss();
     $_PublisherWebsiteImpressionsNetworkLoss->PublisherWebsiteID = $publisher_website_id;
     $_PublisherWebsiteImpressionsNetworkLoss->CorrectionRate = $publisher_website_impressions_network_loss;
     if ($PublisherWebsiteImpressionsNetworkLoss != null) {
         $PublisherWebsiteImpressionsNetworkLossFactory->updatePublisherWebsiteImpressionsNetworkLoss($_PublisherWebsiteImpressionsNetworkLoss);
     } else {
         $PublisherWebsiteImpressionsNetworkLossFactory->insertPublisherWebsiteImpressionsNetworkLoss($_PublisherWebsiteImpressionsNetworkLoss);
     }
     return $this->redirect()->toRoute('publisher');
 }