/**
  * The final "child" implementation of the parental abstract method.
  *
  * @see OA_Admin_Statistics_Common::start()
  */
 function start()
 {
     // Get the preferences
     $aPref = $GLOBALS['_MAX']['PREF'];
     // Get parameters
     $advertiserId = $this->_getId('advertiser');
     $placementId = $this->_getId('placement');
     // Security check
     OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
     $this->_checkAccess(array('advertiser' => $advertiserId, 'placement' => $placementId));
     // Add standard page parameters
     $this->aPageParams = array('clientid' => $advertiserId, 'campaignid' => $placementId);
     // Load the period preset and stats breakdown parameters
     $this->_loadPeriodPresetParam();
     $this->_loadStatsBreakdownParam();
     // Load $_GET parameters
     $this->_loadParams();
     // HTML Framework
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $this->pageId = '2.1.2.2';
         $this->aPageSections = array('2.1.2.1', '2.1.2.2', '2.1.2.3', '2.1.2.4');
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $this->pageId = '1.2.2';
         $this->aPageSections = array('1.2.1', '1.2.2', '1.2.3');
     }
     // Add breadcrumbs
     $this->_addBreadcrumbs('campaign', $placementId);
     // Add context
     $this->aPageContext = array('campaigns', $placementId);
     // Add shortcuts
     if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $this->_addShortcut($GLOBALS['strClientProperties'], 'advertiser-edit.php?clientid=' . $advertiserId, 'images/icon-advertiser.gif');
     }
     $this->_addShortcut($GLOBALS['strCampaignProperties'], 'campaign-edit.php?clientid=' . $advertiserId . '&campaignid=' . $placementId, 'images/icon-campaign.gif');
     $this->hideInactive = MAX_getStoredValue('hideinactive', $aPref['ui_hide_inactive'] == true, null, true);
     $this->showHideInactive = true;
     $this->startLevel = 0;
     // 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;
     $aParams['placement_id'] = $placementId;
     $this->aEntitiesData = $this->getBanners($aParams, $this->startLevel, $expand);
     // Summarise the values into a the totals array, & format
     $this->_summariseTotalsAndFormat($this->aEntitiesData);
     $this->showHideLevels = array();
     $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveBannersHidden']}";
     // Save prefs
     $this->aPagePrefs['startlevel'] = $this->startLevel;
     $this->aPagePrefs['nodes'] = implode(",", $this->aNodes);
     $this->aPagePrefs['hideinactive'] = $this->hideInactive;
     $this->aPagePrefs['startlevel'] = $this->startLevel;
 }
 /**
  * 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;
 }
 /**
  * The final "child" implementation of the parental abstract method.
  *
  * @see OA_Admin_Statistics_Common::start()
  */
 function start()
 {
     // Get the preferences
     $aPref = $GLOBALS['_MAX']['PREF'];
     // Get parameters
     $publisherId = $this->_getId('publisher');
     $zoneId = $this->_getId('zone');
     // Security check
     OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_TRAFFICKER);
     $this->_checkAccess(array('publisher' => $publisherId, 'zone' => $zoneId));
     // Add standard page parameters
     $this->aPageParams = array('affiliateid' => $publisherId, 'zoneid' => $zoneId);
     // Load the period preset and stats breakdown parameters
     $this->_loadPeriodPresetParam();
     $this->_loadStatsBreakdownParam();
     // Load $_GET parameters
     $this->_loadParams();
     // HTML Framework
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $this->pageId = '2.4.2.2';
         $this->aPageSections = array('2.4.2.1', '2.4.2.2');
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $this->pageId = '1.2.2';
         $this->aPageSections = array('1.2.1', '1.2.2');
     }
     // Add breadcrumbs
     $this->_addBreadcrumbs('zone', $zoneId);
     // Add context
     $this->aPageContext = array('zones', $zoneId);
     // Add shortcuts
     if (!OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $this->_addShortcut($GLOBALS['strAffiliateProperties'], 'affiliate-edit.php?affiliateid=' . $publisherId, 'images/icon-affiliate.gif');
     }
     $this->_addShortcut($GLOBALS['strZoneProperties'], 'zone-edit.php?affiliateid=' . $publisherId . '&zoneid=' . $zoneId, 'images/icon-zone.gif');
     // Fix entity links
     $this->entityLinks['c'] = 'stats.php?entity=zone&breakdown=campaign-history';
     $this->entityLinks['b'] = 'stats.php?entity=zone&breakdown=banner-history';
     $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;
     $aParams['zone_id'] = $zoneId;
     switch ($this->startLevel) {
         case 1:
             $this->aEntitiesData = $this->getBanners($aParams, $this->startLevel, $expand, true);
             break;
         default:
             $this->startLevel = 0;
             $this->aEntitiesData = $this->getCampaigns($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['strShowParentCampaigns'], 'icon' => 'images/icon-campaign.gif'));
             $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveBannersHidden']}";
             break;
         case 0:
             $this->showHideLevels = array(1 => array('text' => $GLOBALS['strHideParentCampaigns'], 'icon' => 'images/icon-campaign-d.gif'));
             $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveCampaignsHidden']}";
             break;
     }
     // Add standard page parameters
     $this->aPageParams = array('affiliateid' => $publisherId, 'zoneid' => $zoneId);
     $this->aPageParams['period_preset'] = MAX_getStoredValue('period_preset', 'today');
     $this->aPageParams['statsBreakdown'] = htmlspecialchars(MAX_getStoredValue('statsBreakdown', 'day'));
     $this->_loadParams();
     // Save prefs
     $this->aPagePrefs['startlevel'] = $this->startLevel;
     $this->aPagePrefs['nodes'] = implode(",", $this->aNodes);
     $this->aPagePrefs['hideinactive'] = $this->hideInactive;
     $this->aPagePrefs['startlevel'] = $this->startLevel;
 }
