当前位置: 首页>>代码示例>>PHP>>正文


PHP astercrm类代码示例

本文整理汇总了PHP中astercrm的典型用法代码示例。如果您正苦于以下问题:PHP astercrm类的具体用法?PHP astercrm怎么用?PHP astercrm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了astercrm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: searchFormSubmit

function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    if ($optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'clid');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($optionFlag == "delete") {
        if (empty($_SESSION['curuser']['usertype'])) {
            $objResponse->addAlert($locate->Translate("Session time out,please try again"));
            return $objResponse->getXML();
        }
        if ($_SESSION['curuser']['usertype'] == 'groupadmin') {
            $searchContent[] = $_SESSION['curuser']['groupid'];
            $searchField[] = 'groupid';
            $searchType[] = 'equal';
        } elseif ($_SESSION['curuser']['usertype'] == 'reseller') {
            $searchContent[] = $_SESSION['curuser']['resellerid'];
            $searchField[] = 'resellerid';
            $searchType[] = 'equal';
        }
        if ($config['synchronize']['delete_by_use_history']) {
            astercrm::deleteToHistoryFromSearch($searchContent, $searchField, $searchType, 'clid');
        } else {
            astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'clid');
        }
        $html = createGrid($numRows, $limit, '', '', '', $divName, "", $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } elseif ($type == "delete") {
        if (empty($_SESSION['curuser']['usertype'])) {
            $objResponse->addAlert($locate->Translate("Session time out,please try again"));
            return $objResponse->getXML();
        }
        if ($config['synchronize']['delete_by_use_history']) {
            $res = Customer::deleteRecordToHistory('id', $id, 'clid');
        } else {
            $res = Customer::deleteRecord($id, 'clid');
        }
        if ($res) {
            $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", $searchType);
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record deleted"));
            $objResponse->addAssign($divName, "innerHTML", $html);
        } else {
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record cannot be deleted"));
        }
    } else {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:67,代码来源:clid.server.php

示例2: processAccountData


//.........这里部分代码省略.........
                    setcookie("username", $aFormValues['username'], time() + 94608000);
                    setcookie("password", $aFormValues['password'], time() + 94608000);
                    setcookie("language", $aFormValues['locate'], time() + 94608000);
                    setcookie("pagestyle", $aFormValues['pagestyle'], time() + 94608000);
                } else {
                    // destroy cookies
                    setcookie("username", "", time() - 3600);
                    setcookie("password", "", time() - 3600);
                    setcookie("language", "", time() - 3600);
                    setcookie("pagestyle", $aFormValues['pagestyle'], time() + 94608000);
                    $username = '';
                    $password = '';
                    $language = 'en_US';
                    $checked = false;
                }
                $_SESSION = array();
                $_SESSION['curuser']['username'] = trim($aFormValues['username']);
                $_SESSION['curuser']['usertype'] = $list['usertype'];
                $_SESSION['curuser']['ipaddress'] = $_SERVER["REMOTE_ADDR"];
                $_SESSION['curuser']['userid'] = $list['id'];
                $_SESSION['curuser']['groupid'] = $list['groupid'];
                $_SESSION['curuser']['resellerid'] = $list['resellerid'];
                $_SESSION['curuser']['limittype'] = $list['limittype'];
                $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
                if ($configstatus == -2) {
                    $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
                    return $html;
                } else {
                    $billingfield = trim($asterccConfig['system']['billingfield']);
                    if ($billingfield == 'accountcode') {
                        $_SESSION['curuser']['billingfield'] = $billingfield;
                    }
                }
                $res = astercrm::getCalleridListByID($list['groupid']);
                while ($res->fetchInto($row)) {
                    $_SESSION['curuser']['extensions'][] = $row['clid'];
                }
                if (!is_array($_SESSION['curuser']['extensions'])) {
                    $_SESSION['curuser']['extensions'] = array();
                }
                if ($list['usertype'] == 'reseller') {
                    $_SESSION['curuser']['allowcallback'] = $list['allowcallbackreseller'];
                } else {
                    $_SESSION['curuser']['allowcallback'] = $list['allowcallbackgroup'];
                }
                $_SESSION['curuser']['accountcode'] = $list['accountcode'];
                //				if ($list['extensions'] != ''){
                //					$_SESSION['curuser']['extensions'] = split(',',$list['extensions']);
                //				}
                //				else{
                //				}
                list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
                /*
                	if you dont want check manager status and show device status when user login 
                	please uncomment these three line
                */
                //				$objResponse->addAlert($locate->Translate("login_success"));
                if ($_SESSION['curuser']['usertype'] == 'groupadmin' || $_SESSION['curuser']['usertype'] == 'operator') {
                    if ($aFormValues['pagestyle'] == 'classic') {
                        $objResponse->addScript('window.location.href="systemstatus.php";');
                    } else {
                        $objResponse->addScript('window.location.href="systemstatus_simple.php";');
                    }
                } else {
                    $objResponse->addScript('window.location.href="account.php";');
                }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:67,代码来源:manager_login.server.php

