function APIlityCampaign($name, $id, $status, $startDate, $endDate, $budgetAmount, $budgetPeriod, $networkTargeting, $languages, $geoTargets, $isEnabledOptimizedAdServing, $campaignNegativeKeywordCriteria = array(), $campaignNegativeWebsiteCriteria = array(), $adScheduling, $budgetOptimizerSettings = array(), $conversionOptimizerSettings = array()) { $this->name = $name; $this->id = $id; $this->status = $status; $this->startDate = $startDate; $this->endDate = $endDate; $this->budgetAmount = $budgetAmount; $this->budgetPeriod = $budgetPeriod; $this->networkTargeting = convertToArray($networkTargeting); $this->languages = convertToArray($languages); $this->geoTargets = $geoTargets; $this->campaignNegativeKeywordCriteria = convertToArray($campaignNegativeKeywordCriteria); $this->campaignNegativeWebsiteCriteria = convertToArray($campaignNegativeWebsiteCriteria); $this->isEnabledOptimizedAdServing = convertBool($isEnabledOptimizedAdServing); $this->adScheduling = $adScheduling; $this->budgetOptimizerSettings = $budgetOptimizerSettings; $authenticationContext =& APIlityManager::getContext(); $this->belongsToClientEmail = is_a($authenticationContext, 'APIlityUser') ? $authenticationContext->getClientEmail() : ''; $this->conversionOptimizerSettings = $conversionOptimizerSettings; }
function getManagersClientAccountInfos() { $authenticationContext =& APIlityManager::getContext(); // we want to get the current manager's account clients so temporarily unset // any eventually existing clientEmail setting if (is_a($authenticationContext, 'APIlityUser')) { $savedClientEmail = $authenticationContext->getClientEmail(); $authenticationContext->setClientEmail(""); } $soapClients =& APIlityClients::getClients(); $someSoapClient = $soapClients->getAccountClient(); // prepare soap parameters $soapParameters = "<getClientAccountInfos></getClientAccountInfos>"; // execute soap call $clientAccounts = $someSoapClient->call("getClientAccountInfos", $soapParameters); $soapClients->updateSoapRelatedData(extractSoapHeaderInfo($someSoapClient->getHeaders())); if ($someSoapClient->fault) { pushFault($someSoapClient, $_SERVER['PHP_SELF'] . ":getManagersClientAccountInfos()", $soapParameters); // in case of an error make sure that at least the clientEmail gets restored if (is_a($authenticationContext, 'APIlityUser')) { $authenticationContext->setClientEmail($savedClientEmail); } return false; } // restore clientEmail if (is_a($authenticationContext, 'APIlityUser')) { $authenticationContext->setClientEmail($savedClientEmail); } // make sure we really return an array if (isset($clientAccounts['getClientAccountInfosReturn']) && is_array($clientAccounts['getClientAccountInfosReturn'])) { return $clientAccounts['getClientAccountInfosReturn']; } else { return array(); } }
function setClientEmail($newEmail) { $this->clientEmail = $newEmail; $authenticationContext =& APIlityManager::getContext(); $authenticationContext->clientEmail = $newEmail; $soapClients =& APIlityClients::getClients(); $soapClients->setSoapHeaders($authenticationContext->getHeader()); }