function displayPage($form, $aMessages = '')
{
    phpAds_PageHeader('devtools-plugins', '', '../../');
    $oTpl = new OA_Plugin_Template('oxPlugin.html', 'oxPlugin');
    //$oTpl->debugging = true;
    $oTpl->assign('aMessages', $aMessages);
    $oTpl->assign('form', $form->serialize());
    $oTpl->display();
    phpAds_PageFooter();
}
$oTpl->assign('clientId', $clientid);
$oTpl->assign('campaignId', $campaignid);
$oTpl->assign('aBanners', $banners);
$oTpl->assign('aCount', $aCount);
$oTpl->assign('hideinactive', $hideinactive);
$oTpl->assign('listorder', $listorder);
$oTpl->assign('orderdirection', $orderdirection);
$oTpl->assign('canActivate', !OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) || OA_Permission::hasPermission(OA_PERM_BANNER_ACTIVATE));
$oTpl->assign('canDeactivate', !OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) || OA_Permission::hasPermission(OA_PERM_BANNER_DEACTIVATE));
$session['prefs']['campaign-banners.php'][$campaignid]['hideinactive'] = $hideinactive;
$session['prefs']['campaign-banners.php'][$campaignid]['listorder'] = $listorder;
$session['prefs']['campaign-banners.php'][$campaignid]['orderdirection'] = $orderdirection;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;
phpAds_SessionDataStore();
$oTpl->display();
phpAds_PageFooter();
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);
function display_page($banner_id, $campaign_id, $client_id)
{
    $page_name = basename($_SERVER['PHP_SELF']);
    $entities = array('clientid' => $client_id, 'campaignid' => $campaign_id, 'bannerid' => $banner_id);
    $entity_id = OA_Permission::getEntityId();
    if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
        $entity_type = 'advertiser_id';
    } else {
        $entity_type = 'agency_id';
    }
    // Display navigation
    $other_campaigns = Admin_DA::getPlacements(array($entity_type => $entity_id));
    $other_banners = Admin_DA::getAds(array('placement_id' => $campaign_id), false);
    displayNavigationBanner($page_name, $other_campaigns, $other_banners, $entities);
    if (!empty($banner_id)) {
        $template_id = OA_Dal::factoryDO('Zpbanners')->get_zp_banner_id((int) $banner_id);
        $form = explode('|', form_ajax_request($template_id));
    }
    $template = new OA_Plugin_Template('designer-form.html', 'bannerDesigner');
    //$oTpl->debugging = true;
    $template->assign('bannerid', $banner_id);
    $template->assign('campaignid', $campaign_id);
    $template->assign('clientid', $client_id);
    $template->assign('template_id', $template_id);
    $template->assign('form', $form);
    $template->display();
    phpAds_PageFooter();
}