示例3: processAccountData


//.........这里部分代码省略.........
    $objResponse = new xajaxResponse();
    $bError = false;
    $loginError = false;
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        if ($_SERVER["HTTP_CLIENT_IP"]) {
            $proxy = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $proxy = $_SERVER["REMOTE_ADDR"];
        }
    } else {
        if (isset($_SERVER["HTTP_CLIENT_IP"])) {
            $ip = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $ip = $_SERVER["REMOTE_ADDR"];
        }
    }
    $log = array();
    $log['action'] = 'login';
    $log['ip'] = $ip;
    $log['username'] = $aFormValues['username'];
    $log['usertype'] = 'clid';
    $query = "SELECT * FROM account_log WHERE ip='" . $ip . "' AND action='login' ORDER BY id DESC LIMIT 1";
    $res = $db->query($query);
    if ($res->fetchInto($this_ip_log)) {
        $failedtimes = $this_ip_log['failedtimes'];
    }
    if ($failedtimes >= $config['system']['max_incorrect_login'] && $config['system']['max_incorrect_login'] > 0) {
        $objResponse->addAlert($locate->Translate("login failed,your ip is locked for login"));
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
        return $objResponse;
    }
    if (!$bError) {
        $query = "SELECT * from clid where clid ='" . $aFormValues['username'] . "'";
        $res = $db->query($query);
        if ($res->fetchInto($clid)) {
            $log['account_id'] = $clid['id'];
            if ($clid['pin'] == $aFormValues['password']) {
                $log['status'] = 'success';
                $log['failedtimes'] = 0;
                if ($aFormValues['rememberme'] == "forever") {
                    // set cookies for three years
                    setcookie("username", $aFormValues['username'], time() + 94608000);
                    setcookie("password", $aFormValues['password'], time() + 94608000);
                    setcookie("language", $aFormValues['locate'], time() + 94608000);
                } else {
                    // destroy cookies
                    setcookie("username", "", time() - 3600);
                    setcookie("password", "", time() - 3600);
                    setcookie("language", "", time() - 3600);
                    $username = '';
                    $password = '';
                    $language = 'en_US';
                    $checked = false;
                }
                $_SESSION['curuser']['username'] = trim($aFormValues['username']);
                $_SESSION['curuser']['usertype'] = "clid";
                $_SESSION['curuser']['clidid'] = $clid['id'];
                $_SESSION['curuser']['groupid'] = $clid['groupid'];
                list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
                $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
                if ($configstatus == -2) {
                    $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
                    return $html;
                } else {
                    $billingfield = trim($asterccConfig['system']['billingfield']);
                    if ($billingfield == 'accountcode') {
                        $_SESSION['curuser']['billingfield'] = $billingfield;
                    }
                }
                //$objResponse->addAlert($locate->Translate("login_success"));
                $objResponse->addScript('window.location.href="cdr.php";');
            } else {
                $log['failedtimes'] = $failedtimes + 1;
                $log['status'] = 'failed';
                $log['failedcause'] = 'incorrect password';
                $loginError = true;
            }
        } else {
            $log['failedtimes'] = $failedtimes + 1;
            $log['account_id'] = 0;
            $log['status'] = 'failed';
            $log['failedcause'] = 'notexistent clid';
            $loginError = true;
        }
        astercrm::insertAccountLog($log);
        if (!$loginError) {
            return $objResponse;
        } else {
            $objResponse->addAlert($locate->Translate("login_failed"));
            $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
            $objResponse->addAssign("loginButton", "disabled", false);
            return $objResponse;
        }
    } else {
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
    }
    return $objResponse;
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:login.server.php

