예제 #1
0
 /**
  * 
  * @return \Zend\View\Model\ViewModel
  */
 public function deliveryfilterAction()
 {
     $id = $this->getEvent()->getRouteMatch()->getParam('param1');
     if ($id == null) {
         die("Invalid Banner ID");
     }
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     $is_preview = $this->getRequest()->getQuery('ispreview');
     // verify
     if ($is_preview == "true") {
         $is_preview = \transformation\TransformPreview::doesPreviewBannerExist($id, $this->auth);
     }
     $banner_preview_id = "";
     $campaign_id = "";
     $campaign_preview_id = "";
     if ($is_preview == true) {
         // ACL PREVIEW PERMISSIONS CHECK
         transformation\CheckPermissions::checkEditPermissionAdCampaignBannerPreview($id, $this->auth, $this->config_handle);
         $AdCampaignBannerRestrictionsPreviewFactory = \_factory\AdCampaignBannerRestrictionsPreview::get_instance();
         $params = array();
         $params["AdCampaignBannerPreviewID"] = $id;
         $banner_preview_id = $id;
         $id = "";
         $AdCampaignBannerRestrictions = $AdCampaignBannerRestrictionsPreviewFactory->get_row($params);
         $AdCampaignBannerPreviewFactory = \_factory\AdCampaignBannerPreview::get_instance();
         $params = array();
         $params["AdCampaignBannerPreviewID"] = $banner_preview_id;
         $AdCampaignBannerPreview = $AdCampaignBannerPreviewFactory->get_row($params);
         $campaign_preview_id = $AdCampaignBannerPreview->AdCampaignPreviewID;
     } else {
         // ACL PERMISSIONS CHECK
         transformation\CheckPermissions::checkEditPermissionAdCampaignBanner($id, $this->auth, $this->config_handle);
         $AdCampaignBannerRestrictionsFactory = \_factory\AdCampaignBannerRestrictions::get_instance();
         $params = array();
         $params["AdCampaignBannerID"] = $id;
         $AdCampaignBannerRestrictions = $AdCampaignBannerRestrictionsFactory->get_row($params);
         $AdCampaignBannerFactory = \_factory\AdCampaignBanner::get_instance();
         $params = array();
         $params["AdCampaignBannerID"] = $id;
         $AdCampaignBanner = $AdCampaignBannerFactory->get_row($params);
         $campaign_id = $AdCampaignBanner->AdCampaignID;
     }
     $current_states = "";
     $current_country = "";
     $current_foldpos = "";
     $frequency_option = "";
     $geocity_option = "";
     $adpositionminleft_option = "";
     $adpositionmaxleft_option = "";
     $adpositionmintop_option = "";
     $adpositionmaxtop_option = "";
     $current_timezone = "";
     $current_adtagtype = "";
     $current_iniframe = "";
     $current_inmultiplenestediframes = "";
     $minscreenresolutionwidth_option = "";
     $maxscreenresolutionwidth_option = "";
     $minscreenresolutionheight_option = "";
     $maxscreenresolutionheight_option = "";
     $httplanguage_option = "";
     $browseruseragentgrep_option = "";
     $cookiegrep_option = "";
     $current_pmpenable = "";
     $current_secure = "";
     $current_optout = "";
     $current_vertical = array();
     if ($AdCampaignBannerRestrictions != null) {
         $current_states = $AdCampaignBannerRestrictions->GeoState == null ? "" : $AdCampaignBannerRestrictions->GeoState;
         $current_country = $AdCampaignBannerRestrictions->GeoCountry == null ? "" : $AdCampaignBannerRestrictions->GeoCountry;
         $current_foldpos = $AdCampaignBannerRestrictions->FoldPos == null ? "" : $AdCampaignBannerRestrictions->FoldPos;
         $frequency_option = $AdCampaignBannerRestrictions->Freq == null ? "" : $AdCampaignBannerRestrictions->Freq;
         $geocity_option = $AdCampaignBannerRestrictions->GeoCity == null ? "" : $AdCampaignBannerRestrictions->GeoCity;
         $adpositionminleft_option = $AdCampaignBannerRestrictions->AdPositionMinLeft == null ? "" : $AdCampaignBannerRestrictions->AdPositionMinLeft;
         $adpositionmaxleft_option = $AdCampaignBannerRestrictions->AdPositionMaxLeft == null ? "" : $AdCampaignBannerRestrictions->AdPositionMaxLeft;
         $adpositionmintop_option = $AdCampaignBannerRestrictions->AdPositionMinTop == null ? "" : $AdCampaignBannerRestrictions->AdPositionMinTop;
         $adpositionmaxtop_option = $AdCampaignBannerRestrictions->AdPositionMaxTop == null ? "" : $AdCampaignBannerRestrictions->AdPositionMaxTop;
         $current_timezone = $AdCampaignBannerRestrictions->Timezone == null ? "" : $AdCampaignBannerRestrictions->Timezone;
         $current_adtagtype = $AdCampaignBannerRestrictions->AdTagType == null ? "" : $AdCampaignBannerRestrictions->AdTagType;
         $current_iniframe = $AdCampaignBannerRestrictions->InIframe == null ? "" : $AdCampaignBannerRestrictions->InIframe;
         $current_inmultiplenestediframes = $AdCampaignBannerRestrictions->InMultipleNestedIframes == null ? "" : $AdCampaignBannerRestrictions->InMultipleNestedIframes;
         $minscreenresolutionwidth_option = $AdCampaignBannerRestrictions->MinScreenResolutionWidth == null ? "" : $AdCampaignBannerRestrictions->MinScreenResolutionWidth;
         $maxscreenresolutionwidth_option = $AdCampaignBannerRestrictions->MaxScreenResolutionWidth == null ? "" : $AdCampaignBannerRestrictions->MaxScreenResolutionWidth;
         $minscreenresolutionheight_option = $AdCampaignBannerRestrictions->MinScreenResolutionHeight == null ? "" : $AdCampaignBannerRestrictions->MinScreenResolutionHeight;
         $maxscreenresolutionheight_option = $AdCampaignBannerRestrictions->MaxScreenResolutionHeight == null ? "" : $AdCampaignBannerRestrictions->MaxScreenResolutionHeight;
         $httplanguage_option = $AdCampaignBannerRestrictions->HttpLanguage == null ? "" : $AdCampaignBannerRestrictions->HttpLanguage;
         $browseruseragentgrep_option = $AdCampaignBannerRestrictions->BrowserUserAgentGrep == null ? "" : $AdCampaignBannerRestrictions->BrowserUserAgentGrep;
         $cookiegrep_option = $AdCampaignBannerRestrictions->CookieGrep == null ? "" : $AdCampaignBannerRestrictions->CookieGrep;
         $current_pmpenable = $AdCampaignBannerRestrictions->PmpEnable == null ? "" : $AdCampaignBannerRestrictions->PmpEnable;
         $current_secure = $AdCampaignBannerRestrictions->Secure == null ? "" : $AdCampaignBannerRestrictions->Secure;
         $current_optout = $AdCampaignBannerRestrictions->Optout == null ? "" : $AdCampaignBannerRestrictions->Optout;
         $current_vertical = $AdCampaignBannerRestrictions->Vertical == null ? "" : $AdCampaignBannerRestrictions->Vertical;
     }
     $current_verticals = array();
     if ($current_vertical) {
         $current_verticals = explode(',', $current_vertical);
     }
     $current_countries = array();
     if ($current_country) {
         $current_countries = explode(',', $current_country);
     }
     $current_timezones = array();
     if ($current_timezone) {
         $current_timezones = explode(',', $current_timezone);
     }
     //var_dump($current_country);
     //exit;
     return new ViewModel(array('bannerid' => $id, 'bannerpreviewid' => $banner_preview_id, 'campaignid' => $campaign_id, 'campaignpreviewid' => $campaign_preview_id, 'ispreview' => $is_preview == true ? '1' : '0', 'countrylist' => \util\Countries::$allcountries, 'current_states' => $current_states, 'current_countries' => $current_countries, 'foldpos_options' => \util\DeliveryFilterOptions::$foldpos_options, 'current_foldpos' => $current_foldpos, 'frequency_option' => $frequency_option, 'geocity_option' => $geocity_option, 'adpositionminleft_option' => $adpositionminleft_option, 'adpositionmaxleft_option' => $adpositionmaxleft_option, 'adpositionmintop_option' => $adpositionmintop_option, 'adpositionmaxtop_option' => $adpositionmaxtop_option, 'adtagtype_options' => \util\DeliveryFilterOptions::$adtagtype_options, 'current_adtagtype' => $current_adtagtype, 'timezone_options' => \util\DeliveryFilterOptions::$timezone_options, 'current_timezones' => $current_timezones, 'iniframe_options' => \util\DeliveryFilterOptions::$iniframe_options, 'current_iniframe' => $current_iniframe, 'inmultiplenestediframes_options' => \util\DeliveryFilterOptions::$inmultiplenestediframes_options, 'current_inmultiplenestediframes' => $current_inmultiplenestediframes, 'minscreenresolutionwidth_option' => $minscreenresolutionwidth_option, 'maxscreenresolutionwidth_option' => $maxscreenresolutionwidth_option, 'minscreenresolutionheight_option' => $minscreenresolutionheight_option, 'maxscreenresolutionheight_option' => $maxscreenresolutionheight_option, 'httplanguage_option' => $httplanguage_option, 'browseruseragentgrep_option' => $browseruseragentgrep_option, 'cookiegrep_option' => $cookiegrep_option, 'pmpenable_options' => \util\DeliveryFilterOptions::$pmpenable_options, 'current_pmpenable' => $current_pmpenable, 'secure_options' => \util\DeliveryFilterOptions::$secure_options, 'current_secure' => $current_secure, 'optout_options' => \util\DeliveryFilterOptions::$optout_options, 'current_optout' => $current_optout, 'vertical_options' => \util\DeliveryFilterOptions::$vertical_options, 'current_verticals' => $current_verticals, 'bread_crumb_info' => $this->getBreadCrumbInfoFromBanner($id, $banner_preview_id, $is_preview), 'user_id_list' => $this->user_id_list_demand_customer, 'center_class' => 'centerj', 'user_identity' => $this->identity(), 'true_user_name' => $this->auth->getUserName(), 'header_title' => 'Edit Delivery Filter', 'is_admin' => $this->is_admin, 'effective_id' => $this->auth->getEffectiveIdentityID(), 'impersonate_id' => $this->ImpersonateID));
 }
