本文整理汇总了PHP中getImportExcelFields函数的典型用法代码示例。如果您正苦于以下问题:PHP getImportExcelFields函数的具体用法?PHP getImportExcelFields怎么用?PHP getImportExcelFields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getImportExcelFields函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPreviewDataFromExcel
/**
* A wrapper for the import function getPreviewDataFromExcel
* @param String filePath
* @param String ext
* @return Array
*/
protected function getPreviewDataFromExcel($filePath, $ext)
{
$fileHandle = openImportExcelFile($filePath, $ext);
$headerFieldsFromExcel = getImportExcelFields($fileHandle);
$fieldsData = $this->getCorrespondingImportFieldsData($headerFieldsFromExcel);
$previewData = getPreviewDataFromExcel($fileHandle, $fieldsData);
$previewData["fieldsData"] = $fieldsData;
return $previewData;
}
示例2: ImportFromExcel
function ImportFromExcel($uploadfile)
{
$autoinc = false;
$ret = 1;
global $error_message, $keys, $goodlines, $total_records, $conn, $strOriginalTableName, $strTableName, $keys_present;
$data = openImportExcelFile($uploadfile);
// populate field names array
$fields = array();
$fields = getImportExcelFields($data);
$fields = getFieldNamesByHeaders($fields);
$keys_present = 1;
for ($k = 0; $k < count($keys); $k++) {
if (!in_array(RemoveFieldWrappers($keys[$k]), $fields)) {
$keys_present = 0;
break;
}
}
if (in_array("Record ID", $fields)) {
$autoinc = true;
}
if ($autoinc) {
$sql = "SET IDENTITY_INSERT " . AddTableWrappers($strOriginalTableName) . " ON";
db_exec($sql, $conn);
}
$ret = getImportExcelData($data, $fields);
if ($autoinc) {
$sql = "SET IDENTITY_INSERT " . AddTableWrappers($strOriginalTableName) . " OFF";
db_exec($sql, $conn);
}
return $ret;
}
示例3: ImportFromExcel
function ImportFromExcel($uploadfile)
{
$autoinc = false;
$ret = 1;
global $error_message, $keys, $goodlines, $total_records, $conn, $strOriginalTableName, $strTableName, $keys_present;
$data = openImportExcelFile($uploadfile);
// populate field names array
$fields = array();
$fields = getImportExcelFields($data);
$fields = getFieldNamesByHeaders($fields);
$keys_present = 1;
for ($k = 0; $k < count($keys); $k++) {
if (!in_array(RemoveFieldWrappers($keys[$k]), $fields)) {
$keys_present = 0;
break;
}
}
$ret = getImportExcelData($data, $fields);
return $ret;
}
示例4: ImportFromExcel
function ImportFromExcel($uploadfile, $strOriginalTableName, $ext, $keys, &$keys_present, &$total_records, &$error_message, &$goodlines, $pageObject, $cipherer)
{
global $conn, $strTableName;
$autoinc = false;
$ret = 1;
$data = openImportExcelFile($uploadfile);
// populate field names array
$fields = array();
$fields = getImportExcelFields($data);
$fields = getFieldNamesByHeaders($fields, $strOriginalTableName, $ext);
if($fields == null) // if error happened
return;
$keys_present=1;
for($k=0; $k<count($keys); $k++)
{
if (!in_array(RemoveFieldWrappers($keys[$k]),$fields))
{
$keys_present=0;
break;
}
}
if(in_array("id",$fields))
$autoinc=true;
if(GetDatabaseType() == 2 && $autoinc)
{
$sql = "SET IDENTITY_INSERT ".AddTableWrappers($strOriginalTableName)." ON";
db_exec($sql,$conn);
}
$ret = getImportExcelData($data, $fields, $error_message, $goodlines, $keys, $keys_present, $strOriginalTableName, $pageObject, $cipherer, $autoinc, $total_records);
if(GetDatabaseType() == 2 && $autoinc)
{
$sql="SET IDENTITY_INSERT ".AddTableWrappers($strOriginalTableName)." OFF";
db_exec($sql,$conn);
}
return $ret;
}