示例4: COUNT

 function &getNumRowsMorewithstype($filter, $content, $stype, $table)
 {
     global $db;
     $joinstr = astercrm::createSqlWithStype($filter, $content, $stype);
     $sql = "SELECT COUNT(*) FROM contact LEFT JOIN customer ON customer.id = contact.customerid LEFT JOIN note on note.contactid = contact.id WHERE ";
     if ($_SESSION['curuser']['usertype'] == 'admin') {
         $sql .= " ";
     } else {
         $sql .= " contact.groupid = " . $_SESSION['curuser']['groupid'] . " AND ";
     }
     if ($joinstr != '') {
         $joinstr = ltrim($joinstr, 'AND');
         //去掉最左边的AND
         $sql .= " " . $joinstr;
     } else {
         $sql .= " 1";
     }
     Customer::events($sql);
     $res =& $db->getOne($sql);
     return $res;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:21,代码来源:contact.grid.inc.php

示例5: searchFormSubmit

function searchFormSubmit($searchFormValue, $numRows = null, $limit = null, $id = null, $type = null)
{
    global $locate, $db;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    $ordering = $searchFormValue['ordering'];
    $order = $searchFormValue['order'];
    $divName = "grid";
    if ($optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'worktimes');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($type == "delete") {
        $row = Customer::getRecordByField('worktime_id', $id, 'worktimepackage_worktimes');
        if ($row['id'] != '') {
            $objResponse->addAlert($locate->Translate("this worktime in one or more package, can not delete"));
            return $objResponse->getXML();
        }
        $res = Customer::deleteRecord($id, 'worktimes');
        if ($res) {
            $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $order, $divName, $ordering, $searchType);
            $objResponse = new xajaxResponse();
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
            $objResponse->addAssign($divName, "innerHTML", $html);
        } else {
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
        }
    } else {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:44,代码来源:worktime.server.php

示例6: formEdit

    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $rate =& Customer::getRecordByID($id, 'myrate');
        /*
        $group = astercrm::getAll('accountgroup');
        
        if ($_SESSION['curuser']['usertype'] == 'admin'){
        	$groupoptions .= '<select id="groupid" name="groupid">';
        	while	($group->fetchInto($row)){
        		if ($row['id'] == $rate['groupid']){
        			$groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>";
        		}else{
        			$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
        		}
        	}
        	$groupoptions .= '</select>';
        }else{
        	while	($group->fetchInto($row)){
        		if ($row['id'] == $_SESSION['curuser']['groupid']){
        			$groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">';
        			break;
        		}
        	}
        }
        */
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                }
                if ($row['id'] == $rate['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $rate['resellerid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                    }
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $rate['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                }
                if ($row['id'] == $rate['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $rate['groupid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                    }
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("prefix") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '" onKeyUp="xajax_showBuyRate(this.value);" onclick="xajax_showBuyRate(this.value);">&nbsp;<span id="spanShowBuyRate" name="spanShowBuyRate"></span></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("length") . '</td>
					<td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td>
				</tr>
				<tr>
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:rate.grid.inc.php

示例7: COUNT

 function &getNumRowsMorewithstype($filter, $content, $stype, $table)
 {
     global $db;
     $joinstr = astercrm::createSqlWithStype($filter, $content, $stype, "worktimepackages");
     $sql = "SELECT COUNT(*) FROM worktimepackages LEFT JOIN astercrm_accountgroup ON astercrm_accountgroup.id = worktimepackages.groupid WHERE ";
     if ($_SESSION['curuser']['usertype'] == 'admin') {
         $sql .= " ";
     } else {
         $sql .= " worktimepackages.groupid = " . $_SESSION['curuser']['groupid'] . " AND ";
     }
     if ($joinstr != '') {
         $joinstr = ltrim($joinstr, 'AND');
         //去掉最左边的AND
         $sql .= " " . $joinstr;
     } else {
         $sql .= " 1";
     }
     Customer::events($sql);
     $res =& $db->getOne($sql);
     return $res;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:21,代码来源:worktimepackages.grid.inc.php

示例8: ltrim

 function &getNumRowsMorewithstype($filter, $content, $stype, $table)
 {
     global $db;
     $joinstr = astercrm::createSqlWithStype($filter, $content, $stype);
     if ($joinstr != '') {
         $joinstr = ltrim($joinstr, 'AND');
         //去掉最左边的AND
         $sql = 'SELECT COUNT(*) AS numRows FROM resellergroup WHERE ' . $joinstr;
     } else {
         $sql = "SELECT COUNT(*) AS numRows FROM resellergroup";
     }
     Customer::events($sql);
     $res =& $db->getOne($sql);
     return $res;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:15,代码来源:resellergroup.grid.inc.php

示例9: formEdit

    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $account =& Customer::getRecordByID($id, 'account');
        /*
        		$group = astercrm::getAll('accountgroup');
        
        		if ($_SESSION['curuser']['usertype'] == 'admin'){
        			$groupoptions .= '<select id="groupid" name="groupid">';
        			while	($group->fetchInto($row)){
        				if ($row['id'] == $account['groupid']){
        					$groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>";
        				}else{
        					$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
        				}
        			}
        			if ($account['groupid'] == 0 ){
        				$groupoptions .= "<OPTION value='0' selected></OPTION>";
        			}else{
        				$groupoptions .= "<OPTION value='0'></OPTION>";
        			}
        			$groupoptions .= '</select>';
        		}else{
        			while	($group->fetchInto($row)){
        				if ($row['id'] == $account['groupid']){
        					$groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">';
        					break;
        				}
        			}
        		}
        */
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $account['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $account['resellerid']) {
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $account['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($row['id'] == $account['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $account['groupid']) {
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("username") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $account['id'] . '"><input type="text" id="username" name="username" size="25" maxlength="30" value="' . $account['username'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("password") . '</td>
					<td align="left"><input type="text" id="password" name="password" size="25" maxlength="30" value="' . $account['password'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("usertype") . '</td>
					<td align="left">
					<select id="usertype" name="usertype">
						<option value="" ';
        if ($account['usertype'] == '') {
            $html .= ' selected ';
        }
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:account_log.grid.inc.php

示例10: getOnlineSql

 function getOnlineSql($searchContent, $searchField, $searchType = array(), $table, $fields = '', $leftjoins = array())
 {
     global $db, $config;
     $updateTimeInterval = $config['system']['update_online_interval'] * 60;
     $joinstr = astercrm::createSqlWithStype($searchField, $searchContent, $searchType, $table);
     $fieldstr = '';
     if (is_array($fields)) {
         foreach ($fields as $field => $alias) {
             if (!is_numeric($field)) {
                 $fieldstr .= " " . $field . " AS " . $alias . ",";
             } else {
                 $fieldstr .= " " . $alias . ",";
             }
         }
     }
     $leftStr = '';
     if (!empty($leftjoins)) {
         foreach ($leftjoins as $model => $param) {
             // the keys of array $leftjoins are the table which need to left join
             $leftStr .= 'LEFT JOIN ' . $model . ' ON ' . $param[0] . '=' . $param[1] . ' ';
         }
     }
     if ($joinstr != '') {
         $joinstr = ltrim($joinstr, 'AND');
         if ($fieldstr != '') {
             $fieldstr = rtrim($fieldstr, ',');
             $query = "SELECT " . $fieldstr . " FROM " . $table . " " . $leftStr . " WHERE (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(last_update_time)) < {$updateTimeInterval} AND " . $joinstr;
         } else {
             $query = "SELECT * FROM " . $table . " '" . $leftStr . " WHERE (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(last_update_time)) < {$updateTimeInterval} AND " . $joinstr;
         }
     } else {
         if ($fieldstr != '') {
             $fieldstr = rtrim($fieldstr, ',');
             $query = "SELECT " . $fieldstr . " FROM " . $table . " " . $leftStr . "WHERE (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(last_update_time)) < {$updateTimeInterval} ";
         } else {
             $query = "SELECT * FROM " . $table . " WHERE (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(last_update_time)) < {$updateTimeInterval} ";
         }
     }
     return $query;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:40,代码来源:useronline.grid.inc.php

示例11: checkExtensionStatus

 function checkExtensionStatus($curid, $type = 'list', $curhover)
 {
     global $db, $config;
     /* 
     	if type is list, then only check some specific extension
     	or else we get extension list from events
     */
     $panellist = array();
     $panelphones = array();
     if ($type == 'list') {
         $i = 0;
         foreach ($_SESSION['curuser']['extensions'] as $value) {
             $row = astercrm::getRecordByField('username', $value, 'astercrm_account');
             $panellist[$row['username']]['extension'] = $row['extension'];
             $panellist[$row['username']]['agent'] = $row['agent'];
             $panellist[$row['username']]['channel'] = $row['channel'];
             $panelphones[] = $row['extension'];
             $i++;
         }
         //$_SESSION['curuser']['extensions_session'] = $panellist;
     } else {
         $alluser = astercrm::getall('astercrm_account');
         while ($alluser->fetchinto($row)) {
             $panellist[$row['username']]['extension'] = $row['extension'];
             $panellist[$row['username']]['agent'] = $row['agent'];
             $panellist[$row['username']]['channel'] = $row['channel'];
             $panelphones[] = $row['extension'];
         }
     }
     if (!isset($_SESSION['extension_status'])) {
         $status = array();
         $callerid = array();
         $direction = array();
     } else {
         /*
         because there could be no all extension status data in events
         we need to inherit status from sessions
         */
         $status = $_SESSION['extension_status'];
         $callerid = $_SESSION['callerid'];
         $direction = $_SESSION['direction'];
         $srcchan = $_SESSION['srcchan'];
         $dstchan = $_SESSION['dstchan'];
     }
     if (!isset($panelphones) or $panelphones == '') {
         $panelphones = array();
     }
     if ($config['system']['eventtype'] == 'curcdr') {
         //read all peer status in table peerstatus and save to array $phone_status
         $events =& asterEvent::getPeerstatus(0);
         $phone_status = array();
         while ($events->fetchInto($list)) {
             list($tech, $peer) = split('/', $list['peername']);
             $phone_status[$peer] = $list['status'];
         }
         foreach ($panellist as $username => $phone) {
             $query = "SELECT * FROM curcdr WHERE (src = '" . $phone['extension'] . "' OR dst = '" . $phone['extension'] . "' OR srcchan = 'agent/" . $phone['agent'] . "' OR dstchan = 'agent/" . $phone['agent'] . "' OR srcchan LIKE '" . $phone['channel'] . "-%' OR dstchan LIKE '" . $phone['channel'] . "-%') AND dstchan != '' AND srcchan != '' AND dst != '' AND src != '' ORDER BY id ASC";
             $res = $db->query($query);
             if ($res->fetchInto($cdrrow)) {
                 if ($status[$username] == 1) {
                     continue;
                 }
                 //for check click to transfer
                 if (!strstr($cdrrow['dstchan'], $cdrrow['dst'])) {
                     $dst_tmp = trim($cdrrow['dst']);
                     $cdrrow['dst'] = '';
                 }
                 if ($status[$list['peer']] == 1) {
                     continue;
                 }
                 if (strstr($cdrrow['src'], $phone['extension']) or strstr($cdrrow['srcchan'], $phone['channel']) or $cdrrow['srcchan'] == "agent/" . $phone['agent']) {
                     // dial out
                     if ($cdrrow['didnumber'] != '') {
                         $callerid[$username] = trim($cdrrow['didnumber']);
                     } else {
                         if (trim($cdrrow['dst']) != '') {
                             $callerid[$username] = trim($cdrrow['dst']);
                         } else {
                             $callerid[$username] = $dst_tmp;
                         }
                     }
                     $direction[$username] = "dialout";
                     $status[$username] = 1;
                     $srcchan[$username] = trim($cdrrow['srcchan']);
                     $dstchan[$username] = trim($cdrrow['dstchan']);
                 } elseif (strstr($cdrrow['dst'], $phone['extension']) or strstr($cdrrow['dstchan'], $phone['channel']) or $cdrrow['dstchan'] == "agent/" . $phone['agent']) {
                     //dial in
                     $callerid[$username] = trim($cdrrow['src']);
                     $direction[$username] = "dialin";
                     $status[$username] = 1;
                     $srcchan[$username] = trim($cdrrow['srcchan']);
                     $dstchan[$username] = trim($cdrrow['dstchan']);
                 } else {
                     $callerid[$username] = '';
                     $direction[$username] = '';
                     $status[$username] = 0;
                 }
             } else {
                 if ($phone_status[$phone['extension']] == 'unknown' || $phone_status[$phone['extension']] == 'unreachable' || $phone_status[$phone['extension']] == '' || $phone_status[$phone['extension']] == 'unregistered') {
                     $status[$username] = 2;
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:asterevent.class.php

示例12: archiveCDR

function archiveCDR($archiveDate)
{
    global $db, $locate, $config;
    $objResponse = new xajaxResponse();
    $date = date("Y-m-d");
    $end_date = date("Y-m-d", strtotime("{$date} - {$archiveDate} month"));
    if ($config['system']['useHistoryCdr'] == 1) {
        $table = 'historycdr';
    } else {
        $table = 'mycdr';
    }
    $sql = "SELECT calldate FROM {$table} WHERE calldate < '" . $end_date . "' ORDER BY calldate ASC LIMIT 1";
    $start_date = $db->getOne($sql);
    if ($start_date == '') {
        $objResponse->addAlert($locate->Translate('no cdr data early than') . " " . $archiveDate . " " . $locate->Translate('months'));
        $objResponse->addAssign("divMsg", "style.visibility", "hidden");
        $objResponse->addClear("msgZone", "innerHTML");
        return $objResponse->getXML();
    }
    $file_dir = $config['system']['upload_file_path'] . "cdr_archive";
    if (!is_dir($file_dir)) {
        if (!mkdir($file_dir)) {
            $objResponse->addAlert($locate->Translate('cant create archive directory'));
            $objResponse->addAssign("divMsg", "style.visibility", "hidden");
            $objResponse->addClear("msgZone", "innerHTML");
            return $objResponse->getXML();
        }
    }
    $start_date = split('\\ ', $start_date);
    $start_date = $start_date['0'];
    $file_name = $start_date . "_to_" . $end_date;
    if (!($handle = fopen($file_dir . "/" . $file_name . ".csv", 'x'))) {
        $objResponse->addAlert($locate->Translate('cant create archive file'));
        $objResponse->addAssign("divMsg", "style.visibility", "hidden");
        $objResponse->addClear("msgZone", "innerHTML");
        return $objResponse->getXML();
    }
    $sql = "SELECT * FROM {$table} WHERE calldate < '" . $end_date . "' ORDER BY calldate ASC";
    $archiveData = astercrm::exportDataToCSV($sql);
    if (!fwrite($handle, $archiveData)) {
        $objResponse->addAlert($locate->Translate('cant create archive file'));
        $objResponse->addAssign("divMsg", "style.visibility", "hidden");
        $objResponse->addClear("msgZone", "innerHTML");
        return $objResponse->getXML();
    }
    fclose($handle);
    system("tar zcf " . $file_dir . "/" . $file_name . ".tar.gz " . $file_dir . "/" . $file_name . ".csv", $r);
    if ($r === false) {
        $final_file = $file_dir . "/" . $file_name . ".csv";
    } else {
        $final_file = $file_dir . "/" . $file_name . ".tar.gz";
        unlink($file_dir . "/" . $file_name . ".csv");
    }
    $objResponse->addAlert($locate->Translate('archive success') . ", " . $locate->Translate('file save in') . ": " . $final_file);
    $sql = "DELETE FROM {$table} WHERE calldate < '" . $end_date . "'";
    $res = $db->query($sql);
    if ($res == 1) {
        $objResponse->addAlert($locate->Translate('clear cdr date success'));
    } else {
        $objResponse->addAlert($locate->Translate('clear cdr date failed'));
    }
    $html = createGrid(0, ROWSXPAGE);
    $objResponse->addAssign("divMsg", "style.visibility", "hidden");
    $objResponse->addClear("msgZone", "innerHTML");
    $objResponse->addAssign("grid", "innerHTML", $html);
    return $objResponse->getXML();
    //echo $file_name;exit;
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:68,代码来源:cdr.server.php

示例13: updateRemindercallsRecord

 function updateRemindercallsRecord($f)
 {
     global $db;
     $f = astercrm::variableFiler($f);
     $query = "UPDATE remindercalls SET " . "customerid='" . $f['customerid'] . "', " . "contactid='" . $f['contactid'] . "', " . "phonenumber= '" . $f['phonenumber'] . "', " . "asteriskcallsid= '" . $f['asteriskcallsid'] . "', " . "note= '" . $f['note'] . "', " . "dialtime= '" . $f['dialtime'] . "', " . "groupid = " . $f['groupid'] . ", " . "cretime = now() " . "WHERE id= " . $f['id'] . " ";
     astercrm::events($query);
     $res =& $db->query($query);
     return $res;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:9,代码来源:remindercalls.grid.inc.php

示例14: deleteCustomer

 function deleteCustomer($id)
 {
     global $customers_db, $config;
     $query = "DELETE FROM " . $config['customers']['customertable'] . " WHERE id = {$id}";
     astercrm::events($query);
     $res =& $customers_db->query($query);
     return $res;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:8,代码来源:customers.grid.inc.php

示例15: searchFormSubmit

function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    if ($optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'accountgroup');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($type == "delete") {
        if ($config['synchronize']['delete_by_use_history']) {
            $res = Customer::deleteRecordToHistory('groupid', $id, 'clid');
            $res = Customer::deleteRecordToHistory('groupid', $id, 'myrate');
            $res = Customer::deleteRecordToHistory('groupid', $id, 'callshoprate');
            $res = Customer::deleteRecordToHistory('groupid', $id, 'account');
            $res = Customer::deleteRecordToHistory('id', $id, 'accountgroup');
        } else {
            $res = Customer::deleteRecords('groupid', $id, 'clid');
            $res = Customer::deleteRecords('groupid', $id, 'myrate');
            $res = Customer::deleteRecords('groupid', $id, 'callshoprate');
            $res = Customer::deleteRecords('groupid', $id, 'account');
            $res = Customer::deleteRecord($id, 'accountgroup');
        }
        if ($res) {
            $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", $searchType);
            $objResponse = new xajaxResponse();
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
            $objResponse->addClear("msgZone", "innerHTML");
            $objResponse->addAssign($divName, "innerHTML", $html);
        } else {
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
        }
    } else {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:51,代码来源:accountgroup.server.php


注:本文中的astercrm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。