Exemplo n.º 1
0
function MAX_displayLinkedPlacementsAds($aParams, $publisherId, $zoneId, $hideInactive, $showMatchingAds, $pageName, &$tabIndex, $directLinkedAds = false)
{
    echo "\n    <br /><strong>{$GLOBALS['strCampaignLinkedAds']}:</strong><br />\n    <table id='linked-campaigns' width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>\n    <tr height='25'>\n        <td width='40%'><b>&nbsp;&nbsp;{$GLOBALS['strName']}</b></td>\n        <td width='20%'><b>&nbsp;&nbsp;{$GLOBALS['strType']}</b></td>\n        <td><b>{$GLOBALS['strID']}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>\n        <td>&nbsp;</td>\n    </tr>\n    <tr height='1'>\n        <td colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td>\n    </tr>";
    $i = 0;
    $inactive = 0;
    $aPlacements = !empty($aParams) ? Admin_DA::getPlacements($aParams) : array();
    foreach ($aPlacements as $placementId => $aPlacement) {
        $placementActive = $aPlacement['status'] == OA_ENTITY_STATUS_RUNNING;
        if (!$hideInactive || $placementActive) {
            $pParams = $aParams;
            $pParams['placement_id'] = $placementId;
            $aAds = Admin_DA::getAds($pParams, true);
            $bgcolor = $i % 2 == 0 ? " bgcolor='#F6F6F6'" : '';
            // Remove these ad(s) from the direct linked ads
            foreach ($aAds as $dAdId) {
                unset($directLinkedAds[$dAdId['ad_id']]);
            }
            // Remove from array any ads not linked to the zone.
            // These might exist if campaign has been linked to zone
            // and indivual ads have then been unlinked
            $pParams = array('zone_id' => $zoneId);
            $aAdZones = Admin_DA::getAdZones($pParams, true);
            $aAdZoneLinks = array();
            foreach ($aAdZones as $aAdZone) {
                $aAdZoneLinks[] = $aAdZone['ad_id'];
            }
            foreach ($aAds as $adId => $aAd) {
                if (!in_array($adId, $aAdZoneLinks)) {
                    unset($aAds[$adId]);
                }
            }
            $placementIcon = MAX_getEntityIcon('placement', $placementActive);
            $placementName = htmlspecialchars(MAX_getDisplayName($aPlacement['name']));
            $placementLink = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER) ? "<a href='campaign-edit.php?clientid={$aPlacement['advertiser_id']}&campaignid={$placementId}'>{$placementName}</a>" : $placementName;
            $placementTypeName = OX_Util_Utils::getCampaignTypeName($aPlacement['priority']);
            $adCount = empty($aAds) ? 0 : count($aAds);
            $placementDescription = $showMatchingAds ? '&nbsp;' : str_replace('{count}', $adCount, $GLOBALS['strMatchingBanners']);
            if ($i > 0) {
                echo "\n    <tr height='1'>\n        <td colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td>\n    </tr>";
            }
            echo "\n    <tr height='25'{$bgcolor}>\n        <td>\n            &nbsp;&nbsp;<a href='{$pageName}?affiliateid={$publisherId}&zoneid={$zoneId}&campaignid={$placementId}&action=remove'><img src='" . OX::assetPath() . "/images/caret-l.gif' border='0' align='absmiddle'></a>\n            &nbsp;&nbsp;<img src='{$placementIcon}' align='absmiddle'>\n            &nbsp;{$placementLink}\n        </td>\n        <td><span class='campaign-type'>{$placementTypeName}</span></td>\n        <td>{$placementId}</td>\n        <td>{$placementDescription}</td>\n    </tr>";
            if ($showMatchingAds && !empty($aAds)) {
                foreach ($aAds as $adId => $aAd) {
                    $adActive = $aAd['status'] == OA_ENTITY_STATUS_RUNNING && $aPlacement['status'] == OA_ENTITY_STATUS_RUNNING;
                    if (!$hideInactive || $adActive) {
                        $adIcon = MAX_getEntityIcon('ad', $adActive, $aAd['type']);
                        $adName = htmlspecialchars(MAX_getDisplayName($aAd['name']));
                        $adLink = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER) ? "<a href='banner-edit.php?clientid={$aPlacement['advertiser_id']}&campaignid={$placementId}&bannerid={$adId}'>{$adName}</a>" : $adName;
                        $adWidth = $aAd['contenttype'] == 'txt' ? 300 : $aAd['width'] + 64;
                        $adHeight = $aAd['contenttype'] == 'txt' ? 200 : $aAd['height'] + (!empty($aAd['bannertext']) ? 90 : 64);
                        echo "\n    <tr height='1'>\n        <td{$bgcolor}><img src='" . OX::assetPath() . "/images/spacer.gif' width='1' height='1'></td>\n        <td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-el.gif' height='1' width='100%'></td>\n    </tr>\n    <tr height='25'{$bgcolor}>\n        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='{$adIcon}' align='absmiddle'>&nbsp;{$adLink}</td>\n        <td></td>\n        <td>{$adId}</td>\n        <td align=" . $GLOBALS['phpAds_TextAlignRight'] . ">\n            <img src='" . OX::assetPath() . "/images/icon-zoom.gif' align='absmiddle' border='0'>&nbsp;<a href='banner-htmlpreview.php?bannerid={$adId}' target='_new' onClick=\"return openWindow('banner-htmlpreview.php?bannerid={$adId}', '', 'status=no,scrollbars=no,resizable=no,width={$adWidth},height={$adHeight}');\">{$GLOBALS['strShowBanner']}</a>&nbsp;&nbsp;\n        </td>\n    </tr>";
                    } else {
                        $inactive++;
                    }
                }
            }
            $i++;
        } else {
            $inactive++;
        }
    }
    $showMatchingText = $showMatchingAds ? $GLOBALS['strHideMatchingBanners'] : $GLOBALS['strShowMatchingBanners'];
    $showMatchingValue = $showMatchingAds ? '0' : '1';
    $hideInactiveText = $hideInactive ? $GLOBALS['strShowAll'] : $GLOBALS['strHideInactiveCampaigns'];
    $hideInactiveStats = $hideInactive ? "&nbsp;&nbsp;|&nbsp;&nbsp;{$inactive} {$GLOBALS['strInactiveCampaignsHidden']}" : '';
    $hideInactiveValue = $hideInactive ? '0' : '1';
    $hideInactiveIcon = OX::assetPath($hideInactive ? 'images/icon-activate.gif' : 'images/icon-hideinactivate.gif');
    echo "\n    <tr height='1'>\n        <td colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td>\n    </tr>\n    <tr height='25'>\n        <td colspan='3'>\n            <img src='{$hideInactiveIcon}' align='absmiddle' border='0'>\n            <a href='{$pageName}?affiliateid={$publisherId}&zoneid={$zoneId}&hideinactive={$hideInactiveValue}'>{$hideInactiveText}</a>{$hideInactiveStats}\n        </td>\n        <td align='right'>\n            <img src='" . OX::assetPath() . "/images/icon-banner-stored-d.gif' align='absmiddle' border='0'>\n            <a href='{$pageName}?affiliateid={$publisherId}&zoneid={$zoneId}&showbanners={$showMatchingValue}'>{$showMatchingText}</a>\n    </table>";
    if (!empty($directLinkedAds)) {
        echo "<br /><strong>{$GLOBALS['strBannerLinkedAds']}:</strong><br />";
        $aParams = array('ad_id' => implode(',', array_keys($directLinkedAds)));
        MAX_displayLinkedAdsPlacements($aParams, $publisherId, $zoneId, $hideInactive, $showParentPlacements, $pageName, $tabIndex);
    }
}
Exemplo n.º 2
0
    MAX_displayZoneEntitySelection('placement', $aOtherAdvertisers, $aOtherPlacements, null, $advertiserId, $placementId, $adId, $publisherId, $zoneId, $GLOBALS['strSelectCampaignToLink'], $pageName, $tabIndex);
    if (!empty($aZonesPlacements)) {
        $aParams = array('placement_id' => implode(',', array_keys($aZonesPlacements)));
        $aParams += MAX_getLinkedAdParams($zoneId);
    } else {
        $aParams = null;
    }
    MAX_displayLinkedPlacementsAds($aParams, $publisherId, $zoneId, $hideInactive, $showMatchingAds, $pageName, $tabIndex, $aDirectLinkedAds);
} elseif ($view == 'ad') {
    $aOtherAdvertisers = Admin_DA::getAdvertisers($aParams + array('agency_id' => $agencyId), false);
    $aOtherPlacements = !empty($advertiserId) ? Admin_DA::getPlacements($aParams + array('advertiser_id' => $advertiserId), false) : null;
    $aOtherAds = !empty($placementId) ? Admin_DA::getAds($aParams + array('placement_id' => $placementId), false) : null;
    $aAdsZones = Admin_DA::getAdZones(array('zone_id' => $zoneId), true, 'ad_id');
    MAX_displayZoneEntitySelection('ad', $aOtherAdvertisers, $aOtherPlacements, $aOtherAds, $advertiserId, $placementId, $adId, $publisherId, $zoneId, $GLOBALS['strSelectBannerToLink'], $pageName, $tabIndex);
    $aParams = !empty($aAdsZones) ? array('ad_id' => implode(',', array_keys($aAdsZones))) : null;
    MAX_displayLinkedAdsPlacements($aParams, $publisherId, $zoneId, $hideInactive, $showParentPlacements, $pageName, $tabIndex);
}
?>

    <script language='Javascript'>
    <!--
        function toggleall()
        {
            allchecked = false;

            for (var i=0; i<document.zonetypeselection.elements.length; i++)
            {
                if (document.zonetypeselection.elements[i].name == 'bannerid[]' ||
                    document.zonetypeselection.elements[i].name == 'campaignid[]')
                {
                    if (document.zonetypeselection.elements[i].checked == false)