Ejemplo n.º 1
0
 function getWebsitesAndZonesByAgencyId($agencyId = null)
 {
     if (is_null($agencyId)) {
         $agencyId = OA_Permission::getAgencyId();
     }
     $prefix = $this->getTablePrefix();
     $oDbh = OA_DB::singleton();
     $tableW = $oDbh->quoteIdentifier($prefix . $this->table, true);
     $tableZ = $oDbh->quoteIdentifier($prefix . 'zones', true);
     // Select out websites only first (to ensure websites with no zones are included in the list)
     $aWebsitesAndZones = array();
     $query = "\n            SELECT\n                w.affiliateid AS website_id,\n                w.website     AS website_url,\n                w.name        AS website_name\n            FROM\n                {$tableW} AS w\n            WHERE\n                w.agencyid = " . DBC::makeLiteral($agencyId) . "\n            ORDER BY w.name";
     $rsAffiliates = DBC::NewRecordSet($query);
     $rsAffiliates->find();
     while ($rsAffiliates->fetch()) {
         $aWebsiteZone = $rsAffiliates->toArray();
         $aWebsitesAndZones[$aWebsiteZone['website_id']]['name'] = $aWebsiteZone['website_name'];
         $aWebsitesAndZones[$aWebsiteZone['website_id']]['url'] = $aWebsiteZone['website_url'];
         $aWebsitesAndZones[$aWebsiteZone['website_id']]['zones'] = array();
     }
     $query = "\n        SELECT\n            w.affiliateid AS website_id,\n            w.website     AS website_url,\n            w.name        AS website_name,\n            z.zoneid      AS zone_id,\n            z.zonename    AS zone_name,\n            z.width       AS zone_width,\n            z.height      AS zone_height\n        FROM\n            {$tableW} AS w,\n            {$tableZ} AS z\n        WHERE\n            z.affiliateid = w.affiliateid\n          AND w.agencyid = " . DBC::makeLiteral($agencyId) . "\n        ORDER BY w.name";
     $rsAffiliatesAndZones = DBC::NewRecordSet($query);
     $rsAffiliatesAndZones->find();
     while ($rsAffiliatesAndZones->fetch()) {
         $aWebsiteZone = $rsAffiliatesAndZones->toArray();
         $aWebsitesAndZones[$aWebsiteZone['website_id']]['name'] = $aWebsiteZone['website_name'];
         $aWebsitesAndZones[$aWebsiteZone['website_id']]['url'] = $aWebsiteZone['website_url'];
         $aWebsitesAndZones[$aWebsiteZone['website_id']]['zones'][$aWebsiteZone['zone_id']] = array('name' => $aWebsiteZone['zone_name'], 'width' => $aWebsiteZone['zone_width'], 'height' => $aWebsiteZone['zone_height']);
     }
     return $aWebsitesAndZones;
 }
 function getAgencyDetails($agencyId = null)
 {
     if (is_null($agencyId)) {
         $agencyId = OA_Permission::getAgencyId();
     }
     $doAgency =& OA_Dal::factoryDO('agency');
     $doAgency->get($agencyId);
     $aResult = $doAgency->toArray();
     return $aResult;
 }
Ejemplo n.º 3
0
 /**
  * This method sets all default values when adding a new channel.
  *
  */
 function setDefaultForAdd()
 {
     if (empty($this->agencyId)) {
         $this->agencyId = OA_Permission::getAgencyId();
     }
     if (empty($this->websiteId)) {
         // Set it to 'global'
         $this->websiteId = 0;
     }
 }
Ejemplo n.º 4
0
 /**
  * The final "child" implementation of the parental abstract method.
  *
  * @see OA_Admin_Statistics_Common::start()
  */
 function start()
 {
     // Get the preferences
     $aPref = $GLOBALS['_MAX']['PREF'];
     // Security check
     OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER);
     // HTML Framework
     $this->pageId = '2.4';
     $this->aPageSections = array('2.1', '2.4', '2.2');
     $this->hideInactive = MAX_getStoredValue('hideinactive', $aPref['ui_hide_inactive'] == true, null, true);
     $this->showHideInactive = true;
     $this->startLevel = MAX_getStoredValue('startlevel', 0, null, true);
     // Init nodes
     $this->aNodes = MAX_getStoredArray('nodes', array());
     $expand = MAX_getValue('expand', '');
     $collapse = MAX_getValue('collapse');
     // Adjust which nodes are opened closed...
     MAX_adjustNodes($this->aNodes, $expand, $collapse);
     $aParams = $this->coreParams;
     if (!OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
         $aParams['agency_id'] = OA_Permission::getAgencyId();
     }
     // Add module page parameters
     $this->aPageParams['period_preset'] = MAX_getStoredValue('period_preset', 'today');
     $this->aPageParams['statsBreakdown'] = htmlspecialchars(MAX_getStoredValue('statsBreakdown', 'day'));
     $this->_loadParams();
     switch ($this->startLevel) {
         case 1:
             $this->aEntitiesData = $this->getZones($aParams, $this->startLevel, $expand);
             break;
         default:
             $this->startLevel = 0;
             $this->aEntitiesData = $this->getPublishers($aParams, $this->startLevel, $expand);
             break;
     }
     // Summarise the values into a the totals array, & format
     $this->_summariseTotalsAndFormat($this->aEntitiesData);
     $this->showHideLevels = array();
     switch ($this->startLevel) {
         case 1:
             $this->showHideLevels = array(0 => array('text' => $GLOBALS['strShowParentAffiliates'], 'icon' => 'images/icon-affiliate.gif'));
             $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveZonesHidden']}";
             break;
         case 0:
             $this->showHideLevels = array(1 => array('text' => $GLOBALS['strHideParentAffiliates'], 'icon' => 'images/icon-affiliate-d.gif'));
             $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveAffiliatesHidden']}";
             break;
     }
     // Save prefs
     $this->aPagePrefs['startlevel'] = $this->startLevel;
     $this->aPagePrefs['nodes'] = implode(",", $this->aNodes);
     $this->aPagePrefs['hideinactive'] = $this->hideInactive;
     $this->aPagePrefs['startlevel'] = $this->startLevel;
 }
 public static function createTemplateWithModel($panel, $single = true)
 {
     $agencyId = OA_Permission::getAgencyId();
     $oDalZones = OA_Dal::factoryDAL('zones');
     $infix = $single ? '' : '-' . $panel;
     phpAds_registerGlobalUnslashed('action', 'campaignid', 'clientid', "text{$infix}", "page{$infix}");
     $campaignId = $GLOBALS['campaignid'];
     $text = $GLOBALS["text{$infix}"];
     $linked = $panel == 'linked';
     $showStats = empty($GLOBALS['_MAX']['CONF']['ui']['zoneLinkingStatistics']) ? false : true;
     $websites = $oDalZones->getWebsitesAndZonesList($agencyId, $campaignId, $linked, $text);
     $matchingZones = 0;
     foreach ($websites as $aWebsite) {
         $matchingZones += count($aWebsite['zones']);
     }
     $aZonesCounts = array('all' => $oDalZones->countZones($agencyId, null, $campaignId, $linked), 'matching' => $matchingZones);
     $pagerFileName = 'campaign-zone-zones.php';
     $pagerParams = array('clientid' => $GLOBALS['clientid'], 'campaignid' => $GLOBALS['campaignid'], 'status' => $panel, 'text' => $text);
     $currentPage = null;
     if (!$single) {
         $currentPage = $GLOBALS["page{$infix}"];
     }
     $oTpl = new OA_Admin_Template('campaign-zone-zones.html');
     $oPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, true, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
     $oTopPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, false, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
     list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
     $websites = array_slice($websites, $itemsFrom - 1, self::WEBSITES_PER_PAGE, true);
     // Add statistics for the displayed zones if required
     if ($showStats) {
         $oDalZones->mergeStatistics($websites, $campaignId);
     }
     // Count how many zone are displayed
     $showingCount = 0;
     foreach ($websites as $website) {
         $showingCount += count($website['zones']);
     }
     $aZonesCounts['showing'] = $showingCount;
     $oTpl->assign('pager', $oPager);
     $oTpl->assign('topPager', $oTopPager);
     $oTpl->assign('websites', $websites);
     $oTpl->assign('zonescounts', $aZonesCounts);
     $oTpl->assign('text', $text);
     $oTpl->assign('status', $panel);
     $oTpl->assign('page', $oTopPager->getCurrentPageID());
     $oTpl->assign('showStats', $showStats);
     $oTpl->assign('colspan', $showStats ? 6 : 3);
     return $oTpl;
 }
