Exemple #1
0
 public static function cloneAdCampaignIntoAdCampaignPreview($ad_campaign_id, $auth, $update_data)
 {
     $return_val = array();
     if ($ad_campaign_id === null) {
         return null;
     }
     $AdCampaignFactory = \_factory\AdCampaign::get_instance();
     $params = array();
     $params["AdCampaignID"] = $ad_campaign_id;
     $params["UserID"] = $auth->getEffectiveUserID();
     $params["Active"] = 1;
     $AdCampaign = $AdCampaignFactory->get_row($params);
     if ($AdCampaign == null) {
         //die("Invalid AdCampaign ID");
         $params["error"] = "Invalid AdCampaign ID";
         return $params;
     }
     /*
      * Clone AdCampaign into AdCampaignPreview
      */
     $AdCampaignPreviewFactory = \_factory\AdCampaignPreview::get_instance();
     $AdCampaignPreview = new \model\AdCampaignPreview();
     $AdCampaignPreview->AdCampaignID = $AdCampaign->AdCampaignID;
     $AdCampaignPreview->UserID = $AdCampaign->UserID;
     $AdCampaignPreview->Name = $AdCampaign->Name;
     $AdCampaignPreview->StartDate = $AdCampaign->StartDate;
     $AdCampaignPreview->EndDate = $AdCampaign->EndDate;
     $AdCampaignPreview->Customer = $AdCampaign->Customer;
     $AdCampaignPreview->CustomerID = $AdCampaign->CustomerID;
     $AdCampaignPreview->ImpressionsCounter = 0;
     $AdCampaignPreview->MaxImpressions = $AdCampaign->MaxImpressions;
     $AdCampaignPreview->CurrentSpend = 0;
     $AdCampaignPreview->MaxSpend = $AdCampaign->MaxSpend;
     $AdCampaignPreview->Active = 1;
     $AdCampaignPreview->DateCreated = date("Y-m-d H:i:s");
     $AdCampaignPreview->DateUpdated = date("Y-m-d H:i:s");
     $AdCampaignPreview->ChangeWentLive = 0;
     $AdCampaignPreviewID = $AdCampaignPreviewFactory->saveAdCampaignPreview($AdCampaignPreview);
     if ($update_data['type'] == 'AdCampaignID') {
         $return_val = array('AdCampaignPreviewID' => $AdCampaignPreviewID);
     }
     $AdCampaignBannerFactory = \_factory\AdCampaignBanner::get_instance();
     $params = array();
     $params["AdCampaignID"] = $AdCampaign->AdCampaignID;
     $params["Active"] = 1;
     $AdCampaignBannerList = $AdCampaignBannerFactory->get($params);
     $AdCampaignBannerPreviewFactory = \_factory\AdCampaignBannerPreview::get_instance();
     $AdCampaignBannerRestrictionsFactory = \_factory\AdCampaignBannerRestrictions::get_instance();
     $AdCampaignBannerRestrictionsPreviewFactory = \_factory\AdCampaignBannerRestrictionsPreview::get_instance();
     $LinkedBannerToAdZoneFactory = \_factory\LinkedBannerToAdZone::get_instance();
     $LinkedBannerToAdZonePreviewFactory = \_factory\LinkedBannerToAdZonePreview::get_instance();
     $AdCampaignBannerDomainExclusionFactory = \_factory\AdCampaignBannerDomainExclusion::get_instance();
     $AdCampaignBannerDomainExclusionPreviewFactory = \_factory\AdCampaignBannerDomainExclusionPreview::get_instance();
     $AdCampaignBannerDomainExclusiveInclusionFactory = \_factory\AdCampaignBannerDomainExclusiveInclusion::get_instance();
     $AdCampaignBannerDomainExclusiveInclusionPreviewFactory = \_factory\AdCampaignBannerDomainExclusiveInclusionPreview::get_instance();
     foreach ($AdCampaignBannerList as $AdCampaignBanner) {
         $banner_id = $AdCampaignBanner->AdCampaignBannerID;
         $BannerPreview = new \model\AdCampaignBannerPreview();
         $BannerPreview->AdCampaignPreviewID = $AdCampaignPreviewID;
         $BannerPreview->AdCampaignBannerID = $AdCampaignBanner->AdCampaignBannerID;
         $BannerPreview->UserID = $AdCampaignBanner->UserID;
         $BannerPreview->Name = $AdCampaignBanner->Name;
         $BannerPreview->StartDate = $AdCampaignBanner->StartDate;
         $BannerPreview->EndDate = $AdCampaignBanner->EndDate;
         $BannerPreview->AdCampaignTypeID = $AdCampaignBanner->AdCampaignTypeID;
         $BannerPreview->IsMobile = $AdCampaignBanner->IsMobile;
         $BannerPreview->IABSize = $AdCampaignBanner->IABSize;
         $BannerPreview->Height = $AdCampaignBanner->Height;
         $BannerPreview->Width = $AdCampaignBanner->Width;
         $BannerPreview->Weight = $AdCampaignBanner->Weight;
         $BannerPreview->BidAmount = $AdCampaignBanner->BidAmount;
         $BannerPreview->AdTag = $AdCampaignBanner->AdTag;
         $BannerPreview->DeliveryType = $AdCampaignBanner->DeliveryType;
         $BannerPreview->LandingPageTLD = $AdCampaignBanner->LandingPageTLD;
         $BannerPreview->ImpressionsCounter = $AdCampaignBanner->ImpressionsCounter;
         $BannerPreview->BidsCounter = $AdCampaignBanner->BidsCounter;
         $BannerPreview->CurrentSpend = $AdCampaignBanner->CurrentSpend;
         $BannerPreview->Active = $AdCampaignBanner->Active;
         $BannerPreview->DateCreated = date("Y-m-d H:i:s");
         $BannerPreview->DateUpdated = date("Y-m-d H:i:s");
         $BannerPreview->ChangeWentLive = 0;
         $AdCampaignBannerPreviewID = $AdCampaignBannerPreviewFactory->saveAdCampaignBannerPreview($BannerPreview);
         if ($update_data['type'] == 'AdCampaignBannerID' && $update_data['id'] == $banner_id) {
             $return_val = array('AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
         }
         /*
          * BANNER RESTRICTIONS
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $AdCampaignBannerRestrictions = $AdCampaignBannerRestrictionsFactory->get_row($params);
         // may not be present
         if ($AdCampaignBannerRestrictions != null) {
             $BannerRestrictionsPreview = new \model\AdCampaignBannerRestrictionsPreview();
             $BannerRestrictionsPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $BannerRestrictionsPreview->GeoCountry = $AdCampaignBannerRestrictions->GeoCountry;
             $BannerRestrictionsPreview->GeoState = $AdCampaignBannerRestrictions->GeoState;
             $BannerRestrictionsPreview->GeoCity = $AdCampaignBannerRestrictions->GeoCity;
             $BannerRestrictionsPreview->AdTagType = $AdCampaignBannerRestrictions->AdTagType;
             $BannerRestrictionsPreview->AdPositionMinLeft = $AdCampaignBannerRestrictions->AdPositionMinLeft;
             $BannerRestrictionsPreview->AdPositionMaxLeft = $AdCampaignBannerRestrictions->AdPositionMaxLeft;
             $BannerRestrictionsPreview->AdPositionMinTop = $AdCampaignBannerRestrictions->AdPositionMinTop;
             $BannerRestrictionsPreview->AdPositionMaxTop = $AdCampaignBannerRestrictions->AdPositionMaxTop;
             $BannerRestrictionsPreview->FoldPos = $AdCampaignBannerRestrictions->FoldPos;
             $BannerRestrictionsPreview->Freq = $AdCampaignBannerRestrictions->Freq;
             $BannerRestrictionsPreview->Timezone = $AdCampaignBannerRestrictions->Timezone;
             $BannerRestrictionsPreview->InIframe = $AdCampaignBannerRestrictions->InIframe;
             $BannerRestrictionsPreview->InMultipleNestedIframes = $AdCampaignBannerRestrictions->InMultipleNestedIframes;
             $BannerRestrictionsPreview->MinScreenResolutionWidth = $AdCampaignBannerRestrictions->MinScreenResolutionWidth;
             $BannerRestrictionsPreview->MaxScreenResolutionWidth = $AdCampaignBannerRestrictions->MaxScreenResolutionWidth;
             $BannerRestrictionsPreview->MinScreenResolutionHeight = $AdCampaignBannerRestrictions->MinScreenResolutionHeight;
             $BannerRestrictionsPreview->MaxScreenResolutionHeight = $AdCampaignBannerRestrictions->MaxScreenResolutionHeight;
             $BannerRestrictionsPreview->HttpLanguage = $AdCampaignBannerRestrictions->HttpLanguage;
             $BannerRestrictionsPreview->BrowserUserAgentGrep = $AdCampaignBannerRestrictions->BrowserUserAgentGrep;
             $BannerRestrictionsPreview->CookieGrep = $AdCampaignBannerRestrictions->CookieGrep;
             $BannerRestrictionsPreview->PmpEnable = $AdCampaignBannerRestrictions->PmpEnable;
             $BannerRestrictionsPreview->Secure = $AdCampaignBannerRestrictions->Secure;
             $BannerRestrictionsPreview->Optout = $AdCampaignBannerRestrictions->Optout;
             $BannerRestrictionsPreview->Vertical = $AdCampaignBannerRestrictions->Vertical;
             $BannerRestrictionsPreview->DateCreated = date("Y-m-d H:i:s");
             $BannerRestrictionsPreview->DateUpdated = date("Y-m-d H:i:s");
             $AdCampaignBannerRestrictionsPreviewID = $AdCampaignBannerRestrictionsPreviewFactory->saveAdCampaignBannerRestrictionsPreview($BannerRestrictionsPreview);
             if ($update_data['type'] == 'AdCampaignBannerRestrictionsID' && $update_data['id'] == $AdCampaignBannerRestrictions->AdCampaignBannerRestrictionsID) {
                 $return_val = array('AdCampaignBannerRestrictionsPreviewID' => $AdCampaignBannerRestrictionsPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
             }
         }
         /*
          * LINKED BANNER TO AD ZONE
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $LinkedBannerToAdZoneList = $LinkedBannerToAdZoneFactory->get($params);
         foreach ($LinkedBannerToAdZoneList as $LinkedBannerToAdZone) {
             $LinkedBannerToAdZonePreview = new \model\LinkedBannerToAdZonePreview();
             $LinkedBannerToAdZonePreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $LinkedBannerToAdZonePreview->PublisherAdZoneID = $LinkedBannerToAdZone->PublisherAdZoneID;
             $LinkedBannerToAdZonePreview->Weight = $LinkedBannerToAdZone->Weight;
             $LinkedBannerToAdZonePreview->DateCreated = date("Y-m-d H:i:s");
             $LinkedBannerToAdZonePreview->DateUpdated = date("Y-m-d H:i:s");
             $LinkedBannerToAdZonePreviewFactory->saveLinkedBannerToAdZonePreview($LinkedBannerToAdZonePreview);
         }
         /*
          * DOMAIN EXCLUSIONS
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $AdCampaignBannerDomainExclusionList = $AdCampaignBannerDomainExclusionFactory->get($params);
         foreach ($AdCampaignBannerDomainExclusionList as $AdCampaignBannerDomainExclusion) {
             $BannerDomainExclusionPreview = new \model\AdCampaignBannerDomainExclusionPreview();
             $BannerDomainExclusionPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $BannerDomainExclusionPreview->ExclusionType = $AdCampaignBannerDomainExclusion->ExclusionType;
             $BannerDomainExclusionPreview->DomainName = $AdCampaignBannerDomainExclusion->DomainName;
             $BannerDomainExclusionPreview->DateCreated = date("Y-m-d H:i:s");
             $BannerDomainExclusionPreview->DateUpdated = date("Y-m-d H:i:s");
             $AdCampaignBannerDomainExclusionPreviewID = $AdCampaignBannerDomainExclusionPreviewFactory->saveAdCampaignBannerDomainExclusionPreview($BannerDomainExclusionPreview);
             if ($update_data['type'] == 'AdCampaignBannerDomainExclusionID' && $update_data['id'] == $AdCampaignBannerDomainExclusion->AdCampaignBannerDomainExclusionID) {
                 $return_val = array('AdCampaignBannerDomainExclusionPreviewID' => $AdCampaignBannerDomainExclusionPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
             }
         }
         /*
          * DOMAIN EXCLUSIVE INCLUSIONS
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $AdCampaignBannerDomainExclusiveInclusionList = $AdCampaignBannerDomainExclusiveInclusionFactory->get($params);
         foreach ($AdCampaignBannerDomainExclusiveInclusionList as $AdCampaignBannerDomainExclusiveInclusion) {
             $BannerDomainExclusiveInclusionPreview = new \model\AdCampaignBannerDomainExclusiveInclusionPreview();
             $BannerDomainExclusiveInclusionPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $BannerDomainExclusiveInclusionPreview->InclusionType = $AdCampaignBannerDomainExclusiveInclusion->InclusionType;
             $BannerDomainExclusiveInclusionPreview->DomainName = $AdCampaignBannerDomainExclusiveInclusion->DomainName;
             $BannerDomainExclusiveInclusionPreview->DateCreated = date("Y-m-d H:i:s");
             $BannerDomainExclusiveInclusionPreview->DateUpdated = date("Y-m-d H:i:s");
             $AdCampaignBannerDomainExclusiveInclusionPreviewID = $AdCampaignBannerDomainExclusiveInclusionPreviewFactory->saveAdCampaignBannerDomainExclusiveInclusionPreview($BannerDomainExclusiveInclusionPreview);
             if ($update_data['type'] == 'AdCampaignBannerDomainExclusiveInclusionID' && $update_data['id'] == $AdCampaignBannerDomainExclusiveInclusion->AdCampaignBannerDomainExclusiveInclusionID) {
                 $return_val = array('AdCampaignBannerDomainExclusiveInclusionPreviewID' => $AdCampaignBannerDomainExclusiveInclusionPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
             }
         }
     }
     return $return_val;
 }
Exemple #2
0
 /**
  * 
  * @return Ambigous <\Zend\View\Model\ViewModel, \Zend\View\Model\ViewModel>
  */
 public function newdomainexclusionAction()
 {
     $needed_input = array('exclusiontype', 'domainname');
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     $this->validateInput($needed_input);
     $bannerid = $this->getRequest()->getPost('bannerid');
     $banner_preview_id = $this->getRequest()->getPost('bannerpreviewid');
     $ispreview = $this->getRequest()->getPost('ispreview');
     if ($ispreview != true) {
         /*
          * THIS METHOD CHECKS IF THERE IS AN EXISTING PREVIEW MODE CAMPAIGN
          * IF NOT, IT CHECKS THE ACL PERMISSIONS ON THE PRODUCTION BANNER/CAMPAIGN REFERENCED
          * THEN IT CREATES A PREVIEW VERSION OF THE AD CAMPAIGN
          */
         $update_data = array('type' => 'AdCampaignBannerID', 'id' => $bannerid);
         $return_val = \transformation\TransformPreview::previewCheckBannerID($bannerid, $this->auth, $update_data);
         if ($return_val !== null) {
             $banner_preview_id = $return_val["AdCampaignBannerPreviewID"];
         }
     }
     // ACL PREVIEW PERMISSIONS CHECK
     transformation\CheckPermissions::checkEditPermissionAdCampaignBannerPreview($banner_preview_id, $this->auth, $this->config_handle);
     $exclusiontype = $this->getRequest()->getPost('exclusiontype');
     $domainname = $this->getRequest()->getPost('domainname');
     $BannerDomainExclusionPreview = new \model\AdCampaignBannerDomainExclusionPreview();
     $BannerDomainExclusionPreview->AdCampaignBannerPreviewID = $banner_preview_id;
     $BannerDomainExclusionPreview->ExclusionType = $exclusiontype;
     $BannerDomainExclusionPreview->DomainName = $domainname;
     $BannerDomainExclusionPreview->DateCreated = date("Y-m-d H:i:s");
     $BannerDomainExclusionPreview->DateUpdated = date("Y-m-d H:i:s");
     $AdCampaignBannerDomainExclusionPreviewFactory = \_factory\AdCampaignBannerDomainExclusionPreview::get_instance();
     $AdCampaignBannerDomainExclusionPreviewFactory->saveAdCampaignBannerDomainExclusionPreview($BannerDomainExclusionPreview);
     $refresh_url = "/demand/viewdomainexclusion/" . $banner_preview_id . "?ispreview=true";
     $viewModel = new ViewModel(array('refresh_url' => $refresh_url));
     return $viewModel->setTemplate('dashboard-manager/demand/interstitial.phtml');
 }
 public static function cloneAdCampaignIntoAdCampaignPreview($ad_campaign_id, $auth, $config, $mail_transport, $update_data)
 {
     $return_val = array();
     if ($ad_campaign_id === null) {
         return null;
     }
     $AdCampaignFactory = \_factory\AdCampaign::get_instance();
     $params = array();
     $params["AdCampaignID"] = $ad_campaign_id;
     $params["UserID"] = $auth->getEffectiveUserID();
     $params["Active"] = 1;
     $AdCampaign = $AdCampaignFactory->get_row($params);
     if ($AdCampaign == null) {
         //die("Invalid AdCampaign ID");
         $params["error"] = "Invalid AdCampaign ID";
         return $params;
     }
     /*
      * Clone AdCampaign into AdCampaignPreview
      */
     $AdCampaignPreviewFactory = \_factory\AdCampaignPreview::get_instance();
     $AdCampaignPreview = new \model\AdCampaignPreview();
     $AdCampaignPreview->AdCampaignID = $AdCampaign->AdCampaignID;
     $AdCampaignPreview->UserID = $AdCampaign->UserID;
     $AdCampaignPreview->Name = $AdCampaign->Name;
     $AdCampaignPreview->StartDate = $AdCampaign->StartDate;
     $AdCampaignPreview->EndDate = $AdCampaign->EndDate;
     $AdCampaignPreview->Customer = $AdCampaign->Customer;
     $AdCampaignPreview->CustomerID = $AdCampaign->CustomerID;
     $AdCampaignPreview->ImpressionsCounter = 0;
     $AdCampaignPreview->MaxImpressions = $AdCampaign->MaxImpressions;
     $AdCampaignPreview->CurrentSpend = 0;
     $AdCampaignPreview->MaxSpend = $AdCampaign->MaxSpend;
     $AdCampaignPreview->Active = 1;
     $AdCampaignPreview->DateCreated = date("Y-m-d H:i:s");
     $AdCampaignPreview->DateUpdated = date("Y-m-d H:i:s");
     $AdCampaignPreview->ChangeWentLive = 0;
     $AdCampaignPreviewID = $AdCampaignPreviewFactory->saveAdCampaignPreview($AdCampaignPreview);
     if ($update_data['type'] == 'AdCampaignID') {
         $return_val = array('AdCampaignPreviewID' => $AdCampaignPreviewID);
     }
     $AdCampaignBannerFactory = \_factory\AdCampaignBanner::get_instance();
     $params = array();
     $params["AdCampaignID"] = $AdCampaign->AdCampaignID;
     $params["Active"] = 1;
     $AdCampaignBannerList = $AdCampaignBannerFactory->get($params);
     $AdCampaignBannerPreviewFactory = \_factory\AdCampaignBannerPreview::get_instance();
     $AdCampaignBannerRestrictionsFactory = \_factory\AdCampaignBannerRestrictions::get_instance();
     $AdCampaignBannerRestrictionsPreviewFactory = \_factory\AdCampaignBannerRestrictionsPreview::get_instance();
     $AdCampaignVideoRestrictionsFactory = \_factory\AdCampaignVideoRestrictions::get_instance();
     $AdCampaignVideoRestrictionsPreviewFactory = \_factory\AdCampaignVideoRestrictionsPreview::get_instance();
     $LinkedBannerToAdZoneFactory = \_factory\LinkedBannerToAdZone::get_instance();
     $LinkedBannerToAdZonePreviewFactory = \_factory\LinkedBannerToAdZonePreview::get_instance();
     $AdCampaignBannerDomainExclusionFactory = \_factory\AdCampaignBannerDomainExclusion::get_instance();
     $AdCampaignBannerDomainExclusionPreviewFactory = \_factory\AdCampaignBannerDomainExclusionPreview::get_instance();
     $AdCampaignBannerDomainExclusiveInclusionFactory = \_factory\AdCampaignBannerDomainExclusiveInclusion::get_instance();
     $AdCampaignBannerDomainExclusiveInclusionPreviewFactory = \_factory\AdCampaignBannerDomainExclusiveInclusionPreview::get_instance();
     foreach ($AdCampaignBannerList as $AdCampaignBanner) {
         $banner_id = $AdCampaignBanner->AdCampaignBannerID;
         $BannerPreview = new \model\AdCampaignBannerPreview();
         $BannerPreview->AdCampaignPreviewID = $AdCampaignPreviewID;
         $BannerPreview->AdCampaignBannerID = $AdCampaignBanner->AdCampaignBannerID;
         $BannerPreview->UserID = $AdCampaignBanner->UserID;
         $BannerPreview->Name = $AdCampaignBanner->Name;
         $BannerPreview->ImpressionType = $AdCampaignBanner->ImpressionType;
         $BannerPreview->StartDate = $AdCampaignBanner->StartDate;
         $BannerPreview->EndDate = $AdCampaignBanner->EndDate;
         $BannerPreview->AdCampaignTypeID = $AdCampaignBanner->AdCampaignTypeID;
         $BannerPreview->IsMobile = $AdCampaignBanner->IsMobile;
         $BannerPreview->IABSize = $AdCampaignBanner->IABSize;
         $BannerPreview->Height = $AdCampaignBanner->Height;
         $BannerPreview->Width = $AdCampaignBanner->Width;
         $BannerPreview->Weight = $AdCampaignBanner->Weight;
         $BannerPreview->BidAmount = $AdCampaignBanner->BidAmount;
         $BannerPreview->AdTag = $AdCampaignBanner->AdTag;
         $BannerPreview->DeliveryType = $AdCampaignBanner->DeliveryType;
         $BannerPreview->LandingPageTLD = $AdCampaignBanner->LandingPageTLD;
         $BannerPreview->ImpressionsCounter = $AdCampaignBanner->ImpressionsCounter;
         $BannerPreview->BidsCounter = $AdCampaignBanner->BidsCounter;
         $BannerPreview->CurrentSpend = $AdCampaignBanner->CurrentSpend;
         $BannerPreview->Active = $AdCampaignBanner->Active;
         $BannerPreview->DateCreated = date("Y-m-d H:i:s");
         $BannerPreview->DateUpdated = date("Y-m-d H:i:s");
         $BannerPreview->ChangeWentLive = 0;
         $AdCampaignBannerPreviewID = $AdCampaignBannerPreviewFactory->saveAdCampaignBannerPreview($BannerPreview);
         if ($update_data['type'] == 'AdCampaignBannerID' && $update_data['id'] == $banner_id) {
             $return_val = array('AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
         }
         if ($BannerPreview->ImpressionType == 'video') {
             /*
              * VIDEO RESTRICTIONS
              */
             $params = array();
             $params["AdCampaignBannerID"] = $banner_id;
             $AdCampaignVideoRestrictions = $AdCampaignVideoRestrictionsFactory->get_row($params);
             if ($AdCampaignVideoRestrictions != null) {
                 $VideoRestrictionsPreview = new \model\AdCampaignVideoRestrictionsPreview();
                 $VideoRestrictionsPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
                 $VideoRestrictionsPreview->GeoCountry = $AdCampaignVideoRestrictions->GeoCountry;
                 $VideoRestrictionsPreview->GeoState = $AdCampaignVideoRestrictions->GeoState;
                 $VideoRestrictionsPreview->GeoCity = $AdCampaignVideoRestrictions->GeoCity;
                 $VideoRestrictionsPreview->MimesCommaSeparated = $AdCampaignVideoRestrictions->MimesCommaSeparated;
                 $VideoRestrictionsPreview->MinDuration = $AdCampaignVideoRestrictions->MinDuration;
                 $VideoRestrictionsPreview->MaxDuration = $AdCampaignVideoRestrictions->MaxDuration;
                 $VideoRestrictionsPreview->ApisSupportedCommaSeparated = $AdCampaignVideoRestrictions->ApisSupportedCommaSeparated;
                 $VideoRestrictionsPreview->ProtocolsCommaSeparated = $AdCampaignVideoRestrictions->ProtocolsCommaSeparated;
                 $VideoRestrictionsPreview->DeliveryCommaSeparated = $AdCampaignVideoRestrictions->DeliveryCommaSeparated;
                 $VideoRestrictionsPreview->PlaybackCommaSeparated = $AdCampaignVideoRestrictions->PlaybackCommaSeparated;
                 $VideoRestrictionsPreview->StartDelay = $AdCampaignVideoRestrictions->StartDelay;
                 $VideoRestrictionsPreview->Linearity = $AdCampaignVideoRestrictions->Linearity;
                 $VideoRestrictionsPreview->FoldPos = $AdCampaignVideoRestrictions->FoldPos;
                 $VideoRestrictionsPreview->MinHeight = $AdCampaignVideoRestrictions->MinHeight;
                 $VideoRestrictionsPreview->MinWidth = $AdCampaignVideoRestrictions->MinWidth;
                 $VideoRestrictionsPreview->PmpEnable = $AdCampaignVideoRestrictions->PmpEnable;
                 $VideoRestrictionsPreview->Secure = $AdCampaignVideoRestrictions->Secure;
                 $VideoRestrictionsPreview->Optout = $AdCampaignVideoRestrictions->Optout;
                 $VideoRestrictionsPreview->Vertical = $AdCampaignVideoRestrictions->Vertical;
                 $VideoRestrictionsPreview->DateCreated = date("Y-m-d H:i:s");
                 $VideoRestrictionsPreview->DateUpdated = date("Y-m-d H:i:s");
                 $AdCampaignVideoRestrictionsPreviewID = $AdCampaignVideoRestrictionsPreviewFactory->saveAdCampaignVideoRestrictionsPreview($VideoRestrictionsPreview);
                 if ($update_data['type'] == 'AdCampaignVideoRestrictionsID' && $update_data['id'] == $AdCampaignVideoRestrictions->AdCampaignVideoRestrictionsID) {
                     $return_val = array('AdCampaignVideoRestrictionsPreviewID' => $AdCampaignVideoRestrictionsPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
                 }
             }
         } else {
             /*
              * BANNER RESTRICTIONS
              */
             $params = array();
             $params["AdCampaignBannerID"] = $banner_id;
             $AdCampaignBannerRestrictions = $AdCampaignBannerRestrictionsFactory->get_row($params);
             // may not be present
             if ($AdCampaignBannerRestrictions != null) {
                 $BannerRestrictionsPreview = new \model\AdCampaignBannerRestrictionsPreview();
                 $BannerRestrictionsPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
                 $BannerRestrictionsPreview->GeoCountry = $AdCampaignBannerRestrictions->GeoCountry;
                 $BannerRestrictionsPreview->GeoState = $AdCampaignBannerRestrictions->GeoState;
                 $BannerRestrictionsPreview->GeoCity = $AdCampaignBannerRestrictions->GeoCity;
                 $BannerRestrictionsPreview->AdTagType = $AdCampaignBannerRestrictions->AdTagType;
                 $BannerRestrictionsPreview->AdPositionMinLeft = $AdCampaignBannerRestrictions->AdPositionMinLeft;
                 $BannerRestrictionsPreview->AdPositionMaxLeft = $AdCampaignBannerRestrictions->AdPositionMaxLeft;
                 $BannerRestrictionsPreview->AdPositionMinTop = $AdCampaignBannerRestrictions->AdPositionMinTop;
                 $BannerRestrictionsPreview->AdPositionMaxTop = $AdCampaignBannerRestrictions->AdPositionMaxTop;
                 $BannerRestrictionsPreview->FoldPos = $AdCampaignBannerRestrictions->FoldPos;
                 $BannerRestrictionsPreview->Freq = $AdCampaignBannerRestrictions->Freq;
                 $BannerRestrictionsPreview->Timezone = $AdCampaignBannerRestrictions->Timezone;
                 $BannerRestrictionsPreview->InIframe = $AdCampaignBannerRestrictions->InIframe;
                 $BannerRestrictionsPreview->InMultipleNestedIframes = $AdCampaignBannerRestrictions->InMultipleNestedIframes;
                 $BannerRestrictionsPreview->MinScreenResolutionWidth = $AdCampaignBannerRestrictions->MinScreenResolutionWidth;
                 $BannerRestrictionsPreview->MaxScreenResolutionWidth = $AdCampaignBannerRestrictions->MaxScreenResolutionWidth;
                 $BannerRestrictionsPreview->MinScreenResolutionHeight = $AdCampaignBannerRestrictions->MinScreenResolutionHeight;
                 $BannerRestrictionsPreview->MaxScreenResolutionHeight = $AdCampaignBannerRestrictions->MaxScreenResolutionHeight;
                 $BannerRestrictionsPreview->HttpLanguage = $AdCampaignBannerRestrictions->HttpLanguage;
                 $BannerRestrictionsPreview->BrowserUserAgentGrep = $AdCampaignBannerRestrictions->BrowserUserAgentGrep;
                 $BannerRestrictionsPreview->CookieGrep = $AdCampaignBannerRestrictions->CookieGrep;
                 $BannerRestrictionsPreview->PmpEnable = $AdCampaignBannerRestrictions->PmpEnable;
                 $BannerRestrictionsPreview->Secure = $AdCampaignBannerRestrictions->Secure;
                 $BannerRestrictionsPreview->Optout = $AdCampaignBannerRestrictions->Optout;
                 $BannerRestrictionsPreview->Vertical = $AdCampaignBannerRestrictions->Vertical;
                 $BannerRestrictionsPreview->DateCreated = date("Y-m-d H:i:s");
                 $BannerRestrictionsPreview->DateUpdated = date("Y-m-d H:i:s");
                 $AdCampaignBannerRestrictionsPreviewID = $AdCampaignBannerRestrictionsPreviewFactory->saveAdCampaignBannerRestrictionsPreview($BannerRestrictionsPreview);
                 if ($update_data['type'] == 'AdCampaignBannerRestrictionsID' && $update_data['id'] == $AdCampaignBannerRestrictions->AdCampaignBannerRestrictionsID) {
                     $return_val = array('AdCampaignBannerRestrictionsPreviewID' => $AdCampaignBannerRestrictionsPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
                 }
             }
         }
         /*
          * LINKED BANNER TO AD ZONE
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $LinkedBannerToAdZoneList = $LinkedBannerToAdZoneFactory->get($params);
         foreach ($LinkedBannerToAdZoneList as $LinkedBannerToAdZone) {
             $LinkedBannerToAdZonePreview = new \model\LinkedBannerToAdZonePreview();
             $LinkedBannerToAdZonePreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $LinkedBannerToAdZonePreview->PublisherAdZoneID = $LinkedBannerToAdZone->PublisherAdZoneID;
             $LinkedBannerToAdZonePreview->Weight = $LinkedBannerToAdZone->Weight;
             $LinkedBannerToAdZonePreview->DateCreated = date("Y-m-d H:i:s");
             $LinkedBannerToAdZonePreview->DateUpdated = date("Y-m-d H:i:s");
             $LinkedBannerToAdZonePreviewFactory->saveLinkedBannerToAdZonePreview($LinkedBannerToAdZonePreview);
         }
         /*
          * DOMAIN EXCLUSIONS
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $AdCampaignBannerDomainExclusionList = $AdCampaignBannerDomainExclusionFactory->get($params);
         foreach ($AdCampaignBannerDomainExclusionList as $AdCampaignBannerDomainExclusion) {
             $BannerDomainExclusionPreview = new \model\AdCampaignBannerDomainExclusionPreview();
             $BannerDomainExclusionPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $BannerDomainExclusionPreview->ExclusionType = $AdCampaignBannerDomainExclusion->ExclusionType;
             $BannerDomainExclusionPreview->DomainName = $AdCampaignBannerDomainExclusion->DomainName;
             $BannerDomainExclusionPreview->DateCreated = date("Y-m-d H:i:s");
             $BannerDomainExclusionPreview->DateUpdated = date("Y-m-d H:i:s");
             $AdCampaignBannerDomainExclusionPreviewID = $AdCampaignBannerDomainExclusionPreviewFactory->saveAdCampaignBannerDomainExclusionPreview($BannerDomainExclusionPreview);
             if ($update_data['type'] == 'AdCampaignBannerDomainExclusionID' && $update_data['id'] == $AdCampaignBannerDomainExclusion->AdCampaignBannerDomainExclusionID) {
                 $return_val = array('AdCampaignBannerDomainExclusionPreviewID' => $AdCampaignBannerDomainExclusionPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
             }
         }
         /*
          * DOMAIN EXCLUSIVE INCLUSIONS
          */
         $params = array();
         $params["AdCampaignBannerID"] = $banner_id;
         $AdCampaignBannerDomainExclusiveInclusionList = $AdCampaignBannerDomainExclusiveInclusionFactory->get($params);
         foreach ($AdCampaignBannerDomainExclusiveInclusionList as $AdCampaignBannerDomainExclusiveInclusion) {
             $BannerDomainExclusiveInclusionPreview = new \model\AdCampaignBannerDomainExclusiveInclusionPreview();
             $BannerDomainExclusiveInclusionPreview->AdCampaignBannerPreviewID = $AdCampaignBannerPreviewID;
             $BannerDomainExclusiveInclusionPreview->InclusionType = $AdCampaignBannerDomainExclusiveInclusion->InclusionType;
             $BannerDomainExclusiveInclusionPreview->DomainName = $AdCampaignBannerDomainExclusiveInclusion->DomainName;
             $BannerDomainExclusiveInclusionPreview->DateCreated = date("Y-m-d H:i:s");
             $BannerDomainExclusiveInclusionPreview->DateUpdated = date("Y-m-d H:i:s");
             $AdCampaignBannerDomainExclusiveInclusionPreviewID = $AdCampaignBannerDomainExclusiveInclusionPreviewFactory->saveAdCampaignBannerDomainExclusiveInclusionPreview($BannerDomainExclusiveInclusionPreview);
             if ($update_data['type'] == 'AdCampaignBannerDomainExclusiveInclusionID' && $update_data['id'] == $AdCampaignBannerDomainExclusiveInclusion->AdCampaignBannerDomainExclusiveInclusionID) {
                 $return_val = array('AdCampaignBannerDomainExclusiveInclusionPreviewID' => $AdCampaignBannerDomainExclusiveInclusionPreviewID, 'AdCampaignBannerPreviewID' => $AdCampaignBannerPreviewID, 'AdCampaignPreviewID' => $AdCampaignPreviewID);
             }
         }
     }
     if (!$auth->getIsAdmin() && $config['mail']['subscribe']['campaigns'] === true) {
         // if this ad campaign was not created/edited by the admin, then send out a notification email
         $message = '<b>NginAd Demand Customer Campaign Edited by ' . $auth->getUserName() . '.</b><br /><br />';
         $message = $message . '<table border="0" width="10%">';
         $message = $message . '<tr><td><b>AdCampaignID: </b></td><td>' . $AdCampaign->AdCampaignID . '</td></tr>';
         $message = $message . '<tr><td><b>UserID: </b></td><td>' . $AdCampaign->UserID . '</td></tr>';
         $message = $message . '<tr><td><b>Name: </b></td><td>' . $AdCampaign->Name . '</td></tr>';
         $message = $message . '<tr><td><b>StartDate: </b></td><td>' . $AdCampaign->StartDate . '</td></tr>';
         $message = $message . '<tr><td><b>EndDate: </b></td><td>' . $AdCampaign->EndDate . '</td></tr>';
         $message = $message . '<tr><td><b>Customer: </b></td><td>' . $AdCampaign->Customer . '</td></tr>';
         $message = $message . '<tr><td><b>CustomerID: </b></td><td>' . $AdCampaign->CustomerID . '</td></tr>';
         $message = $message . '<tr><td><b>MaxImpressions: </b></td><td>' . $AdCampaign->MaxImpressions . '</td></tr>';
         $message = $message . '<tr><td><b>MaxSpend: </b></td><td>' . $AdCampaign->MaxSpend . '</td></tr>';
         $message = $message . '</table>';
         $subject = "NginAd Demand Customer Campaign Edited by " . $auth->getUserName();
         $text = new Mime\Part($message);
         $text->type = Mime\Mime::TYPE_HTML;
         $text->charset = 'utf-8';
         $mimeMessage = new Mime\Message();
         $mimeMessage->setParts(array($text));
         $zf_message = new Message();
         $zf_message->addTo($config['mail']['admin-email']['email'], $config['mail']['admin-email']['name'])->addFrom($config['mail']['reply-to']['email'], $config['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage);
         $mail_transport->send($zf_message);
     }
     return $return_val;
 }