function init()
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    return $objResponse;
}
Exemple #2
0
/**
*  function to init import page
*
*
*  @return $objResponse
*
*/
function init($fileName)
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("spanSelectFile", "innerHTML", $locate->Translate("please_select_file"));
    $file_list = getExistfilelist();
    $objResponse->addScript("addOption('filelist','0','" . $locate->Translate('select a existent file') . "');");
    foreach ($file_list as $file) {
        $objResponse->addScript("addOption('filelist','" . $file['fileid'] . "','" . $file['originalname'] . "');");
    }
    $objResponse->addAssign("btnUpload", "value", $locate->Translate("upload"));
    $objResponse->addAssign("btnImportData", "value", $locate->Translate("import"));
    $objResponse->addAssign("spanFileManager", "innerHTML", $locate->Translate("file_manager"));
    $objResponse->addAssign("hidOnUploadMsg", "value", $locate->Translate("uploading"));
    $objResponse->addAssign("hidOnSubmitMsg", "value", $locate->Translate("data_importing"));
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        $tableList = "<select name='sltTable' id='sltTable' onchange='selectTable(this.value);' >\r\n\t\t\t\t\t\t\t<option value=''>" . $locate->Translate("selecttable") . "</option>\r\n\t\t\t\t\t\t\t<option value='resellerrate'>resellerrate</option>\r\n\t\t\t\t\t\t\t<option value='callshoprate'>callshoprate</option>\r\n\t\t\t\t\t\t\t<option value='myrate'>myrate</option>\r\n\t\t\t\t\t\t</select>";
    } elseif ($_SESSION['curuser']['usertype'] == 'reseller') {
        $tableList = "<select name='sltTable' id='sltTable' onchange='selectTable(this.value);' >\r\n\t\t\t\t\t\t\t<option value=''>" . $locate->Translate("selecttable") . "</option>\r\n\t\t\t\t\t\t\t<option value='callshoprate'>callshoprate</option>\r\n\t\t\t\t\t\t\t<option value='myrate'>myrate</option>\r\n\t\t\t\t\t\t</select>";
    } elseif ($_SESSION['curuser']['usertype'] == 'groupadmin') {
        $tableList = "<select name='sltTable' id='sltTable' onchange='selectTable(this.value);' >\r\n\t\t\t\t\t\t\t<option value=''>" . $locate->Translate("selecttable") . "</option>\r\n\t\t\t\t\t\t\t<option value='myrate'>myrate</option>\r\n\t\t\t\t\t\t</select>";
    }
    $objResponse->addAssign("divTables", "innerHTML", $tableList);
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin));
    $objResponse->addAssign("divGrid", "innerHTML", '');
    //$objResponse->addScript("xajax_showDivMainRight(document.getElementById('hidFileName').value);");
    //$objResponse->loadXML(showDivMainRight($fileName));
    //$objResponse->addAssign("divDiallistImport", "innerHTML", '');
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->loadXML(showDivMainRight($fileName));
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        // add all reseller
        $res = astercrm::getAll('resellergroup');
        $objResponse->addScript("addOption('resellerid','0','" . $locate->Translate("All") . "');");
        while ($row = $res->fetchRow()) {
            if ($config['synchronize']['id_autocrement_byset'] && ($row['id'] < $config['local_host']['minId'] || $row['id'] > $config['local_host']['maxId'])) {
                continue;
            }
            $objResponse->addScript("addOption('resellerid','" . $row['id'] . "','" . $row['resellername'] . "');");
        }
    } elseif ($_SESSION['curuser']['usertype'] == 'reseller') {
        // add self
        $objResponse->addScript("addOption('resellerid','" . $_SESSION['curuser']['resellerid'] . "','" . "" . "');");
        // add groups
        $objResponse->addScript("addOption('groupid','0','" . $locate->Translate("All") . "');");
        $res = astercrm::getAll('accountgroup', "resellerid", $_SESSION['curuser']['resellerid']);
        while ($row = $res->fetchRow()) {
            if ($config['synchronize']['id_autocrement_byset'] && ($row['id'] < $config['local_host']['minId'] || $row['id'] > $config['local_host']['maxId'])) {
                continue;
            }
            $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
        }
    } else {
        // add self
        $objResponse->addScript("addOption('resellerid','" . $_SESSION['curuser']['resellerid'] . "','" . "" . "');");
        $objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . "" . "');");
    }
    $objResponse->addScript("setCampaign();");
    return $objResponse;
}
Exemple #3
0
function init($post = '')
{
    global $locate;
    //,$config,$db;
    $aciton = '';
    $campaign_id = 0;
    if ($post != '') {
        $post = explode(',', $post);
        foreach ($post as $key => $value) {
            if ($value != '') {
                $v = explode(':', $value);
                if ($v['0'] == 'cid') {
                    if (is_numeric($v['1'])) {
                        $campaign_id = $v['1'];
                    }
                } elseif ($v['0'] == 'action') {
                    $aciton = $v['1'];
                }
            }
        }
    }
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("btnDial", "value", $locate->Translate("Dial list"));
    $objResponse->addAssign("btnCampaign", "value", $locate->Translate("Campaign"));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','','grid','','" . $aciton . "'," . $campaign_id . ")");
    $noanswer = Customer::getNoanswerCallsNumber();
    $objResponse->addAssign("spanRecycleUp", "innerHTML", $locate->Translate("No answer calls and never recycle") . ": {$noanswer}");
    $objResponse->addAssign("spanRecycleDown", "innerHTML", $locate->Translate("No answer calls and never recycle") . ": {$noanswer}");
    return $objResponse;
}
Exemple #4
0
/**
*  function to init import page
*
*
*  @return $objResponse
*
*/
function init($fileName)
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $file_list = getExistfilelist();
    $objResponse->addAssign('filelist', 'innerHTML', '');
    $objResponse->addScript("addOption('filelist','0','" . $locate->Translate('select a existent file') . "');");
    foreach ($file_list as $file) {
        $objResponse->addScript("addOption('filelist','" . $file['fileid'] . "','" . $file['originalname'] . "');");
    }
    $tableList = "<select name='sltTable' id='sltTable' onchange='selectTable(this.value);' >\n\t\t\t\t\t\t\t\t\t\t\t<option value=''>" . $locate->Translate("selecttable") . "</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='customer'>customer</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='contact'>contact</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='diallist'>diallist</option>\n\t\t\t\t\t\t\t\t\t\t</select>";
    $objResponse->addAssign("divTables", "innerHTML", $tableList);
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divGrid", "innerHTML", '');
    //$objResponse->addScript("xajax_showDivMainRight(document.getElementById('hidFileName').value);");
    //$objResponse->loadXML(showDivMainRight($fileName));
    //$objResponse->addAssign("divDiallistImport", "innerHTML", '');
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        // add all group
        $res = astercrm::getGroups();
        while ($row = $res->fetchRow()) {
            $objResponse->addScript("addOption('groupid','" . $row['groupid'] . "','" . $row['groupname'] . "');");
        }
    } else {
        // add self
        $objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . $_SESSION['curuser']['group']['groupname'] . "');");
    }
    $objResponse->addScript("setCampaign();");
    $objResponse->loadXML(showDivMainRight($fileName));
    return $objResponse;
}
Exemple #5
0
/**
*  initialize page elements
*
*/
function init()
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
    $objResponse->addAssign("btnContact", "value", $locate->Translate("contact"));
    $objResponse->addAssign("btnNote", "value", $locate->Translate("note"));
    $objResponse->addAssign("btnCustomerLead", "value", $locate->Translate("customer_leads"));
    if ($config['system']['customer_leads'] == 'default_move' || $config['system']['customer_leads'] == 'move') {
        $objResponse->addAssign("customerLeadAction", "innerHTML", "<input type=\"button\" onclick=\"xajax_customerLeadsAction('" . $config['system']['customer_leads'] . "',xajax.getFormValues('delGrid'),xajax.getFormValues('searchForm'));\" id=\"btnCustomerlead\" name=\"btnCustomerlead\" value=\"" . $locate->Translate("move_to_customerleads") . "\">");
    } else {
        if ($config['system']['customer_leads'] == 'default_copy' || $config['system']['customer_leads'] == 'copy') {
            $objResponse->addAssign("customerLeadAction", "innerHTML", "<input type=\"button\" onclick=\"xajax_customerLeadsAction('" . $config['system']['customer_leads'] . "',xajax.getFormValues('delGrid'),xajax.getFormValues('searchForm'));\" id=\"btnCustomerlead\" name=\"btnCustomerlead\" value=\"" . $locate->Translate("copy_to_customerleads") . "\">");
        } else {
            $objResponse->addAssign("customerLeadAction", "innerHTML", "");
        }
    }
    //*******
    $objResponse->addAssign("by", "value", $locate->Translate("by"));
    //搜索条件
    $objResponse->addAssign("search", "value", $locate->Translate("search"));
    //搜索内容
    //*******
    return $objResponse;
}
Exemple #6
0
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $peers = array();
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        // set all group first
        $group = astercrm::getAll('astercrm_accountgroup');
        $objResponse->addScript("addOption('groupid',0,'" . $locate->Translate("All") . "');");
        while ($group->fetchInto($row)) {
            $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
        }
    } else {
        // set one group
        $objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . "" . "');");
        // set all account
        $account = astercrm::getGroupMemberListByID($_SESSION['curuser']['groupid']);
        $objResponse->addScript("addOption('accountid','" . "0" . "','" . "All" . "');");
        while ($account->fetchInto($row)) {
            $objResponse->addScript("addOption('accountid','" . $row['id'] . "','" . $row['username'] . "');");
        }
    }
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    return $objResponse;
}
Exemple #7
0
/**
*  initialize page elements
*
*/
function init($customerid = '')
{
    global $locate;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','','grid','','','" . $customerid . "')");
    return $objResponse;
}
Exemple #8
0
/**
*  initialize page elements
*
*/
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
    return $objResponse;
}
Exemple #9
0
/**
*  initialize page elements
*
*/
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addAssign("delTable", "value", "");
    $objResponse->addAssign("delType", "value", "all");
    $objResponse->addAssign("delObject", "value", 'all');
    return $objResponse;
}
/**
*  initialize page elements
*
*/
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("btnAgentQueueStatistics", "value", $locate->Translate("agent_queue_statistics"));
    $_SESSION['ParentID'] = '';
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
    return $objResponse;
}
Exemple #11
0
/**
*  initialize page elements
*
*/
function init()
{
    global $locate;
    //,$config,$db;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addAssign("btnCustomer", "value", $locate->Translate("customer"));
    $objResponse->addAssign("btnNote", "value", $locate->Translate("note"));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
    return $objResponse;
}
/**
*  initialize page elements
*
*/
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("btnTicketCategory", "value", $locate->Translate("ticketcategory_manage"));
    $objResponse->addAssign("btnTicketOplogs", "value", $locate->Translate("ticket_details_operate_logs"));
    $objResponse->addAssign("btnTicket", "value", $locate->Translate("ticket_manage"));
    $_SESSION['ParentID'] = '';
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
    return $objResponse;
}
Exemple #13
0
function init()
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $myAsterisk = new Asterisk();
    $myAsterisk->config['asmanager'] = $config['asterisk'];
    $res = $myAsterisk->connect();
    if (!$res) {
        $objResponse->addAssign("divAMIStatus", "innerHTML", $locate->Translate("AMI_connection_failed"));
    }
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addAssign("msgChannelsInfo", "value", $locate->Translate("msgChannelsInfo"));
    return $objResponse;
}
Exemple #14
0
/**
*  initialize page elements
*
*/
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
    if ($_SESSION['curuser']['usertype'] == "groupadmin") {
        $row = astercrm::getRecordById($_SESSION['curuser']['groupid'], "accountgroup");
        $objResponse->addAssign("customer_multiple", "value", $row['customer_multiple']);
        $objResponse->addAssign("spnShortcutUpdate", "innerHTML", '<input type="button" value="' . $locate->Translate("Shortcut update rate") . '" onclick="xajax_shortcutUpdate();">');
        $objResponse->addAssign("spnShortcutMsg", "innerHTML", '');
    }
    return $objResponse;
}
Exemple #15
0
/**
*  initialize page elements
*
*/
function init()
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $myAsterisk = new Asterisk();
    $myAsterisk->config['asmanager'] = $config['asterisk'];
    $res = $myAsterisk->connect();
    if (!$res) {
        $objResponse->addAssign("AMIStatudDiv", "innerHTML", $locate->Translate("AMI_connection_failed"));
    }
    $objResponse->addAssign("msgChannelsInfo", "value", $locate->Translate("msgChannelsInfo"));
    ////set time intervals of check system status
    $check_interval = 2000;
    if (is_numeric($config['system']['status_check_interval'])) {
        $check_interval = $config['system']['status_check_interval'] * 1000;
        $objResponse->addAssign("check_interval", "value", $check_interval);
    }
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    return $objResponse;
}
Exemple #16
0
function init($curpeer)
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $peers = array();
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        // set all reseller first
        $reseller = astercrm::getAll('resellergroup');
        $objResponse->addScript("addOption('resellerid','" . "0" . "','" . $locate->Translate("All") . "');");
        while ($reseller->fetchInto($row)) {
            if ($config['synchronize']['display_synchron_server']) {
                $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
            }
            $objResponse->addScript("addOption('resellerid','" . $row['id'] . "','" . $row['resellername'] . "');");
        }
    } else {
        if ($_SESSION['curuser']['usertype'] == 'reseller') {
            // set one reseller
            $objResponse->addScript("addOption('resellerid','" . $_SESSION['curuser']['resellerid'] . "','" . "" . "');");
            // set all group
            $group = astercrm::getAll('accountgroup', 'resellerid', $_SESSION['curuser']['resellerid']);
            $objResponse->addScript("addOption('groupid','" . "0" . "','" . "All" . "');");
            while ($group->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                }
                $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
            }
            // get limit status and creditlimit
            $reseller = astercc::readRecord("resellergroup", "id", $_SESSION['curuser']['resellerid']);
            if ($reseller) {
                if ($reseller['limittype'] == "") {
                    $html = $locate->Translate("Limit Type") . ":" . $locate->Translate("No limit");
                } else {
                    $html = $locate->Translate("Limit Type") . $accountgroup['limittype'] . "(" . $accountgroup['creditlimit'] . ")";
                }
                $html = $locate->Translate("Limit Type") . $reseller['limittype'] . "(" . $reseller['creditlimit'] . ")";
                $objResponse->addAssign("divLimitStatus", "innerHTML", $html);
            }
        } else {
            $objResponse->addScript("addOption('resellerid','" . $_SESSION['curuser']['resellerid'] . "','" . "" . "');");
            $objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . "" . "');");
            $clid = astercrm::getAll('clid', 'groupid', $_SESSION['curuser']['groupid']);
            $objResponse->addScript("addOption('sltBooth','" . "0" . "','" . $locate->Translate("All") . "');");
            while ($clid->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $clidDisplay = astercrm::getSynchronDisplay($row['id'], $row['clid']);
                }
                if ($curpeer == $row['clid']) {
                    $objResponse->addScript("addOption('sltBooth','" . $row['clid'] . "','" . $clidDisplay . "',true);");
                } else {
                    $objResponse->addScript("addOption('sltBooth','" . $row['clid'] . "','" . $clidDisplay . "');");
                }
            }
            $objResponse->addScript("addOption('sltBooth','-1','" . $locate->Translate("Callback") . "');");
            // get limit status and creditlimit
            $accountgroup = astercc::readRecord("accountgroup", "id", $_SESSION['curuser']['groupid']);
            if ($accountgroup) {
                if ($accountgroup['limittype'] == "") {
                    $html = $locate->Translate("Limit Type") . ":" . $locate->Translate("No limit");
                } else {
                    $html = $locate->Translate("Limit Type") . $accountgroup['limittype'] . "(" . $accountgroup['creditlimit'] . ")";
                }
                $objResponse->addAssign("divLimitStatus", "innerHTML", $html);
            }
        }
    }
    //去除了控制chekcout按钮是否显示的代码//20110303 donnie
    //if($config['system']['useHistoryCdr'] == 1){
    //$objResponse->addScript("document.getElementById('btnCheckOut').style.display='none';");
    //}else if($config['system']['useHistoryCdr'] == 0){
    //$objResponse->addScript("document.getElementById('btnCheckOut').style.display='block';");
    //}
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    return $objResponse;
}
function init()
{
    global $locate, $config, $db;
    $objResponse = new xajaxResponse();
    $myAsterisk = new Asterisk();
    $myAsterisk->config['asmanager'] = $config['asterisk'];
    $res = $myAsterisk->connect();
    if (!$res) {
        $objResponse->addAssign("divAMIStatus", "innerHTML", $locate->Translate("AMI_connection_failed"));
    }
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    // get all groups
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        $groups = astercrm::getAll("astercrm_accountgroup");
    } else {
        $groups = astercrm::getRecordsByField('id', $_SESSION['curuser']['groupid'], 'astercrm_accountgroup');
    }
    while ($groups->fetchInto($group)) {
        // get all enabled campaigns
        $query = "SELECT * FROM campaign WHERE enable = 1 AND groupid = " . $group['groupid'];
        $campaigns = $db->query($query);
        $campaignHTML = '';
        while ($campaigns->fetchInto($campaign)) {
            // get worktime
            $localtime = localtime(time(), true);
            $wday = $localtime['tm_wday'];
            if ($localtime['tm_wday'] == 0) {
                $wday = 7;
            }
            $cur = $localtime['tm_hour'] . ":" . $localtime['tm_min'] . ":" . $localtime['tm_sec'];
            $query = " SELECT worktimes.*,worktimepackages.worktimepackage_status FROM worktimepackage_worktimes LEFT JOIN worktimes ON worktimes.id = worktimepackage_worktimes.worktime_id LEFT JOIN worktimepackages ON worktimepackages.id = worktimepackage_worktimes.worktimepackage_id WHERE worktimepackages.worktimepackage_status = 'enable' AND worktimepackage_id = " . $campaign['worktime_package_id'] . " AND ( starttime <= '{$cur}' AND endtime >= '{$cur}' ) AND (startweek <= {$wday} AND endweek >= {$wday} ) ";
            $worktime = $db->getOne($query);
            // get numbers in diallist
            $query = "SELECT COUNT(*) FROM diallist WHERE campaignid = " . $campaign['id'];
            $phoneNumber = $db->getOne($query);
            $has_queue = 0;
            // check if we have a queue in queue_name
            if ($campaign['queuename'] != "") {
                $query = "SELECT id FROM queue_name WHERE queuename = '" . $campaign['queuename'] . "' ";
                $has_queue = $db->getOne($query);
            }
            $status = "";
            $channel_checked = "";
            $queue_checked = "";
            if ($campaign['status'] == "busy") {
                $status = "checked";
            }
            if ($campaign['limit_type'] == "channel") {
                $channel_checked = "checked";
            } else {
                if ($campaign['limit_type'] == "queue") {
                    $queue_checked = "checked";
                }
            }
            if ($campaign['enablebalance'] == 'strict' && $campaign['balance'] <= 0) {
                $curStyle = ' style="color:gray" ';
                $curInputAbled = ' disabled ';
            } else {
                $curStyle = ' ';
                $curInputAbled = '';
            }
            $campaignHTML .= '<div class="group01content" ' . $curStyle . '>';
            if ($has_queue != 0) {
                $campaignHTML .= "<div class='group01l'>" . '<img src="images/groups_icon02.gif" width="20" height="20" align="absmiddle" /><acronym title="' . $locate->Translate("inexten") . ':' . $campaign['inexten'] . '&nbsp;|&nbsp;' . $locate->Translate("Outcontext") . ':' . $campaign['outcontext'] . '&nbsp;|&nbsp;' . $locate->Translate("Incontext") . ':' . $campaign['incontext'] . '"> ' . $campaign['campaignname'] . ' ( ' . $locate->Translate("queue") . ': ' . $campaign['queuename'] . ' ) ( <span id="numbers-' . $campaign['id'] . '">' . $phoneNumber . '</span> ' . $locate->Translate("numbers in dial list") . ' )</acronym> </div>';
                if (!$worktime && $campaign['worktime_package_id'] != 0) {
                    $campaignHTML .= '
						<div class="group01r">' . $locate->Translate("not in worktime") . '</div>';
                } else {
                    $campaignHTML .= '
						<div class="group01r">
						<input type="checkbox" ' . $curInputAbled . ' onclick="setStatus(this);" id="' . $campaign['id'] . '-ckb" ' . $status . '>' . $locate->Translate("Start") . '
						<input type="radio" ' . $curInputAbled . ' onclick="setLimitType(this);" id="' . $campaign['id'] . '-limittpye" name="' . $campaign['id'] . '-limittpye" value="channel" ' . $channel_checked . '> ' . $locate->Translate("Limited by max calls") . ' 
						<input type="text" ' . $curInputAbled . ' value="' . $campaign['max_channel'] . '" id="' . $campaign['id'] . '-maxchannel" name="' . $campaign['id'] . '-maxchannel" size="2" maxlength="3" class="inputlimit" onblur="setMaxChannel(this);">
						<input type="radio" ' . $curInputAbled . ' onclick="setLimitType(this);" id="' . $campaign['id'] . '-limittpye" name="' . $campaign['id'] . '-limittpye" value="queue" ' . $queue_checked . '> ' . $locate->Translate("Limited by agents and multipled by") . ' 
						<input type="text" ' . $curInputAbled . ' value="' . $campaign['queue_increasement'] . '" id="' . $campaign['id'] . '-rate" name="' . $campaign['id'] . '-rate" size="4" maxlength="4" class="inputlimit" onblur="setQueueRate(this);">
						</div>';
                }
            } else {
                $campaignHTML .= "<div class='group01l'>" . '<img src="images/groups_icon02.gif" width="20" height="20" align="absmiddle" /><acronym title="' . $locate->Translate("inexten") . ':' . $campaign['inexten'] . '&nbsp;|&nbsp;' . $locate->Translate("Outcontext") . ':' . $campaign['outcontext'] . '&nbsp;|&nbsp;' . $locate->Translate("Incontext") . ':' . $campaign['incontext'] . '">' . $campaign['campaignname'] . ' ( ' . $locate->Translate("no queue for this campaign") . ' ) ( <span id="numbers' . $campaign['id'] . '">' . $phoneNumber . '</span> ' . $locate->Translate("numbers in dial list") . ' ) </acronym></div>';
                if (!$worktime && $campaign['worktime_package_id'] != 0) {
                    $campaignHTML .= '
						<div class="group01r">' . $locate->Translate("not in worktime") . '</div>';
                } else {
                    $campaignHTML .= '
						<div class="group01r">
						<input type="checkbox" ' . $curInputAbled . ' onclick="setStatus(this);" id="' . $campaign['id'] . '-ckb" ' . $status . '>' . $locate->Translate("Start") . '
						<input type="radio" ' . $curInputAbled . ' name="' . $campaign['id'] . '-limittpye[]" value="channel" ' . $channel_checked . '>
						' . $locate->Translate("Limited by max calls") . ' 
						<input type="text" ' . $curInputAbled . ' value="' . $campaign['max_channel'] . '" id="' . $campaign['id'] . '-maxchannel" name="' . $campaign['id'] . '-maxchannel" size="3" maxlength="3" class="inputlimit" onblur="setMaxChannel(this);">
						</div>';
                }
            }
            $campaignHTML .= '</div>';
            $campaignHTML .= '<div class="group01_channel" id="campaign' . $campaign['id'] . '" ></div>';
        }
        $divGroup .= '<div class="group01"><img src="images/groups_icon01.gif" align="absmiddle" />' . $group['groupname'] . '</div>
												<div id="group' . $group['groupid'] . '">' . $campaignHTML . '</div>
											  <div class="group01_channel" id="unknown' . $group['groupid'] . '"></div>
											 </div>';
    }
    $objResponse->addAssign("divMain", "innerHTML", $divGroup);
    return $objResponse;
}
Exemple #18
0
/**
*  initialize page elements
*
*/
function init($get = '')
{
    global $config, $locate;
    $objResponse = new xajaxResponse();
    if ($get != '') {
        $get = rtrim($get, ',');
        $get = split(',', $get);
        foreach ($get as $item_tmp) {
            $item = split(':', $item_tmp);
            $get_item[$item[0]] = $item[1];
        }
    }
    $rechargeEable = true;
    if ($_SESSION['curuser']['usertype'] == 'reseller') {
        $paymentinfoHtml = paymentInfoHtml();
        $objResponse->addAssign("paymentInfo", "innerHTML", $paymentinfoHtml);
        if ($config['epayment']['epayment_status'] != 'enable' || $config['epayment']['paypal_payment_url'] == '' || $config['epayment']['paypal_account'] == '' || $config['epayment']['pdt_identity_token'] == '' || $config['epayment']['asterbilling_url'] == '' || $config['epayment']['amount'] == '' || $config['epayment']['currency_code'] == '') {
            $rechargeEable = false;
        } else {
            $identity_token = $config['epayment']['pdt_identity_token'];
            $receiver_email = $config['epayment']['paypal_account'];
            $currency_code = $config['epayment']['currency_code'];
        }
    } elseif ($_SESSION['curuser']['usertype'] == 'groupadmin') {
        $reseller_row = astercrm::getRecordByID($_SESSION['curuser']['resellerid'], 'resellergroup');
        if ($reseller_row['epayment_status'] != 'enable') {
            $rechargeEable = false;
        } else {
            $identity_token = $reseller_row['epayment_identity_token'];
            $receiver_email = $reseller_row['epayment_account'];
            $currency_code = $config['epayment']['currency_code'];
        }
    }
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    $infoHtml = InfomationHtml();
    $objResponse->addAssign("info", "innerHTML", $infoHtml);
    if ($rechargeEable) {
        $rechargeInfoHtml = '<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F0F0F0" width="600">
				  <tr>
					<td width="26%" height="39" class="td font" align="center">' . $locate->Translate('Recharge By Paypal') . '
					</td>
					<td width="74%" class="td font" align="center">&nbsp;</td>
				  </tr>
					<tr><td height="10" class="td"></td>
					<td class="td font" align="center">&nbsp;</td>
				  </tr>
				</table>
				<table border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#F0F0F0" id="menu" width="600">
					<tr bgcolor="#F7F7F7">
					<td align="center" valign="top"><b>';
        if ($get_item["action"] == 'success') {
            if ($get_item['tx'] != '') {
                $txn_res = astercrm::getRecordByField('epayment_txn_id', $get_item['tx'], 'credithistory');
                // check that txn_id has not been previously processed
                if ($txn_res['id'] > 0) {
                    $rechargeInfoHtml .= $locate->Translate('payment_success');
                } else {
                    if ($identity_token != '') {
                        $p = new paypal_class();
                        $p->verify_url = $config['epayment']['paypal_verify_url'];
                        if ($config['epayment']['pdt_log']) {
                            $return = $p->paypal_pdt_return($get_item['tx'], $identity_token, true);
                        } else {
                            $return = $p->paypal_pdt_return($get_item['tx'], $identity_token);
                        }
                        if ($return['flag'] == 'SUCCESS') {
                            $errorFlag = 0;
                            // check that receiver_email is your Primary PayPal email
                            if ($return['pdt']['receiver_email'] != $receiver_email) {
                                $rechargeInfoHtml .= $locate->Translate('payment_receiver_error') . '</br>';
                                $errorFlag += 1;
                            }
                            // check that payment_amount/payment_currency are correct
                            if ($return['pdt']['mc_currency'] != $currency_code) {
                                $rechargeInfoHtml .= $locate->Translate('payment_currency_error') . '</br>';
                                $errorFlag += 1;
                            }
                            if ($return['pdt']['payment_status'] == "Completed") {
                                if ($errorFlag > 0) {
                                    $rechargeInfoHtml .= $locate->Translate('payment_order_error') . "</br>" . $locate->Translate('payment_may_completed');
                                } else {
                                    // process Order 不再用pdt处理订单,等待ipn处理
                                    //$process_res = processOrder($return['pdt']);
                                    sleep(1);
                                    $infoHtml = InfomationHtml();
                                    $objResponse->addAssign("info", "innerHTML", $infoHtml);
                                    $rechargeInfoHtml .= $locate->Translate('payment_success');
                                }
                            } else {
                                $rechargeInfoHtml .= $locate->Translate('payment_failed');
                            }
                        } else {
                            //PDT return failed
                            $rechargeInfoHtml .= $locate->Translate('payment_return_failed');
                        }
                    }
                }
            } else {
                $rechargeInfoHtml = rechargeHtml();
                $objResponse->addAssign("rechargeInfo", "innerHTML", $rechargeInfoHtml);
                return $objResponse;
            }
        } elseif ($get_item["action"] == 'cancel') {
            $rechargeInfoHtml .= $locate->Translate('payment_canceled');
        } else {
            $rechargeInfoHtml = rechargeHtml();
            $objResponse->addAssign("rechargeInfo", "innerHTML", $rechargeInfoHtml);
            return $objResponse;
        }
        $rechargeInfoHtml .= '</b>&nbsp;&nbsp;&nbsp;<a href="profile.php" >' . $locate->Translate('Return') . '</a></td></tr></table>';
        $objResponse->addAssign("rechargeInfo", "innerHTML", $rechargeInfoHtml);
    }
    return $objResponse;
}