예제 #2
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;
 }
 /**
  * 
  * @return Ambigous <\Zend\View\Model\ViewModel, \Zend\View\Model\ViewModel>
  */
 public function newbannerAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     $ImpressionType = $this->getRequest()->getPost('ImpressionType');
     if ($ImpressionType != 'banner' && $ImpressionType != 'video') {
         die("Required Field: ImpressionType was missing");
     }
     $needed_input_banner = array('bannername', 'startdate', 'enddate', 'ismobile', 'iabsize', 'height', 'width', 'bidamount', 'adtag', 'landingpagetld');
     $needed_input_video = array('bannername', 'startdate', 'enddate', 'bidamount', 'adtag', 'landingpagetld');
     if ($ImpressionType == 'video') {
         $this->validateInput($needed_input_video);
     } else {
         $this->validateInput($needed_input_banner);
     }
     $adcampaigntype = AD_TYPE_ANY_REMNANT;
     $linkedzones = array();
     $campaignid = $this->getRequest()->getPost('campaignid');
     $campaign_preview_id = $this->getRequest()->getPost('campaignpreviewid');
     $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
          */
         if ($bannerid != null) {
             $update_data = array('type' => 'AdCampaignBannerID', 'id' => $bannerid);
         } else {
             $update_data = array('type' => 'AdCampaignID', 'id' => $campaignid);
         }
         $return_val = \transformation\TransformPreview::previewCheckAdCampaignID($campaignid, $this->auth, $this->config_handle, $this->getServiceLocator()->get('mail.transport'), $update_data);
         if ($return_val !== null) {
             if ($bannerid != null) {
                 $campaign_preview_id = $return_val["AdCampaignPreviewID"];
                 $banner_preview_id = $return_val["AdCampaignBannerPreviewID"];
             } else {
                 $campaign_preview_id = $return_val["AdCampaignPreviewID"];
             }
         }
     }
     // ACL PREVIEW PERMISSIONS CHECK
     transformation\CheckPermissions::checkEditPermissionAdCampaignPreview($campaign_preview_id, $this->auth, $this->config_handle);
     $bannername = $this->getRequest()->getPost('bannername');
     $startdate = $this->getRequest()->getPost('startdate');
     $enddate = $this->getRequest()->getPost('enddate');
     if ($this->is_admin) {
         $adcampaigntype = $this->getRequest()->getPost('adcampaigntype');
         $linkedzones = $this->getRequest()->getPost('linkedzones');
     }
     $ismobile = $this->getRequest()->getPost('ismobile');
     $iabsize = $this->getRequest()->getPost('iabsize');
     $height = $this->getRequest()->getPost('height');
     $width = $this->getRequest()->getPost('width');
     $weight = $this->getRequest()->getPost('weight');
     $bidamount = $this->getRequest()->getPost('bidamount');
     $adtag = $this->getRequest()->getPost('adtag');
     $landingpagetld = $this->getRequest()->getPost('landingpagetld');
     $bannerid = $this->getRequest()->getPost('bannerid');
     if ($ImpressionType == 'video') {
         $mimes = $this->getRequest()->getPost("Mimes");
         if ($mimes && is_array($mimes) && count($mimes) > 0) {
             $mimes = join(',', $mimes);
         } else {
             $mimes = "";
         }
         $protocols = $this->getRequest()->getPost("Protocols");
         if ($protocols && is_array($protocols) && count($protocols) > 0) {
             $protocols = join(',', $protocols);
         } else {
             $protocols = "";
         }
         $apis_supported = $this->getRequest()->getPost("ApisSupported");
         if ($apis_supported && is_array($apis_supported) && count($apis_supported) > 0) {
             $apis_supported = join(',', $apis_supported);
         } else {
             $apis_supported = "";
         }
         $delivery = $this->getRequest()->getPost("Delivery");
         if ($delivery && is_array($delivery) && count($delivery) > 0) {
             $delivery = join(',', $delivery);
         } else {
             $delivery = "";
         }
         $playback = $this->getRequest()->getPost("Playback");
         if ($playback && is_array($playback) && count($playback) > 0) {
             $playback = join(',', $playback);
         } else {
             $playback = "";
         }
         $start_delay = $this->getRequest()->getPost("StartDelay");
         $linearity = $this->getRequest()->getPost("Linearity");
     }
     $BannerPreview = new \model\AdCampaignBannerPreview();
     if ($banner_preview_id != null) {
         $BannerPreview->AdCampaignBannerPreviewID = $banner_preview_id;
     }
     $BannerPreview->UserID = $this->auth->getEffectiveUserID();
     $BannerPreview->Name = $bannername;
     $BannerPreview->AdCampaignPreviewID = $campaign_preview_id;
     $BannerPreview->StartDate = date("Y-m-d H:i:s", strtotime($startdate));
     $BannerPreview->EndDate = date("Y-m-d H:i:s", strtotime($enddate));
     if ($this->is_admin || $banner_preview_id == null) {
         $BannerPreview->AdCampaignTypeID = $adcampaigntype;
     }
     $BannerPreview->ImpressionType = $ImpressionType;
     $BannerPreview->IsMobile = $ismobile;
     $BannerPreview->IABSize = $iabsize;
     $BannerPreview->Height = $height;
     $BannerPreview->Width = $width;
     $BannerPreview->Weight = $weight == null ? 5 : $weight;
     $BannerPreview->BidAmount = $bidamount;
     $BannerPreview->AdTag = trim($adtag);
     $BannerPreview->DeliveryType = 'js';
     $BannerPreview->LandingPageTLD = $landingpagetld;
     $BannerPreview->ImpressionsCounter = 0;
     $BannerPreview->BidsCounter = 0;
     $BannerPreview->CurrentSpend = 0;
     $BannerPreview->Active = 1;
     $BannerPreview->DateCreated = date("Y-m-d H:i:s");
     $BannerPreview->DateUpdated = date("Y-m-d H:i:s");
     $BannerPreview->ChangeWentLive = 0;
     $AdCampaignBannerPreviewFactory = \_factory\AdCampaignBannerPreview::get_instance();
     $banner_preview_id_new = $AdCampaignBannerPreviewFactory->saveAdCampaignBannerPreview($BannerPreview);
     if ($banner_preview_id_new != null) {
         $banner_preview_id = $banner_preview_id_new;
     } elseif ($BannerPreview->AdCampaignBannerPreviewID == null) {
         $BannerPreview->AdCampaignBannerPreviewID = $banner_preview_id;
     }
     $AdCampaignVideoRestrictionsPreviewFactory = \_factory\AdCampaignVideoRestrictionsPreview::get_instance();
     $AdCampaignBannerRestrictionsPreviewFactory = \_factory\AdCampaignBannerRestrictionsPreview::get_instance();
     if ($ImpressionType == 'video') {
         $params = array();
         $params["AdCampaignBannerPreviewID"] = $banner_preview_id;
         $AdCampaignVideoRestrictionsPreview = $AdCampaignVideoRestrictionsPreviewFactory->get_row($params);
         if ($AdCampaignVideoRestrictionsPreview == null) {
             $AdCampaignVideoRestrictionsPreview = new \model\AdCampaignVideoRestrictionsPreview();
         }
         $AdCampaignVideoRestrictionsPreview->AdCampaignBannerPreviewID = $banner_preview_id;
         $AdCampaignVideoRestrictionsPreview->DateCreated = date("Y-m-d H:i:s");
         $AdCampaignVideoRestrictionsPreview->MimesCommaSeparated = trim($mimes);
         $AdCampaignVideoRestrictionsPreview->ProtocolsCommaSeparated = trim($protocols);
         $AdCampaignVideoRestrictionsPreview->ApisSupportedCommaSeparated = trim($apis_supported);
         $AdCampaignVideoRestrictionsPreview->DeliveryCommaSeparated = trim($delivery);
         $AdCampaignVideoRestrictionsPreview->PlaybackCommaSeparated = trim($playback);
         $AdCampaignVideoRestrictionsPreview->StartDelay = trim($start_delay);
         $AdCampaignVideoRestrictionsPreview->Linearity = trim($linearity);
         $AdCampaignVideoRestrictionsPreviewFactory->saveAdCampaignVideoRestrictionsPreview($AdCampaignVideoRestrictionsPreview);
         $AdCampaignBannerRestrictionsPreviewFactory->deleteAdCampaignBannerRestrictionsPreview($banner_preview_id);
     } else {
         $AdCampaignVideoRestrictionsPreviewFactory->deleteAdCampaignVideoRestrictionsPreview($banner_preview_id);
     }
     if ($this->is_admin) {
         $LinkedBannerToAdZonePreviewFactory = \_factory\LinkedBannerToAdZonePreview::get_instance();
         $LinkedBannerToAdZonePreviewFactory->deleteLinkedBannerToAdZonePreview($BannerPreview->AdCampaignBannerPreviewID);
         // campaigntype AD_TYPE_CONTRACT case
         if ($adcampaigntype == AD_TYPE_CONTRACT && $linkedzones != null && count($linkedzones) > 0) {
             foreach ($linkedzones as $linked_zone_id) {
                 $LinkedBannerToAdZonePreview = new \model\LinkedBannerToAdZonePreview();
                 $LinkedBannerToAdZonePreview->AdCampaignBannerPreviewID = $BannerPreview->AdCampaignBannerPreviewID;
                 $LinkedBannerToAdZonePreview->PublisherAdZoneID = intval($linked_zone_id);
                 $LinkedBannerToAdZonePreview->Weight = intval($weight);
                 $LinkedBannerToAdZonePreview->DateCreated = date("Y-m-d H:i:s");
                 $LinkedBannerToAdZonePreview->DateUpdated = date("Y-m-d H:i:s");
                 $LinkedBannerToAdZonePreviewFactory->saveLinkedBannerToAdZonePreview($LinkedBannerToAdZonePreview);
             }
         }
     }
     $refresh_url = "/demand/viewbanner/" . $BannerPreview->AdCampaignPreviewID . "?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;
 }