本文整理汇总了PHP中astercrm::getTableStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP astercrm::getTableStructure方法的具体用法?PHP astercrm::getTableStructure怎么用?PHP astercrm::getTableStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astercrm
的用法示例。
在下文中一共展示了astercrm::getTableStructure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* function to insert data to database from excel
*
* @param $aFormValues (array) insert form excel
if import datas to diallist $aFormValues['chkAdd']
if assign extnesion to phone numbers $aFormValues['chkAssign']
assign which extensions to phone numbers $aFormValues['assign']
import which field $aFormValues['dialListField']
* @return $objResponse
*
*/
function submitForm($aFormValues)
{
global $locate, $db, $config;
$objResponse = new xajaxResponse();
$order = $aFormValues['order'];
//得到的排序数字,数组形式,要添加到数据库的列
$fileName = $aFormValues['hidFileName'];
$tableName = $aFormValues['hidTableName'];
$flag = 0;
foreach ($order as $value) {
//判断是否有要导入的数据
if (trim($value) != '') {
$flag = 1;
break;
}
}
//如果没有任何选择, 就退出
if ($flag != 1) {
$objResponse->addScript('init();');
return $objResponse;
}
//对提交的数据进行校验
$orderNum = count($order);
if ($orderNum > 0) {
$arrRepeat = array_count_values($order);
foreach ($arrRepeat as $key => $value) {
if ($key != '' && $value > 1) {
//数据重复
$objResponse->addAlert($locate->Translate('field_cant_repeat'));
$objResponse->addScript('init();');
return $objResponse;
}
}
}
for ($j = 0; $j < $orderNum; $j++) {
if (trim($order[$j]) != '') {
if (trim($order[$j]) > $aFormValues['hidMaxTableColumnNum']) {
//最大值校验
$objResponse->addAlert($locate->Translate('field_overflow'));
$objResponse->addScript('init();');
return $objResponse;
}
if (!ereg("[0-9]+", trim($order[$j]))) {
//是否为数字
$objResponse->addAlert($locate->Translate('field_must_digits'));
$objResponse->addScript('init();');
return $objResponse;
}
}
}
$tableStructure_source = astercrm::getTableStructure($tableName);
$tableStructure = array();
foreach ($tableStructure_source as $row) {
$type_arr = explode(' ', $row['flags']);
if (!in_array('auto_increment', $type_arr)) {
if ($row['name'] == "creby" || $row['name'] == "cretime" || $row['name'] == "groupid") {
} else {
$tableStructure[] = $row;
}
} else {
if ($row['name'] == 'id' && $config['synchronize']['id_autocrement_byset']) {
$tableStructure[] = $row;
}
}
}
$filePath = $config['system']['upload_file_path'] . $fileName;
//数据文件存放路径
$affectRows = 0;
//计数据库影响结果变量
$x = 0;
//计数变量
$date = date('Y-m-d H:i:s');
//当前时间
$groupid = $aFormValues['groupid'];
$resellerid = $aFormValues['resellerid'];
//$campaignid = $aFormValues['campaignid'];
//print $groupid;
$x = 0;
$affectRows = importResource($filePath, $order, $tableName, $tableStructure, $dialListField, $date, $groupid, $resellerid);
if ($affectRows < 0) {
$affectRows = 0;
}
$resultMsg = $tableName . ' : ' . $affectRows . ' ' . $locate->Translate('records_inserted') . "<br>";
//delete upload file
//@ unlink($filePath);
$objResponse->addAlert($locate->Translate('success'));
$objResponse->addScript("document.getElementById('btnImportData').disabled = false;");
$objResponse->addAssign("divResultMsg", "innerHTML", $resultMsg);
$objResponse->addScript("init();");
//.........这里部分代码省略.........
示例2: formMutiEdit
function formMutiEdit($searchContent, $searchField, $searchType, $table)
{
global $locate;
$reselleroptions = '';
$reseller = astercrm::getAll('resellergroup');
if ($_SESSION['curuser']['usertype'] == 'admin') {
$reselleroptions .= '<select id="resellerid" name="resellerid"';
if ($table != "resellerrate") {
$reselleroptions .= 'onchange="setGroup();"';
}
$reselleroptions .= '><option value=""></option>';
$reselleroptions .= '<option value="0">' . $locate->Translate("All") . '</option>';
while ($reseller->fetchInto($row)) {
$reselleroptions .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>";
}
$reselleroptions .= '</select>';
} else {
while ($reseller->fetchInto($row)) {
if ($row['id'] == $_SESSION['curuser']['resellerid']) {
$reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
break;
}
}
}
if ($table != "resellerrate") {
$group = astercrm::getAll('accountgroup', 'resellerid', $_SESSION['curuser']['resellerid']);
if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
$groupoptions .= '<select id="groupid" name="groupid">';
if ($_SESSION['curuser']['usertype'] == 'reseller') {
$groupoptions .= "<OPTION value=''></OPTION>";
}
$groupoptions .= "<OPTION value='0'>" . $locate->Translate("All") . "</OPTION>";
while ($group->fetchInto($row)) {
$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;
}
}
}
}
//可修改字段
$tableField = astercrm::getTableStructure('myrate');
foreach ($tableField as $row) {
if ($row['name'] != 'id' && $row['name'] != 'resellerid' && $row['name'] != 'groupid' && $row['name'] != 'addtime') {
$fieldOption .= '<option value="' . $row['name'] . ',' . $row['type'] . '">' . $row['name'] . '</option>';
}
}
//将条件重置成字符串,通过post传递
$i = 0;
foreach ($searchContent as $content) {
if (trim($content) != '' && trim($searchField[$i]) != '') {
$searchContentStr .= $content . ",";
$searchFieldStr .= $searchField[$i] . ",";
$searchTypeStr .= $searchType[$i] . ",";
}
$i++;
}
//echo $searchContentStr.$searchFieldStr.$searchTypeStr;exit;
//print_r($searchField);exit;
$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("Option") . '</td>
<td align="left"><input type="radio" name="multioption" id="multioption" value="modify" checked> ' . $locate->Translate("Modify") . ' <input type="radio" name="multioption" id="multioption" value="duplicate"> ' . $locate->Translate("Duplicate") . '</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Change") . '</td>
<td align="left"><select id="multieditField" name="multieditField" onchange=\'xajax_setMultieditType(this.value)\'>' . $fieldOption . '</select>
<select id="multieditType" name="multieditType" >
<option value="to">' . $locate->Translate("to") . '</option>
</select> <input type="text" id="multieditcontent" name="multieditcontent" size="15"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
<td align="left">' . $reselleroptions . '</td>
</tr>';
if ($table != "resellerrate") {
$html .= '<tr><td nowrap align="left">' . $locate->Translate("Group") . '</td><td align="left">' . $groupoptions . '</td></tr>';
}
$html .= '<tr>
<td colspan="2" align="center">
<button id="submitButton" onClick=\'xajax_multiEditUpdate("' . $searchContentStr . '","' . $searchFieldStr . '","' . $searchTypeStr . '","' . $table . '",xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button>
</td>
</tr>
</table>
';
$html .= '
</form>';
//echo $html;exit;
return $html;
//.........这里部分代码省略.........