Ejemplo n.º 6
0
 /**
  * The final "child" implementation of the parental abstract method.
  *
  * @see OA_Admin_Statistics_Common::start()
  */
 function start()
 {
     // Security check
     OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER);
     // Load the period preset and stats breakdown parameters
     $this->_loadPeriodPresetParam();
     $this->_loadStatsBreakdownParam();
     // Load $_GET parameters
     $this->_loadParams();
     // HTML Framework
     $this->pageId = '2.2';
     $this->aPageSections = array('2.1', '2.4', '2.2');
     // Prepare the data for display by output() method
     $aParams = array();
     if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $aParams['agency_id'] = OA_Permission::getAgencyId();
     }
     $this->prepare($aParams, 'stats.php');
 }
Ejemplo n.º 7
0
 public static function createTemplateWithModel($panel, $single = true)
 {
     $agencyId = OA_Permission::getAgencyId();
     $oDalZones = OA_Dal::factoryDAL('zones');
     $infix = $single ? '' : '-' . $panel;
     phpAds_registerGlobalUnslashed('action', 'campaignid', 'clientid', "category{$infix}", "category{$infix}-text", "text{$infix}", "page{$infix}");
     $campaignId = $GLOBALS['campaignid'];
     $category = $GLOBALS["category{$infix}"];
     $categoryText = $GLOBALS["category{$infix}-text"];
     $text = $GLOBALS["text{$infix}"];
     $linked = $panel == 'linked';
     $websites = $oDalZones->getWebsitesAndZonesListByCategory($agencyId, $category, $campaignId, $linked, $text);
     $pagerFileName = 'campaign-zone-zones.php';
     $pagerParams = array('clientid' => $GLOBALS['clientid'], 'campaignid' => $GLOBALS['campaignid'], 'status' => $panel, 'category' => $category, 'category-text' => $categoryText, 'text' => $text);
     $currentPage = null;
     if (!$single) {
         $currentPage = $GLOBALS["page{$infix}"];
     }
     $oTpl = new OA_Admin_Template('campaign-zone-zones.html');
     $oPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, true, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
     $oTopPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, false, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
     list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
     $websites = array_slice($websites, $itemsFrom - 1, self::WEBSITES_PER_PAGE, true);
     $aZonesCounts = array('all' => $oDalZones->countZones($agencyId, null, $campaignId, $linked), 'matching' => $oDalZones->countZones($agencyId, $category, $campaignId, $linked, $text));
     $showingCount = 0;
     // TODO: currently we're calculating the number in PHP code. Once
     // MAX_Dal_Admin_Zones::countZones() supports the limit parameter, we can remove
     // the code below and use the dal.
     foreach ($websites as $website) {
         $showingCount += count($website['zones']);
     }
     $aZonesCounts['showing'] = $showingCount;
     $oTpl->assign('pager', $oPager);
     $oTpl->assign('topPager', $oTopPager);
     $oTpl->assign('websites', $websites);
     $oTpl->assign('zonescounts', $aZonesCounts);
     $oTpl->assign('category', $categoryText);
     $oTpl->assign('text', $text);
     $oTpl->assign('status', $panel);
     $oTpl->assign('page', $oTopPager->getCurrentPageID());
     return $oTpl;
 }