Esempio n. 4
0
 /**
  * Get zone stats
  *
  * @param array Query parameters
  * @param int Tree level
  * @param string Expand GET parameter, used only when called from other get methods
  * @return Entities array
  */
 function getZones($aParams, $level, $expand)
 {
     $aParams['exclude'] = array('ad_id');
     $aParams['include'] = array('publisher_id');
     $this->prepareData($aParams);
     $period_preset = MAX_getStoredValue('period_preset', 'today');
     $aZones = $this->mergeData($aParams, 'zone_id');
     MAX_sortArray($aZones, $this->listOrderField == 'id' ? 'zone_id' : $this->listOrderField, $this->listOrderDirection == 'up');
     $aEntitiesData = array();
     foreach ($aZones as $zoneId => $zone) {
         $zone['active'] = $this->_hasActiveStats($zone);
         if ($this->startLevel > $level || !$this->hideInactive || $zone['active']) {
             $this->_summarizeStats($zone);
             $zone['prefix'] = 'z';
             $zone['id'] = $zoneId;
             $zone['linkparams'] = "affiliateid={$zone['publisher_id']}&zoneid={$zoneId}&";
             if (is_array($aParams) && count($aParams) > 0) {
                 foreach ($aParams as $key => $value) {
                     if ($key != "include" && $key != "exclude") {
                         $zone['linkparams'] .= $key . "=" . $value . "&";
                     }
                 }
             } else {
                 $zone['linkparams'] .= "&";
             }
             $zone['linkparams'] .= "period_preset={$period_preset}&period_start=" . MAX_getStoredValue('period_start', date('Y-m-d')) . "&period_end=" . MAX_getStoredValue('period_end', date('Y-m-d'));
             $zone['expanded'] = MAX_isExpanded($zoneId, $expand, $this->aNodes, $zone['prefix']);
             $zone['icon'] = MAX_getEntityIcon('zone', $zone['active'], $zone['type']);
             if ($zone['type'] == MAX_ZoneMarketMigrated) {
                 $zone['html-append'] = $this->getHtmlHelpLink('help-market-zone-migrated-from-pre-283');
                 $zone['name'] = $GLOBALS['strMarketZoneBeforeOpenX2.8.4'];
             }
             $aEntitiesData[] = $zone;
         } elseif ($this->startLevel == $level) {
             $this->hiddenEntities++;
         }
     }
     return $aEntitiesData;
 }
}
if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
    $aParams['website_account_id'] = OA_Permission::getAccountId();
}
$oUserlog = new OA_Dll_Audit();
$aAuditData = $oUserlog->getAuditLog($aParams);
$aParams['totalItems'] = count($aAuditData);
if (!isset($pageID) || $pageID == 1) {
    $aParams['startRecord'] = 0;
} else {
    $aParams['startRecord'] = $pageID * $setPerPage - $setPerPage;
}
if ($aParams['startRecord'] > $aParams['totalItems']) {
    $aParams['startRecord'] = 0;
}
$aParams['perPage'] = MAX_getStoredValue('setPerPage', 10);
// Retrieve audit details
$aAuditData = $oUserlog->getAuditLog($aParams);
$pager =& Pager::factory($aParams);
$per_page = $pager->_perPage;
$pager->history = $pager->getPageData();
$pager->pagerLinks = $pager->getLinks();
$pager->pagerLinks = $pager->pagerLinks['all'];
$pager->pagerSelect = preg_replace('/(<select.*?)(>)/i', '$1 onchange="submitForm()" id="setPerPage"$2', $pager->getPerPageSelectBox(10, 100, 10));
// Build column header link params
$aAllowdParams = array('advertiserId', 'campaignId', 'publisherId', 'zoneId');
foreach ($aAllowdParams as $key) {
    if (!empty(${$key})) {
        $aUrlParam[$key] = "{$key}=" . ${$key};
    }
}
Esempio n. 6
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'];
     // Get parameters
     $advertiserId = $this->_getId('advertiser');
     $placementId = $this->_getId('placement');
     $adId = $this->_getId('ad');
     // Security check
     OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
     $this->_checkAccess(array('advertiser' => $advertiserId, 'placement' => $placementId, 'ad' => $adId));
     // Add standard page parameters
     $this->aPageParams = array('clientid' => $advertiserId, 'campaignid' => $placementId, 'bannerid' => $adId);
     // Load the period preset and stats breakdown parameters
     $this->_loadPeriodPresetParam();
     $this->_loadStatsBreakdownParam();
     // Load $_GET parameters
     $this->_loadParams();
     // HTML Framework
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $this->pageId = '2.1.2.2.2';
         $this->aPageSections = array('2.1.2.2.1', '2.1.2.2.2', '2.1.2.2.3');
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $this->pageId = '1.2.2.4';
         $this->aPageSections[] = '1.2.2.1';
         if (OA_Permission::hasPermission(OA_PERM_BANNER_EDIT)) {
             $this->aPageSections[] = '1.2.2.2';
         }
         $this->aPageSections[] = '1.2.2.4';
     }
     // Add breadcrumbs
     $this->_addBreadcrumbs('banner', $adId);
     // Add context
     $this->aPageContext = array('banners', $adId);
     // Add shortcuts
     if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $this->_addShortcut($GLOBALS['strClientProperties'], 'advertiser-edit.php?clientid=' . $advertiserId, 'images/icon-advertiser.gif');
     }
     $this->_addShortcut($GLOBALS['strCampaignProperties'], 'campaign-edit.php?clientid=' . $advertiserId . '&campaignid=' . $placementId, 'images/icon-campaign.gif');
     $this->_addShortcut($GLOBALS['strBannerProperties'], 'banner-edit.php?clientid=' . $advertiserId . '&campaignid=' . $placementId . '&bannerid=' . $adId, 'images/icon-banner-stored.gif');
     $this->_addShortcut($GLOBALS['strModifyBannerAcl'], 'banner-acl.php?clientid=' . $advertiserId . '&campaignid=' . $placementId . '&bannerid=' . $adId, 'images/icon-acl.gif');
     // Fix entity links
     $this->entityLinks['p'] = 'stats.php?entity=banner&breakdown=affiliate-history';
     $this->entityLinks['z'] = 'stats.php?entity=banner&breakdown=zone-history';
     $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 = array();
     $aParams['ad_id'] = $adId;
     switch ($this->startLevel) {
         case 1:
             $this->aEntitiesData = $this->getZones($aParams, $this->startLevel, $expand, true);
             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;
 }
