/** * The modifyPublisher method checks if a publisher ID exists and * modifies the details for the publisher if it exists or returns an error * message, as appropriate. * * @access public * * @param string $sessionId * @param OA_Dll_PublisherInfo &$oPublisher <br /> * <b>Required properties:</b> publisherId<br /> * <b>Optional properties:</b> agencyId, publisherName, contactName, emailAddress, username, password<br /> * * @return boolean */ function modifyPublisher($sessionId, &$oPublisher) { if ($this->verifySession($sessionId)) { if (isset($oPublisher->publisherId)) { return $this->_validateResult($this->_dllPublisher->modify($oPublisher)); } else { $this->raiseError("Field 'publisherId' in structure does not exists"); return false; } } else { return false; } }
function processForm($affiliateid, $form, $oComponent) { $aFields = $form->exportValues(); $newWebsite = empty($aFields['affiliateid']); // Setup a new publisher object and set the fields passed in from the form: $oPublisher = new OA_Dll_PublisherInfo(); $oPublisher->agencyId = $aFields['agencyid']; $oPublisher->contactName = $aFields['contact']; $oPublisher->emailAddress = $aFields['email']; $oPublisher->publisherId = $aFields['affiliateid']; $oPublisher->publisherName = $aFields['name']; $oPublisher->website = $aFields['website']; // process form data for oxThorium if this is edit existing website if (!$newWebsite && $oComponent) { $aFields['affiliateid'] = $oPublisher->publisherId; $oComponent->processAffiliateForm($aFields); } $oPublisherDll = new OA_Dll_Publisher(); if ($oPublisherDll->modify($oPublisher) && !$oPublisherDll->_noticeMessage) { // Queue confirmation message $translation = new OX_Translation(); if ($newWebsite) { //process form data for oxThorium for new website if ($oComponent) { $aFields['affiliateid'] = $oPublisher->publisherId; $oComponent->processAffiliateForm($aFields); } $translated_message = $translation->translate($GLOBALS['strWebsiteHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'affiliate-edit.php?affiliateid=' . $oPublisher->publisherId), htmlspecialchars($oPublisher->publisherName), MAX::constructURL(MAX_URL_ADMIN, 'zone-edit.php?affiliateid=' . $oPublisher->publisherId))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); $redirectURL = "website-index.php"; } else { $translated_message = $translation->translate($GLOBALS['strWebsiteHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'affiliate-edit.php?affiliateid=' . $oPublisher->publisherId), htmlspecialchars($oPublisher->publisherName))); $redirectURL = "affiliate-edit.php?affiliateid={$oPublisher->publisherId}"; } OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); OX_Admin_Redirect::redirect($redirectURL); } return $oPublisherDll; }