Ejemplo n.º 8
0
 /**
  * This method sets all default values when adding a new publisher.
  *
  */
 function setDefaultForAdd()
 {
     if (empty($this->agencyId)) {
         $this->agencyId = OA_Permission::getAgencyId();
     }
 }
                break;
            case 'w':
                $aDates['day_begin'] = $oDayDate->format('%Y-%m-%d');
                $oDayDate->addSeconds(60 * 60 * 24 * 7);
                // Add 7 days
                $aDates['day_end'] = $oDayDate->format('%Y-%m-%d');
                break;
            case 'd':
            default:
                $aDates['day'] = $oDayDate->format('%Y-%m-%d');
                break;
        }
    }
}
// Restrict to the current manager ID
$aParams['agency_id'] = OA_Permission::getAgencyId();
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
// Get conversions - additional security check which allow to edit only those conversions visible to user
$aConversions = Admin_DA::getConversions($aParams + $aDates);
if (!empty($aConversions)) {
    $conf = $GLOBALS['_MAX']['CONF'];
    $modified = false;
    // Modify conversions
    foreach ($statusIds as $conversionId => $statusId) {
        if (isset($aConversions[$conversionId]) && $aConversions[$conversionId]['connection_status'] != $statusId) {
            $modified = true;
            // Edit conversion
            $doData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
            $doData_intermediate_ad_connection->get($conversionId);
Ejemplo n.º 10
0
 function getDefaultAgencyId()
 {
     return OA_Permission::getAgencyId();
 }
function processForm($aAdvertiser, $form)
{
    $aFields = $form->exportValues();
    // Name
    if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        $aAdvertiser['clientname'] = $aFields['clientname'];
    }
    // Default fields
    $aAdvertiser['contact'] = $aFields['contact'];
    $aAdvertiser['email'] = $aFields['email'];
    $aAdvertiser['comments'] = $aFields['comments'];
    // Same advertiser limitation
    $aAdvertiser['advertiser_limitation'] = $aFields['advertiser_limitation'] == '1' ? 1 : 0;
    // Reports
    $aAdvertiser['report'] = $aFields['report'] == 't' ? 't' : 'f';
    $aAdvertiser['reportdeactivate'] = $aFields['reportdeactivate'] == 't' ? 't' : 'f';
    $aAdvertiser['reportinterval'] = (int) $aFields['reportinterval'];
    if ($aAdvertiser['reportinterval'] == 0) {
        $aAdvertiser['reportinterval'] = 1;
    }
    if ($aFields['reportlastdate'] == '' || $aFields['reportlastdate'] == '0000-00-00' || $aFields['reportprevious'] != $aAdvertiser['report']) {
        $aAdvertiser['reportlastdate'] = date("Y-m-d");
    }
    if (empty($aAdvertiser['clientid'])) {
        // Set agency ID
        $aAdvertiser['agencyid'] = OA_Permission::getAgencyId();
        $doClients = OA_Dal::factoryDO('clients');
        $doClients->setFrom($aAdvertiser);
        $doClients->updated = OA::getNow();
        // Insert
        $aAdvertiser['clientid'] = $doClients->insert();
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname']), MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aAdvertiser['clientid'])));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        // Go to next page
        OX_Admin_Redirect::redirect("advertiser-index.php");
    } else {
        $doClients = OA_Dal::factoryDO('clients');
        $doClients->get($aAdvertiser['clientid']);
        $doClients->setFrom($aAdvertiser);
        $doClients->updated = OA::getNow();
        $doClients->update();
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname'])));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        OX_Admin_Redirect::redirect('advertiser-edit.php?clientid=' . $aAdvertiser['clientid']);
    }
    exit;
}
Ejemplo n.º 12
0
 /**
  * Gets list of other publishers and set a menu page context variable with them
  * Can be easily reused across inventory->publishers pages
  *
  * TODO: Consider reading page name from automatically instead of passing it as a parameter
  *
  * @static
  * @param integer $affiliateid  Affiliate ID
  * @param string $pageName
  * @param string $sortPageName
  */
 function setPublisherPageContext($affiliateid, $pageName, $sortPageName = 'website-index.php')
 {
     $doAffiliates = OA_Dal::factoryDO('affiliates');
     $doAffiliates->agencyid = OA_Permission::getAgencyId();
     if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $doAffiliates->affiliateid = $affiliateid;
     }
     $doAffiliates->addSessionListOrderBy($sortPageName);
     $doAffiliates->find();
     while ($doAffiliates->fetch()) {
         phpAds_PageContext(phpAds_buildAffiliateName($doAffiliates->affiliateid, $doAffiliates->name), "{$pageName}?affiliateid=" . $doAffiliates->affiliateid, $affiliateid == $doAffiliates->affiliateid);
     }
 }
Ejemplo n.º 13
0
function MAX_checkZone($publisherId, $zoneId)
{
    $allowed = false;
    if (MAX_checkGenericId($publisherId) && MAX_checkGenericId($zoneId)) {
        if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
            $allowed = count(Admin_DA::getZones(array('publisher_id' => $publisherId, 'zone_id' => $zoneId)));
        } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
            $allowed = count(Admin_DA::getZones(array('agency_id' => OA_Permission::getAgencyId(), 'publisher_id' => $publisherId, 'zone_id' => $zoneId)));
        } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
            $allowed = $publisherId == OA_Permission::getEntityId() && count(Admin_DA::getZones(array('publisher_id' => $publisherId, 'zone_id' => $zoneId)));
        }
    }
    return $allowed;
}
Ejemplo n.º 14
0
 /**
  * A static method to load the current account's preferences from the
  * database and store them in the global array $GLOBALS['_MAX']['PREF'].
  *
  * @static
  * @param boolean $loadExtraInfo An optional parameter, when set to true,
  *                               the array of preferences is loaded as
  *                               an array of arrays, indexed by preference
  *                               key, containing the preference "value" and
  *                               "account_type" information. When not set,
  *                               the preferences are loaded as a
  *                               one-dimensional array of values, indexed
  *                               by preference key.
  * @param boolean $return        An optional parameter, when set to true,
  *                               returns the preferences instead of setting
  *                               them into $GLOBALS['_MAX']['PREF'].
  * @param boolean $parentOnly    An optional parameter, when set to true,
  *                               only loads those preferences that are
  *                               inherited from parent accounts, not preferences
  *                               at the current account level. If the current
  *                               account is the admin account, and this option
  *                               is true, no preferences will be loaded!
  * @param boolean $loadAdminOnly An optional parameter, when set to true, loads
  *                               the admin preferences only, EVEN IF NO ACCUONT
  *                               IS LOGGED IN. If set to true, REQUIRES that the
  *                               $parentOnly parameter is false. Should only
  *                               ever be set when called from
  *                               OA_Preferences::loadAdminAccountPreferences().
  * @param integer $accountId     An optional account ID, when set, the preferences
  *                               for this account will be loaded, provided there
  *                               is no currently logged in account.
  * @return mixed The array of preferences if $return is true, otherwise null.
  */
 function loadPreferences($loadExtraInfo = false, $return = false, $parentOnly = false, $loadAdminOnly = false, $accountId = null)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Ensure $parentOnly and $loadAdminOnly are correctly set
     if ($parentOnly && $loadAdminOnly) {
         // Cannot both be true!
         OA_Preferences::_unsetPreferences();
         return;
     }
     // Only worry about the current account type and if a user is logged
     // in if $loadAdminOnly == false
     if ($loadAdminOnly == false) {
         // Get the type of the current accout
         $currentAccountType = OA_Permission::getAccountType();
         // If no user logged in, and we are supposed to load a specific account's
         // preferences, load the account type of that specific account
         if (empty($currentAccountType) && is_numeric($accountId)) {
             // Get the account type for the specified account
             $doAccounts = OA_Dal::factoryDO('accounts');
             $doAccounts->account_id = $accountId;
             $doAccounts->find();
             if ($doAccounts->getRowCount() > 0) {
                 $aCurrentAccountType = $doAccounts->getAll(array('account_type'), false, true);
                 $currentAccountType = $aCurrentAccountType[0];
             }
         }
         // If (still) no user logged in or invalid specific account, return
         if (is_null($currentAccountType) || $currentAccountType == false) {
             OA_Preferences::_unsetPreferences();
             return;
         }
     }
     // Get all of the preference types that exist
     $doPreferences = OA_Dal::factoryDO('preferences');
     $aPreferenceTypes = $doPreferences->getAll(array(), true);
     // Are there any preference types in the system?
     if (empty($aPreferenceTypes)) {
         OA_Preferences::_unsetPreferences();
         return;
     }
     // Get the admin account's ID, as this will be required
     $adminAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
     // Get the admin account's preferences, as these are always required
     $aAdminPreferenceValues = OA_Preferences::_getPreferenceValues($adminAccountId);
     if (empty($aAdminPreferenceValues)) {
         OA_Preferences::_unsetPreferences();
         return;
     }
     // Prepare an array to store the preferences that should
     // eventually be set in the global array
     $aPreferences = array();
     // Put the admin account's preferences into the temporary
     // storage array for preferences
     if ($loadAdminOnly == true || !($currentAccountType == OA_ACCOUNT_ADMIN && $parentOnly)) {
         OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aAdminPreferenceValues, $loadExtraInfo);
     }
     // Is the current account NOT the admin account?
     if ($loadAdminOnly == false && $currentAccountType != OA_ACCOUNT_ADMIN) {
         // Is the current account not a manager account?
         if ($currentAccountType == OA_ACCOUNT_MANAGER) {
             // This is a manager account
             if (!$parentOnly) {
                 // Locate the owning manager account ID
                 if (!is_numeric($accountId)) {
                     $managerAccountId = OA_Permission::getAccountId();
                 } else {
                     $managerAccountId = $accountId;
                 }
                 if ($managerAccountId == 0) {
                     OA_Preferences::_unsetPreferences();
                     return;
                 }
                 // Get the manager account's preference values
                 $aManagerPreferenceValues = OA_Preferences::_getPreferenceValues($managerAccountId);
                 // Merge the preference values into the temporary
                 // storage array for preferences
                 OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aManagerPreferenceValues, $loadExtraInfo);
             }
         } else {
             // This must be an advertiser or trafficker account, so
             // need to locate the manager account that "owns" this account
             if (!is_numeric($accountId)) {
                 $owningAgencyId = OA_Permission::getAgencyId();
             } else {
                 $owningAgencyId = 0;
                 if ($currentAccountType == OA_ACCOUNT_ADVERTISER) {
                     $doClients = OA_Dal::factoryDO('clients');
                     $doClients->account_id = $accountId;
                     $doClients->find();
                     if ($doClients->getRowCount() == 1) {
                         $aOwningAgencyId = $doClients->getAll(array('agencyid'), false, true);
                         $owningAgencyId = $aOwningAgencyId[0];
                     }
                 } else {
                     if ($currentAccountType == OA_ACCOUNT_TRAFFICKER) {
                         $doAffiliates = OA_Dal::factoryDO('affiliates');
                         $doAffiliates->account_id = $accountId;
                         $doAffiliates->find();
                         if ($doAffiliates->getRowCount() == 1) {
                             $aOwningAgencyId = $doAffiliates->getAll(array('agencyid'), false, true);
                             $owningAgencyId = $aOwningAgencyId[0];
                         }
                     }
                 }
             }
             if ($owningAgencyId == 0) {
                 OA_Preferences::_unsetPreferences();
                 return;
             }
             $doAgency = OA_Dal::factoryDO('agency');
             $doAgency->agencyid = $owningAgencyId;
             $doAgency->find();
             if ($doAgency->getRowCount() == 1) {
                 // The manager account "owning" the advertiser or
                 // trafficker account has some preferences that
                 // override the admin account preferences
                 $aManagerAccountId = $doAgency->getAll(array('account_id'), false, true);
                 $managerAccountId = $aManagerAccountId[0];
                 // Get the manager account's preference values
                 $aManagerPreferenceValues = OA_Preferences::_getPreferenceValues($managerAccountId);
                 // Merge the preference values into the temporary
                 // storage array for preferences
                 OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aManagerPreferenceValues, $loadExtraInfo);
             }
             if (!$parentOnly) {
                 // Get the current account's ID
                 if (!is_numeric($accountId)) {
                     $currentAccountId = OA_Permission::getAccountId();
                 } else {
                     $currentAccountId = $accountId;
                 }
                 if ($currentAccountId <= 0) {
                     OA_Preferences::_unsetPreferences();
                     return;
                 }
                 // Get the current account's preference values
                 $aCurrentPreferenceValues = OA_Preferences::_getPreferenceValues($currentAccountId);
                 // Merge the preference values into the temporary
                 // storage array for preferences
                 OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aCurrentPreferenceValues, $loadExtraInfo);
             }
         }
     }
     // Set the initial (default) language to conf value or english
     $aPreferences['language'] = !empty($aConf['max']['language']) ? $aConf['max']['language'] : 'en';
     // Add user preferences (currently language) to the prefs array
     if ($userId = OA_Permission::getUserId()) {
         $doUser = OA_Dal::factoryDO('users');
         $doUser->get('user_id', $userId);
         if (!empty($doUser->language)) {
             $aPreferences['language'] = $doUser->language;
         }
     }
     // Return or store the preferences
     if ($return) {
         return $aPreferences;
     } else {
         $GLOBALS['_MAX']['PREF'] = $aPreferences;
     }
 }
