<?php
QUnit_Global::includeClass('Affiliate_Merchants_Views_CampaignManager');

class Affiliate_Merchants_Views_CampaignLeadregist extends Affiliate_Merchants_Views_CampaignManager {

    function Affiliate_Merchants_Views_CampaignLeadregist() {
        $_REQUEST['action'] = 'edit';
        $_REQUEST['cid'] = $_POST['cid'] = 'clickreg';

        parent::Affiliate_Merchants_Views_CampaignManager();
    }

    function drawFormEditCampaign() {

        $this->navigationAddURL(L_G_BASIC_LEADREGIST, '');

        if($_REQUEST['campaign_tab_sheet'] == '')
            $_REQUEST['campaign_tab_sheet'] = 'commissions';

        if($_POST['commited'] != 'yes')
        {
            if(!$this->loadCampaignInfo())
                return false;
        }

        $_POST['action'] = 'edit';
        $_POST['postaction'] = 'edit';

        $tabs = array(
            array('id'      => 'commissions',
                  'caption' => L_G_COMMISSIONS,
                  'content' => $this->drawFormEditCampaignCommissions(),
                  'icon' => 'icon_commissions.gif',
                  'description' => L_G_COMMISSIONS_DESCRIPTION),
            array('id' => 'campsettings',
                  'caption' => L_G_CAMPSETTINGS,
                  'icon' => 'icon_settings.gif',
                  'content' => $this->drawFormEditCampaignAffSettings(),
                  'description' => L_G_CAMPSETTINGS_DESCRIPTION),
            array('id' => 'specialcommissions',
                  'hidden' => true,
                  'caption' => L_G_SPECIAL_COMMISSIONS,
                  'icon' => 'icon_comm_special.gif',
                  'content' => $this->drawFormEditCampaignSpecialCommissions(),
                  'description' => L_G_SPECIAL_COMMISSIONS_DESCRIPTION),
            array('id' => 'performance_rules',
                  'hidden' => true,
                  'caption' => L_G_PERFORMANCE_RULES,
                  'icon' => 'icon_perfrules.gif',
                  'content' => $this->drawFormEditCampaignPerformanceRules(),
                  'description' => L_G_PERFORMANCE_RULES_DESCRIPTION)
        );

        $selectedTab = $_REQUEST['sheet'];

        $this->assign('a_tabs', $tabs);
        $this->assign('a_selectedTab', $selectedTab);

        $this->addContent('campaigns');
        return true;
    }
}