コード例 #1
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', "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;
 }
コード例 #2
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;
 }
コード例 #3
0
ファイル: website-index.php プロジェクト: villos/tree_admin
    if (isset($session['prefs']['website-index.php']['orderdirection'])) {
        $orderdirection = $session['prefs']['website-index.php']['orderdirection'];
    } else {
        $orderdirection = '';
    }
}
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
$oTpl = new OA_Admin_Template('website-index.html');
$dalAffiliates = OA_Dal::factoryDAL('affiliates');
$aWebsitesZones = $dalAffiliates->getWebsitesAndZonesByAgencyId();
$itemsPerPage = 250;
$oPager = OX_buildPager($aWebsitesZones, $itemsPerPage);
$oTopPager = OX_buildPager($aWebsitesZones, $itemsPerPage, false);
list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
$aWebsitesZones = array_slice($aWebsitesZones, $itemsFrom - 1, $itemsPerPage, true);
$oTpl->assign('pager', $oPager);
$oTpl->assign('topPager', $oTopPager);
$oTpl->assign('affiliates', $aWebsitesZones);
$oTpl->assign('listorder', $listorder);
$oTpl->assign('orderdirection', $orderdirection);
$oTpl->assign('phpAds_ZoneBanner', phpAds_ZoneBanner);
$oTpl->assign('phpAds_ZoneInterstitial', phpAds_ZoneInterstitial);
$oTpl->assign('phpAds_ZonePopup', phpAds_ZonePopup);
$oTpl->assign('phpAds_ZoneText' . phpAds_ZoneText);
$oTpl->assign('showAdDirect', defined('OA_AD_DIRECT_ENABLED') && OA_AD_DIRECT_ENABLED === true ? true : false);
/*-------------------------------------------------------*/
/* Store preferences                                     */
/*-------------------------------------------------------*/
コード例 #4
0
    foreach ($campaigns as $ckey => $campaign) {
        if (OA_ENTITY_STATUS_RUNNING == $campaign['status'] && array_key_exists('has_active_banners', $campaign)) {
            $clients[$campaign['clientid']]['has_active_campaigns'] = true;
        }
    }
    foreach (array_keys($clients) as $clientid) {
        $client =& $clients[$clientid];
        if (!array_key_exists('has_active_campaigns', $client) && $client['type'] != DataObjects_Clients::ADVERTISER_TYPE_MARKET) {
            unset($clients[$clientid]);
            $aCount['advertisers_hidden']++;
        }
    }
}
$itemsPerPage = 250;
$oPager = OX_buildPager($clients, $itemsPerPage);
$oTopPager = OX_buildPager($clients, $itemsPerPage, false);
list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
$clients = array_slice($clients, $itemsFrom - 1, $itemsPerPage, true);
$oTpl->assign('pager', $oPager);
$oTpl->assign('topPager', $oTopPager);
$oTpl->assign('aAdvertisers', $clients);
$oTpl->assign('aCount', $aCount);
$oTpl->assign('hideinactive', $hideinactive);
$oTpl->assign('listorder', $listorder);
$oTpl->assign('orderdirection', $orderdirection);
$oTpl->assign('MARKET_TYPE', DataObjects_Clients::ADVERTISER_TYPE_MARKET);
/*-------------------------------------------------------*/
/* Store preferences                                     */
/*-------------------------------------------------------*/
$session['prefs']['advertiser-index.php']['hideinactive'] = $hideinactive;
$session['prefs']['advertiser-index.php']['listorder'] = $listorder;