Ejemplo n.º 15
0
function displayPage($channel, $form)
{
    $pageName = basename($_SERVER['PHP_SELF']);
    $agencyId = OA_Permission::getAgencyId();
    // Obtain the needed data
    if (!empty($channel['affiliateid'])) {
        $aEntities = array('agencyid' => $agencyId, 'affiliateid' => $channel['affiliateid'], 'channelid' => $channel['channelid']);
        // Editing a channel at the publisher level; Only use the
        // channels at this publisher level for the navigation bar
        $aOtherChannels = Admin_DA::getChannels(array('publisher_id' => $channel['affiliateid']));
    } else {
        $aEntities = array('agencyid' => $agencyId, 'channelid' => $channel['channelid']);
        // Editing a channel at the agency level; Only use the
        // channels at this agency level for the navigation bar
        $aOtherChannels = Admin_DA::getChannels(array('agency_id' => $agencyId, 'channel_type' => 'agency'));
    }
    //show header and breadcrumbs
    MAX_displayNavigationChannel($pageName, $aOtherChannels, $aEntities);
    //get template and display form
    $oTpl = new OA_Admin_Template('channel-edit.html');
    $oTpl->assign('form', $form->serialize());
    $oTpl->assign('formId', $form->getId());
    $oTpl->display();
    //show footer
    phpAds_PageFooter();
}
Ejemplo n.º 16
0
 /**
  * PHP4 constructor
  */
 function __construct()
 {
     $this->_publisherId = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : false;
     $this->_advertiserId = OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) ? OA_Permission::getEntityId() : false;
     $this->_agencyId = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? false : OA_Permission::getAgencyId();
 }
