Пример #1
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();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "diallist");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "diallist");
        } 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[] = 'dialnumber';
    $fields[] = 'customer';
    $fields[] = 'assign';
    $fields[] = 'dialtime';
    $fields[] = 'groupname';
    $fields[] = 'campaignname';
    $fields[] = 'customername';
    $fields[] = 'callOrder';
    $fields[] = 'creby';
    $fields[] = 'memo';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("ALL") . "<input type='checkbox' onclick=\"ckbAllOnClick(this);\"><BR \\>";
    $headers[] = $locate->Translate("Number");
    $headers[] = $locate->Translate("Customer");
    $headers[] = $locate->Translate("Assign to");
    $headers[] = $locate->Translate("Dialtime");
    $headers[] = $locate->Translate("Group Name");
    $headers[] = $locate->Translate("Campaign Name");
    $headers[] = $locate->Translate("Name");
    $headers[] = $locate->Translate("Call Order");
    $headers[] = $locate->Translate("Create by");
    $headers[] = $locate->Translate("Memo");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width="';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $attribsCols[] = 'style="text-align: left"';
    // HTML Table: If you want ascendent and descendent ordering, set the Header Events.
    $eventHeader = array();
    $eventHeader[] = '';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","dialnumber","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customer","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","assign","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","dialtime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","campaignname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customername","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","callOrder","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","creby","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'diallist.dialnumber';
    $fieldsFromSearch[] = 'customer';
    $fieldsFromSearch[] = 'diallist.assign';
    $fieldsFromSearch[] = 'diallist.dialtime';
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'campaignname';
    $fieldsFromSearch[] = 'customername';
    $fieldsFromSearch[] = 'diallist.cretime';
    $fieldsFromSearch[] = 'diallist.creby';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("number");
    $fieldsFromSearchShowAs[] = $locate->Translate("Customer");
    $fieldsFromSearchShowAs[] = $locate->Translate("assign_to");
    $fieldsFromSearchShowAs[] = $locate->Translate("dialtime");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Campaign Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Create By");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    //$table->addRowSearch("diallist",$fieldsFromSearch,$fieldsFromSearchShowAs);
    $table->exportFlag = '2';
    //对导出标记进行赋值
    $table->deleteFlag = '1';
    //对删除标记进行赋值
    $table->ordering = $ordering;
    $editFlag = 1;
    $deleteFlag = 1;
    $delteBtnFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['diallist']['delete']) {
            $deleteFlag = 1;
            $delteBtnFlag = 1;
            $table->deleteFlag = '1';
        } else {
            $deleteFlag = 0;
            $delteBtnFlag = 0;
            $table->deleteFlag = '0';
        }
        if ($_SESSION['curuser']['privileges']['diallist']['edit']) {
            $editFlag = 1;
        } else {
            $editFlag = 0;
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $editFlag, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("diallist", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, $delteBtnFlag, $typeFromSearch, $typeFromSearchShowAs, $stype);
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        $rowc['select_id'] = $row['id'];
        $rowc[] = $row['dialnumber'];
        $rowc[] = $row['customer'];
        $rowc[] = $row['assign'];
        $rowc[] = $row['dialtime'];
        $rowc[] = $row['groupname'];
        $rowc[] = $row['campaignname'];
        $rowc[] = $row['customername'];
        $rowc[] = $row['callOrder'];
        $rowc[] = $row['creby'];
        $rowc[] = $row['memo'];
        $table->addRow("diallist", $rowc, $editFlag, $deleteFlag, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render('delGrid');
    return $html;
}
Пример #2
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array())
{
    global $locate, $config;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null or $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows();
        $arreglo =& Customer::getAllRecords($start, $limit, $order);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "accountgroup");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "accountgroup");
        } 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[] = 'id';
    $fields[] = 'groupname';
    $fields[] = 'resellername';
    $fields[] = 'accountcode';
    $fields[] = 'callback';
    $fields[] = 'creditlimit';
    $fields[] = 'limittype';
    $fields[] = 'curcredit';
    $fields[] = 'credit_clid';
    $fields[] = 'credit_group';
    $fields[] = 'credit_reseller';
    $fields[] = 'group_multiple';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("ID") . '<br/>';
    $headers[] = $locate->Translate("Name") . '<br/>';
    $headers[] = $locate->Translate("Reseller") . '<br/>';
    $headers[] = $locate->Translate("Callback") . '<br/>';
    $headers[] = $locate->Translate("Credit Limit") . '<br/>';
    $headers[] = $locate->Translate("Limit Type") . '<br/>';
    $headers[] = $locate->Translate("Cur Credit") . '<br/>';
    $headers[] = $locate->Translate("Clid Credit") . '<br/>';
    $headers[] = $locate->Translate("Group Credit") . '<br/>';
    $headers[] = $locate->Translate("Reseller Credit") . '<br/>';
    $headers[] = $locate->Translate("Group Billsec Multiple") . '<br/>';
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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 . '","id","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","resellername","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","allowcallback","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","creditlimit","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","limittype","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","curcredit","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","credit_clid","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","credit_group","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","credit_reseller","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","group_multiple","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'resellername';
    $fieldsFromSearch[] = 'accountgroup.accountcode';
    $fieldsFromSearch[] = 'accountgroup.allowcallback';
    $fieldsFromSearch[] = 'accountgroup.creditlimit';
    $fieldsFromSearch[] = 'accountgroup.limittype';
    $fieldsFromSearch[] = 'accountgroup.curcredit';
    $fieldsFromSearch[] = 'accountgroup.credit_clid';
    $fieldsFromSearch[] = 'accountgroup.credit_group';
    $fieldsFromSearch[] = 'accountgroup.credit_reseller';
    $fieldsFromSearch[] = 'accountgroup.group_multiple';
    $fieldsFromSearch[] = 'accountgroup.customer_multiple';
    $fieldsFromSearch[] = 'accountgroup.addtime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Group Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Reseller Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Account Code");
    $fieldsFromSearchShowAs[] = $locate->Translate("Callback");
    $fieldsFromSearchShowAs[] = $locate->Translate("Credit Limit");
    $fieldsFromSearchShowAs[] = $locate->Translate("Limit Type");
    $fieldsFromSearchShowAs[] = $locate->Translate("Cur Credit");
    $fieldsFromSearchShowAs[] = $locate->Translate("Clid Credit");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group Credit");
    $fieldsFromSearchShowAs[] = $locate->Translate("Reseller Credit");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group Billsec Multiple");
    $fieldsFromSearchShowAs[] = $locate->Translate("Customer Billsec Multiple");
    $fieldsFromSearchShowAs[] = $locate->Translate("Last Update");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 1, 1, 0);
    $table->setAttribsCols($attribsCols);
    $table->exportFlag = '1';
    //对导出标记进行赋值
    $table->addRowSearchMore("accountgroup", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, $typeFromSearch, $typeFromSearchShowAs, $stype);
    if ($config['synchronize']['display_synchron_server']) {
        $otherHost = $config['synchronize_host']['Host'];
        $hostArray = explode(',', trim($otherHost, ','));
    }
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        if ($config['synchronize']['display_synchron_server']) {
            $existFlag = false;
            foreach ($hostArray as $tmp) {
                if ($row['id'] >= $config['synchronize_host'][$tmp . '_minId'] && $row['id'] <= $config['synchronize_host'][$tmp . '_maxId']) {
                    $rowc[] = $row['id'] . '(' . $config['synchronize_host'][$tmp] . ')';
                    $existFlag = true;
                }
            }
            if (!$existFlag) {
                $rowc[] = $row['id'] . '(' . $locate->Translate("Local") . ')';
            }
        } else {
            $rowc[] = $row['id'];
        }
        $rowc[] = $row['groupname'];
        $rowc[] = $row['resellername'];
        $rowc[] = $row['allowcallback'];
        $rowc[] = $row['creditlimit'];
        $rowc[] = $row['limittype'];
        $rowc[] = $row['curcredit'];
        $rowc[] = $row['credit_clid'];
        $rowc[] = $row['credit_group'];
        $rowc[] = $row['credit_reseller'];
        //astercc::readAmount($row['id'],null,$row['billingtime'],null,'callshopcredit');
        $rowc[] = $row['group_multiple'];
        if (!empty($row['limittype']) && $row['creditlimit'] - $row['curcredit'] < 0) {
            //|| $row['curcredit'] < 0)
            $trstyle = 'style="background-color:red;"';
        } else {
            $trstyle = '';
        }
        $table->addRow("accountgroup", $rowc, 1, 1, 0, $divName, $fields, $trstyle);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #3
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	stype		string		the matching type for search 
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array(), $customerid = '', $allOrAnswer = null)
{
    global $locate, $config;
    //print_R($filter);
    //print_r($content);exit;
    if ($config['system']['useHistoryCdr'] == 1) {
        $table = 'historycdr';
    } else {
        $table = 'mycdr';
    }
    //echo $config['system']['useHistoryCdr'];
    //echo $table;exit;
    $_SESSION['ordering'] = $ordering;
    if (is_numeric($customerid) && $customerid != 0 && $_SESSION['curuser']['usertype'] != 'clid') {
        $filter['0'] = 'customerid';
        $content['0'] = $customerid;
        $stype['0'] = 'equal';
    }
    if ($filter == null || $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows($table);
        $arreglo =& Customer::getAllRecords($start, $limit, $order, '', $table);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows($table, $allOrAnswer);
            $arreglo =& Customer::getAllRecords($start, $limit, $order, '', $table, $allOrAnswer);
        } elseif ($flag3 != 1) {
            //未选择搜索方式
            $order = "calldate";
            $numRows =& Customer::getNumRowsMore($filter, $content, $table, $allOrAnswer);
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, $table, '', $allOrAnswer);
        } else {
            $order = "calldate";
            $numRows =& Customer::getNumRowsMorewithstype($filter, $content, $stype, $table, $allOrAnswer);
            $arreglo =& Customer::getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype, $order, $table, '', $allOrAnswer);
        }
    }
    // Editable zone
    // Databse Table: fields
    $fields = array();
    $fields[] = 'calldate';
    $fields[] = 'src';
    $fields[] = 'dst';
    $fields[] = 'duration';
    $fields[] = 'billsec';
    $fields[] = 'disposition';
    $fields[] = 'credit';
    $fileds[] = 'destination';
    $fileds[] = 'memo';
    $fileds[] = 'discount';
    $fileds[] = 'note';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Calldate");
    $headers[] = $locate->Translate("Src");
    $headers[] = $locate->Translate("Dst");
    $headers[] = $locate->Translate("Duration");
    $headers[] = $locate->Translate("Billsec");
    $headers[] = $locate->Translate("Disposition");
    $headers[] = $locate->Translate("credit");
    $headers[] = $locate->Translate("destination");
    $headers[] = $locate->Translate("memo");
    $headers[] = $locate->Translate("discount");
    $headers[] = $locate->Translate("note");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width="13%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="13%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="12%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="12%"';
    $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"';
    $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 . '","calldate","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","src","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","dst","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","duration","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","billsec","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","disposition","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","credit","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","destination","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","memo","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","discount","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
    $eventHeader[] = '';
    // 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[] = '<';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'src';
    $fieldsFromSearch[] = 'calldate';
    $fieldsFromSearch[] = 'dst';
    $fieldsFromSearch[] = 'billsec';
    $fieldsFromSearch[] = 'disposition';
    $fieldsFromSearch[] = 'credit';
    $fieldsFromSearch[] = 'destination';
    $fieldsFromSearch[] = 'customerid';
    $fieldsFromSearch[] = 'memo';
    $fieldsFromSearch[] = 'discount';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("src");
    $fieldsFromSearchShowAs[] = $locate->Translate("calldate");
    $fieldsFromSearchShowAs[] = $locate->Translate("dst");
    $fieldsFromSearchShowAs[] = $locate->Translate("billsec");
    $fieldsFromSearchShowAs[] = $locate->Translate("disposition");
    $fieldsFromSearchShowAs[] = $locate->Translate("credit");
    $fieldsFromSearchShowAs[] = $locate->Translate("destination");
    $fieldsFromSearchShowAs[] = $locate->Translate("customer id");
    $fieldsFromSearchShowAs[] = $locate->Translate("memo");
    $fieldsFromSearchShowAs[] = $locate->Translate("discount");
    // Create object whit 5 cols and all data arrays set before.
    $specArchive = false;
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        $specArchive = 1;
    }
    $tableGrid = new ScrollTable(9, $start, $limit, $filter, $numRows, $content, $order, $specArchive);
    $tableGrid->setHeader('title', $headers, $attribsHeader, $eventHeader, $edit = false, $delete = false, $detail = false);
    $tableGrid->setAttribsCols($attribsCols);
    $tableGrid->exportFlag = '1';
    //对导出标记进行赋值
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        $tableGrid->deleteFlag = '1';
        //对导出标记进行赋值
    }
    $tableGrid->addRowSearchMore($table, $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, $typeFromSearch, $typeFromSearchShowAs, $stype, '', $allOrAnswer);
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $trstyle = '';
        $rowc[] = $row['id'];
        $rowc[] = $row['calldate'];
        $rowc[] = $row['src'];
        $rowc[] = $row['dst'];
        $rowc[] = astercrm::FormatSec($row['duration']);
        $rowc[] = astercrm::FormatSec($row['billsec']);
        $rowc[] = $row['disposition'];
        $rowc[] = $row['credit'];
        $rowc[] = $row['destination'];
        $rowc[] = $row['memo'];
        $rowc[] = $row['discount'];
        $rowc[] = $row['note'];
        if ($row['userfield'] == 'UNBILLED') {
            $trstyle = 'style="background:#EED5D2;"';
        }
        if ($row['setfreecall'] == 'yes') {
            $trstyle = 'style="background:#d5c59f;"';
        }
        $tableGrid->addRow($table, $rowc, false, false, false, $divName, $fields, $trstyle);
    }
    // End Editable Zone
    $html = $tableGrid->render();
    return $html;
}
Пример #4
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $exportFlag = "", $stype = array())
{
    global $locate;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null or $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows();
        $arreglo =& Customer::getAllRecords($start, $limit, $order);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "curcdr");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "curcdr");
        } 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[] = 'curcdr.src';
    $fields[] = 'curcdr.dst';
    $fields[] = 'curcdr.srcname';
    $fields[] = 'curcdr.starttime';
    $fields[] = 'curcdr.answertime';
    //$fields[] = 'clid.clid';
    $fields[] = 'accountgroup.groupname';
    $fields[] = 'resellergroup.resellername';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Src") . '<br>';
    $headers[] = $locate->Translate("Dst") . '<br>';
    $headers[] = $locate->Translate("Srcname") . '<br>';
    $headers[] = $locate->Translate("Starttime") . '<br>';
    $headers[] = $locate->Translate("Answertime") . '<br>';
    //$headers[] = $locate->Translate("Clid").'<br>';
    $headers[] = $locate->Translate("Groupname") . '<br>';
    $headers[] = $locate->Translate("Resellername") . '<br>';
    // HTML table: fieldsFromSearch showed
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'curcdr.src';
    $fieldsFromSearch[] = 'curcdr.dst';
    $fieldsFromSearch[] = 'curcdr.srcname';
    $fieldsFromSearch[] = 'curcdr.starttime';
    $fieldsFromSearch[] = 'curcdr.answertime';
    //$fieldsFromSearch[] = 'clid.clid';
    $fieldsFromSearch[] = 'accountgroup.groupname';
    $fieldsFromSearch[] = 'resellergroup.resellername';
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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 . '","curcdr.src","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","curcdr.dst","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","curcdr.srcname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","curcdr.starttime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","curcdr.answertime","' . $divName . '","ORDERING");return false;\'';
    //$eventHeader[]= 'onClick=\'xajax_showGrid(0,'.$limit.',"'.$filter.'","'.$content.'","clid.clid","'.$divName.'","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","accountgroup.groupname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","resellergroup.resellername","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'curcdr.src';
    $fieldsFromSearch[] = 'curcdr.dst';
    $fieldsFromSearch[] = 'curcdr.srcname';
    $fieldsFromSearch[] = 'curcdr.starttime';
    $fieldsFromSearch[] = 'curcdr.answertime';
    //$fieldsFromSearch[] = 'clid.clid';
    $fieldsFromSearch[] = 'accountgroup.groupname';
    $fieldsFromSearch[] = 'resellergroup.resellername';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Src");
    $fieldsFromSearchShowAs[] = $locate->Translate("Dst");
    $fieldsFromSearchShowAs[] = $locate->Translate("Srcname");
    $fieldsFromSearchShowAs[] = $locate->Translate("Starttime");
    $fieldsFromSearchShowAs[] = $locate->Translate("Answertime");
    //$fieldsFromSearchShowAs[] = $locate->Translate("Clid");
    $fieldsFromSearchShowAs[] = $locate->Translate("Groupname");
    $fieldsFromSearchShowAs[] = $locate->Translate("Resellername");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, 1, 0);
    $table->setAttribsCols($attribsCols);
    $table->deleteFlag = '1';
    //对导出标记进行赋值
    $table->exportFlag = '0';
    //对导出标记进行赋值
    $table->multiEditFlag = '0';
    //对批量修改标记进行赋值
    $table->addRowSearchMore("curcdr", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 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['src'];
        $rowc[] = $row['dst'];
        $rowc[] = $row['srcname'];
        $rowc[] = $row['starttime'];
        $rowc[] = $row['answertime'];
        //$rowc[] = $row['clid'];
        $rowc[] = $row['groupname'];
        $rowc[] = $row['resellername'];
        $table->addRow("curcdr", $rowc, 0, 1, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #5
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $exportFlag = "", $stype = array())
{
    global $locate, $config;
    //echo $ordering.$order;exit;
    $_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") {
            //无值
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "customer_leads");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "customer_leads");
        } 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[] = 'customer';
    $fields[] = 'state';
    if ($config['system']['enable_code']) {
        $fields[] = 'note';
        $fields[] = 'codes';
        $fields[] = 'note_leads.cretime';
    }
    $fields[] = 'city';
    $fields[] = 'phone';
    $fields[] = 'contact';
    $fields[] = 'website';
    $fields[] = 'category';
    $fields[] = 'cretime';
    $fields[] = 'creby';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("ALL") . "<input type='checkbox' onclick=\"ckbAllOnClick(this);\"><BR \\>";
    //"select all for delete";
    $headers[] = $locate->Translate("customer_name") . "<BR \\>";
    //"Customer Name";
    $headers[] = $locate->Translate("state") . "<BR \\>";
    //"state";
    if ($config['system']['enable_code']) {
        $headers[] = $locate->Translate("note") . "<BR \\>";
        $headers[] = $locate->Translate("codes") . "<BR \\>";
        $headers[] = $locate->Translate("note_cretime") . "<BR \\>";
    }
    $headers[] = $locate->Translate("city") . "<BR \\>";
    //"Category";
    $headers[] = $locate->Translate("phone") . "<BR \\>";
    //"Contact";
    $headers[] = $locate->Translate("contact") . "<BR \\>";
    //"Category";
    $headers[] = $locate->Translate("website") . "<BR \\>";
    //"Note";
    $headers[] = $locate->Translate("category") . "<BR \\>";
    //"Create Time";
    $headers[] = $locate->Translate("create_time") . "<BR \\>";
    //"Create By";
    $headers[] = $locate->Translate("create_by") . "<BR \\>";
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width="5%"';
    $attribsHeader[] = 'width="12%"';
    $attribsHeader[] = 'width="8%"';
    if ($config['system']['enable_code']) {
        $attribsHeader[] = 'width="8%"';
        $attribsHeader[] = 'width="8%"';
    }
    $attribsHeader[] = 'width="7%"';
    $attribsHeader[] = 'width="8%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="12%"';
    $attribsHeader[] = 'width="8%"';
    $attribsHeader[] = 'width="9%"';
    $attribsHeader[] = 'width="7%"';
    //	$attribsHeader[] = 'width="5%"';
    // HTML Table: columns attributes
    $attribsCols = array();
    $attribsCols[] = 'style="text-align: left"';
    $attribsCols[] = 'style="text-align: left"';
    if ($config['system']['enable_code']) {
        $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[] = 'nowrap 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[] = '';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customer","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","state","' . $divName . '","ORDERING");return false;\'';
    if ($config['system']['enable_code']) {
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","note","' . $divName . '","ORDERING");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","codes","' . $divName . '","ORDERING");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","noteCretime","' . $divName . '","ORDERING");return false;\'';
    }
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","city","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","phone","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","contact","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","website","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","category","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customer_leads.cretime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customer_leads.creby","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'customer';
    $fieldsFromSearch[] = 'state';
    if ($config['system']['enable_code']) {
        $fieldsFromSearch[] = 'note';
        $fieldsFromSearch[] = 'codes';
        $fieldsFromSearch[] = 'note_leads.cretime';
    }
    $fieldsFromSearch[] = 'city';
    $fieldsFromSearch[] = 'phone';
    $fieldsFromSearch[] = 'fax';
    $fieldsFromSearch[] = 'contact';
    $fieldsFromSearch[] = 'website';
    $fieldsFromSearch[] = 'category';
    $fieldsFromSearch[] = 'customer_leads.cretime';
    $fieldsFromSearch[] = 'customer_leads.creby';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("customer_name");
    $fieldsFromSearchShowAs[] = $locate->Translate("state");
    if ($config['system']['enable_code']) {
        $fieldsFromSearchShowAs[] = $locate->Translate("note");
        $fieldsFromSearchShowAs[] = $locate->Translate("codes");
        $fieldsFromSearchShowAs[] = $locate->Translate("note_cretime");
    }
    $fieldsFromSearchShowAs[] = $locate->Translate("city");
    $fieldsFromSearchShowAs[] = $locate->Translate("phone");
    $fieldsFromSearchShowAs[] = $locate->Translate("fax");
    $fieldsFromSearchShowAs[] = $locate->Translate("contact");
    $fieldsFromSearchShowAs[] = $locate->Translate("website");
    $fieldsFromSearchShowAs[] = $locate->Translate("category");
    $fieldsFromSearchShowAs[] = $locate->Translate("create_time");
    $fieldsFromSearchShowAs[] = $locate->Translate("create_by");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(7, $start, $limit, $filter, $numRows, $content, $order);
    $table->exportFlag = '2';
    //对导出标记进行赋值
    $table->deleteFlag = '1';
    $table->ordering = $ordering;
    $deleteFlag = 1;
    $deleteBtnFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['customer_leads']['delete']) {
            $deleteFlag = 1;
            $table->deleteFlag = '1';
            $deleteBtnFlag = 1;
        } else {
            $deleteFlag = 0;
            $table->deleteFlag = '0';
            $deleteBtnFlag = 0;
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("customer_leads", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, $deleteBtnFlag, $typeFromSearch, $typeFromSearchShowAs, $stype);
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        $rowc['select_id'] = $row['id'];
        $rowc[] = '<a href=? onclick="xajax_showDetail(\'' . $row['id'] . '\');return false;">' . $row['customer'] . '</a>';
        $rowc[] = $row['state'];
        if ($config['system']['enable_code']) {
            $rowc[] = $row['note'];
            $rowc[] = $row['codes'];
            $rowc[] = $row['noteCretime'];
        }
        $rowc[] = $row['city'];
        $rowc[] = $row['phone'];
        $rowc[] = $row['contact'];
        $rowc[] = $row['website'];
        $rowc[] = $row['category'];
        $rowc[] = $row['cretime'];
        $rowc[] = $row['creby'];
        //		$rowc[] = 'Detail';
        $table->addRow("customer", $rowc, 0, $deleteFlag, 0, $divName, $fields);
    }
    $html = $table->render('delGrid');
    return $html;
    // End Editable Zone
}
Пример #6
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
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") {
            //无值
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "campaign");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "campaign");
        } 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[] = 'id';
    $fields[] = 'campaignname';
    $fields[] = 'campaignnote';
    $fields[] = 'groupname';
    $fields[] = 'servername';
    $fields[] = 'balance';
    $fields[] = 'creby';
    $fields[] = 'cretime';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Campaign Name");
    $headers[] = $locate->Translate("Campaign Note");
    $headers[] = $locate->Translate("Group Name");
    $headers[] = $locate->Translate("Server Name");
    $headers[] = $locate->Translate("Remaining") . '/' . $locate->Translate("Dialed ") . '/' . $locate->Translate("Answered");
    $headers[] = $locate->Translate("Balance");
    $headers[] = $locate->Translate("Creby");
    $headers[] = $locate->Translate("Cretime");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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 . '","campaignname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","campaignnote","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","servers.name","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","balance","' . $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[] = 'campaignname';
    $fieldsFromSearch[] = 'campaignnote';
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'servers.name';
    $fieldsFromSearch[] = 'balance';
    $fieldsFromSearch[] = 'campaign.creby';
    $fieldsFromSearch[] = 'campaign.cretime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Campaign Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Campaign Note");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Server Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Balance");
    $fieldsFromSearchShowAs[] = $locate->Translate("Creby");
    $fieldsFromSearchShowAs[] = $locate->Translate("Cretime");
    //echo 'dddddddddddddd';
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->exportFlag = '2';
    //对导出标记进行赋值
    $table->ordering = $ordering;
    $editFlag = 1;
    $deleteFlag = 1;
    $addFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['campaign']['delete']) {
            $deleteFlag = 1;
        } else {
            $deleteFlag = 0;
        }
        if ($_SESSION['curuser']['privileges']['campaign']['edit']) {
            $editFlag = 1;
        } else {
            $editFlag = 0;
        }
    }
    //如果是groupoperator 就没有添加 编辑和删除的功能
    if ($_SESSION['curuser']['usertype'] == 'groupoperator') {
        $addFlag = 0;
        $editFlag = 0;
        $deleteFlag = 0;
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $editFlag, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("campaign", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, $addFlag, 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[] = "<a href=? onclick=\"xajax_showDetail('" . $row['id'] . "');return false;\">" . $row['campaignname'] . "</a>";
        $rowc[] = $row['campaignnote'];
        $rowc[] = $row['groupname'];
        if ($row['serverid'] != 0) {
            $rowc[] = $row['servername'];
        } else {
            $rowc[] = $locate->Translate("Default server");
        }
        $total = astercrm::getCountByField('campaignid', $row['id'], 'diallist');
        #$dialed = $row['dialed'];
        #$answered = customer::getCountAnswered($row['id']);
        $rowc[] = $total . '/' . $row['dialed'] . '/' . $row['answered'];
        $rowc[] = $row['balance'];
        $rowc[] = $row['creby'];
        $rowc[] = $row['cretime'];
        $table->addRow("campaign", $rowc, $editFlag, $deleteFlag, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #7
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
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();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content);
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order);
        } 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[] = 'name';
    $fields[] = 'ip';
    $fields[] = 'port';
    $fields[] = 'username';
    $fields[] = 'secret';
    $fields[] = 'note';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Server name");
    $headers[] = $locate->Translate("IP");
    $headers[] = $locate->Translate("Port");
    $headers[] = $locate->Translate("Username");
    $headers[] = $locate->Translate("Secret");
    $headers[] = $locate->Translate("Note");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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 . '","name","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","ip","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","port","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","username","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","secret","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","note","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'name';
    $fieldsFromSearch[] = 'ip';
    $fieldsFromSearch[] = 'port';
    $fieldsFromSearch[] = 'username';
    $fieldsFromSearch[] = 'secret';
    $fieldsFromSearch[] = 'note';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Server name");
    $fieldsFromSearchShowAs[] = $locate->Translate("IP");
    $fieldsFromSearchShowAs[] = $locate->Translate("Port");
    $fieldsFromSearchShowAs[] = $locate->Translate("Username");
    $fieldsFromSearchShowAs[] = $locate->Translate("Secret");
    $fieldsFromSearchShowAs[] = $locate->Translate("Note");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader);
    $table->setAttribsCols($attribsCols);
    $table->exportFlag = '1';
    //对导出标记进行赋值
    $table->deleteFlag = '1';
    //对删除标记进行赋值
    $table->ordering = $ordering;
    $table->addRowSearchMore("servers", $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['name'];
        $rowc[] = $row['ip'];
        $rowc[] = $row['port'];
        $rowc[] = $row['username'];
        $rowc[] = $row['secret'];
        $rowc[] = $row['note'];
        $table->addRow("servers", $rowc, 1, 1, 1, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #8
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	stype		string		the matching type for search 
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $stype = null, $order = null, $divName = "grid", $ordering = "", $stype = array())
{
    global $locate;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null || $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows();
        $arreglo =& Customer::getAllRecords($start, $limit, $order);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            //未选择搜索方式
            $order = "modifytime";
            $numRows =& Customer::getNumRowsMore($filter, $content, "credithistory");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "credithistory");
        } else {
            $order = "modifytime";
            $numRows =& Customer::getNumRowsMorewithstype($filter, $content, $stype, "credithistory");
            $arreglo =& Customer::getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype, $order, "credithistory");
        }
    }
    // 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
    if ($_SESSION['curuser']['usertype'] == 'clid') {
        // Database Table: fields
        $fields = array();
        $fields[] = 'modifytime';
        $fields[] = 'clidid';
        $fields[] = 'srccredit';
        $fields[] = 'modifystatus';
        $fields[] = 'modifyamount';
        $fields[] = 'comment';
        // HTML table: Headers showed
        $headers = array();
        $headers[] = $locate->Translate("Modifytime");
        $headers[] = $locate->Translate("Clid");
        $headers[] = $locate->Translate("Srccredit");
        $headers[] = $locate->Translate("Modifystatus");
        $headers[] = $locate->Translate("Modifyamount");
        $headers[] = $locate->Translate("Comment");
        // HTML table: hearders attributes
        $attribsHeader = array();
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        // 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 . '","modifytime","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","clidid","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","srccredit","' . $divName . '","ORDERING");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","modifystatus","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","modifyamount","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","comment","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        // Select Box: fields table.
        $fieldsFromSearch = array();
        $fieldsFromSearch[] = 'modifytime';
        $fieldsFromSearch[] = 'clidid';
        $fieldsFromSearch[] = 'srccredit';
        $fieldsFromSearch[] = 'modifystatus';
        $fieldsFromSearch[] = 'modifyamount';
        $fieldsFromSearch[] = 'comment';
        // Selecct Box: Labels showed on search select box.
        $fieldsFromSearchShowAs = array();
        $fieldsFromSearchShowAs[] = $locate->Translate("modifytime");
        $fieldsFromSearchShowAs[] = $locate->Translate("clidid");
        $fieldsFromSearchShowAs[] = $locate->Translate("srccredit");
        $fieldsFromSearchShowAs[] = $locate->Translate("modifystatus");
        $fieldsFromSearchShowAs[] = $locate->Translate("modifyamount");
        $fieldsFromSearchShowAs[] = $locate->Translate("comment");
        // Create object whit 5 cols and all data arrays set before.
        $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
        $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $edit = false, $delete = false, $detail = false);
        $table->setAttribsCols($attribsCols);
        $table->addRowSearchMore("credithistory", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, $typeFromSearch, $typeFromSearchShowAs, $stype);
        while ($arreglo->fetchInto($row)) {
            // Change here by the name of fields of its database table
            $name =& Customer::getNames($row['operator'], $row['resellerid'], $row['groupid'], $row['clidid']);
            $rowc = array();
            $rowc[] = $row['id'];
            $rowc[] = $row['modifytime'];
            $rowc[] = $name['clidname'];
            $rowc[] = $row['srccredit'];
            if ($row['modifystatus'] == 'add') {
                $rowc['modifystatus'] = 'refund';
            } else {
                $rowc['modifystatus'] = 'charge';
            }
            $rowc['modifyamount'] = $row['modifyamount'];
            $rowc['comment'] = $row['comment'];
            $table->addRow("credithistory", $rowc, false, false, false, $divName, $fields);
        }
    } else {
        // Database Table: fields
        $fields = array();
        $fields[] = 'modifytime';
        $fields[] = 'resellerid';
        $fields[] = 'groupid';
        $fields[] = 'clidid';
        $fields[] = 'srccredit';
        $fields[] = 'modifystatus';
        $fields[] = 'modifyamount';
        $fields[] = 'comment';
        $fields[] = 'operator';
        // HTML table: Headers showed
        $headers = array();
        $headers[] = $locate->Translate("Modifytime");
        $headers[] = $locate->Translate("Resellername");
        $headers[] = $locate->Translate("Group");
        $headers[] = $locate->Translate("Clid");
        $headers[] = $locate->Translate("Srccredit");
        $headers[] = $locate->Translate("Modifystatus");
        $headers[] = $locate->Translate("Modifyamount");
        $headers[] = $locate->Translate("Comment");
        $headers[] = $locate->Translate("Modifyby");
        // HTML table: hearders attributes
        $attribsHeader = array();
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        $attribsHeader[] = 'width=""';
        // 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"';
        $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 . '","modifytime","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","resellerid","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupid","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","clidid","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","srccredit","' . $divName . '","ORDERING");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","modifystatus","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","modifyamount","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","comment","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","operator","' . $divName . '","ORDERING","' . $stype . '");return false;\'';
        // Select Box: fields table.
        $fieldsFromSearch = array();
        $fieldsFromSearch[] = 'modifytime';
        $fieldsFromSearch[] = 'resellerid';
        $fieldsFromSearch[] = 'groupid';
        $fieldsFromSearch[] = 'clidid';
        $fieldsFromSearch[] = 'srccredit';
        $fieldsFromSearch[] = 'modifystatus';
        $fieldsFromSearch[] = 'modifyamount';
        $fieldsFromSearch[] = 'comment';
        $fieldsFromSearch[] = 'epayment_txn_id';
        $fieldsFromSearch[] = 'operator';
        // Selecct Box: Labels showed on search select box.
        $fieldsFromSearchShowAs = array();
        $fieldsFromSearchShowAs[] = $locate->Translate("modifytime");
        $fieldsFromSearchShowAs[] = $locate->Translate("resellerid");
        $fieldsFromSearchShowAs[] = $locate->Translate("groupid");
        $fieldsFromSearchShowAs[] = $locate->Translate("clidid");
        $fieldsFromSearchShowAs[] = $locate->Translate("srccredit");
        $fieldsFromSearchShowAs[] = $locate->Translate("modifystatus");
        $fieldsFromSearchShowAs[] = $locate->Translate("modifyamount");
        $fieldsFromSearchShowAs[] = $locate->Translate("comment");
        $fieldsFromSearchShowAs[] = $locate->Translate("txn id");
        $fieldsFromSearchShowAs[] = $locate->Translate("operator");
        // Create object whit 5 cols and all data arrays set before.
        $table = new ScrollTable(10, $start, $limit, $filter, $numRows, $content, $order);
        $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $edit = false, $delete = false, $detail = false);
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $table->deleteFlag = '1';
        }
        //对删除标记进行赋值
        $table->exportFlag = '1';
        //对导出标记进行赋值
        $table->setAttribsCols($attribsCols);
        $table->addRowSearchMore("credithistory", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, $typeFromSearch, $typeFromSearchShowAs, $stype);
        while ($arreglo->fetchInto($row)) {
            // Change here by the name of fields of its database table
            $name =& Customer::getNames($row['operator'], $row['resellerid'], $row['groupid'], $row['clidid']);
            $rowc = array();
            $rowc[] = $row['id'];
            $rowc[] = $row['modifytime'];
            $rowc[] = $name['resellername'] . "(" . $row['resellerid'] . ")";
            $rowc[] = $name['groupname'] . "(" . $row['groupid'] . ")";
            $rowc[] = $name['clidname'] . "(" . $row['clidid'] . ")";
            $rowc[] = $row['srccredit'];
            if ($row['modifystatus'] == 'add') {
                $rowc['modifystatus'] = 'refund';
            } else {
                $rowc['modifystatus'] = 'charge';
            }
            $rowc['modifyamount'] = $row['modifyamount'];
            if ($row['epayment_txn_id'] != '') {
                $rowc['comment'] = $row['comment'] . '(' . $row['epayment_txn_id'] . ')';
            } else {
                $rowc['comment'] = $row['comment'];
            }
            $rowc[] = $name['username'];
            $table->addRow("credithistory", $rowc, false, false, false, $divName, $fields);
        }
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #9
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $exportFlag = "", $stype = array())
{
    //print_r($stype);exit;
    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();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "surveyresult");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "surveyresult");
        } else {
            $order = "id";
            $numRows =& Customer::getNumRowsMorewithstype($filter, $content, $stype, "surveyresult");
            $arreglo =& Customer::getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype, $order, "surveyresult");
        }
    }
    // 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[] = 'surveytitle';
    $fields[] = 'surveyoption';
    $fields[] = 'surveynote';
    $fields[] = 'customer';
    $fields[] = 'contact';
    $fields[] = 'phonenumber';
    $fields[] = 'campaignname';
    $fields[] = 'cretime';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Survey Title");
    $headers[] = $locate->Translate("Survey Option");
    $headers[] = $locate->Translate("Survey Item");
    $headers[] = $locate->Translate("Survey Note");
    $headers[] = $locate->Translate("customer");
    $headers[] = $locate->Translate("contact");
    $headers[] = $locate->Translate("Phone Number");
    $headers[] = $locate->Translate("Campaign Name");
    $headers[] = $locate->Translate("create_time");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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 . '","surveyname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","surveyoption","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","itemcontent","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","surveynote","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customer","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","contact","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","phonenumber","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","campaignname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","cretime","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'surveytitle';
    $fieldsFromSearch[] = 'surveyoption';
    $fieldsFromSearch[] = 'itemcontent';
    $fieldsFromSearch[] = 'surveyresult.surveynote';
    $fieldsFromSearch[] = 'customer';
    $fieldsFromSearch[] = 'contact.contact';
    $fieldsFromSearch[] = 'surveyresult.phonenumber';
    $fieldsFromSearch[] = 'campaign.campaignname';
    //$fieldsFromSearch[] = 'survey.id';
    $fieldsFromSearch[] = 'surveyresult.cretime';
    $fieldsFromSearch[] = 'surveyresult.creby';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("survey_title");
    $fieldsFromSearchShowAs[] = $locate->Translate("survey_option");
    $fieldsFromSearchShowAs[] = $locate->Translate("survey_item");
    $fieldsFromSearchShowAs[] = $locate->Translate("survey_note");
    $fieldsFromSearchShowAs[] = $locate->Translate("customer");
    $fieldsFromSearchShowAs[] = $locate->Translate("contact");
    $fieldsFromSearchShowAs[] = $locate->Translate("Phone Number");
    $fieldsFromSearchShowAs[] = $locate->Translate("Campaign Name");
    //$fieldsFromSearchShowAs[] = $locate->Translate("Survey ID");
    $fieldsFromSearchShowAs[] = $locate->Translate("create_time");
    $fieldsFromSearchShowAs[] = $locate->Translate("create_by");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->exportFlag = '1';
    //对导出标记进行赋值
    $table->deleteFlag = '1';
    //对删除标记进行赋值
    $deleteFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['surveyresult']['delete']) {
            $deleteFlag = 1;
            $table->deleteFlag = '1';
        } else {
            $deleteFlag = 0;
            $table->deleteFlag = '0';
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->ordering = $ordering;
    $table->addRowSearchMore("surveyresult", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, 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['surveyname'];
        $rowc[] = $row['surveyoption'];
        $rowc[] = $row['itemcontent'];
        $rowc[] = $row['surveynote'];
        $rowc[] = "<a href=? onclick='xajax_showCustomer(" . $row['customerid'] . ");return false;'>" . $row['customer'] . "</a>";
        $rowc[] = "<a href=? onclick='xajax_showContact(" . $row['contactid'] . ");return false;'>" . $row['contact'] . "</a>";
        $rowc[] = $row['phonenumber'];
        $rowc[] = $row['campaignname'];
        $rowc[] = $row['cretime'];
        $table->addRow("surveyresult", $rowc, 0, $deleteFlag, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #10
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array())
{
    global $locate, $config;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null or $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows();
        $arreglo =& Customer::getAllRecords($start, $limit, $order);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "account");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "account");
        } 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[] = 'username';
    $fields[] = 'ip';
    $fields[] = 'usertype';
    $fields[] = 'action';
    $fields[] = 'status';
    $fields[] = 'failedcause';
    $fields[] = 'cretime';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Username");
    $headers[] = $locate->Translate("IP");
    $headers[] = $locate->Translate("Usertype");
    $headers[] = $locate->Translate("Action");
    $headers[] = $locate->Translate("Status");
    $headers[] = $locate->Translate("Failed cause");
    $headers[] = $locate->Translate("Cretime");
    $headers[] = $locate->Translate("Option");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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 . '","username","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","ip","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","usertype","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","action","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","status","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","failedcause","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","cretime","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'username';
    $fieldsFromSearch[] = 'ip';
    $fieldsFromSearch[] = 'usertype';
    $fieldsFromSearch[] = 'action';
    $fieldsFromSearch[] = 'status';
    $fieldsFromSearch[] = 'failedcause';
    $fieldsFromSearch[] = 'cretime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Username");
    $fieldsFromSearchShowAs[] = $locate->Translate("IP");
    $fieldsFromSearchShowAs[] = $locate->Translate("Usertype");
    $fieldsFromSearchShowAs[] = $locate->Translate("Action");
    $fieldsFromSearchShowAs[] = $locate->Translate("status");
    $fieldsFromSearchShowAs[] = $locate->Translate("failedcause");
    $fieldsFromSearchShowAs[] = $locate->Translate("cretime");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(7, $start, $limit, $filter, $numRows, $content, $order);
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, 0, 0);
    $table->setAttribsCols($attribsCols);
    $table->exportFlag = '1';
    //对导出标记进行赋值
    $table->addRowSearchMore("account_log", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 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['username'];
        $rowc[] = $row['ip'];
        $rowc[] = $row['usertype'];
        $rowc[] = $row['action'];
        $rowc[] = $row['status'];
        $rowc[] = $row['failedcause'];
        $rowc[] = $row['cretime'];
        if ($row['failedtimes'] >= $config['system']['max_incorrect_login'] && $config['system']['max_incorrect_login'] > 0) {
            $rowc[] = '<a onclick="xajax_unlock(\'' . $row['ip'] . '\',xajax.getFormValues(\'searchForm\'))">' . $locate->Translate("Unlock") . '</a>';
            $trstyle = 'style="background:#d5c59f;"';
        } else {
            $trstyle = '';
        }
        $table->addRow("account_log", $rowc, 0, 0, 0, $divName, $fields, $trstyle);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #11
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array())
{
    global $locate, $config;
    $_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();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "astercrm_accout");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "astercrm_accout");
        } 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[] = 'username';
    $fields[] = 'login_time';
    $fields[] = 'online_time';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("ALL") . "<input type='checkbox' onclick=\"ckbAllOnClick(this);\">";
    //"select all for delete";
    $headers[] = $locate->Translate("username");
    $headers[] = $locate->Translate("login time");
    $headers[] = $locate->Translate("online time");
    //"Customer Name";
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width="5%"';
    $attribsHeader[] = 'width="30%"';
    $attribsHeader[] = 'width="30%"';
    $attribsHeader[] = 'width="30%"';
    // HTML Table: columns attributes
    $attribsCols = array();
    $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[] = '';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","username","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = '';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","last_login_time","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'username';
    $fieldsFromSearch[] = 'last_login_time';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("username");
    $fieldsFromSearchShowAs[] = $locate->Translate("login time");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, 0, 0);
    $table->setAttribsCols($attribsCols);
    $table->exportFlag = '2';
    //对导出标记进行赋值
    //$table->deleteFlag = '1';
    $table->ordering = $ordering;
    //$table->addRowSearchMore("note",$fieldsFromSearch,$fieldsFromSearchShowAs,$filter,$content);
    $table->addRowSearchMore("astercrm_accout", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, 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['select_id'] = $row['id'];
        $rowc[] = $row['username'];
        $rowc[] = astercrm::FormatSec(strtotime(date("Y-m-d H:i:s")) - strtotime($row['last_login_time']));
        $rowc[] = $row['last_login_time'];
        $table->addRow("astercrm_accout", $rowc, 0, 0, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render('delGrid');
    return $html;
}
Пример #12
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $exportFlag = "", $stype = array(), $displaymode = 'on')
{
    global $locate, $config;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null or $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows($displaymode);
        $arreglo =& Customer::getAllRecords($start, $limit, $order, $displaymode);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "callshoprate");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "callshoprate");
        } else {
            $order = "id";
            $numRows =& Customer::getNumRowsMorewithstype($filter, $content, $stype, $table, $displaymode);
            $arreglo =& Customer::getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype, $order, $table, $displaymode);
        }
    }
    // 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();
    if ($config['synchronize']['display_synchron_server']) {
        $fields[] = 'id';
    }
    $fields[] = 'dialprefix';
    $fields[] = 'numlen';
    $fields[] = 'destination';
    $fields[] = 'connectcharge';
    $fields[] = 'initblock';
    $fields[] = 'rateinitial';
    $fields[] = 'billingblock';
    $fields[] = 'groupname';
    $fields[] = 'resellername';
    $fields[] = 'addtime';
    // HTML table: Headers showed
    $headers = array();
    if ($config['synchronize']['display_synchron_server']) {
        $headers[] = $locate->Translate("Id") . '<br>';
    }
    $headers[] = $locate->Translate("Prefix") . '<br>';
    $headers[] = $locate->Translate("Length") . '<br>';
    $headers[] = $locate->Translate("Destination") . '<br>';
    $headers[] = $locate->Translate("Connect Charge") . '<br>';
    $headers[] = $locate->Translate("Init Block") . '<br>';
    $headers[] = $locate->Translate("Rate") . '<br>';
    $headers[] = $locate->Translate("Billing Block") . '<br>';
    $headers[] = $locate->Translate("Group") . '<br>';
    $headers[] = $locate->Translate("Reseller") . '<br>';
    $headers[] = $locate->Translate("Addtime") . '<br>';
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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();
    if ($config['synchronize']['display_synchron_server']) {
        $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","id","' . $divName . '","ORDERING");return false;\'';
    }
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","dialprefix","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","numlen","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","destination","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","connectcharge","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","initblock","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","rateinitial","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","billingblock","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","resellername","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","addtime","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'dialprefix';
    $fieldsFromSearch[] = 'numlen';
    $fieldsFromSearch[] = 'destination';
    $fieldsFromSearch[] = 'rateinitial';
    $fieldsFromSearch[] = 'initblock';
    $fieldsFromSearch[] = 'billingblock';
    $fieldsFromSearch[] = 'connectcharge';
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'resellername';
    $fieldsFromSearch[] = 'callshoprate.addtime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate('prefix');
    $fieldsFromSearchShowAs[] = $locate->Translate('length');
    $fieldsFromSearchShowAs[] = $locate->Translate('destination');
    $fieldsFromSearchShowAs[] = $locate->Translate('rate');
    $fieldsFromSearchShowAs[] = $locate->Translate('init block');
    $fieldsFromSearchShowAs[] = $locate->Translate('billing block');
    $fieldsFromSearchShowAs[] = $locate->Translate('connect charge');
    $fieldsFromSearchShowAs[] = $locate->Translate('group');
    $fieldsFromSearchShowAs[] = $locate->Translate('reseller');
    $fieldsFromSearchShowAs[] = $locate->Translate('addtime');
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
        $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 1, 1, 0);
        $table->deleteFlag = '1';
        //对导出标记进行赋值
        $table->multiEditFlag = '1';
        //对批量修改标记进行赋值
    } else {
        $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, 0, 0);
    }
    $table->setAttribsCols($attribsCols);
    $table->exportFlag = '1';
    //对导出标记进行赋值
    if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
        $table->addRowSearchMore("callshoprate", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, $typeFromSearch, $typeFromSearchShowAs, $stype);
    } else {
        $table->addRowSearchMore("callshoprate", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, $typeFromSearch, $typeFromSearchShowAs, $stype, $displaymode);
    }
    if ($config['synchronize']['display_synchron_server']) {
        $otherHost = $config['synchronize_host']['Host'];
        $hostArray = explode(',', trim($otherHost, ','));
    }
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        if ($config['synchronize']['display_synchron_server']) {
            $existFlag = false;
            foreach ($hostArray as $tmp) {
                if ($row['id'] >= $config['synchronize_host'][$tmp . '_minId'] && $row['id'] <= $config['synchronize_host'][$tmp . '_maxId']) {
                    $rowc[] = $row['id'] . '(' . $config['synchronize_host'][$tmp] . ')';
                    $existFlag = true;
                }
            }
            if (!$existFlag) {
                $rowc[] = $row['id'] . '(' . $locate->Translate("Local") . ')';
            }
        }
        $rowc[] = $row['dialprefix'];
        $rowc[] = $row['numlen'];
        $rowc[] = $row['destination'];
        $rowc[] = $row['connectcharge'];
        $rowc[] = $row['initblock'];
        $rowc[] = $row['rateinitial'];
        $rowc[] = $row['billingblock'];
        $rowc[] = $row['groupname'];
        $rowc[] = $row['resellername'];
        $rowc[] = $row['addtime'];
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            if ($_SESSION['curuser']['usertype'] == 'reseller' && $row['resellerid'] != $_SESSION['curuser']['resellerid']) {
                $table->addRow("myrate", $rowc, 0, 0, 0, $divName, $fields);
            } else {
                $table->addRow("callshoprate", $rowc, 1, 1, 0, $divName, $fields);
            }
        } else {
            $table->addRow("callshoprate", $rowc, 0, 0, 0, $divName, $fields);
        }
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #13
0
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array(), $action = '', $campaign_id = 0)
{
    if ($action == 'abandoned' && $campaign_id > 0) {
        $campaignrow = astercrm::getRecordById($campaign_id, 'campaign');
        $filter = array('campaigndialedlist.billsec_leg_a', 'campaigndialedlist.billsec', 'campaignname');
        $content = array(0, 0, $campaignrow['campaignname']);
        $stype = array('more', 'equal', 'equal');
    }
    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, "campaigndialedlist");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "campaigndialedlist");
        } 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[] = 'dialednumber';
    $fields[] = 'answertime';
    $fields[] = 'duration';
    $fields[] = 'callresult';
    $fields[] = 'billsec';
    $fields[] = 'billsec_leg_a';
    $fields[] = 'customer';
    $fields[] = 'customername';
    //	$fields[] = 'uniqueid';
    $fields[] = 'campaignresult';
    $fields[] = 'response';
    $fields[] = 'detect';
    $fields[] = 'transfertime';
    $fields[] = 'transfertarget';
    $fields[] = 'resultby';
    $fields[] = 'dialedby';
    //	$fields[] = 'groupname';
    $fields[] = 'recycles';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("ALL") . "<input type='checkbox' onclick=\"ckbAllOnClick(this);\"><BR \\>";
    $headers[] = $locate->Translate("Dialed Number");
    //	$headers[] = $locate->Translate("Answer Time");
    $headers[] = $locate->Translate("Duration");
    $headers[] = $locate->Translate("Billsec");
    $headers[] = $locate->Translate("Total Billsec");
    $headers[] = $locate->Translate("Call Result");
    $headers[] = $locate->Translate("Customer");
    $headers[] = $locate->Translate("Name");
    //	$headers[] = $locate->Translate("Uniqueid");
    $headers[] = $locate->Translate("Campaign Result");
    $headers[] = $locate->Translate("Response");
    $headers[] = $locate->Translate("Detect");
    $headers[] = $locate->Translate("Transfertime");
    $headers[] = $locate->Translate("Transfertarget");
    $headers[] = $locate->Translate("Result By");
    $headers[] = $locate->Translate("Tried");
    $headers[] = $locate->Translate("Dialed Time");
    //	$headers[] = $locate->Translate("Group");
    $headers[] = $locate->Translate("Campaign");
    $headers[] = $locate->Translate("Recycles");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    //	$attribsHeader[] = 'width=""';
    // 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"';
    $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"';
    $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[] = '';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","dialednumber","' . $divName . '","ORDERING");return false;\'';
    //	$eventHeader[]= 'onClick=\'xajax_showGrid(0,'.$limit.',"'.$filter.'","'.$content.'","answertime","'.$divName.'","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","duration","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","billsec","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","billsec_leg_a","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","callresult","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customer","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","customername","' . $divName . '","ORDERING");return false;\'';
    //	$eventHeader[]= 'onClick=\'xajax_showGrid(0,'.$limit.',"'.$filter.'","'.$content.'","uniqueid","'.$divName.'","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","campaignresult","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","response","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","detect","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","transfertime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","transfertarget","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","resultby","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","trytime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","dialedtime","' . $divName . '","ORDERING");return false;\'';
    //	$eventHeader[]= 'onClick=\'xajax_showGrid(0,'.$limit.',"'.$filter.'","'.$content.'","groupname","'.$divName.'","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","campaignname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","recycles","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'dialednumber';
    //$fieldsFromSearch[] = 'answertime';
    $fieldsFromSearch[] = 'duration';
    $fieldsFromSearch[] = 'campaigndialedlist.billsec';
    $fieldsFromSearch[] = 'campaigndialedlist.billsec_leg_a';
    $fieldsFromSearch[] = 'callresult';
    $fieldsFromSearch[] = 'customer';
    $fieldsFromSearch[] = 'customername';
    $fieldsFromSearch[] = 'uniqueid';
    $fieldsFromSearch[] = 'response';
    $fieldsFromSearch[] = 'detect';
    $fieldsFromSearch[] = 'campaignresult';
    $fieldsFromSearch[] = 'transfertarget';
    $fieldsFromSearch[] = 'resultby';
    $fieldsFromSearch[] = 'dialedby';
    $fieldsFromSearch[] = 'trytime';
    $fieldsFromSearch[] = 'dialedtime';
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'campaignname';
    $fieldsFromSearch[] = 'recycles';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Dialed Number");
    //$fieldsFromSearchShowAs[] = $locate->Translate("Answer Time");
    $fieldsFromSearchShowAs[] = $locate->Translate("Duration");
    $fieldsFromSearchShowAs[] = $locate->Translate("Billsec");
    $fieldsFromSearchShowAs[] = $locate->Translate("Total Billsec");
    $fieldsFromSearchShowAs[] = $locate->Translate("Call Result");
    $fieldsFromSearchShowAs[] = $locate->Translate("Customer");
    $fieldsFromSearchShowAs[] = $locate->Translate("Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Uniqueid");
    $fieldsFromSearchShowAs[] = $locate->Translate("Response");
    $fieldsFromSearchShowAs[] = $locate->Translate("Detect");
    $fieldsFromSearchShowAs[] = $locate->Translate("Campaign Result");
    $fieldsFromSearchShowAs[] = $locate->Translate("Transfertarget");
    $fieldsFromSearchShowAs[] = $locate->Translate("Result By");
    $fieldsFromSearchShowAs[] = $locate->Translate("Dialed By");
    $fieldsFromSearchShowAs[] = $locate->Translate("Tried");
    $fieldsFromSearchShowAs[] = $locate->Translate("Dialed time");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group");
    $fieldsFromSearchShowAs[] = $locate->Translate("Campaign");
    $fieldsFromSearchShowAs[] = $locate->Translate("Recycles");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->exportFlag = '2';
    //对导出标记进行赋值
    $table->deleteFlag = '1';
    //对删除标记进行赋值
    $table->ordering = $ordering;
    $editFlag = 1;
    $deleteFlag = 1;
    $deleteBtnFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['dialedlist']['delete']) {
            $deleteFlag = 1;
            $table->deleteFlag = '1';
            $deleteBtnFlag = 1;
        } else {
            $deleteFlag = 0;
            $table->deleteFlag = '0';
            $deleteBtnFlag = 0;
        }
        if ($_SESSION['curuser']['privileges']['dialedlist']['edit']) {
            $editFlag = 1;
        } else {
            $editFlag = 0;
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("campaigndialedlist", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 0, $deleteBtnFlag, $typeFromSearch, $typeFromSearchShowAs, $stype);
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        $rowc['select_id'] = $row['id'];
        $rowc[] = $row['dialednumber'];
        //		$rowc[] = $row['answertime'];
        $rowc[] = astercrm::FormatSec($row['duration']);
        $rowc[] = astercrm::FormatSec($row['billsec']);
        $rowc[] = astercrm::FormatSec($row['billsec_leg_a']);
        $rowc[] = $row['callresult'];
        $rowc[] = $row['customer'];
        $rowc[] = $row['customername'];
        //		$rowc[] = $row['uniqueid'];
        $rowc[] = $row['campaignresult'];
        $rowc[] = $row['response'];
        $rowc[] = $row['detect'];
        $rowc[] = $row['transfertime'];
        $rowc[] = $row['transfertarget'];
        $rowc[] = $row['resultby'];
        $rowc[] = $row['trytime'];
        $rowc[] = $row['dialedtime'];
        //		$rowc[] = $row['groupname'];
        $rowc[] = $row['campaignname'];
        $rowc[] = $row['recycles'];
        $table->addRow("campaigndialedlist", $rowc, 0, $deleteFlag, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render('delGrid');
    return $html;
}
Пример #14
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
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();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "worktimepackages");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "worktimepackages");
        } 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[] = 'starttime';
    $fields[] = 'endtime';
    $fields[] = 'startweek';
    $fields[] = 'endweek';
    $fields[] = 'groupname';
    $fields[] = 'cretime';
    $fields[] = 'creby';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Start Time");
    $headers[] = $locate->Translate("End Time");
    $headers[] = $locate->Translate("Start Week");
    $headers[] = $locate->Translate("End Week");
    $headers[] = $locate->Translate("Group Name");
    $headers[] = $locate->Translate("Cretime");
    $headers[] = $locate->Translate("Creby");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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"';
    $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 . '","starttime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","endtime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","startweek","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","endweek","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","worktimes.cretime","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","worktimes.creby","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'starttime';
    $fieldsFromSearch[] = 'endtime';
    $fieldsFromSearch[] = 'startweek';
    $fieldsFromSearch[] = 'endweek';
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'worktimes.cretime';
    $fieldsFromSearch[] = 'worktimes.creby';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Start Time");
    $fieldsFromSearchShowAs[] = $locate->Translate("End Time");
    $fieldsFromSearchShowAs[] = $locate->Translate("Start Week");
    $fieldsFromSearchShowAs[] = $locate->Translate("End Week");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group Name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Cretime");
    $fieldsFromSearchShowAs[] = $locate->Translate("Creby");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $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']['worktime']['delete']) {
            $deleteFlag = 1;
        } else {
            $deleteFlag = 0;
        }
        if ($_SESSION['curuser']['privileges']['worktime']['edit']) {
            $editFlag = 1;
        } else {
            $editFlag = 0;
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $editFlag, $deleteFlag, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("worktimes", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, 0, $typeFromSearch, $typeFromSearchShowAs, $stype);
    $weekShow = array('', $locate->Translate("Monday"), $locate->Translate('Tuesday'), $locate->Translate('Wednesday'), $locate->Translate('Thursday'), $locate->Translate('Friday'), $locate->Translate('Saturday'), $locate->Translate('Sunday'));
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        $rowc[] = $row['starttime'];
        $rowc[] = $row['endtime'];
        $rowc[] = $weekShow[$row['startweek']];
        $rowc[] = $weekShow[$row['endweek']];
        $rowc[] = $row['groupname'];
        $rowc[] = $row['cretime'];
        $rowc[] = $row['creby'];
        $table->addRow("worktimes", $rowc, $editFlag, $deleteFlag, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #15
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "")
{
    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;
            }
        }
        if ($flag != "1" || $flag2 != "1") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } else {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, "remindercalls");
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, "remindercalls");
        }
    }
    // Editable zone
    // Databse Table: fields
    $fields = array();
    $fields[] = 'phonenumber';
    $fields[] = 'status';
    $fields[] = 'result';
    $fields[] = 'note';
    $fields[] = 'asteriskcallsname';
    $fields[] = 'groupname';
    $fields[] = 'creby';
    $fields[] = 'cretime';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Number");
    $headers[] = $locate->Translate("Status");
    $headers[] = $locate->Translate("Result");
    $headers[] = $locate->Translate("Note");
    $headers[] = $locate->Translate("Plan name");
    $headers[] = $locate->Translate("Groupname");
    $headers[] = $locate->Translate("Creby");
    $headers[] = $locate->Translate("Cretime");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width="15%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="15%"';
    $attribsHeader[] = 'width="15%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="10%"';
    $attribsHeader[] = 'width="15%"';
    // 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"';
    $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 . '","phonenumber","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","status","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","result","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","note","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","asteriskcallsname","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","groupname","' . $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[] = 'phonenumber';
    $fieldsFromSearch[] = 'status';
    $fieldsFromSearch[] = 'result';
    $fieldsFromSearch[] = 'note';
    $fieldsFromSearch[] = 'asteriskcallsname';
    $fieldsFromSearch[] = 'groupname';
    $fieldsFromSearch[] = 'remindercalls.creby';
    $fieldsFromSearch[] = 'remindercalls.cretime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Number");
    $fieldsFromSearchShowAs[] = $locate->Translate("Status");
    $fieldsFromSearchShowAs[] = $locate->Translate("Result");
    $fieldsFromSearchShowAs[] = $locate->Translate("Note");
    $fieldsFromSearchShowAs[] = $locate->Translate("Plan name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Group name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Creby");
    $fieldsFromSearchShowAs[] = $locate->Translate("Cretime");
    //echo 'dddddddddddddd';
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 1, 1, 0);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("remindercalls", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit);
    while ($arreglo->fetchInto($row)) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['id'];
        $rowc[] = '<a href="?" onclick="return false;">' . $row['phonenumber'] . '</a>';
        $rowc[] = $row['status'];
        $rowc[] = $row['result'];
        $rowc[] = $row['note'];
        $rowc[] = $row['asteriskcallsname'];
        $rowc[] = $row['groupname'];
        $rowc[] = $row['creby'];
        $rowc[] = $row['cretime'];
        $table->addRow("remindercalls", $rowc, 1, 1, 0, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #16
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
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') {
        $arreglo =& Customer::getAllRecords($start, $limit, $order, $_SESSION['curuser']['groupid']);
        $numRows = count($arreglo);
        $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") {
            //无值
            $arreglo =& Customer::getAllRecords($start, $limit, $order, $_SESSION['curuser']['groupid']);
            $numRows = count($arreglo);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content);
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order);
        } 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[] = 'agent';
    $fields[] = 'password';
    $fields[] = 'name';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Agent");
    $headers[] = $locate->Translate("Password");
    $headers[] = $locate->Translate("Name");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // HTML Table: columns attributes
    $attribsCols = array();
    $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 . '","username","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","password","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","extension","' . $divName . '","ORDERING");return false;\'';
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(7, $start, $limit, $filter, $numRows, $content, $order, '', '', '', 'agents');
    $table->ordering = $ordering;
    $editFlag = 1;
    $deleteFlag = 1;
    if ($_SESSION['curuser']['usertype'] != 'admin' && $_SESSION['curuser']['usertype'] != 'groupadmin') {
        if ($_SESSION['curuser']['privileges']['agent']['delete']) {
            $deleteFlag = 1;
        } else {
            $deleteFlag = 0;
        }
        if ($_SESSION['curuser']['privileges']['agent']['edit']) {
            $editFlag = 1;
        } else {
            $editFlag = 0;
        }
    }
    $table->setHeader('title', $headers, $attribsHeader, $eventHeader, $editFlag, $deleteFlag);
    $table->setAttribsCols($attribsCols);
    $table->addRowSearchMore("agents", $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, 0, $typeFromSearch, $typeFromSearchShowAs, 'none');
    //print_r($arreglo);exit;
    foreach ($arreglo as $row) {
        // Change here by the name of fields of its database table
        $rowc = array();
        $rowc[] = $row['agent'];
        $rowc[] = $row['agent'];
        $rowc[] = $row['password'];
        $rowc[] = $row['name'];
        $table->addRow("agents", $rowc, $editFlag, $deleteFlag, 1, $divName, $fields);
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}
Пример #17
0
/**
*  generate grid HTML code
*  @param	start		int			record start
*  @param	limit		int			how many records need
*  @param	filter		string		the field need to search
*  @param	content		string		the contect want to match
*  @param	divName		string		which div grid want to be put
*  @param	order		string		data order
*  @return	html		string		grid HTML code
*/
function createGrid($start = 0, $limit = 1, $filter = null, $content = null, $order = null, $divName = "grid", $ordering = "", $stype = array())
{
    global $locate, $config;
    $_SESSION['ordering'] = $ordering;
    if ($filter == null or $content == null || !is_array($content) && $content == 'Array' || !is_array(filter) && $filter == 'Array') {
        $content = null;
        $filter = null;
        $numRows =& Customer::getNumRows();
        $arreglo =& Customer::getAllRecords($start, $limit, $order);
    } 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") {
            //无值
            $order = null;
            $numRows =& Customer::getNumRows();
            $arreglo =& Customer::getAllRecords($start, $limit, $order);
        } elseif ($flag3 != 1) {
            $order = "id";
            $numRows =& Customer::getNumRowsMore($filter, $content, $config['customers']['customertable']);
            $arreglo =& Customer::getRecordsFilteredMore($start, $limit, $filter, $content, $order, $config['customers']['customertable']);
        } else {
            $order = "id";
            $numRows =& Customer::getNumRowsMorewithstype($filter, $content, $stype, $config['customers']['customertable']);
            $arreglo =& Customer::getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype, $order, $config['customers']['customertable']);
        }
    }
    // 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[] = 'pin';
    $fields[] = 'first_name';
    $fields[] = 'last_name';
    $fields[] = 'amount';
    $fields[] = 'discount';
    $fields[] = 'cretime';
    // HTML table: Headers showed
    $headers = array();
    $headers[] = $locate->Translate("Pin");
    $headers[] = $locate->Translate("First name");
    $headers[] = $locate->Translate("Last name");
    $headers[] = $locate->Translate("Amount");
    $headers[] = $locate->Translate("Discount");
    $headers[] = $locate->Translate("Create time");
    // HTML table: hearders attributes
    $attribsHeader = array();
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    $attribsHeader[] = 'width=""';
    // 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 . '","pin","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","first_name","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","last_name","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","amount","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","discount","' . $divName . '","ORDERING");return false;\'';
    $eventHeader[] = 'onClick=\'xajax_showGrid(0,' . $limit . ',"' . $filter . '","' . $content . '","cretime","' . $divName . '","ORDERING");return false;\'';
    // Select Box: fields table.
    $fieldsFromSearch = array();
    $fieldsFromSearch[] = 'pin';
    $fieldsFromSearch[] = 'first_name';
    $fieldsFromSearch[] = 'last_name';
    $fieldsFromSearch[] = 'amount';
    $fieldsFromSearch[] = 'discount';
    $fieldsFromSearch[] = 'cretime';
    // Selecct Box: Labels showed on search select box.
    $fieldsFromSearchShowAs = array();
    $fieldsFromSearchShowAs[] = $locate->Translate("Pin");
    $fieldsFromSearchShowAs[] = $locate->Translate("First name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Last name");
    $fieldsFromSearchShowAs[] = $locate->Translate("Amount");
    $fieldsFromSearchShowAs[] = $locate->Translate("Discount");
    $fieldsFromSearchShowAs[] = $locate->Translate("Create time");
    // Create object whit 5 cols and all data arrays set before.
    $table = new ScrollTable(6, $start, $limit, $filter, $numRows, $content, $order);
    $table->setAttribsCols($attribsCols);
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 1, 1, 'customer');
        //$table->deleteFlag = '1';//对删除标记进行赋值
        //$table->exportFlag = '1';//对导出标记进行赋值
        $table->addRowSearchMore($config['customers']['customertable'], $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 1, $typeFromSearch, $typeFromSearchShowAs, $stype);
    } else {
        $table->setHeader('title', $headers, $attribsHeader, $eventHeader, 0, 0, 'customer');
        //if($_SESSION['curuser']['usertype'] == 'groupadmin') $table->exportFlag = '1';//对导出标记进行赋值
        $table->addRowSearchMore($config['customers']['customertable'], $fieldsFromSearch, $fieldsFromSearchShowAs, $filter, $content, $start, $limit, 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['pin'];
        $rowc[] = $row['first_name'];
        $rowc[] = $row['last_name'];
        $rowc[] = $row['amount'];
        if ($row['discount'] == -1) {
            $rowc[] = $locate->Translate("dynamic");
        } else {
            $rowc[] = $row['discount'];
        }
        $rowc[] = $row['cretime'];
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $table->addRow($config['customers']['customertable'], $rowc, 1, 1, 'customer', $divName, $fields);
        } else {
            $table->addRow($config['customers']['customertable'], $rowc, 0, 0, 'customer', $divName, $fields);
        }
    }
    // End Editable Zone
    $html = $table->render();
    return $html;
}