<?php

QUnit_Global::includeClass('Affiliate_Merchants_Views_TransactionManager');

class Affiliate_Merchants_Views_PendingTransaction extends Affiliate_Merchants_Views_TransactionManager {

    function Affiliate_Merchants_Views_PendingTransaction() {

        //重置参数
        $_REQUEST['is_pending_page'] = 1;

        $_REQUEST['md'] = 'Affiliate_Merchants_Views_PendingTransaction';
        $_REQUEST['filtered'] = 1;
        $_REQUEST['type'] = 'all';
        $_REQUEST['list_page'] = empty($_GET['list_page'])?0:$_GET['list_page'];;
        $_REQUEST['action'] = empty($_GET['action'])?'':$_GET['action'];
        $_REQUEST['sortby'] = '';
        $_REQUEST['sortorder'] = '';
        $_REQUEST['tm_advanced_filter_show'] = 1;
        $_REQUEST['tm_userid'] = '_';
        $_REQUEST['tm_orderid'] = '';
        $_REQUEST['tm_custom1'] = 'productid';
        $_REQUEST['tm_custom1data'] = '';
        $_REQUEST['tm_custom2'] = 'productid';
        $_REQUEST['tm_custom2data'] = '';
        $_REQUEST['transtype_comitted'] = 1;
        $_REQUEST['tm_transtype'] = array(1,2,4,16,64);
        $_REQUEST['status_comitted'] = 1;
        $_REQUEST['tm_status'] = array(1);
        $_REQUEST['tm_campaign'] = '_';
        $_REQUEST['tm_timeselect'] = 1;
        $_REQUEST['tm_timepreset'] = 10;
        $_REQUEST['numrows'] = empty($_GET['numrows'])?20:$_GET['numrows'];
        $_REQUEST['list_view'] = '_';

        parent::Affiliate_Merchants_Views_TransactionManager();

        $this->navigationRemoveURL(L_G_CTRSALES);
        $this->navigationAddURL(L_G_HOME,'index.php?md=home');
        $this->navigationAddURL(L_G_TRANSAPPLICATIONS_TOPMENU,'index.php?md=Affiliate_Merchants_Views_PendingAffiliates');
    }

    function showTransactions($exportToCsv=false) {
        $temp_perm['view'] = $this->checkPermissions('view');
        $temp_perm['create'] = $this->checkPermissions('create');

        $this->assign('a_action_permission', $temp_perm);

        $this->createWhereOrderBy($orderby, $where);

        $this->getUsersForFilter();
        $this->campCategory = $this->viewCampCategManager->getCampCategoriesAsArray();

        $campaigns = $this->viewCampManager->getCampaignsAsArray();
        $list_data = QUnit_Global::newobj('QCore_RecordSet');
        $list_data->setTemplateRS($campaigns);
        $this->assign('a_list_campaigns', $list_data);

        if($GLOBALS['Auth']->getSetting('Glob_acct_geo_allowed') == '1') {
            $blIpCountry = QUnit_Global::newObj('QCore_Bl_IpCountry');
            $this->countryInfo = $blIpCountry->getCountriesAsArray();
        }

        $recs = $this->getRecords($orderby, $where);
        $this->initViews();

        $list_data = QUnit_Global::newobj('QCore_RecordSet');
        $list_data->setTemplateRS($recs);

        $this->assign('a_list_data', $list_data);
        $this->assign('a_curyear', date("Y"));

        $this->pageLimitsAssign();

        $this->addContent('tm_list_pending');
    }

}