本文整理汇总了PHP中createGrid函数的典型用法代码示例。如果您正苦于以下问题:PHP createGrid函数的具体用法?PHP createGrid怎么用?PHP createGrid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createGrid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchFormSubmit
function searchFormSubmit($searchFormValue, $numRows = null, $limit = null, $id = null, $type = null, $order = '')
{
global $locate, $db;
#print_r($searchFormValue);exit;
$objResponse = new xajaxResponse();
$searchField = array();
$searchContent = array();
$searchType = array();
$optionFlag = $searchFormValue['optionFlag'];
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$searchType = $searchFormValue['searchType'];
//搜索方式 数组
$ordering = $searchFormValue['ordering'];
$order = $searchFormValue['order'];
$divName = "grid";
$allOrAnswer = $searchFormValue['allOrAnswer'];
#选中的radio值
if ($optionFlag == "export" || $optionFlag == "exportcsv") {
$fieldArray = array('mycdr.*', 'astercrm_accountgroup.groupname', 'astercrm_account.username');
$leftjoinArray = array('astercrm_accountgroup' => array('astercrm_accountgroup.id', 'mycdr.astercrm_groupid'), 'astercrm_account' => array('astercrm_account.id', 'mycdr.accountid'));
if ($searchFormValue['allOrAnswer'] == 'answered') {
$searchContent[] = '0';
$searchField[] = 'billsec';
$searchType[] = 'more';
}
$sql = astercrm::getSql($searchContent, $searchField, $searchType, 'mycdr', $fieldArray, $leftjoinArray);
//得到要导出的sql语句
$_SESSION['export_sql'] = $sql;
$objResponse->addAssign("hidSql", "value", $sql);
//赋值隐含域
$objResponse->addAssign("exporttype", "value", $optionFlag);
$objResponse->addScript("document.getElementById('exportForm').submit();");
} else {
if ($type == "delete") {
$res = Customer::deleteRecord($id, 'account');
if ($res) {
$html = createGrid('', '', $searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $order, $divName, $ordering, $searchType, $allOrAnswer);
$objResponse = new xajaxResponse();
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
}
} else {
$html .= createGrid('', '', $numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType, $allOrAnswer);
}
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
}
return $objResponse->getXML();
}
示例2: 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();
}
示例3: update
/**
* update ticketcategory record
* @param f array account record
* @return objResponse object xajax response object
*/
function update($f)
{
global $locate, $db;
$objResponse = new xajaxResponse();
if (trim($f['ticketcategoryid']) == 0 || trim($f['ticketid']) == 0 || trim($f['customerid']) == 0) {
$objResponse->addAlert($locate->Translate("obligatory_fields"));
return $objResponse->getXML();
}
$validParentTicket = true;
if ($f['parent_id'] != '') {
if (!preg_match('/^[\\d]*$/', $f['parent_id'])) {
$objResponse->addAlert($locate->Translate("Parent TicketDetail ID must be integer"));
return $objResponse->getXML();
}
//验证写入的parent_id 是否存在
$validParentTicket = Customer::validParentTicketId($f['parent_id']);
}
$oriResult = Customer::getOriResult($f['id']);
//if ( $f['usertype'] == 'admin' ) $f['groupid'] = 0;
// check over
$respOk = Customer::updateTicketDetail($f);
if ($respOk) {
if (!$validParentTicket) {
$objResponse->addAlert($locate->Translate("Update Success,but Parent TicketDetail ID is not exists"));
}
$new_assign = '';
if ($f['assignto'] != 0) {
$new_assign = Customer::getAssignToName($f['assignto']);
}
$ori_assign = '';
if ($oriResult['assignto'] != 0) {
$ori_assign = Customer::getAssignToName($oriResult['assignto']);
}
// track the ticket_op_logs
if ($oriResult['status'] != $f['status']) {
Customer::ticketOpLogs('update', 'status', $oriResult['status'], $f['status'], $new_assign, $f['groupid']);
}
if ($oriResult['assignto'] != $f['assignto']) {
Customer::ticketOpLogs('update', 'assignto', $ori_assign, $new_assign, $new_assign, $f['groupid']);
}
$html = createGrid(0, ROWSXPAGE);
$objResponse->addAssign("grid", "innerHTML", $html);
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("update_rec"));
$objResponse->addAssign("formDiv", "style.visibility", "hidden");
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_update"));
}
return $objResponse->getXML();
}
示例4: saveCustomerLeadNote
function saveCustomerLeadNote($f)
{
global $locate;
$objResponse = new xajaxResponse();
$respOk = Customer::saveCustomerLeadNote($f);
if ($respOk) {
$objResponse->addAssign("formNoteInfo", "style.visibility", "hidden");
$objResponse->addClear("formNoteInfo", "innerHTML");
$html = createGrid(0, ROWSXPAGE);
$objResponse->addAssign("grid", "innerHTML", $html);
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("a_new_note_added"));
} else {
$objResponse->addAlert('can not add note');
}
return $objResponse;
}
示例5: 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();
}
示例6: 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();
}
示例7: update
/**
* update ticketcategory record
* @param f array account record
* @return objResponse object xajax response object
*/
function update($f)
{
global $locate, $db;
$objResponse = new xajaxResponse();
if (trim($f['templatetitle']) == '') {
$objResponse->addAlert($locate->Translate("obligatory_fields"));
return $objResponse->getXML();
}
$respOk = Customer::updateSmsTemplates($f);
if ($respOk) {
$html = createGrid(0, ROWSXPAGE);
$objResponse->addAssign("grid", "innerHTML", $html);
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("update_rec"));
$objResponse->addAssign("formDiv", "style.visibility", "hidden");
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_update"));
}
return $objResponse->getXML();
}
示例8: delete
/**
* update ticketcategory record
* @param ticketid int ticket id
* @return objResponse object xajax response object
*/
function delete($sms_sentsId = null)
{
global $locate;
$res = Customer::deleteRecord($sms_sentsId, 'sms_sents');
if ($res) {
$html = createGrid(0, ROWSXPAGE);
$objResponse = new xajaxResponse();
$objResponse->addAssign("grid", "innerHTML", $html);
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
}
return $objResponse->getXML();
}
示例9: 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'];
$exportFlag = $searchFormValue['exportFlag'];
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$ordering = $searchFormValue['ordering'];
$order = $searchFormValue['order'];
$divName = "grid";
$searchType = $searchFormValue['searchType'];
if ($optionFlag == "export" || $optionFlag == "exportcsv") {
$sql =& Customer::getOnlineSql($searchContent, $searchField, $searchType, 'astercrm_account', array('username', '(UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(last_login_time))' => 'onlinetime', 'last_login_time'));
//得到要导出的sql语句
$objResponse->addAssign("hidSql", "value", $sql);
//赋值隐含域
$objResponse->addAssign("exporttype", "value", $optionFlag);
$objResponse->addAssign("maintable", "value", "note_leads");
//传递主表名,防止groupid等字段在各表中重复
$objResponse->addScript("document.getElementById('exportForm').submit();");
} else {
$html = createGrid($numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType);
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
}
return $objResponse->getXML();
}
示例10: 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'];
$exportFlag = $searchFormValue['exportFlag'];
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$divName = "grid";
$searchType = $searchFormValue['searchType'];
$ordering = $searchFormValue['ordering'];
$order = $searchFormValue['order'];
if ($exportFlag == "1" || $optionFlag == "export") {
// 需要特殊处理
// $sql = astercrm::getSql($searchContent,$searchField,$searchType,'surveyresult'); //得到要导出的sql语句
$joinstr = astercrm::createSqlWithStype($searchField, $searchContent, $searchType, 'surveyresult');
$objResponse->addAssign("hidSql", "value", $joinstr);
//赋值隐含域
$objResponse->addScript("document.getElementById('exportForm').submit();");
} elseif ($optionFlag == "delete") {
astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'surveyresult');
$html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', $order, $divName, $ordering, 1, 1, '');
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
} else {
if ($type == "delete") {
$res = Customer::deleteRecord($id, 'surveyresult');
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"));
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
}
} else {
$html = createGrid($numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, "", $searchType);
}
$objResponse = new xajaxResponse();
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
}
return $objResponse->getXML();
}
示例11: customerLeadsAction
function customerLeadsAction($leadType, $f, $searchFormValue)
{
$objResponse = new xajaxResponse();
if (is_array($f['ckb'])) {
foreach ($f['ckb'] as $vaule) {
$res_contact = astercrm::insertNewCustomerLead($vaule, $leadType, true);
}
}
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$numRows = $searchFormValue['numRows'];
$limit = $searchFormValue['limit'];
$html = createGrid($numRows, $limit, $searchField, $searchContent, '', 'grid');
$objResponse->addAssign('grid', "innerHTML", $html);
return $objResponse->getXML();
}
示例12: multiEditUpdate
//.........这里部分代码省略.........
$newValue = $row[$field] * $f['multieditcontent'];
}
}
$updateSql = "UPDATE " . $table . " SET " . trim($field) . " = '" . $newValue . "'";
if ($f['resellerid'] != '') {
$updateSql .= ", resellerid =" . $f['resellerid'] . ", groupid =" . $f['groupid'];
}
$updateSql .= ",addtime = now() WHERE id = " . $row['id'];
} else {
if ($f['resellerid'] != '') {
$updateSql = "UPDATE " . $table . " SET resellerid =" . $f['resellerid'] . ", groupid =" . $f['groupid'] . ",addtime = now() WHERE id = " . $row['id'];
} else {
$objResponse->addAlert($locate->Translate("No Option"));
return $objResponse;
}
}
astercrm::events($updateSql);
$updateRes = $db->query($updateSql);
if ($updateRes === 1) {
$sucessNum++;
}
}
$objResponse->addAlert($sucessNum . $locate->Translate("records have been changed"));
} elseif ($f['multioption'] == 'duplicate') {
$query = "SELECT * FROM " . $table . " WHERE 1 " . $joinstr . $groupJoinStr . $resellerJoinStr;
astercrm::events($query);
$res =& $db->query($query);
while ($res->fetchInto($row)) {
$insertField = '';
$insertValue = '';
if ($f['multieditcontent'] != '') {
if ($f['multieditType'] == 'to') {
if ($fieldType == 'int' || $fieldType == 'real') {
if (!is_numeric($f['multieditcontent'])) {
$objResponse->addAlert($locate->Translate("Must fill number in blank for field") . ":" . $field);
return $objResponse;
}
}
$newValue = $f['multieditcontent'];
} else {
if (!is_numeric($f['multieditcontent'])) {
$objResponse->addAlert($locate->Translate("Must fill number in blank for field") . ":" . $field);
return $objResponse;
}
if ($f['multieditType'] == 'plus') {
$newValue = $row[$field] + $f['multieditcontent'];
} elseif ($f['multieditType'] == 'minus') {
$newValue = $row[$field] - $f['multieditcontent'];
} elseif ($f['multieditType'] == 'multiply') {
$newValue = $row[$field] * $f['multieditcontent'];
}
}
foreach ($row as $key => $value) {
if (!preg_match("/id\$/", $key) && $key != 'addtime') {
$insertField .= $key . ",";
if ($key != $field) {
$insertValue .= "'" . $value . "',";
} else {
$insertValue .= "'" . $newValue . "',";
}
}
}
$insertField .= "resellerid,groupid";
if ($f['resellerid'] != '') {
$insertValue .= $f['resellerid'] . "," . $f['groupid'];
} else {
$insertValue .= $row['resellerid'] . "," . $row['groupid'];
}
} else {
foreach ($row as $key => $value) {
if (!preg_match("/id\$/", $key) && $key != 'addtime') {
$insertField .= $key . ",";
$insertValue .= "'" . $value . "',";
}
}
if ($f['resellerid'] != '') {
$insertField .= " resellerid,groupid";
$insertValue .= $f['resellerid'] . "," . $f['groupid'];
} else {
$objResponse->addAlert($locate->Translate("No Option"));
return $objResponse;
}
}
$insertField = "(" . $insertField . ",addtime)";
$insertValue = "(" . $insertValue . ",now())";
$insertSql = "INSERT INTO " . $table . " " . $insertField . " VALUES " . $insertValue;
//echo $insertSql;exit;
astercrm::events($insertSql);
$insertRes = $db->query($insertSql);
if ($insertRes === 1) {
$sucessNum++;
}
}
$objResponse->addAlert($sucessNum . $locate->Translate("records have been added"));
}
$html = createGrid(0, 25, $searchField, $searchContent, $searchField, 'grid', "", 1, 1, $searchType, $f['displaymode']);
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign('grid', "innerHTML", $html);
return $objResponse;
}
示例13: searchFormSubmit
function searchFormSubmit($searchFormValue, $numRows, $limit, $id = '', $type = '')
{
global $locate, $db;
$objResponse = new xajaxResponse();
$searchField = array();
$searchContent = array();
$searchType = array();
$customerid = $searchFormValue['customerid'];
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$searchType = $searchFormValue['searchType'];
//搜索方式 数组
$ordering = $searchFormValue['ordering'];
$order = $searchFormValue['order'];
$divName = "grid";
if ($type == "delete") {
$res = Customer::deleteRecord($id, 'account');
if ($res) {
$html = createGrid($customerid, $searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", $searchType);
$objResponse = new xajaxResponse();
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
}
} else {
$html .= createGrid($customerid, $numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType);
}
$html .= Table::Footer();
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
return $objResponse->getXML();
}
示例14: 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;
}
示例15: 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" || $optionFlag == "exportcsv") {
$sql = astercrm::getSql($searchContent, $searchField, $searchType, 'astercrm_account');
//得到要导出的sql语句
$_SESSION['export_sql'] = $sql;
$objResponse->addAssign("hidSql", "value", $sql);
//赋值隐含域
$objResponse->addAssign("maintable", "value", 'astercrm_account');
//赋值隐含域
$objResponse->addAssign("exporttype", "value", $optionFlag);
$objResponse->addScript("document.getElementById('exportForm').submit();");
} elseif ($optionFlag == "delete") {
astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'astercrm_account');
$html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', $order, $divName, $ordering, '');
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
} elseif ($type == "delete") {
$myrow = astercrm::getRecordByField('username', $_SESSION['curuser']['username'], 'astercrm_account');
$myid = $myrow['id'];
//echo $myid;exit;
if ($myid == $id) {
$objResponse->addAlert($locate->Translate("Can not delete your own account"));
return $objResponse->getXML();
}
$res = Customer::deleteRecord($id, 'astercrm_account');
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();
}