function buildHeaderModel($aEntities)
{
    global $phpAds_TextDirection;
    $aConf = $GLOBALS['_MAX']['CONF'];
    $advertiserId = $aEntities['clientid'];
    $campaignId = $aEntities['campaignid'];
    $agencyId = OA_Permission::getAgencyId();
    $entityString = _getEntityString($aEntities);
    $aOtherEntities = $aEntities;
    unset($aOtherEntities['campaignid']);
    $otherEntityString = _getEntityString($aOtherEntities);
    $advertiser = phpAds_getClientDetails($advertiserId);
    $advertiserName = $advertiser['clientname'];
    $campaignDetails = Admin_DA::getPlacement($campaignId);
    $campaignName = $campaignDetails['name'];
    if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
        $campaignEditUrl = "campaign-edit.php?clientid={$advertiserId}&campaignid={$campaignId}";
    }
    $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder();
    $oHeaderModel = $builder->buildEntityHeader(array(array('name' => $advertiserName, 'url' => '', 'id' => $advertiserId, 'entities' => getAdvertiserMap($agencyId), 'htmlName' => 'clientid'), array('name' => $campaignName, 'url' => $campaignEditUrl, 'id' => $campaignId, 'entities' => getCampaignMap($advertiserId), 'htmlName' => 'campaignid'), array('name' => '')), 'banners', 'list');
    return $oHeaderModel;
}
Ejemplo n.º 18
0
 /**
  * PHP4 constructor
  */
 function Admin_UI_OrganisationScope()
 {
     $this->_publisherId = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : false;
     $this->_advertiserId = OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) ? OA_Permission::getEntityId() : false;
     $this->_agencyId = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? false : OA_Permission::getAgencyId();
 }