$aParams = array();
$aParams['clientid'] = $clientId;
$aParams['campaignid'] = $campaignId;
$aParams['bannerid'] = $bannerId;
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
if (!empty($day)) {
    // Reset period
    $period_preset = '';
    // Always refresh howLong and hour
    $howLong = MAX_getValue('howLong', 'd');
    $hour = MAX_getValue('hour');
} else {
    $period_preset = MAX_getStoredValue('period_preset', 'today');
    $period_start = MAX_getStoredValue('period_start', date('Y-m-d'));
    $period_end = MAX_getStoredValue('period_end', date('Y-m-d'));
}
if (!empty($period_preset)) {
    $aDates = MAX_getDatesByPeriod($period_preset, $period_start, $period_end);
} else {
    $aDates = array();
    $oDayDate = new Date();
    $oDayDate->setDate($day, DATE_FORMAT_TIMESTAMP);
    if (!empty($hour)) {
        // If hour is set build day date including hour
        $aDates['day_hour'] = $oDayDate->format('%Y-%m-%d') . ' ' . $hour;
    } else {
        // Build month, day, day_begin and day_end dependends on $howLong
        switch ($howLong) {
            case 'm':
                $aDates['month'] = $oDayDate->format('%Y-%m');
 /**
  * Fetch and decorates the history stats using the specified parameters
  *
  * @param array  $aParams Query parameters
  * @param string $link    Optional link for the leftmost column content
  */
 function prepare(&$aParams, $link = '')
 {
     parent::prepare($aParams);
     // Set the span requirements
     // Disable this for now, since these queries can be very slow
     // $this->oHistory->getSpan($this, $aParams);
     // Get the historical stats
     $aStats = $this->getHistory($aParams, $link);
     if ($this->noStatsAvailable) {
         $this->aStatsData = array();
         return;
     }
     if ($this->disablePager) {
         $use_pager = false;
     } elseif ($this->statsBreakdown == 'week') {
         $per_page = 4;
         $use_pager = count($stats) > $per_page;
     } elseif ($this->aGlobalPrefs['period_preset'] == 'this_month' || $this->aGlobalPrefs['period_preset'] == 'last_month') {
         // Do not use pager when showing last or current month
         $use_pager = false;
     } elseif ($this->statsBreakdown == 'hour' || $this->statsBreakdown == 'dow') {
         $use_pager = false;
     } else {
         $per_page = 15;
         $use_pager = count($stats) > $per_page;
     }
     if ($use_pager) {
         $params = array('itemData' => $stats, 'perPage' => htmlspecialchars(MAX_getStoredValue('setPerPage', $per_page)), 'delta' => 8, 'append' => true, 'clearIfVoid' => false, 'urlVar' => 'page', 'useSessions' => false, 'mode' => 'Jumping');
         if ($params['perPage'] % $per_page || $params['perPage'] > $per_page * 4) {
             // Reset the perPage and the request parameters when not matching the available values
             $params['perPage'] = $per_page;
             $_REQUEST['setPerPage'] = $per_page;
         }
         $pager =& Pager::factory($params);
         $this->aStatsData = $pager->getPageData();
         $this->pagerLinks = $pager->getLinks();
         $this->pagerLinks = $this->pagerLinks['all'];
         $this->pagerSelect = preg_replace('/(<select.*?)(>)/i', '$1 onchange="this.form.submit()"$2', $pager->getPerPageSelectBox($per_page, $per_page * 4, $per_page));
     } else {
         $this->aStatsData = $aStats;
         $this->pagerLinks = false;
         $this->pagerSelect = false;
     }
     $this->aPagePrefs['setPerPage'] = $params['perPage'];
     // Format the rows appropriately for output
     $this->oHistory->formatRows($this->aStatsData, $this);
 }
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/lib/OA/Dll/Audit.php';
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
require_once MAX_PATH . '/www/admin/config.php';
// Register input variables
$auditId = MAX_getStoredValue('auditId', 0);
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER);
OA_Permission::enforceAccountPermission(OA_ACCOUNT_ADVERTISER, OA_PERM_USER_LOG_ACCESS);
OA_Permission::enforceAccountPermission(OA_ACCOUNT_TRAFFICKER, OA_PERM_USER_LOG_ACCESS);
OA_Permission::enforceAccessToObject('audit', $auditId);
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageHeader('userlog-index');
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
    // Show all "My Account" sections
    phpAds_ShowSections(array("5.1", "5.2", "5.3", "5.5", "5.6", "5.4"));
    phpAds_UserlogSelection("index");
} else {
    if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
Esempio n. 10
0
 /**
  * A private method that returns the start and end dates
  * that bound the span, based based on a pre-defined 'friendly'
  * value.
  *
  * See the {@link OA_Admin_DaySpan::setSpanPresetValue()} method
  * for the pre-defined values.
  *
  * @param string $presetValue The preset value string.
  * @return array An array of two elements, "start" and "end",
  *               representing the start and end dates of
  *               the span, respectively.
  */
 function _getSpanDates($presetValue)
 {
     switch ($presetValue) {
         case 'today':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'yesterday':
             $oDateStart = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'this_week':
             $oDateStart = new Date(Date_Calc::beginOfWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'last_week':
             $oDateStart = new Date(Date_Calc::beginOfPrevWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd->copy($oDateStart);
             $oDateEnd->addSpan($oSixDaySpan);
             break;
         case 'last_7_days':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             $oDateStart->subtractSpan($oSevenDaySpan);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'this_month_full':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month_remainder':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'next_month':
             $oDateStart = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::endOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'last_month':
             $oDateStart = new Date(Date_Calc::beginOfPrevMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'all_stats':
             $oDateStart = null;
             $oDateEnd = null;
             break;
         case 'specific':
             $startDate = MAX_getStoredValue('startDate', date('Y-m-d'));
             $oDateStart = new Date($startDate);
             $endDate = MAX_getStoredValue('endDate', date('Y-m-d'));
             $oDateEnd = new Date($endDate);
             break;
     }
     $this->_setStartDate($oDateStart);
     $this->_setEndDate($oDateEnd);
     $aDates = array('start' => $oDateStart, 'end' => $oDateEnd);
     return $aDates;
 }
Esempio n. 11
0
$pref =& $GLOBALS['_MAX']['PREF'];
$publisherId = MAX_getValue('affiliateid');
$zoneId = MAX_getValue('zoneid');
$advertiserId = MAX_getValue('clientid');
$placementId = MAX_getValue('campaignid');
$adId = MAX_getValue('bannerid');
$action = MAX_getValue('action');
$aCurrent = MAX_getValue('includebanner');
$hideInactive = MAX_getStoredValue('hideinactive', $pref['ui_hide_inactive'] == true, null, true);
$listorder = MAX_getStoredValue('listorder', 'name');
$orderdirection = MAX_getStoredValue('orderdirection', 'up');
$selection = MAX_getValue('selection');
$showMatchingAds = MAX_getStoredValue('showbanners', $pref['ui_show_matching_banners'] == true, null, true);
$showParentPlacements = MAX_getStoredValue('showcampaigns', $pref['ui_show_matching_banners_parents'] == true, null, true);
$submit = MAX_getValue('submit');
$view = MAX_getStoredValue('view', 'placement');
$aZone = Admin_DA::getZone($zoneId);
if ($aZone['type'] == MAX_ZoneEmail) {
    $view = 'ad';
}
// Initialise some parameters
$pageName = basename($_SERVER['PHP_SELF']);
$tabIndex = 1;
$agencyId = OA_Permission::getAgencyId();
$aEntities = array('affiliateid' => $publisherId, 'zoneid' => $zoneId);
if (isset($action)) {
    $result = true;
    if ($action == 'set' && $view == 'placement' && !empty($placementId)) {
        $aLinkedPlacements = Admin_DA::getPlacementZones(array('zone_id' => $zoneId), false, 'placement_id');
        if (!isset($aLinkedPlacements[$placementId])) {
            Admin_DA::addPlacementZone(array('zone_id' => $zoneId, 'placement_id' => $placementId));
Esempio n. 12
0
 /**
  * A private method to initialise the day span selector element.
  *
  * @access pivate
  */
 function _initDaySpanSelector()
 {
     require_once MAX_PATH . '/lib/max/Admin/UI/FieldFactory.php';
     $aPeriod = array();
     $aPeriod['period_preset'] = MAX_getStoredValue('period_preset', 'today');
     $aPeriod['period_start'] = MAX_getStoredValue('period_start', date('Y-m-d'));
     $aPeriod['period_end'] = MAX_getStoredValue('period_end', date('Y-m-d'));
     $this->oDaySpanSelector =& FieldFactory::newField('day-span');
     $this->oDaySpanSelector->_name = 'period';
     $this->oDaySpanSelector->enableAutoSubmit();
     $this->oDaySpanSelector->setValueFromArray($aPeriod);
     $this->aDates = array('day_begin' => $this->oDaySpanSelector->getStartDate(), 'day_end' => $this->oDaySpanSelector->getEndDate());
     if (!is_null($this->aDates['day_begin'])) {
         $this->aDates['day_begin'] = $this->aDates['day_begin']->format('%Y-%m-%d');
         $this->aDates['day_end'] = $this->aDates['day_end']->format('%Y-%m-%d');
     } else {
         $this->aDates = array();
     }
     $this->aGlobalPrefs['period_preset'] = $this->oDaySpanSelector->_fieldSelectionValue;
     $this->aGlobalPrefs['period_start'] = $this->aDates['day_begin'];
     $this->aGlobalPrefs['period_end'] = $this->aDates['day_end'];
 }
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/max/other/common.php';
// OA-900, hide graph
OA_Permission::enforceTrue(false);
require_once MAX_PATH . '/lib/OA/Admin/Statistics/Factory.php';
// Make data loading depending only on period_start & period_end
$tempPeriodPreset = $_REQUEST['period_preset'];
$_REQUEST['period_preset'] = 'specific';
$period_preset = 'specific';
$session['prefs']['GLOBALS']['period_preset'] = 'specific';
$period_preset = MAX_getStoredValue('period_preset', 'today');
phpAds_registerGlobal('breakdown', 'entity', 'agency_id', 'advertiser_id', 'clientid', 'campaignid', 'placement_id', 'ad_id', 'bannerid', 'publisher_id', 'affiliateid', 'zone_id', 'zoneid', 'start_date', 'end_date', 'sort', 'asc', 'show', 'expand', 'day', 'plugin', 'peroid_preset', 'tempPeriodPreset', 'GraphFile', 'graphFilter', 'graphFields', 'listorder');
if (!isset($listorder)) {
    $prm['listorder'] = MAX_getStoredValue('listorder', null, 'stats.php');
}
// Handle filters
if (is_numeric($advertiser_id)) {
    $clientid = $advertiser_id;
}
if (is_numeric($placement_id)) {
    $campaignid = $placement_id;
}
if (is_numeric($ad_id)) {
    $bannerid = $ad_id;
}
if (is_numeric($publisher_id)) {
    $affiliateid = $publisher_id;
}
if (is_numeric($zone_id)) {
Esempio n. 14
0
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
OA_Permission::enforceAccessToObject('banners', $bannerid);
/*-------------------------------------------------------*/
/* Store preferences									 */
/*-------------------------------------------------------*/
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;
phpAds_SessionDataStore();
// Get input parameters
$advertiserId = MAX_getValue('clientid');
$campaignId = MAX_getValue('campaignid');
$bannerId = MAX_getValue('bannerid');
$aCurrentZones = MAX_getValue('includezone');
$listorder = MAX_getStoredValue('listorder', 'name');
$orderdirection = MAX_getStoredValue('orderdirection', 'up');
$submit = MAX_getValue('submit');
// Initialise some parameters
$pageName = basename($_SERVER['PHP_SELF']);
$tabindex = 1;
$agencyId = OA_Permission::getAgencyId();
$aEntities = array('clientid' => $advertiserId, 'campaignid' => $campaignId, 'bannerid' => $bannerId);
// Process submitted form
if (isset($submit)) {
    $dalZones = OA_Dal::factoryDAL('zones');
    $prioritise = false;
    $error = false;
    $aPreviousZones = Admin_DA::getAdZones(array('ad_id' => $bannerId));
    $aDeleteZones = array();
    // First, remove any zones that should be deleted.
    if (!empty($aPreviousZones)) {
Esempio n. 15
0
// "".
$periodPreset = MAX_getValue('period_preset', 'today');
if ($periodPreset == 'all_stats') {
    unset($_REQUEST['period_start']);
    unset($session['prefs']['GLOBALS']['period_start']);
    unset($_REQUEST['period_end']);
    unset($session['prefs']['GLOBALS']['period_end']);
    $_REQUEST['period_preset'] = $periodPreset;
    $session['prefs']['GLOBALS']['period_preset'] = $periodPreset;
} else {
    $period_start = htmlspecialchars(MAX_getStoredValue('period_start', date('Y-m-d')));
    if (!strstr($period_start, '-')) {
        $period_start = date('Y-m-d', strtotime($period_start));
        MAX_changeStoredValue('period_start', $period_start);
    }
    $period_end = htmlspecialchars(MAX_getStoredValue('period_end', date('Y-m-d')));
    if (!strstr($period_end, '-')) {
        $period_end = date('Y-m-d', strtotime($period_end));
        MAX_changeStoredValue('period_end', $period_end);
    }
    if (!empty($period_start) && !empty($period_end)) {
        $oStartDate = new Date($period_start);
        $oEndDate = new Date($period_end);
        $oDaySpan = new OA_Admin_DaySpan();
        $oDaySpan->setSpanDays($oStartDate, $oEndDate);
        $periodFromDates = $oDaySpan->getPreset();
        $_REQUEST['period_preset'] = $periodFromDates;
        $session['prefs']['GLOBALS']['period_preset'] = $periodFromDates;
    } else {
        $_REQUEST['period_preset'] = $periodPreset;
        $session['prefs']['GLOBALS']['period_preset'] = $periodPreset;
Esempio n. 16
0
 /**
  * A PHP5-style constructor that can be used to perform common
  * class instantiation by children classes.
  *
  * @param array $aParams An array of parameters. The array should
  *                       be indexed by the name of object variables,
  *                       with the values that those variables should
  *                       be set to. For example, the parameter:
  *                       $aParams = array('foo' => 'bar')
  *                       would result in $this->foo = bar.
  */
 function __construct($aParams)
 {
     // Set the output type & template directory for targeting statistcs
     $this->outputType = 'targetingHistory';
     $this->templateDir = MAX_PATH . '/lib/OA/Admin/Statistics/Targeting/themes/';
     // Get list order and direction
     $this->listOrderField = MAX_getStoredValue('listorder', 'key');
     $this->listOrderDirection = MAX_getStoredValue('orderdirection', 'down');
     // Ensure the history class is prepared
     $this->useHistoryClass = true;
     // Disable graphs in targeting pages
     $this->aGraphData = array('noGraph' => true);
     parent::__construct($aParams);
     // Store the preferences
     $this->aPagePrefs['listorder'] = $this->listOrderField;
     $this->aPagePrefs['orderdirection'] = $this->listOrderDirection;
 }