本文整理汇总了PHP中dbase_create函数的典型用法代码示例。如果您正苦于以下问题:PHP dbase_create函数的具体用法?PHP dbase_create怎么用?PHP dbase_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbase_create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file0
function file0()
{
$_SESSION['ADPOS'] = 0;
$max = $_SESSION['MaxData'];
$md = $_SESSION['AD' . $max];
BuatArrayHeader($hdr, $hdrid);
$namadbf = "autodebet-{$_SESSION['tahun']}-{$_SESSION['prodi']}.dbf";
$dbfheader = array(array("THSMSTRINA", 'C', 5), array("KDFAKTRINA", 'C', 1), array("KDJURTRINA", 'C', 1), array("NIMHSTRINA", 'C', 9), array("NMMHSTRINA", 'C', 30), array("TAGIHTRINA", 'N', 9, 0), array("STATUTRINA", 'C', 1), array("NLHUTTRINA", 'N', 12, 0), array("NLDENTRINA", 'N', 12, 0), array("NLSEMTRINA", 'N', 12, 0), array("NLKOKTRINA", 'N', 12, 0), array("NLSKSTRINA", 'N', 12, 0), array("NLPRATRINA", 'N', 12, 0), array("NLSKITRINA", 'N', 12, 0), array("TGDEBTRINA", 'D', 8), array("NOBPMTRINA", 'C', 10), array("JMSKSTRINA", 'N', 2, 0), array("JMPRATRINA", 'N', 2, 0));
if (!dbase_create("autodebet/{$namadbf}", $dbfheader)) {
echo "Gagal membuat File DBF";
exit;
}
$gab = array();
//for ($i=0; $i<sizeof($hdr); $i++) $gab[$i] = $hdr[$i] . '(' . $hdrid[$i] . ')';
//$_hdr = implode(';', $gab) . "\n";
//$hdr = "No;NPM;KHS;Nama;Rekening;Biaya;Potongan;Bayar;Tarik;TotalSKS;BPM;Tagih;Status;$_hdr";
$hdr = "THSMSTRINA;KDFAKTRINA;KDJURTRINA;NIMHSTRINA;NMMHSTRINA;TAGIHTRINA;STATUTRINA;NLHUTTRINA(30);NLDENTRINA(35);NLSEMTRINA(11);NLKOKTRINA(8);NLSKSTRINA(5);NLPRATRINA(6);NLSRITRINA(38);TGDEBTRINA;NOBPMTRINA;JMSKSTRINA;JMPRATRINA;\n";
//fwrite($f,"NIM;Nama;Tagihan;Autodebet;BPM;Sumbangan;BPS;Pokok;BPP SKS;Skripsi;Praktikum;Ospek;Hutang;Denda;Status;\n");
// Buat file
$nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.autodebet.csv";
$f = fopen($nmf, 'w');
//fwrite($f, $hdr);
//fwrite($f,"NIM;Nama;Tagihan;Autodebet;BPM;Sumbangan;BPS;Pokok;BPP SKS;Skripsi;Praktikum;Ospek;Hutang;Denda;Status;\n");
fwrite($f, "THSMSTRINA(5~C);KDFAKTRINA(1~C);KDJURTRINA(1~C);NIMHSTRINA(9~C);NMMHSTRINA(30~C);TAGIHTRINA(9~N);STATUTRINA(1~C);NLHUTTRINA(12~N);NLDENTRINA(12~N);NLSEMTRINA(12~N);NLKOKTRINA(12~N);NLPRATRINA(12~N);NLSKSTRINA(12~N);NLSRITRINA(12~N);TGDEBTRINA(8~D);NOBPMTRINA(10~N);JMSKSTRINA(2~N);JMPRATRINA(2~N);\n");
fclose($f);
// Buat file header
$nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.autodebet.hdr.csv";
$f = fopen($nmf, 'w');
fwrite($f, $hdr);
fclose($f);
echo "<p>\r\n Inisialisasi\r\n » Proses Keuangan</font>\r\n » <font size=+2><b>Buat File Bank</b></font>\r\n </p>\r\n <p>Proses ini akan membuat file untuk bank.</p>\r\n <p><IFRAME src='cetak/autodebet1.php?WZRD=file0' frameborder=0 height=300 width=300>\r\n </IFRAME></p>\r\n <p>Setelah proses ini selesai, Anda dapat mendownload file untuk bank.</p>\r\n ";
}
示例2: create_dbf
public function create_dbf($filename, $def)
{
if (!dbase_create($filename, $def)) {
return cy_dt(CYE_ERROR, 'create DBF file failed!');
}
return cy_dt(0);
}
示例3: export
/**
* Export data
* @return boolean
*/
function export()
{
$def = array(array('o_id', 'N', 10, 0), array('o_uid', 'N', 10, 0), array('o_date', 'D'), array('o_state', 'N', 1, 0), array('o_ip', 'C', 32), array('o_lastname', 'C', 155), array('o_firstnam', 'C', 155), array('o_adress', 'C', 155), array('o_zip', 'C', 30), array('o_town', 'C', 155), array('o_country', 'C', 3), array('o_telephon', 'C', 30), array('o_email', 'C', 155), array('o_articles', 'N', 10, 0), array('o_total', 'N', 10, 2), array('o_shipping', 'N', 10, 2), array('o_bill', 'L'), array('o_password', 'C', 155), array('o_text', 'C', 155), array('o_cancel', 'C', 155), array('c_id', 'N', 10, 0), array('c_prod_id', 'N', 10, 0), array('c_qte', 'N', 10, 0), array('c_price', 'N', 10, 2), array('c_o_id', 'N', 10, 0), array('c_shipping', 'N', 10, 2), array('c_pass', 'C', 155));
/*
* Correspondances
* cmd_id o_id
* cmd_uid o_uid
* cmd_date o_date
* cmd_state o_state
* cmd_ip o_ip
* cmd_lastname o_lastname
* cmd_firstname o_firstnam
* cmd_adress o_adress
* cmd_zip o_zip
* cmd_town o_town
* cmd_country o_country
* cmd_telephone o_telephon
* cmd_email o_email
* cmd_articles_count o_articles
* cmd_total o_total
* cmd_shipping o_shipping
* cmd_bill o_bill
* cmd_password o_password
* cmd_text o_text
* cmd_cancel o_cancel
* caddy_id c_id
* caddy_product_id c_prod_id
* caddy_qte c_qte
* caddy_price c_price
* caddy_cmd_id c_o_id
* caddy_shipping c_shipping
* caddy_pass c_pass
*/
if (!dbase_create($this->folder . DIRECTORY_SEPARATOR . $this->filename, $def)) {
$this->success = false;
return false;
}
$dbf = dbase_open($this->folder . DIRECTORY_SEPARATOR . $this->filename, 2);
if ($dbf === false) {
$this->success = false;
return false;
}
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cmd_id', 0, '<>'));
$criteria->add(new Criteria('cmd_state', $this->orderType, '='));
$criteria->setSort('cmd_date');
$criteria->setOrder('DESC');
$orders = $this->handlers->h_myshop_commands->getObjects($criteria);
foreach ($orders as $order) {
$carts = array();
$carts = $this->handlers->h_myshop_caddy->getObjects(new Criteria('caddy_cmd_id', $order->getVar('cmd_id'), '='));
foreach ($carts as $cart) {
dbase_add_record($dbf, array($order->getVar('cmd_id'), $order->getVar('cmd_uid'), date('Ymd', strtotime($order->getVar('cmd_date'))), $order->getVar('cmd_state'), $order->getVar('cmd_ip'), $order->getVar('cmd_lastname'), $order->getVar('cmd_firstname'), $order->getVar('cmd_adress'), $order->getVar('cmd_zip'), $order->getVar('cmd_town'), $order->getVar('cmd_country'), $order->getVar('cmd_telephone'), $order->getVar('cmd_email'), $order->getVar('cmd_articles_count'), $order->getVar('cmd_total'), $order->getVar('cmd_shipping'), $order->getVar('cmd_bill'), $order->getVar('cmd_password'), $order->getVar('cmd_text'), $order->getVar('cmd_cancel'), $cart->getVar('caddy_id'), $cart->getVar('caddy_product_id'), $cart->getVar('caddy_qte'), $cart->getVar('caddy_price'), $cart->getVar('caddy_cmd_id'), $cart->getVar('caddy_shipping'), $cart->getVar('caddy_pass')));
}
}
dbase_close($dbf);
$this->success = true;
return true;
}
示例4: criar
public function criar($array)
{
$this->conexao = dbase_create($this->caminho, $array);
if ($this->conexao == false) {
return false;
}
return $this->conexao;
}
示例5: DBFCreate
function DBFCreate($arrDef)
{
if (is_array($arrDef)) {
if (dbase_create($this->DBFFile, $arrDef)) {
$ret = TRUE;
} else {
$ret = FALSE;
}
} else {
die("Tipe data bukan Array nih ye");
}
return $ret;
}
示例6: create
public static function create($filename, array $fieldDefinitions)
{
if (!file_exists($filename)) {
throw new RuntimeException(sprintf('Filename %s not found', $filename));
}
if (!function_exists('dbase_create')) {
throw new RuntimeException(sprintf('Extension dBase not support with your PHP interpreter'));
}
$dbaseId = @dbase_create($filename, $fieldDefinitions);
if (false === $dbaseId) {
throw new RuntimeException(sprintf('Failed to create database file %s', $filename));
}
return new self($dbaseId);
}
示例7: mspti
function mspti()
{
$this->layout = 'ajax';
$this->autoRender = FALSE;
// database "definition"
$def = array(array("KDYYSMSPTI", "C", 7), array("KDPTIMSPTI", "C", 6), array("NMPTIMSPTI", "C", 50), array("ALMT1MSPTI", "C", 30), array("ALMT2MSPTI", "C", 30), array("KOTAAMSPTI", "C", 20), array("KDPOSMSPTI", "C", 5), array("TELPOMSPTI", "C", 20), array("FAKSIMSPTI", "C", 20), array("TGPTIMSPTI", "D"), array("NOMSKMSPTI", "C", 30), array("EMAILMSPTI", "C", 40), array("HPAGEMSPTI", "C", 40), array("TGAWLMSPTI", "D"));
$epsbed_file = EPSBED_DIR . 'MSPTI.dbf';
if (!dbase_create($epsbed_file, $def)) {
echo "Error, can't create the database\n";
exit;
} else {
$db = dbase_open($epsbed_file, 2);
if ($db) {
$this->loadModel('Configuration');
$yys = $this->Configuration->getPTI();
$yys['YYS_KODE'] = '';
dbase_add_record($db, array($yys['YYS_KODE'], $yys['PTI_KODE'], $yys['PTI_NAMA'], $yys['PTI_ALAMAT_1'], $yys['PTI_ALAMAT_2'], $yys['PTI_KOTA'], $yys['PTI_KODE_POS'], $yys['PTI_TELEPON'], $yys['PTI_FAX'], str_replace('-', '/', $yys['PTI_TANGGAL_SK']), $yys['PTI_NOMOR_SK'], $yys['PTI_EMAIL'], $yys['PTI_WEBSITE'], str_replace('-', '/', $yys['PTI_TANGGAL_BERDIRI'])));
echo "<a href='files/epsbed/MSPTI.dbf'>Download file MSPTI.dbf</a>";
dbase_close($db);
}
}
}
示例8: array
array("HN","C",15),
array("AN","C",15),
array("DATEADM","D"),
array("TIMEADM","C",4),
array("DATEDSC","D"),
array("TIMEDSC","C",4),
array("DISCHS","C",1),
array("DISCHT","C",1),
array("WARDDSC","C",4),
array("DEPT","C",2),
array("ADM_W","C",7),
array("UUC","C",1),
);
// creation
if (!dbase_create($dbname7, $def7)) {
echo "Error, can't create the database7\n";
};
$sql7 ="select * from ipcard where dcdate between '".$_POST['year']."-".$_POST['mon']."-"."01"." 00:00:00' and '".$_POST['year']."-".$_POST['mon']."-"."31"." 23:59:59'"; // Query ��Ң����Ũҡ���ҧ ipcard
$result7 = mysql_query($sql7) or die("Query IPD Failed");
while($rows7 = mysql_fetch_array($result7)){
$hn7=$rows7["hn"]; // HN �����ù�����Ң�����
$an7=$rows7["an"]; // AN �����ù�����Ң�����
//datetimeADM
$datetimead=$rows7["date"];
$datead7 = substr($datetimead,0,10);
$datead =explode("-",$datead7);
$newdatead=$datead[0]-543;
$newdateadm =$newdatead.$datead[1].$datead[2]; // DATEADM�����ù�����Ң�����
示例9: array
//--------------------Start DataSet6-------------------------//
$dbname6 = "OOP".$yy.$mm.".dbf";
$def6 = array(
array("HN","C",15),
array("DATEOPD","D"),
array("CLINIC","C", 4),
array("OPER","C",7),
array("DROPID","C",6),
array("PERSON_ID","C",13),
array("SEQ","C",15)
);
// creation
if (!dbase_create($dbname6, $def6)) {
echo "Error, can't create the database6\n";
}
$sql6 ="select * from opicd9cm where (svdate between '".$_POST['year']."-".$_POST['mon']."-"."01"." 00:00:00' and '".$_POST['year']."-".$_POST['mon']."-"."31"." 23:59:59') order by row_id";
$result6 = mysql_query($sql6) or die("Query failed6");
while($rows6 = mysql_fetch_array($result6)){
$hn6=$rows6["hn"]; // HN Ц╙И╣ягА╩ц╧уИ╧сЮ╒Ир╒Имаые
$oper6=$rows6["icd9cm"]; // OPER Ц╙И╣ягА╩ц╧уИ╧сЮ╒Ир╒Имаые
//DATEOPD
$dateopd6=$rows6["svdate"];
$date6 = substr($dateopd6,0,10);
$date =explode("-",$date6);
$newdate=$date[0]-543;
$newdateopd =$newdate.$date[1].$date[2]; // DATEOPD Ц╙И╣ягА╩ц╧уИ╧сЮ╒Ир╒Имаые
示例10: inserePoligonosUrl
function inserePoligonosUrl()
{
global $tamanhosimbolo, $simbolo, $corsimbolo, $poligonos, $nometemapoligonos, $dir_tmp, $imgdir, $tmpfname, $locaplic;
include_once "pacotes/phpxbase/api_conversion.php";
if (!isset($nometemapoligonos)) {
$nometemapoligonos = "Poligonos";
}
if ($nometemapoligonos == "") {
$nometemapoligonos = "Poligonos";
}
//
//cria o shape file
//
$tipol = MS_SHP_POLYGON;
$nomeshp = $dir_tmp . "/" . $imgdir . "/poligonosins";
// cria o dbf
$def = array();
$items = array("COORD");
foreach ($items as $ni) {
$def[] = array($ni, "C", "254");
}
if (!function_exists(dbase_create)) {
xbase_create($nomeshp . ".dbf", $def);
} else {
dbase_create($nomeshp . ".dbf", $def);
}
$dbname = $nomeshp . ".dbf";
$db = xbase_open($dbname, 2);
$novoshpf = ms_newShapefileObj($nomeshp, $tipol);
$linhas = explode(",", trim($poligonos));
$pontosLinhas = array();
//guarda os pontos de cada linha em arrays
foreach ($linhas as $l) {
$tempPTs = explode(" ", trim($l));
$temp = array();
foreach ($tempPTs as $p) {
if (is_numeric($p)) {
$temp[] = $p;
}
}
$pontosLinhas[] = $temp;
}
foreach ($pontosLinhas as $ptsl) {
$linhas = $ptsl;
$shape = ms_newShapeObj($tipol);
$linha = ms_newLineObj();
$reg = array();
$reg[] = "";
for ($ci = 0; $ci < count($linhas); $ci = $ci + 2) {
$linha->addXY($linhas[$ci], $linhas[$ci + 1]);
}
$shape->add($linha);
$novoshpf->addShape($shape);
xbase_add_record($db, $reg);
}
$novoshpf->free();
xbase_close($db);
//adiciona o layer
$mapa = ms_newMapObj($tmpfname);
$layer = ms_newLayerObj($mapa);
$layer->set("name", "linhains");
$layer->set("data", $nomeshp . ".shp");
$layer->setmetadata("DOWNLOAD", "sim");
$layer->setmetadata("temalocal", "sim");
$layer->setmetadata("tema", $nometemapoligonos);
$layer->setmetadata("classe", "sim");
$layer->setmetadata("ATLAS", "nao");
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("opacity", "50");
$layer->set("status", MS_DEFAULT);
$classe = ms_newClassObj($layer);
$classe->set("name", " ");
$estilo = ms_newStyleObj($classe);
$cor = $estilo->color;
if (!isset($corsimbolo)) {
$corsimbolo = "255,0,0";
}
$corsimbolo = str_replace(" ", ",", $corsimbolo);
$corsimbolo = explode(",", $corsimbolo);
$cor->setRGB($corsimbolo[0], $corsimbolo[1], $corsimbolo[2]);
$salvo = $mapa->save($tmpfname);
erroCriacao();
}
示例11: regiao2shp
/**
* Converte um tipo de regiao em shapefile
* @param codigo do tipo de regiao
* @return nome do arquivo criado
*/
function regiao2shp($codigo_tipo_regiao)
{
$regiao = $this->listaTipoRegiao($codigo_tipo_regiao);
$dados = $this->obtemDadosTabelaDB($regiao["codigo_estat_conexao"], $regiao["esquemadb"], $regiao["tabela"], "sim");
$tipol = $this->listaPropGeoRegiao($codigo_tipo_regiao);
include_once dirname(__FILE__) . "/../../classesphp/classe_shp.php";
$s = new SHP();
//st_dimension returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON
//echo MS_SHP_POINT.", ".MS_SHP_ARC.", ".MS_SHP_POLYGON.", ".MS_SHP_MULTIPOINT;
//1, 3, 5, 8
$conv[0] = 1;
$conv[1] = 3;
$conv[2] = 5;
//cria as colunas
$cni = 0;
foreach ($dados["colunas"] as $t) {
$temp = strtoupper($t["field"]);
if (strlen($temp) > 10) {
$temp = substr($temp, 0, 8) . $cni++;
}
if ($t["type"] == "varchar" || $t["type"] == "char" || $t["type"] == "character varying" || $t["type"] == "character" || $t["type"] == "text") {
$def[] = array($temp, "C", "254");
} else {
if ($t["lengthvar"] < 0) {
$t["lengthvar"] = 0;
}
$def[] = array($temp, "N", $t["length"], $t["lengthvar"]);
}
}
$nomeshp = $this->dir_tmp . "/regiao{$codigo_tipo_regiao}" . "_" . $this->nomeRandomico();
$dbaseExiste = false;
if (function_exists("dbase_create")) {
$dbaseExiste = true;
}
//para manipular dbf
if ($dbaseExiste == false) {
include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
$db = xbase_create($nomeshp . ".dbf", $def);
} else {
$db = dbase_create($nomeshp . ".dbf", $def);
}
$dbname = $nomeshp . ".dbf";
$reg = array();
$novoshpf = ms_newShapefileObj($nomeshp . ".shp", $conv[$tipol["st_dimension"]]);
$cols = $dados["colunas"];
$nc = count($dados["colunas"]);
foreach ($dados["linhas"] as $l) {
$reg = array();
for ($i = 0; $i < $nc; $i++) {
if ($cols[$i]["type"] != "geometry" && $cols[$i]["type"] != "geography") {
$reg[] = $l[$i];
} else {
$reg[] = 0;
if ($cols[$i]["field"] == $regiao["colunageo"]) {
$shape = ms_shapeObjFromWkt($l[$i]);
}
}
}
$novoshpf->addShape($shape);
if ($dbaseExiste == false) {
xbase_add_record($db, $reg);
} else {
dbase_add_record($db, $reg);
}
}
if ($this->dbaseExiste == false) {
xbase_close($db);
} else {
dbase_close($db);
}
return $nomeshp;
}
示例12: array
//---------------Start Dataset10---------------//
$dbname10 = "IOP".$yy.$mm.".dbf";
$def10 = array(
array("AN","C",15),
array("OPER","C",7),
array("OPTYPE","C",1),
array("DROPID","C",6),
array("DATEIN","D"),
array("TIMEIN","C",4),
array("DATEOUT","D"),
array("TIMEOUT","C",4)
);
// creation
if (!dbase_create($dbname10, $def10)) {
echo "Error, can't create the database10\n";
}
$sqliop ="select * from ipcard where dcdate between '".$_POST['year']."-".$_POST['mon']."-"."01"." 00:00:00' and '".$_POST['year']."-".$_POST['mon']."-"."31"." 23:59:59'"; // Query ��Ң����Ũҡ���ҧ ipcard
$resultiop = mysql_query($sqliop) or die("Query IOP Failed");
while($rowsiop = mysql_fetch_array($resultiop)){
$aniop=$rowsiop["an"]; // AN �����ù�����Ң�����
//$dateidx = substr($rowsiop["dcdate"],0,10);
$sql10 ="select * from ipicd9cm where an ='".$aniop."' "; // Query ��Ң����Ũҡ���ҧ ipicd9cm
$result10 = mysql_query($sql10) or die("Query failed10");
$num10 =mysql_num_rows($result10);
//echo "�ӹǹ : $num10";
if($num10 > 1 ){
示例13: exportToDbase
/**
* Export the data for a specific mouse over s specified time range to a dbase file
*
* @returns url of created dbase file
*/
function exportToDbase($rfid, $from, $to)
{
$parameters['rfid'] = $rfid;
$parameters['from'] = $from;
$parameters['to'] = $to;
$parameters["all"] = 1;
list($summary, $data) = $this->getRfidData($parameters);
if (sizeof($data) == 0) {
return null;
}
// boxes
$boxes = $summary['boxes'];
// where to store the files
$downloadXML = $this->configXML->xpath("//downloaddir");
$downloadDir = implode('', $downloadXML);
$downloadUrlXML = $this->configXML->xpath("//downloadurl");
$downloadURL = implode('', $downloadUrlXML);
// Adding data to dbf files
// definition for the dbf files
$def = array(array("ID", "N", 5, 0), array("RFID", "C", 10), array("YEAR", "C", 4), array("MONTH", "C", 2), array("TIME", "C", 8), array("DATETIME", "C", 19), array("BOX", "C", 2), array("ANTENNA", "C", 2), array("X", "N", 3, 0), array("Y", "N", 3, 0));
// create a dbf_file
//$dbf_file = $downloadDir.$rfid . "_" . $year . "_" . $month . ".dbf";
// $dbf_file = "data_for_" . $rfid . "_" . $from . "_" . $to . ".csv";
$filename = "data_for_" . $rfid . "_" . $from . "_" . $to . ".dbf";
$dbf_file = $downloadDir . $filename;
if (!dbase_create($dbf_file, $def)) {
return "Error, can't create the database: {$dbf_file}\n";
}
// open dbf file for reading and writing
$dbf_file = dbase_open($dbf_file, 2);
//$fh = fopen ($downloadDir.$dbf_file, "w");
// write data
// the datasets have the form: [rfid, antenna, box, time]
$id = 0;
foreach ($data as $dataset) {
list($rfid, $antenna, $unix_time) = $dataset;
$box = substr($antenna, 0, 2);
$datetime = date('Y-m-d H:i:s', $unix_time);
$month = date('m', $unix_time);
$year = date('Y', $unix_time);
$time = date('H:i:s', $unix_time);
$x = $boxes["{$box}"]['x'];
$y = $boxes[$box]['y'];
$dataset_converted = array($id, $rfid, $year, $month, $time, $datetime, $antenna, $box, $x, $y);
$str = implode(',', $dataset_converted) . "\n";
//fwrite($fh, $str);
dbase_add_record($dbf_file, $dataset_converted) or die("Could not add record to dbf file {$dbase_file}.");
$id++;
}
dbase_close($dbf_file);
//fclose($fh);
// returning url
return $downloadURL . $filename;
}
示例14: adicionaTemaGeoRSS
function adicionaTemaGeoRSS($servico, $dir_tmp, $locaplic, $canal)
{
$xml = simplexml_load_file($servico);
$conta = 0;
foreach ($xml->channel as $c) {
if ($conta == $canal) {
$canal = $c;
}
}
$nos = $canal->item;
//verifica se o canal faz referencia a elementos externos
//se sim, usa todos os elementos do xml no lugar do canal
foreach ($canal->items as $t) {
foreach ($t->xpath('rdf:Seq') as $x) {
foreach ($x->xpath('rdf:li') as $z) {
$nos = $xml->item;
}
}
}
$resultado = array();
$tipog = "";
foreach ($nos as $item) {
$env = array();
//define o tipo
if ($item->xpath('geo:lat')) {
$tipog = "geo";
}
if ($item->xpath('georss:point')) {
$tipog = "georsspoint";
}
if ($item->xpath('georss:where')) {
$tipog = "envelope";
}
if ($tipog == "envelope") {
foreach ($item->xpath('georss:where') as $w) {
foreach ($w->xpath('gml:Envelope') as $e) {
//$lc = $e->xpath('gml:lowerCorner');
$lc = (string) $e->children('gml', TRUE)->lowerCorner;
//$uc = $e->xpath('gml:upperCorner');
$uc = (string) $e->children('gml', TRUE)->upperCorner;
$lc = explode(" ", $lc);
$uc = explode(" ", $uc);
if (is_numeric($lc[0])) {
$ymin = $lc[0];
$ymax = $uc[0];
$xmin = $lc[1];
$xmax = $uc[1];
if ($ymin != "") {
$env = array($xmin, $ymin, $xmax, $ymax);
}
}
}
}
}
if ($tipog == "geo") {
if ($item->xpath('geo:lon')) {
$x = (string) $item->children('geo', TRUE)->lon;
} else {
$x = (string) $item->children('geo', TRUE)->long;
}
//$y = $item->xpath('geo:lat');
$y = (string) $item->children('geo', TRUE)->lat;
$env = array($y, $x);
}
if ($tipog == "georsspoint") {
//$temp = $item->xpath('georss:point');
$temp = (string) $item->children('georss', TRUE)->point;
$env = explode(" ", $temp);
}
if (count($env) > 0) {
$resultado[] = array(ixml($item, "title"), ixml($item, "link"), ixml($item, "description"), ixml($item, "category"), $env);
}
}
//cria o shapefile com os dados
if (count($resultado) > 0) {
//para manipular dbf
include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
$diretorio = dirname($this->arquivo);
$tipol = MS_SHP_POLYGON;
if ($tipog == "georsspoint") {
$tipol = MS_SHP_POINT;
}
if ($tipog == "geo") {
$tipol = MS_SHP_POINT;
}
$novonomelayer = nomeRandomico(10) . "georss";
$nomeshp = $diretorio . "/" . $novonomelayer;
$novoshpf = ms_newShapefileObj($nomeshp, $tipol);
$def[] = array("TITULO", "C", "254");
$def[] = array("LINK", "C", "254");
$def[] = array("DESC", "C", "254");
$def[] = array("CATEGORIA", "C", "254");
if (!function_exists(dbase_create)) {
$db = xbase_create($nomeshp . ".dbf", $def);
xbase_close($db);
} else {
$db = dbase_create($nomeshp . ".dbf", $def);
dbase_close($db);
}
//acrescenta os pontos no novo shapefile
//.........这里部分代码省略.........
示例15: createDBF
function createDBF($fullpath_filename, $field_structure, $data, $file_mode = '0')
{
# Constants for dbf field types
/*
L = BOOLEAN
C = CHAR
D = DATE
N = NUMBER
*/
# Constants for dbf file mode
/*
'0' = 'READ_ONLY';
'1' = 'WRITE_ONLY';
'2' = 'READ_WRITE';
*/
# Path to dbf file
$db_file = $fullpath_filename;
if (is_dir($db_file)) {
unlink($db_file);
}
# create dbf file using the
$create = dbase_create($db_file, $field_structure);
# open dbf file for reading and writing
$id = @dbase_open($db_file, $file_mode) or die("Could not open dbf file <i>{$db_file}</i>.");
if (is_array($data)) {
foreach ($data as $dt) {
dbase_add_record($id, $dt) or die("Could not add record {$dt['0']} to dbf file <i>{$db_file}</i>.");
}
}
# close the dbf file
dbase_close($id);
}