function getWebsiteMap()
{
    $doAffiliates = OA_Dal::factoryDO('affiliates');
    if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        //should this constraint be added always instead of only for managers?
        $doAffiliates->agencyid = OA_Permission::getAgencyId();
    }
    if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
        $doAffiliates->agencyid = OA_Permission::getEntityId();
    }
    $doAffiliates->addSessionListOrderBy($sortPageName);
    $doAffiliates->find();
    $aWebsiteMap = array();
    while ($doAffiliates->fetch() && ($row = $doAffiliates->toArray())) {
        $aWebsiteMap[$row['affiliateid']] = array('name' => $row['name'], 'url' => "affiliate-edit.php?affiliateid=" . $row['affiliateid']);
    }
    return $aWebsiteMap;
}
Ejemplo n.º 20
0
// Authorize the user
OA_Start();
// Load the account's preferences
OA_Preferences::loadPreferences();
$pref = $GLOBALS['_MAX']['PREF'];
// Set time zone to local
OA_setTimeZoneLocal();
// Load the required language files
Language_Loader::load('default');
// Register variables
phpAds_registerGlobalUnslashed('affiliateid', 'agencyid', 'bannerid', 'campaignid', 'channelid', 'clientid', 'day', 'trackerid', 'userlogid', 'zoneid');
if (!isset($affiliateid)) {
    $affiliateid = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : '';
}
if (!isset($agencyid)) {
    $agencyid = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? '' : OA_Permission::getAgencyId();
}
if (!isset($bannerid)) {
    $bannerid = '';
}
if (!isset($campaignid)) {
    $campaignid = '';
}
if (!isset($channelid)) {
    $channelid = '';
}
if (!isset($clientid)) {
    $clientid = OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) ? OA_Permission::getEntityId() : '';
}
if (!isset($day)) {
    $day = '';
 function _getPublishers()
 {
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
         if ($this->_filter == FILTER_TRACKER_PRESENT) {
             $aParams = array();
             $aTrackers = Admin_DA::getTrackers($aParams, false, 'advertiser_id');
             $aParams = array('advertiser_id' => implode(',', array_keys($aTrackers)));
             $aPlacementZones = Admin_DA::getPlacementZones($aParams, false, 'zone_id');
             $aAdZones = Admin_DA::getAdZones($aParams, false, 'zone_id');
             $aParams = array('zone_id' => implode(',', array_keys($aPlacementZones + $aAdZones)));
             $aPublishers = Admin_DA::getPublishers($aParams);
         } else {
             $aParams = array();
             $aPublishers = Admin_DA::getPublishers($aParams);
         }
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         if ($this->_filter == FILTER_TRACKER_PRESENT) {
             $aParams = array('agency_id' => OA_Permission::getEntityId());
             $aTrackers = Admin_DA::getTrackers($aParams, false, 'advertiser_id');
             $aParams = array('advertiser_id' => implode(',', array_keys($aTrackers)));
             $aPlacementZones = Admin_DA::getPlacementZones($aParams, false, 'zone_id');
             $aAdZones = Admin_DA::getAdZones($aParams, false, 'zone_id');
             $aParams = array('zone_id' => implode(',', array_keys($aPlacementZones + $aAdZones)));
             $aPublishers = Admin_DA::getPublishers($aParams);
         } else {
             $aParams = array('agency_id' => OA_Permission::getEntityId());
             $aPublishers = Admin_DA::getPublishers($aParams);
         }
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         if ($this->_filter == FILTER_TRACKER_PRESENT) {
             $aParams = array('agency_id' => OA_Permission::getAgencyId());
             $aTrackers = Admin_DA::getTrackers($aParams, false, 'advertiser_id');
             $aParams = array('advertiser_id' => implode(',', array_keys($aTrackers)));
             $aPlacementZones = Admin_DA::getAdZones($aParams, false, 'zone_id');
             $aAdZones = Admin_DA::getAdZones($aParams, false, 'zone_id');
             $aParams = array('publisher_id' => OA_Permission::getEntityId(), 'zone_id' => implode(',', array_keys($aPlacementZones + $aAdZones)));
             $aPublishers = Admin_DA::getPublishers($aParams);
         } else {
             $aParams = array('publisher_id' => OA_Permission::getEntityId());
             $aPublishers = Admin_DA::getPublishers($aParams);
         }
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $aPublishers = array();
         if ($this->_filter == FILTER_TRACKER_PRESENT) {
             $aParams = array('advertiser_id' => OA_Permission::getEntityId());
             $aTrackers = Admin_DA::getTrackers($aTrackers, 'advertiser_id');
             if (!empty($aTrackers)) {
                 $aParams = array('advertiser_id' => OA_Permission::getEntityId(), 'placement_anonymous' => 'f');
                 $aPlacementZones = Admin_DA::getPlacementZones($aParams, false, 'zone_id');
                 $aAdZones = Admin_DA::getAdZones($aParams, false, 'zone_id');
                 $aZones = $aPlacementZones + $aAdZones;
                 if (!empty($aZones)) {
                     $aParams = array('zone_id' => implode(',', array_keys($aZones)));
                     $aPublishers = Admin_DA::getPublishers($aParams);
                 }
             }
         } else {
             $aParams = array('advertiser_id' => OA_Permission::getEntityId(), 'placement_anonymous' => 'f');
             $aPlacementZones = Admin_DA::getPlacementZones($aParams, false, 'zone_id');
             $aAdZones = Admin_DA::getAdZones($aParams, false, 'zone_id');
             $aZones = $aPlacementZones + $aAdZones;
             if (!empty($aZones)) {
                 $aParams = array('zone_id' => implode(',', array_keys($aZones)));
                 $aPublishers = Admin_DA::getPublishers($aParams);
             }
         }
     }
     // order the array by publisher name
     foreach ($aPublishers as $key => $row) {
         $name[$key] = strtolower($row['name']);
     }
     array_multisort($name, SORT_ASC, $aPublishers);
     // rewrite the array to preserve key
     foreach ($aPublishers as $row) {
         $aPublishersTmp[$row['publisher_id']] = $row;
     }
     $aPublishers = $aPublishersTmp;
     return $aPublishers;
 }
Ejemplo n.º 22
0
 /**
  * Post init session
  *
  */
 function postInitSession()
 {
     global $session, $pref;
     global $affiliateid, $agencyid, $bannerid, $campaignid, $channelid;
     global $clientid, $day, $trackerid, $userlogid, $zoneid;
     // Overwrite certain preset preferences
     if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) {
         $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language'];
     }
     // Load the user preferences from the database
     OA_Preferences::loadPreferences();
     // Load the required language files
     Language_Loader::load('default');
     // Register variables
     phpAds_registerGlobalUnslashed('affiliateid', 'agencyid', 'bannerid', 'campaignid', 'channelid', 'clientid', 'day', 'trackerid', 'userlogid', 'zoneid');
     if (!isset($affiliateid)) {
         $affiliateid = '';
     }
     if (!isset($agencyid)) {
         $agencyid = OA_Permission::getAgencyId();
     }
     if (!isset($bannerid)) {
         $bannerid = '';
     }
     if (!isset($campaignid)) {
         $campaignid = '';
     }
     if (!isset($channelid)) {
         $channelid = '';
     }
     if (!isset($clientid)) {
         $clientid = '';
     }
     if (!isset($day)) {
         $day = '';
     }
     if (!isset($trackerid)) {
         $trackerid = '';
     }
     if (!isset($userlogid)) {
         $userlogid = '';
     }
     if (!isset($zoneid)) {
         $zoneid = '';
     }
 }
Ejemplo n.º 23
0
 /**
  * Cleans up the session and carry on any additional tasks required to logout the user
  *
  */
 function logout()
 {
     phpAds_SessionDataDestroy();
     $dalAgency = OA_Dal::factoryDAL('agency');
     header("Location: " . $dalAgency->getLogoutUrl(OA_Permission::getAgencyId()));
     exit;
 }
