예제 #1
0
function waitingCalls($myValue)
{
    global $db, $config;
    $locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'portal');
    $objResponse = new xajaxResponse();
    $curid = trim($myValue['curid']);
    // to improve system efficiency
    /**************************
    **************************/
    //	modified 2007/10/30 by solo
    //  start
    //print_r($_SESSION);exit;
    //if ($_SESSION['curuser']['channel'] == '')
    $call = asterEvent::checkNewCall($curid, $_SESSION['curuser']['extension'], $_SESSION['curuser']['channel'], $_SESSION['curuser']['agent']);
    //else
    //	$call = asterEvent::checkNewCall($curid,$_SESSION['curuser']['channel']);
    //  end
    if ($call['status'] == '') {
        $title = $locate->Translate("waiting");
        $status = 'idle';
        //$call['curid'] = $curid;
        $direction = '';
        $info = $locate->Translate("extension") . $_SESSION['curuser']['extension'] . "-" . $locate->Translate("stand_by");
    } elseif ($call['status'] == 'incoming') {
        //incoming calls here
        $title = $call['callerid'];
        $stauts = 'ringing';
        $direction = 'in';
        $info = $locate->Translate("incoming") . ' ' . $call['callerid'];
        $trunk = split("-", $call['callerChannel']);
        //print_r($trunk);exit;
        $trunk_name = split('@', $trunk[0]);
        $info = $info . ' channel: ' . $trunk_name[0];
        // get trunk info
        $mytrunk = astercrm::getTrunkinfo($trunk[0], $call['didnumber']);
        if ($mytrunk) {
            $infomsg = "<strong>" . $mytrunk['trunkname'] . "</strong><br>";
            $infomsg .= mb_substr(astercrm::db2html($mytrunk['trunknote']), 0, 10, "UTF-8") . '...';
            if ($call['didnumber'] != '') {
                $infomsg .= "&nbsp;|" . $locate->Translate("Callee id") . "&nbsp;:&nbsp;<b>" . $call['didnumber'] . "</b>";
            }
            $objResponse->addAssign('divTrunkinfo', "innerHTML", $infomsg);
        } else {
            $trunk_name = split('@', $trunk[0]);
            $infomsg = $locate->Translate("no information get for trunk") . ": " . $trunk_name[0];
            $objResponse->addAssign('divTrunkinfo', "innerHTML", $infomsg);
        }
        $objResponse->addAssign("iptSrcNumber", "value", $call['callerid']);
        $objResponse->addAssign("iptCallerid", "value", $call['callerid']);
        $objResponse->addAssign("btnHangup", "disabled", false);
        if ($config['system']['pop_up_when_dial_in']) {
            if (strlen($call['callerid']) > $config['system']['phone_number_length'] && $call['callerid'] != '<unknown>') {
                if ($myValue['popup'] == 'yes') {
                    if ($config['system']['enable_external_crm'] == false) {
                        $objResponse->loadXML(getContact($call['callerid']));
                        if ($config['system']['browser_maximize_when_pop_up'] == true) {
                            $objResponse->addScript('maximizeWin();');
                        }
                    } else {
                        //use external link
                        $myurl = $config['system']['external_crm_url'];
                        $myurl = preg_replace("/\\%method/", "dial_in", $myurl);
                        $myurl = preg_replace("/\\%callerid/", $call['callerid'], $myurl);
                        $myurl = preg_replace("/\\%calleeid/", $_SESSION['curuser']['extension'], $myurl);
                        if ($config['system']['open_new_window'] == false) {
                            $mycrm = '<iframe id="mycrm" name="mycrm" src="' . $myurl . '" width="100%"  frameBorder=0 scrolling=auto height="100%"></iframe>';
                            $objResponse->addAssign("divCrm", "innerHTML", $mycrm);
                        } else {
                            $javascript = "openwindow('" . $myurl . "')";
                            $objResponse->addScript($javascript);
                        }
                    }
                }
            } else {
            }
        }
    } elseif ($call['status'] == 'dialout') {
        //dailing out here
        $title = $call['callerid'];
        $status = 'dialing';
        $direction = 'out';
        $info = $locate->Translate("dial_out") . ' ' . $call['callerid'];
        $objResponse->addAssign("iptCallerid", "value", $call['callerid']);
        $objResponse->addAssign("btnHangup", "disabled", false);
        if ($call['didnumber'] != '') {
            $didinfo = $locate->Translate("Callee id") . "&nbsp;:&nbsp;" . $call['didnumber'];
            $objResponse->addAssign('divDIDinfo', 'innerHTML', $didinfo);
        }
        if ($config['system']['pop_up_when_dial_out']) {
            if (strlen($call['callerid']) > $config['system']['phone_number_length']) {
                if ($myValue['popup'] == 'yes') {
                    if ($config['system']['enable_external_crm'] == false) {
                        $objResponse->loadXML(getContact($call['callerid']));
                        if ($config['system']['browser_maximize_when_pop_up'] == true) {
                            $objResponse->addScript('maximizeWin();');
                        }
                    } else {
                        //use external link
                        $myurl = $config['system']['external_crm_url'];
                        $myurl = preg_replace("/\\%method/", "dial_out", $myurl);
                        $myurl = preg_replace("/\\%callerid/", $_SESSION['curuser']['extension'], $myurl);
                        $myurl = preg_replace("/\\%calleeid/", $call['callerid'], $myurl);
                        if ($config['system']['open_new_window'] == false) {
                            $mycrm = '<iframe id="mycrm" name="mycrm" src="' . $myurl . '" width="100%"  frameBorder=0 scrolling=auto height="100%"></iframe>';
                            $objResponse->addAssign("divCrm", "innerHTML", $mycrm);
                        } else {
                            $javascript = "openwindow('" . $myurl . "')";
                            $objResponse->addScript($javascript);
                        }
                    }
                }
            }
        }
    }
    //	$objResponse->addScript('document.title='.$title.';');
    //	$objResponse->addAssign("status","innerHTML", $stauts );
    $objResponse->addAssign("extensionStatus", "value", $stauts);
    //echo $call['uniqueid'];exit;
    $objResponse->addAssign("uniqueid", "value", $call['uniqueid']);
    $objResponse->addAssign("callerid", "value", $call['callerid']);
    $objResponse->addAssign("callerChannel", "value", $call['callerChannel']);
    $objResponse->addAssign("calleeChannel", "value", $call['calleeChannel']);
    $objResponse->addAssign("curid", "value", $call['curid']);
    $objResponse->addAssign("direction", "value", $direction);
    $objResponse->addAssign("myevents", "innerHTML", $info);
    return $objResponse;
}
예제 #2
0
function incomingCalls($myValue)
{
    global $db, $locate, $config;
    $objResponse = new xajaxResponse();
    //print_r($myValue);exit;
    if ($myValue['direction'] != '') {
        $call = asterEvent::checkCallStatus($myValue['curid'], $myValue['uniqueid']);
        #print_r($call);exit;
        if ($call['status'] == '') {
            if ($call['hold']['number'] != '') {
                //print_r($myValue);exit;
                $curcallerid = $call['hold']['number'];
                $objResponse->addAssign("divHolding", "innerHTML", '<a href="###" onclick="getContact(' . $call['hold']['number'] . ');">[' . $call['hold']['number'] . ']</a>&nbsp;&nbsp;<a onclick="xajax_turnback(\'' . $call['hold']['channel'] . '\',\'' . $myValue['callerChannel'] . '\');return false;" href="###"><font size="2px">' . $locate->Translate("Turn back") . '</font></a>&nbsp;&nbsp;&nbsp;');
                //<a onclick="xajax_holdhangup(\''.$call['hold']['channel'].'\');return false;" href="###"><font size="2px">'.$locate->Translate("Hangup").'</font></a>
            } else {
                $curcallerid = $myValue['callerid'];
                $objResponse->addAssign("divHolding", "innerHTML", '');
            }
            return $objResponse;
        } elseif ($call['status'] == 'link') {
            $objResponse->addAssign("btnDial", "disabled", true);
            $objResponse->addScript("clearSettimePopup();");
            if ($myValue['direction'] == 'in' && $myValue['trunkinfoStatus'] == 0) {
                if ($call['didnumber'] != '') {
                    $didinfo = $locate->Translate("Callee id") . "&nbsp;:&nbsp;<b>" . $call['didnumber'] . "</b>";
                    $objResponse->addAssign('divDIDinfo', 'innerHTML', $didinfo);
                }
                $trunk = split("-", $call['callerChannel']);
                //print_r($trunk);exit;
                $info = $info . ' channel: ' . $trunk[0];
                // get trunk info
                $mytrunk = astercrm::getTrunkinfo($trunk[0], $call['didnumber']);
                if ($mytrunk) {
                    $infomsg = "<strong>" . $mytrunk['trunkname'] . "</strong><br>";
                    $infomsg .= astercrm::db2html($mytrunk['trunknote']);
                    $objResponse->addAssign('divTrunkinfo', "innerHTML", $infomsg);
                    $objResponse->addAssign('trunkinfo_number', "innerHTML", $mytrunk['trunk_number']);
                } else {
                    $infomsg = $locate->Translate("no information get for trunk") . ": " . $trunk[0];
                    $objResponse->addAssign('divTrunkinfo', "innerHTML", $infomsg);
                    $objResponse->addAssign('trunkinfo_number', "innerHTML");
                }
                $objResponse->addAssign('trunkinfoStatus', "value", '1');
                if ($config['system']['enable_sms'] == 'callerid' && $myValue['callerid'] != '') {
                    $objResponse->addScript('xajax_SendSmsForm("callerid",' . $myValue['callerid'] . ')');
                } else {
                    if ($config['system']['enable_sms'] == 'trunk_number' && $mytrunk['trunk_number'] != '') {
                        $objResponse->addScript('xajax_SendSmsForm("trunk_number",' . $mytrunk['trunk_number'] . ')');
                    } else {
                        if ($config['system']['enable_sms'] == 'campaign_number' && $result['campaignid'] != '') {
                            $objResponse->addScript('xajax_SendSmsForm("campaign_number",' . $result['campaignid'] . ')');
                        }
                    }
                }
            }
            if ($myValue['callResultStatus'] != '2') {
                $result = asterCrm::checkDialedlistCall($myValue['callerid']);
                //print_r($result);exit;
                $dialedlistid = $result['id'];
                //$dialedlistid =
                $campaign_id = $result['campaignid'];
                if ($campaign_id != '') {
                    $objResponse->addAssign("dndlist_campaignid", "value", $campaign_id);
                } else {
                    $objResponse->addAssign("dndlist_campaignid", "value", "0");
                }
                if ($dialedlistid) {
                    $divCallresult = Customer::getCampaignResultHtml($dialedlistid, 'ANSWERED');
                    //echo $divCallresult;exit;
                    $objResponse->addAssign("divCallresult", "style.display", "");
                    $objResponse->addAssign("divCallresult", "innerHTML", $divCallresult);
                    $objResponse->addAssign("dialedlistid", "value", $dialedlistid);
                } else {
                    $objResponse->addAssign("dialedlistid", "value", 0);
                }
                $objResponse->addAssign("callResultStatus", "value", '2');
            }
            if ($myValue['extensionStatus'] == 'link') {
                //already get link event
                return $objResponse;
            }
            //			if ($call['callerChannel'] == '' or $call['calleeChannel'] == '')
            //				return $objResponse;
            $status = "link";
            if ($call['hold']['number'] != '') {
                //print_r($myValue);exit;
                $curcallerid = $call['consultnum'];
                $objResponse->addAssign("divHolding", "innerHTML", '<a href="###" onclick="getContact(' . $call['hold']['number'] . ');">[' . $call['hold']['number'] . ']</a>&nbsp;&nbsp;<a onclick="xajax_turnback(\'' . $call['hold']['channel'] . '\',\'' . $myValue['callerChannel'] . '\');return false;" href="###"><font size="2px">' . $locate->Translate("Turn back") . '</font></a>&nbsp;&nbsp;&nbsp;<a onclick="xajax_attendtransfer(\'' . $call['hold']['channel'] . '\',\'' . $myValue['calleeChannel'] . '\');return false;" href="###"><font size="2px">' . $locate->Translate("Transfer") . '</font></a>&nbsp;&nbsp;&nbsp;');
                //<a onclick="xajax_holdhangup(\''.$call['hold']['channel'].'\');return false;" href="###"><font size="2px">'.$locate->Translate("Hangup").'</font></a>
            } else {
                $curcallerid = $myValue['callerid'];
                $objResponse->addAssign("divHolding", "innerHTML", '');
            }
            #print_r($myValue);exit;
            if (!empty($call['srcname']) && $call['srcname'] != 'unknown' && $call['srcname'] != '<unknown>') {
                $info = $locate->Translate("talking_to") . $curcallerid . ' (' . $call['srcname'] . ')&nbsp;&nbsp;';
            } else {
                $info = $locate->Translate("talking_to") . $curcallerid;
            }
            if ($call['queue'] != '') {
                foreach ($_SESSION['curuser']['campaign_queue'] as $row) {
                    if ($row['queuename'] == $call['queue']) {
                        if ($row['autopause'] == 'checked') {
                            $pagent = '';
                            if (strstr($call['calleeChannel'], 'agent')) {
                                $pagent = $call['calleeChannel'];
                            }
                            $objResponse->addScript("xajax_queueAgentControl('" . $row['queuename'] . "','pause','" . $row['queue_context'] . "','" . $pagent . "');");
                        }
                        $objResponse->addAssign("campaignDiv-" . $row['id'], "style.background", 'red');
                    }
                }
            }
            $objResponse->addAssign("callerChannel", "value", $call['callerChannel']);
            $objResponse->addAssign("calleeChannel", "value", $call['calleeChannel']);
            //if chkMonitor be checked or monitor by astercctools btnMonitor must be disabled
            $configstatus = Common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
            if ($configstatus != -2) {
                if ($myValue['chkMonitor'] != 'on' && $asterccConfig['system']['force_record'] != 1) {
                    $objResponse->addAssign("btnMonitor", "disabled", false);
                }
            }
            //$objResponse->addAssign("btnMonitor","value", $locate->Translate("start_record") );
            astercrm::events($myValue['chkMonitor'] . '-chkMonitor');
            astercrm::events($myValue['btnMonitorStatus'] . '-btnMonitorStatus');
            //echo $myValue['chkMonitor'];exit;
            if ($myValue['chkMonitor'] == 'on' && $myValue['btnMonitorStatus'] == 'idle') {
                $objResponse->addScript("monitor();");
            }
            $objResponse->addAssign("btnHangup", "disabled", false);
            if (strtoupper($config['system']['transfer_pannel']) == 'ON' && $call['hold']['number'] == '') {
                $objResponse->addAssign("btnTransfer", "disabled", false);
            }
        } elseif ($call['status'] == 'hangup') {
            if ($call['hold']['number'] != '') {
                //print_r($myValue);exit;
                $curcallerid = $call['hold']['number'];
                $objResponse->addAssign("divHolding", "innerHTML", '<a href="###" onclick="getContact(' . $call['hold']['number'] . ');">[' . $call['hold']['number'] . ']</a>&nbsp;&nbsp;<a onclick="xajax_turnback(\'' . $call['hold']['channel'] . '\',\'' . $myValue['callerChannel'] . '\');return false;" href="###"><font size="2px">' . $locate->Translate("Turn back") . '</font></a>&nbsp;&nbsp;&nbsp;');
                //<a onclick="xajax_holdhangup(\''.$call['hold']['channel'].'\');return false;" href="###"><font size="2px">'.$locate->Translate("Hangup").'</font></a>
            } else {
                $curcallerid = $myValue['callerid'];
                $objResponse->addAssign("divHolding", "innerHTML", '');
            }
            //			if($call['hold']['channel'] != ''){//检查是否还有onhold的通话,有则呼叫座席进行接回
            //
            //				$myAsterisk = new Asterisk();
            //				$myAsterisk->config['asmanager'] = $config['asterisk'];
            //				$res = $myAsterisk->connect();
            //				$strChannel = "Local/".$_SESSION['curuser']['extension']."@from-internal/n";
            //				$myAsterisk->sendCall($strChannel,NULL,NULL,1,'Bridge',$call['hold']['channel'],30,$_SESSION['curuser']['extension'],NULL,$_SESSION['curuser']['accountcode']);
            //			}
            //$objResponse->addAssign("divCallresult", "style.display", "none");
            $objResponse->addAssign("callResultStatus", "value", "");
            $objResponse->addAssign('trunkinfoStatus', "value", '0');
            //$objResponse->addAssign("divCallresult", "innerHTML", '<input type="radio" value="normal" id="callresult" name="callresult" onclick="updateCallresult(this.value);" checked>'.$locate->Translate("normal").' <input type="radio" value="fax" id="callresult" name="callresult" onclick="updateCallresult(this.value);">'. $locate->Translate("fax").' <input type="radio" value="voicemail" id="callresult" name="callresult" onclick="updateCallresult(this.value);">'. $locate->Translate("voicemail").'<input type="hidden" id="dialedlistid" name="dialedlistid" value="0">');
            if ($myValue['chkMonitor'] == 'on' && $myValue['btnMonitorStatus'] == 'recording') {
                $objResponse->addScript("monitor();");
            }
            $status = 'hang up';
            $info = "Hang up call from " . $myValue['callerid'];
            //			$objResponse->addScript('document.title=\'asterCrm\';');
            $objResponse->addAssign("uniqueid", "value", "");
            $objResponse->addAssign("callerid", "value", "");
            $objResponse->addAssign("callerChannel", "value", '');
            $objResponse->addAssign("calleeChannel", "value", '');
            if (strtoupper($config['system']['transfer_pannel']) == 'ON') {
                $objResponse->addAssign("btnTransfer", "disabled", true);
            }
            //disable monitor
            $objResponse->addAssign("btnMonitor", "disabled", true);
            $objResponse->addAssign("spanMonitorStatus", "innerHTML", $locate->Translate("idle"));
            $objResponse->addAssign("btnMonitor", "value", $locate->Translate("start_record"));
            foreach ($_SESSION['curuser']['campaign_queue'] as $row) {
                //print_r($row);exit;
                $objResponse->addAssign("campaignDiv-" . $row['id'], "style.background", '');
            }
            //disable hangup button
            $objResponse->addAssign("btnHangup", "disabled", true);
            $objResponse->addAssign('divTrunkinfo', "innerHTML", '');
            $objResponse->addAssign('trunkinfo_number', "innerHTML", '');
            $objResponse->addAssign('divDIDinfo', 'innerHTML', '');
            if ($myValue['btnWorkStatus'] == 'working') {
                $interval = $_SESSION['curuser']['dialinterval'];
                $objResponse->addScript("autoDial('{$interval}');");
            }
            $objResponse->addScript("document.getElementById('btnDial').disabled=false;");
            $objResponse->addScript("setTimeoutforPopup();");
        }
        $objResponse->addAssign("status", "innerHTML", $status);
        //		$objResponse->addAssign("extensionStatus","value", $status );
        $objResponse->addAssign("myevents", "innerHTML", $info);
    }
    return $objResponse;
}
예제 #3
0
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array())
{
    global $locate;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null or $content == null or $content == 'Array' or $filter == 'Array') {
        $numRows =& Customer::getNumRows();
        $arreglo =& Customer::getAllRecords($start, $limit, $order);
        $content = null;
        $filter = null;
    } else {
        foreach ($content as $value) {
            if (trim($value) != "") {
                //搜索内容有值
                $flag = "1";
                break;
            }
        }
        foreach ($filter as $value) {
            if (trim($value) != "") {
                //搜索条件有值
                $flag2 = "1";
                break;
            }
        }
        foreach ($stype as $value) {
            if (trim($value) != "") {
                //搜索方式有值
                $flag3 = "1";
                break;
            }
        }
        if ($flag != "1" || $flag2 != "1") {
            //无值
            if (is_array($order) || $order == '') {
                $order = null;
            }
            $numRows =& Customer::getNumRows($_SESSION['curuser']['groupid']);
            $arreglo =& Customer::getAllRecords($start, $limit, $order, $_SESSION['curuser']['groupid']);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "trunkinfo");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "survey");
        } else {
            $order = "id";
            $numRows =& Customer::getNumRowsMorewithstype($filter, $content, $stype, $table);
            $arreglo =& Customer::getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype, $order, $table);
        }
    }
    // Select Box: type table.
    $typeFromSearch = array();
    $typeFromSearch[] = 'like';
    $typeFromSearch[] = 'equal';
    $typeFromSearch[] = 'more';
    $typeFromSearch[] = 'less';
    // Selecct Box: Labels showed on searchtype select box.
    $typeFromSearchShowAs = array();
    $typeFromSearchShowAs[] = $locate->Translate("like");
    $typeFromSearchShowAs[] = '=';
    $typeFromSearchShowAs[] = '>';
    $typeFromSearchShowAs[] = '<';
    // Editable zone
    // Databse Table: fields
    $fields = array();
    $fields[] = 'trunkname';
    $fields[] = 'trunkchannel';
    $fields[] = 'didnumber';
    $fields[] = 'trunknote';
    $fields[] = 'creby';
    $fields[] = 'cretime';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Trunk Name");
    $headers[] = $locate->Translate("Trunk Channel");
    $headers[] = $locate->Translate("DID Number");
    $headers[] = $locate->Translate("Trunk Note");
    $headers[] = $locate->Translate("Create by");
    $headers[] = $locate->Translate("Create time");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width="15%"';
    $attribsHeader[] = 'width="15%"';
    $attribsHeader[] = 'width="15%"';
    $attribsHeader[] = 'width="30%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="10%"';
    // HTML Table: columns attributes
    $attribsCols = array();
    $attribsCols[] = 'style="text-align: left"';
    $attribsCols[] = 'style="text-align: left"';
    $attribsCols[] = 'style="text-align: left"';
    $attribsCols[] = 'style="text-align: left"';
    $attribsCols[] = 'style="text-align: left"';
    $attribsCols[] = 'style="text-align: left"';
    // HTML Table: If you want ascendent and descendent ordering, set the Header Events.
    $eventHeader = array();
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","trunkname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","trunkchannel","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","didnumber","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","trunknote","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","creby","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","cretime","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'trunkname';
    $fieldsFromSearch[] = 'trunkchannel';
    $fieldsFromSearch[] = 'didnumber';
    $fieldsFromSearch[] = 'trunknote';
    $fieldsFromSearch[] = 'creby';
    $fieldsFromSearch[] = 'cretime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Trunk Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Trunk Channel");
    $fieldsFromSearchShowAs[] = $locate->Translate("DID Number");
    $fieldsFromSearchShowAs[] = $locate->Translate("Trunk Note");
    $fieldsFromSearchShowAs[] = $locate->Translate("Create by");
    $fieldsFromSearchShowAs[] = $locate->Translate("Create time");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(7, $start, $limit, $filter, $numRows, $content, $order);
    //$table->exportFlag = '1';//对导出标记进行赋值
    $table->ordering = $ordering;
    $editFlag = 1;
    $deleteFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['trunkinfo']['delete']) {
            $deleteFlag = 1;
        } else {
            $deleteFlag = 0;
        }
        if ($_SESSION['curuser']['privileges']['trunkinfo']['edit']) {
            $editFlag = 1;
        } else {
            $editFlag = 0;
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $editFlag, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("trunkinfo", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, 0, $typeFromSearch, $typeFromSearchShowAs, $stype);
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        $rowc[] = $row['trunkname'];
        $rowc[] = $row['trunkchannel'];
        $rowc[] = $row['didnumber'];
        $rowc[] = astercrm::db2html($row['trunknote']);
        $rowc[] = $row['creby'];
        $rowc[] = $row['cretime'];
        $table->addRow("trunkinfo", $rowc, $editFlag, $deleteFlag, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}