Ejemplo n.º 1
0
 public static function getNetworkLossCorrectionRateForPublisher($publisher_info_id, $config, $cached = true)
 {
     $PublisherImpressionsNetworkLossFactory = \_factory\PublisherImpressionsNetworkLoss::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $publisher_info_id;
     if ($cached === true) {
         $publisher_impression_network_loss = $PublisherImpressionsNetworkLossFactory->get_row_cached($config, $params);
     } else {
         $publisher_impression_network_loss = $PublisherImpressionsNetworkLossFactory->get_row($params);
     }
     return $publisher_impression_network_loss;
 }
 public function changepublisherimpressionsnetworklossAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if ($this->is_admin == false) {
         die("You do not have permission to access this page");
     }
     $publisher_info_id = $this->getRequest()->getQuery('networkimpressionslosspublisherinfoid');
     $publisher_impressions_network_loss = $this->getRequest()->getQuery('publisher-impressions-network-loss');
     $PublisherImpressionsNetworkLossFactory = \_factory\PublisherImpressionsNetworkLoss::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $publisher_info_id;
     $PublisherImpressionsNetworkLoss = $PublisherImpressionsNetworkLossFactory->get_row($params);
     $publisher_impressions_network_loss = floatval($publisher_impressions_network_loss) / 100;
     if ($publisher_impressions_network_loss < 0) {
         die("Publisher Impressions Network Loss can not be less than zero percent");
     }
     if ($publisher_impressions_network_loss >= 1) {
         die("Publisher Impressions Network Loss can not be greater than or equal to one hundred percent");
     }
     $publisher_impressions_network_loss = sprintf("%1.2f", $publisher_impressions_network_loss);
     $_PublisherImpressionsNetworkLoss = new \model\PublisherImpressionsNetworkLoss();
     $_PublisherImpressionsNetworkLoss->PublisherInfoID = $publisher_info_id;
     $_PublisherImpressionsNetworkLoss->CorrectionRate = $publisher_impressions_network_loss;
     if ($PublisherImpressionsNetworkLoss != null) {
         $PublisherImpressionsNetworkLossFactory->updatePublisherImpressionsNetworkLoss($_PublisherImpressionsNetworkLoss);
     } else {
         $PublisherImpressionsNetworkLossFactory->insertPublisherImpressionsNetworkLoss($_PublisherImpressionsNetworkLoss);
     }
     return $this->redirect()->toRoute('publisher');
 }