Ejemplo n.º 24
0
function displayPage($zone, $form, $zoneErrors = null)
{
    //header and breadcrumbs
    $pageName = basename($_SERVER['PHP_SELF']);
    $agencyId = OA_Permission::getAgencyId();
    $aEntities = array('affiliateid' => $zone['affiliateid'], 'zoneid' => $zone['zoneid']);
    $aOtherPublishers = Admin_DA::getPublishers(array('agency_id' => $agencyId));
    $aOtherZones = Admin_DA::getZones(array('publisher_id' => $zone['affiliateid']));
    MAX_displayNavigationZone($pageName, $aOtherPublishers, $aOtherZones, $aEntities);
    //get template and display form
    $oTpl = new OA_Admin_Template('zone-edit.html');
    $oTpl->assign('zoneid', $zone['zoneid']);
    $oTpl->assign('zoneHeight', $zone["height"]);
    $oTpl->assign('zoneWidth', $zone["width"]);
    $oTpl->assign('zoneErrors', $zoneErrors);
    $oTpl->assign('form', $form->serialize());
    $oTpl->display();
    //footer
    phpAds_PageFooter();
}
Ejemplo n.º 25
0
function _getChainZones($aZone)
{
    // Get list of zones to link to
    $doZones = OA_Dal::factoryDO('zones');
    $allowothersizes = $aZone['delivery'] == phpAds_ZoneInterstitial || $aZone['delivery'] == phpAds_ZonePopup;
    if ($aZone['width'] != -1 && !$allowothersizes) {
        $doZones->width = $aZone['width'];
    }
    if ($aZone['height'] != -1 && !$allowothersizes) {
        $doZones->height = $aZone['height'];
    }
    $doZones->delivery = $aZone['delivery'];
    $doZones->whereAdd('zoneid <> ' . $aZone['zoneid']);
    // Limit the list of zones to the appropriate list
    if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        $doAffiliates = OA_Dal::factoryDO('affiliates');
        $doAffiliates->agencyid = OA_Permission::getAgencyId();
        $doZones->joinAdd($doAffiliates);
    } else {
        $doZones->whereAdd('affiliateid = ' . $aZone['affiliateid']);
    }
    $doZones->find();
    $aChainZones = array();
    while ($doZones->fetch() && ($row = $doZones->toArray())) {
        $aChainZones[$row['zoneid']] = $row['zonename'];
    }
    return $aChainZones;
}
 /**
  * Generate the HTML option
  *
  * @return string    A string containing html for option
  */
 function campaignid()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     if ($mi->zone_invocation || OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
         return null;
     }
     $option = '';
     // Display available campaigns...
     $option .= "<tr bgcolor='#F6F6F6'><td width='30'>&nbsp;</td>\n";
     $option .= "<td width='200'>" . $GLOBALS['strInvocationCampaignID'] . "</td><td width='370'>\n";
     $option .= "<select name='campaignid' style='width:350px;' tabindex='" . $mi->tabindex++ . "'>\n";
     $option .= "<option value='0'>-</option>\n";
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
         $query = "SELECT campaignid,campaignname" . " FROM " . $conf['table']['prefix'] . $conf['table']['campaigns'];
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $query = "SELECT m.campaignid AS campaignid" . ",m.campaignname AS campaignname" . " FROM " . $conf['table']['prefix'] . $conf['table']['campaigns'] . " AS m" . "," . $conf['table']['prefix'] . $conf['table']['clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND c.agencyid=" . OA_Permission::getAgencyId();
     }
     $oDbh = OA_DB::singleton();
     $aResult = $oDbh->queryAll($query);
     if (PEAR::isError($aResult)) {
         $option .= "<option value='0'>'.{$aResult->getUserInfo}().'</option>\n";
     } else {
         foreach ($aResult as $k => $row) {
             $option .= "<option value='" . $row['campaignid'] . "'" . ($mi->campaignid == $row['campaignid'] ? ' selected' : '') . ">";
             $option .= phpAds_buildName($row['campaignid'], $row['campaignname']);
             $option .= "</option>\n";
         }
     }
     $option .= "</select>\n";
     $option .= "</td></tr>";
     $option .= "<tr bgcolor='#F6F6F6'><td height='10' colspan='3'>&nbsp;</td></tr>";
     $option .= "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
     $option .= "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
     return $option;
 }
