$column3 = _getHtmlHeaderColumn($GLOBALS['strTrackerID'], 'tracker_id', $pageName, $entityIds, $listorder, $orderdirection);
 $column4 = _getHtmlHeaderColumn($GLOBALS['strTrackerName'], 'trackername', $pageName, $entityIds, $listorder, $orderdirection);
 $column5 = _getHtmlHeaderColumn($GLOBALS['strCampaignID'], 'campaignid', $pageName, $entityIds, $listorder, $orderdirection);
 $column6 = _getHtmlHeaderColumn($GLOBALS['strCampaignName'], 'campaignname', $pageName, $entityIds, $listorder, $orderdirection);
 echo "\n        <tr height='1'>\n            <td><img src='" . OX::assetPath() . "/images/spacer.gif' width='150' height='1' border='0' alt='' title=''></td>\n            <td><img src='" . OX::assetPath() . "/images/spacer.gif' width='80' height='1' border='0' alt='' title=''></td>\n            <td><img src='" . OX::assetPath() . "/images/spacer.gif' width='60' height='1' border='0' alt='' title=''></td>\n            <td><img src='" . OX::assetPath() . "/images/spacer.gif' width='80' height='1' border='0' alt='' title=''></td>\n            <td><img src='" . OX::assetPath() . "/images/spacer.gif' width='60' height='1' border='0' alt='' title=''></td>\n            <td><img src='" . OX::assetPath() . "/images/spacer.gif' width='80' height='1' border='0' alt='' title=''></td>\n        </tr>\n        <tr height='25'>\n            <td width='150' style='padding-left: 16px'>&nbsp;&nbsp;{$column1}</td>\n            <td align='center' style='padding: 0 4px'>{$column2}</td>\n            <td align='{$phpAds_TextAlignLeft}' style='padding: 0 4px'>{$column3}</td>\n            <td align='{$phpAds_TextAlignLeft}' style='padding: 0 4px'>{$column4}</td>\n            <td align='{$phpAds_TextAlignLeft}' style='padding: 0 4px'>{$column5}</td>\n            <td align='{$phpAds_TextAlignLeft}' style='padding: 0 4px'>{$column6}</td>\n        </tr>\n        <tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
 // Variable to determine if the row should be grey or white...
 $i = 0;
 $statusesColors = array(MAX_CONNECTION_STATUS_IGNORE => 'grey', MAX_CONNECTION_STATUS_PENDING => 'darkblue', MAX_CONNECTION_STATUS_ONHOLD => 'blue', MAX_CONNECTION_STATUS_APPROVED => 'green', MAX_CONNECTION_STATUS_DISAPPROVED => 'red', MAX_CONNECTION_STATUS_DUPLICATE => 'grey');
 $totalRequests = 0;
 $totalViews = 0;
 $totalClicks = 0;
 $totalConversions = 0;
 // Loop through advertisers
 MAX_sortArray($aConversions, $listorder == 'id' ? 'date_time' : $listorder, $orderdirection == 'up');
 foreach ($aConversions as $conversionId => $conversion) {
     $conversionExpanded = MAX_isExpanded($conversionId, $expand, $aNodes, 'a');
     $bgcolor = $i++ % 2 == 0 ? " bgcolor='#F6F6F6'" : '';
     $connectionStatus = $GLOBALS['_MAX']['STATUSES'][$conversion['connection_status']];
     $translatedStatus = $GLOBALS[$connectionStatus];
     echo "\n        <tr height='25'{$bgcolor}>\n            <td>";
     if ($conversionExpanded) {
         echo "&nbsp;<a href='{$pageName}?collapse=a{$conversionId}&{$addUrl}'><img src='" . OX::assetPath() . "/images/triangle-d.gif' align='absmiddle' border='0'></a>&nbsp;";
     } else {
         echo "&nbsp;<a href='{$pageName}?expand=a{$conversionId}&{$addUrl}'><img src='" . OX::assetPath() . "/images/{$phpAds_TextDirection}/triangle-l.gif' align='absmiddle' border='0'></a>&nbsp;";
     }
     $aConversionStatuses = array(MAX_CONNECTION_STATUS_IGNORE, MAX_CONNECTION_STATUS_PENDING, MAX_CONNECTION_STATUS_ONHOLD, MAX_CONNECTION_STATUS_APPROVED, MAX_CONNECTION_STATUS_DISAPPROVED, MAX_CONNECTION_STATUS_DUPLICATE);
     echo "{$conversion['date_time']}</td>";
     if ($editStatuses) {
         // Only managers can edit statuses. No constraint to the type of changes since OX-4138.
         echo "<td align='center' style='padding: 0 4px'><nobr>";
         foreach ($GLOBALS['_MAX']['STATUSES'] as $statusId => $statusStr) {
 /**
  * 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;
 }
Example #3
0
function MAX_displayPublisherZoneStats($aParams, $pageName, $anonymous, $aNodes, $expand, $listorder, $orderdirection, $hideinactive, $showPublisher, $entityIds)
{
    global $phpAds_TextAlignLeft, $phpAds_TextAlignRight, $phpAds_TextDirection;
    // Get the icons for all levels (publisher/zone)
    $entity = _getEntityString($entityIds);
    $publishersHidden = 0;
    $aPublishers = Admin_DA::fromCache('getPublishersStats', $aParams);
    if (!empty($aPublishers)) {
        echo "\n        <br /><br />\n        <table border='0' width='100%' cellpadding='0' cellspacing='0'>";
        MAX_displayStatsHeader($pageName, $listorder, $orderdirection, $entityIds);
        // Variable to determine if the row should be grey or white...
        $i = 0;
        // Loop through publishers
        $totalRequests = 0;
        $totalViews = 0;
        $totalClicks = 0;
        $totalConversions = 0;
        MAX_sortArray($aPublishers, $listorder == 'id' ? 'publisher_id' : $listorder, $orderdirection == 'up');
        foreach ($aPublishers as $publisherId => $publisher) {
            $publisherRequests = phpAds_formatNumber($publisher['sum_requests']);
            $publisherViews = phpAds_formatNumber($publisher['sum_views']);
            $publisherClicks = phpAds_formatNumber($publisher['sum_clicks']);
            $publisherConversions = phpAds_formatNumber($publisher['sum_conversions']);
            $publisherCtr = phpAds_buildRatioPercentage($publisher['sum_clicks'], $publisher['sum_views']);
            $publisherSr = phpAds_buildRatioPercentage($publisher['sum_conversions'], $publisher['sum_clicks']);
            $publisherExpanded = MAX_isExpanded($publisherId, $expand, $aNodes, 'p');
            $publisherActive = true;
            $publisherIcon = MAX_getEntityIcon('publisher', $publisherActive);
            if (!$hideinactive || $publisherActive) {
                $bgcolor = $i++ % 2 == 0 ? " bgcolor='#F6F6F6'" : '';
                echo "\n            <tr height='25'{$bgcolor}>\n                <td>";
                if (!empty($publisher['num_children'])) {
                    if ($publisherExpanded) {
                        echo "&nbsp;<a href='{$pageName}?{$entity}collapse=p{$publisherId}'><img src='" . OX::assetPath() . "/images/triangle-d.gif' align='absmiddle' border='0'></a>&nbsp;";
                    } else {
                        echo "&nbsp;<a href='{$pageName}?{$entity}expand=p{$publisherId}'><img src='" . OX::assetPath() . "/images/{$phpAds_TextDirection}/triangle-l.gif' align='absmiddle' border='0'></a>&nbsp;";
                    }
                } else {
                    echo "&nbsp;<img src='" . OX::assetPath() . "/images/spacer.gif' height='16' width='16'>&nbsp;";
                }
                echo "\n                    <img src='{$publisherIcon}' align='absmiddle'>&nbsp;\n                    <a href='stats.php?entity=affiliate&breakdown=history&affiliateid={$publisherId}'>{$publisher['name']}</a>\n                </td>";
                if ($anonymous) {
                    echo "\n                <td align='{$phpAds_TextAlignRight}'>&nbsp;</td>";
                } else {
                    echo "\n                <td align='{$phpAds_TextAlignRight}'>{$publisherId}</td>";
                }
                echo "\n                <td align='{$phpAds_TextAlignRight}'>{$publisherRequests}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$publisherViews}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$publisherClicks}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$publisherCtr}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$publisherConversions}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$publisherSr}</td>\n            </tr>";
                if (!empty($publisher['num_children']) && $publisherExpanded) {
                    echo "\n            <tr height='1'>\n                <td{$bgcolor}><img src='" . OX::assetPath() . "/images/spacer.gif' width='1' height='1'></td>\n                <td colspan='8' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td>\n            </tr>";
                    // Loop through zones
                    $aZones = Admin_DA::fromCache('getZonesStats', $aParams);
                    MAX_sortArray($aZones, $listorder == 'id' ? 'zone_id' : $listorder, $orderdirection == 'up');
                    foreach ($aZones as $zoneId => $zone) {
                        $zoneRequests = phpAds_formatNumber($zone['sum_requests']);
                        $zoneViews = phpAds_formatNumber($zone['sum_views']);
                        $zoneClicks = phpAds_formatNumber($zone['sum_clicks']);
                        $zoneConversions = phpAds_formatNumber($zone['sum_conversions']);
                        $zoneCtr = phpAds_buildRatioPercentage($zone['sum_clicks'], $zone['sum_views']);
                        $zoneSr = phpAds_buildRatioPercentage($zone['sum_conversions'], $zone['sum_clicks']);
                        $zoneActive = true;
                        $zoneIcon = MAX_getEntityIcon('zone', $zoneActive, $zone['type']);
                        echo "\n            <tr height='25'{$bgcolor}>\n                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n                    <img src='" . OX::assetPath() . "/images/spacer.gif' height='16' width='16' align='absmiddle'>&nbsp;\n                    <img src='{$zoneIcon}' align='absmiddle'>&nbsp;\n                    <a href='stats.php?entity=zone&breakdown=history&affiliateid={$publisherId}&zoneid={$zoneId}'>{$zone['name']}</a>\n                </td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneId}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneRequests}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneViews}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneClicks}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneCtr}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneConversions}</td>\n                <td align='{$phpAds_TextAlignRight}'>{$zoneSr}</td>\n            </tr>";
                    }
                }
                echo "\n                <tr height='1'><td colspan='8' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
            } else {
                $publishersHidden++;
            }
            $totalRequests += $publisher['sum_requests'];
            $totalViews += $publisher['sum_views'];
            $totalClicks += $publisher['sum_clicks'];
            $totalConversions += $publisher['sum_conversions'];
        }
        // Total
        echo "\n        <tr height='25'{$bgcolor}>\n            <td>&nbsp;&nbsp;<b>{$GLOBALS['strTotal']}</b></td>\n            <td>&nbsp;</td>\n            <td align='{$phpAds_TextAlignRight}'>" . phpAds_formatNumber($totalRequests) . "</td>\n            <td align='{$phpAds_TextAlignRight}'>" . phpAds_formatNumber($totalViews) . "</td>\n            <td align='{$phpAds_TextAlignRight}'>" . phpAds_formatNumber($totalClicks) . "</td>\n            <td align='{$phpAds_TextAlignRight}'>" . phpAds_buildCTR($totalViews, $totalClicks) . "</td>\n            <td align='{$phpAds_TextAlignRight}'>" . phpAds_formatNumber($totalConversions) . "</td>\n            <td align='{$phpAds_TextAlignRight}'>" . phpAds_buildCTR($totalClicks, $totalConversions) . "</td>\n        </tr>\n        <tr height='1'>\n            <td colspan='8' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td>\n        </tr>";
        if (!$anonymous) {
            $publisherIcon = MAX_getEntityIcon('publisher');
            echo "\n        <tr>\n            <td colspan='4' align='{$phpAds_TextAlignLeft}' nowrap>";
            if ($hideinactive == true) {
                echo "&nbsp;&nbsp;<img src='" . OX::assetPath() . "/images/icon-activate.gif' align='absmiddle' border='0'>&nbsp;<a href='{$pageName}?{$entity}hideinactive=0'>{$GLOBALS['strShowAll']}</a>&nbsp;&nbsp;|&nbsp;&nbsp;{$publishersHidden} {$GLOBALS['strInactivePublishersHidden']}";
            } else {
                echo "&nbsp;&nbsp;<img src='" . OX::assetPath() . "/images/icon-hideinactivate.gif' align='absmiddle' border='0'>&nbsp;<a href='{$pageName}?{$entity}hideinactive=1'>{$GLOBALS['strHideInactivePublishers']}</a>";
            }
            echo "\n            </td>\n            <td colspan='4' align='{$phpAds_TextAlignRight}' nowrap><img src='" . OX::assetPath() . "/images/triangle-d.gif' align='absmiddle' border='0'>&nbsp;<a href='{$pageName}?{$entity}expand=all' accesskey='{$keyExpandAll}'>{$GLOBALS['strExpandAll']}</a>&nbsp;&nbsp;|&nbsp;&nbsp;<img src='" . OX::assetPath() . "/images/{$phpAds_TextDirection}/triangle-l.gif' align='absmiddle' border='0'>&nbsp;<a href='{$pageName}?{$entity}expand=none' accesskey='{$keyCollapseAll}'>{$GLOBALS['strCollapseAll']}</a>&nbsp;&nbsp;</td>\n        </tr>\n        <tr height='25'>";
            if ($showPublisher == 't') {
                echo "\n            <td colspan='8' align='{$phpAds_TextAlignLeft}' nowrap>&nbsp;&nbsp;<img src='{$publisherIcon}' align='absmiddle'><a href='{$pageName}?{$entity}showpublisher=f'> Hide parent publisher</a></td>";
            } else {
                echo "\n            <td colspan='8' align='{$phpAds_TextAlignLeft}' nowrap>&nbsp;&nbsp;<img src='{$publisherIcon}' align='absmiddle'><a href='{$pageName}?{$entity}showpublisher=t'> Show parent publisher</a></td>";
            }
            echo "\n        </tr>";
        }
        echo "\n        </table>\n        <br /><br />";
    } else {
        MAX_displayNoStatsMessage();
    }
}