本文整理汇总了PHP中Spreadsheet_Excel_Reader::type方法的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader::type方法的具体用法?PHP Spreadsheet_Excel_Reader::type怎么用?PHP Spreadsheet_Excel_Reader::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spreadsheet_Excel_Reader
的用法示例。
在下文中一共展示了Spreadsheet_Excel_Reader::type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: max
function xls_read($sequence = -1)
{
global $_CAMILA;
if ($this->interactive) {
$filename = $_REQUEST['configurator_filename'];
$sheetnum = $_REQUEST['configurator_sheet'] - 1;
$name = $_REQUEST['configurator_wtname'];
$desc = $_REQUEST['configurator_wtdesc'];
$this->db = $_CAMILA['db'];
} else {
$filename = $this->filename;
$sheetnum = $this->sheetnum;
$name = 'name';
$desc = 'desc';
}
$success = true;
$result = $this->db->Execute('select max(id) as id from ' . CAMILA_TABLE_WORKT);
if ($result === false) {
camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg());
}
$id = intval($result->fields['id']) + 1;
$record['id'] = $id;
$record['status'] = 'd';
$record['active'] = 'n';
$record['filename'] = basename($filename);
$record['sheetnum'] = $sheetnum;
$record['scriptname'] = 'cf_worktable' . $id . '.php';
$record['short_title'] = $name;
$record['full_title'] = $desc;
$record['tablename'] = CAMILA_TABLE_WORKP . $id;
$record['sequence'] = $sequence > 0 ? $sequence : $id;
$insertSQL = $this->db->AutoExecute(CAMILA_TABLE_WORKT, $record, 'INSERT');
if (!$insertSQL) {
camila_information_text(camila_get_translation('camila.worktable.db.error'));
$success = false;
}
if ($filename != '') {
require_once CAMILA_LIB_DIR . 'php-excel-reader/excel_reader2.php';
if ($this->interactive) {
$data = new Spreadsheet_Excel_Reader(CAMILA_TMP_DIR . '/' . $filename);
} else {
$data = new Spreadsheet_Excel_Reader($filename);
}
$fmt = str_replace(array('d', 'm', 'y'), array('dd', 'mm', 'yyyy'), strtolower($_CAMILA['date_format']));
$datefmt = preg_replace('/[^a-z0-9]/', '', $fmt);
$i = 1;
while ($data->val(1, $i, $sheetnum) != '') {
$cols[$i - 1] = $data->val(1, $i, $sheetnum);
//print_r($data->sheets[$sheetnum]['cellsInfo']);
for ($j = 1; $j <= $data->rowcount($sheetnum); $j++) {
$curr = $data->type($j, $i, $sheetnum);
if ($data->sheets[$sheetnum]['cellsInfo'][$j][$i]['hyperlink']['link'] != '') {
$curr = 'hyperlink';
}
if ($curr != '') {
$safefmt = strtolower(preg_replace('/[^a-z0-9]/', '', $data->read16bitstring($data->sheets[$sheetnum]['cellsInfo'][$j][$i]['format'], 0)));
//echo $data->read16bitstring($data->sheets[$sheetnum]['cellsInfo'][$j][$i]['format'],0);
if ($curr == 'unknown' && $safefmt == $datefmt) {
$curr = 'date';
}
$types[$i - 1] = $curr;
continue;
}
}
$i++;
}
if (!$this->interactive || $sheetnum + 2 <= count($data->sheets) && $this->is_configuration_sheet($data, $sheetnum + 1)) {
$colNum = count($cols);
$fieldArr = array();
for ($i = 0; $i < $colNum; $i++) {
//echo $data->val(2, 2 + $i, $sheetnum + 1);
$name = $data->val(1, 2 + $i, $sheetnum + 1);
$sequence = $data->val(2, 2 + $i, $sheetnum + 1);
$nameAbbrev = $data->val(3, 2 + $i, $sheetnum + 1);
$type = $data->val(4, 2 + $i, $sheetnum + 1);
$listboxOptions = $data->val(5, 2 + $i, $sheetnum + 1);
$maxLength = $data->val(6, 2 + $i, $sheetnum + 1);
$required = $data->val(7, 2 + $i, $sheetnum + 1);
$defaultValue = $data->val(8, 2 + $i, $sheetnum + 1);
$readonly = $data->val(9, 2 + $i, $sheetnum + 1);
$visible = $data->val(10, 2 + $i, $sheetnum + 1);
$forceCase = $data->val(11, 2 + $i, $sheetnum + 1);
$mustBeUnique = $data->val(12, 2 + $i, $sheetnum + 1);
$fieldOptions = $data->val(13, 2 + $i, $sheetnum + 1);
$autosuggestWorktableName = $data->val(14, 2 + $i, $sheetnum + 1);
$autosuggestWorktableColName = $data->val(15, 2 + $i, $sheetnum + 1);
$name = isUTF8($name) ? $name : utf8_encode($name);
$sequence = isUTF8($sequence) ? $sequence : utf8_encode($sequence);
$nameAbbrev = isUTF8($nameAbbrev) ? $nameAbbrev : utf8_encode($nameAbbrev);
$type = isUTF8($type) ? $type : utf8_encode($type);
$listboxOptions = isUTF8($listboxOptions) ? $listboxOptions : utf8_encode($listboxOptions);
$maxLength = isUTF8($maxLength) ? $maxLength : utf8_encode($maxLength);
$required = isUTF8($required) ? $required : utf8_encode($required);
$defaultValue = isUTF8($defaultValue) ? $defaultValue : utf8_encode($defaultValue);
$readonly = isUTF8($readonly) ? $readonly : utf8_encode($readonly);
$visible = isUTF8($visible) ? $visible : utf8_encode($visible);
$forceCase = isUTF8($forceCase) ? $forceCase : utf8_encode($forceCase);
$mustBeUnique = isUTF8($mustBeUnique) ? $mustBeUnique : utf8_encode($mustBeUnique);
$fieldOptions = isUTF8($fieldOptions) ? $fieldOptions : utf8_encode($fieldOptions);
$autosuggestWorktableName = isUTF8($autosuggestWorktableName) ? $autosuggestWorktableName : utf8_encode($autosuggestWorktableName);
//.........这里部分代码省略.........