Ejemplo n.º 27
0
| along with this program; if not, write to the Free Software               |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA |
+---------------------------------------------------------------------------+
$Id: campaign-zone-link.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/config.php';
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/CampaignZoneLink.php';
phpAds_registerGlobalUnslashed('action', 'campaignid', 'allSelected', 'category-linked', 'category-available', 'text-linked', 'text-available');
$agencyId = OA_Permission::getAgencyId();
$oDalZones = OA_Dal::factoryDAL('zones');
$action = $GLOBALS["action"];
$campaignId = $GLOBALS['campaignid'];
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
$aZonesIds = array();
$aZonesIdsHash = array();
foreach ($_REQUEST['ids'] as $zone) {
    if (substr($zone, 0, 1) == 'z') {
        $aZonesIds[] = substr($zone, 1);
        $aZonesIdsHash[substr($zone, 1)] = "x";
    }
}
// If we're requested to link all matching zones, we need to determine the ids to link
// Ideally, there should be a DAL method to that directly. Note that we're replacing
Ejemplo n.º 28
0
function displayPage($tracker, $form)
{
    //header and breadcrumbs
    if ($tracker['trackerid'] != "") {
        $doClients = OA_Dal::factoryDO('clients');
        $doClients->whereAdd('clientid <>' . $tracker['clientid']);
        if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
            $doClients->agencyid = OA_Permission::getAgencyId();
        }
        $doClients->find();
        $aOtherAdvertisers = array();
        while ($doClients->fetch() && ($row = $doClients->toArray())) {
            $aOtherAdvertisers[] = $row;
        }
        MAX_displayNavigationTracker($tracker['clientid'], $tracker['trackerid'], $aOtherAdvertisers);
    } else {
        // New tracker
        $oHeaderModel = MAX_displayTrackerBreadcrumbs($tracker['clientid'], null);
        phpAds_PageHeader("tracker-edit_new", $oHeaderModel);
    }
    //get template and display form
    $oTpl = new OA_Admin_Template('tracker-edit.html');
    $oTpl->assign('form', $form->serialize());
    $oTpl->assign('formId', $form->getId());
    $oTpl->display();
    //footer
    phpAds_PageFooter();
}
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        // unset variables!
        unset($session['prefs']['tracker-variables.php']);
        phpAds_SessionDataStore();
        // Rebuild cache
        // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
        // phpAds_CacheDelete('what=tracker:' . $trackerid);
        // redirect to the next page
        header("Location: tracker-variables.php?clientid=" . $clientid . "&trackerid=" . $trackerid);
        exit;
    }
}
$doClients = OA_Dal::factoryDO('clients');
$doClients->whereAdd('clientid <>' . $trackerid);
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
    $doClients->agencyid = OA_Permission::getAgencyId();
}
$doClients->find();
$aOtherAdvertisers = array();
while ($doClients->fetch() && ($row = $doClients->toArray())) {
    $aOtherAdvertisers[] = $row;
}
MAX_displayNavigationTracker($clientid, $trackerid, $aOtherAdvertisers);
//Start
$tabindex = 0;
if (isset($trackerid) && $trackerid != '') {
    echo "<form action='" . $_SERVER['SCRIPT_NAME'] . "?clientid={$clientid}&trackerid={$trackerid}' method='post' onsubmit='return m3_hideShowSubmit()'>\n";
    echo "<input type='hidden' name='submit' value='true'>";
    echo "<input type='image' name='dummy' src='" . OX::assetPath() . "/images/spacer.gif' border='0' width='1' height='1'>\n";
    echo "<br /><br />\n";
    echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>" . "\n";
Ejemplo n.º 30
0
function displayPage($campaign, $campaignForm, $statusForm, $campaignErrors = null)
{
    global $conf;
    //header and breadcrumbs
    if ($campaign['campaignid'] != "") {
        //edit campaign
        // Initialise some parameters
        $tabindex = 1;
        $agencyId = OA_Permission::getAgencyId();
        $aEntities = array('clientid' => $campaign['clientid'], 'campaignid' => $campaign['campaignid']);
        // Display navigation
        $aOtherAdvertisers = Admin_DA::getAdvertisers(array('agency_id' => $agencyId));
        $aOtherCampaigns = Admin_DA::getPlacements(array('advertiser_id' => $campaign['clientid']));
        MAX_displayNavigationCampaign($campaign['campaignid'], $aOtherAdvertisers, $aOtherCampaigns, $aEntities);
    } else {
        //new campaign
        $advertiser = phpAds_getClientDetails($campaign['clientid']);
        $advertiserName = $advertiser['clientname'];
        $advertiserEditUrl = "advertiser-edit.php?clientid=" . $campaign['clientid'];
        // New campaign
        $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder();
        $oHeaderModel = $builder->buildEntityHeader(array(array("name" => $advertiserName, "url" => $advertiserEditUrl), array("name" => "")), "campaign", "edit-new");
        phpAds_PageHeader("campaign-edit_new", $oHeaderModel);
    }
    //get template and display form
    $oTpl = new OA_Admin_Template('campaign-edit.html');
    $oTpl->assign('clientid', $campaign['clientid']);
    $oTpl->assign('campaignid', $campaign['campaignid']);
    $oTpl->assign('calendarBeginOfWeek', $GLOBALS['pref']['begin_of_week'] ? 1 : 0);
    $oTpl->assign('language', $GLOBALS['_MAX']['PREF']['language']);
    $oTpl->assign('conversionsEnabled', $conf['logging']['trackerImpressions']);
    $oTpl->assign('adDirectEnabled', defined('OA_AD_DIRECT_ENABLED') && OA_AD_DIRECT_ENABLED === true);
    $oTpl->assign('impressionsDelivered', isset($campaign['impressions_delivered']) ? $campaign['impressions_delivered'] : 0);
    $oTpl->assign('clicksDelivered', isset($campaign['clicks_delivered']) ? $campaign['clicks_delivered'] : 0);
    $oTpl->assign('conversionsDelivered', isset($campaign['conversions_delivered']) ? $campaign['conversions_delivered'] : 0);
    $oTpl->assign('strCampaignWarningNoTargetMessage', str_replace("\n", '\\n', addslashes($GLOBALS['strCampaignWarningNoTarget'])));
    $oTpl->assign('strCampaignWarningRemnantNoWeight', str_replace("\n", '\\n', addslashes($GLOBALS['strCampaignWarningRemnantNoWeight'])));
    $oTpl->assign('strCampaignWarningEcpmNoRevenue', str_replace("\n", '\\n', addslashes($GLOBALS['strCampaignWarningEcpmNoRevenue'])));
    $oTpl->assign('strCampaignWarningExclusiveNoWeight', str_replace("\n", '\\n', addslashes($GLOBALS['strCampaignWarningExclusiveNoWeight'])));
    $oTpl->assign('campaignErrors', $campaignErrors);
    $oTpl->assign('CAMPAIGN_TYPE_REMNANT', OX_CAMPAIGN_TYPE_REMNANT);
    $oTpl->assign('CAMPAIGN_TYPE_CONTRACT_NORMAL', OX_CAMPAIGN_TYPE_CONTRACT_NORMAL);
    $oTpl->assign('CAMPAIGN_TYPE_CONTRACT_EXCLUSIVE', OX_CAMPAIGN_TYPE_CONTRACT_EXCLUSIVE);
    $oTpl->assign('CAMPAIGN_TYPE_ECPM', OX_CAMPAIGN_TYPE_ECPM);
    $oTpl->assign('CAMPAIGN_TYPE_CONTRACT_ECPM', OX_CAMPAIGN_TYPE_CONTRACT_ECPM);
    $oTpl->assign('PRIORITY_ECPM_FROM', DataObjects_Campaigns::PRIORITY_ECPM_FROM);
    $oTpl->assign('PRIORITY_ECPM_TO', DataObjects_Campaigns::PRIORITY_ECPM_TO);
    $oTpl->assign('MODEL_CPM', MAX_FINANCE_CPM);
    $oTpl->assign('MODEL_CPC', MAX_FINANCE_CPC);
    $oTpl->assign('MODEL_CPA', MAX_FINANCE_CPA);
    if ($conf['logging']['trackerImpressions']) {
        $oTpl->assign('MODEL_MT', MAX_FINANCE_MT);
    }
    $oTpl->assign('campaignFormId', $campaignForm->getId());
    $oTpl->assign('campaignForm', $campaignForm->serialize());
    if (!empty($campaign['campaignid']) && defined('OA_AD_DIRECT_ENABLED') && OA_AD_DIRECT_ENABLED === true) {
        $oTpl->assign('statusForm', $statusForm->serialize());
    }
    $oTpl->display();
    _echoDeliveryCappingJs();
    //footer
    phpAds_PageFooter();
}