📄 marcimport.class.php
字号:
<?
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
///
/// PhpMyLibrary is a Php-MySQL driven online library automation, it
/// offers cataloging, circulation, and web public access catalog.
///
/// Copyright (C) 2000 Polerio T. Babao Jr. II
///
/// This program is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with this program; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// Refer to http://phpmylibrary.sourceforge.net/phpmylibrary for an online
/// demonstration of the phpmylibrary online application program.
///
/// Modified 21 December 17, 2002 01:25p GMT+8
/// Copy of license at http://phpmylibrary.sourceforge.net/LICENSE
/// http://www.phpmylibrary.n3.net or http://phpmylibrary.sourceforge.net
/// Polerio T. Babao Jr.II http://www.polerio.n3.net
/// 43-A Bagong Lote, Potrero Malabon, Metro Manila Philippines.
///
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
Class File
{
function file_import($marc="",$fupload="",$Media="",$view_marc="",$fromisis="",$fromisisrec="",$fromisisflds="",$fromisissubflds="",$isistomarc="")
{
global $config;
//$base_url = Polerio::script_url();
$GetModuleURL = Polerio::GetModuleURL();
if(!empty($marc)) {
$marc_values=$marc;
}
else
{
$form ="<form method=\"post\" action=\"$GetModuleURL\" enctype=\"multipart/form-data\">";
$form .="<br>"._PMLPLEASEPASTEYOURMARCDATABELOWOR." <br>"._PMLBROWSETHEFILELOCATIONOFYOURMARC.".<br>";
$form .="<textarea name=\"marc\" cols=\"40\" rows=\"7\" wrap=\"virtual\">";
$form .="</textarea><br>";
$form .="<br>"._PMLSELECTMEDIATYPE.":";
$form .="<SELECT NAME=\"Media\">";
$form .="<OPTION VALUE=\"1\" selected>"._PMLBOOKS." </OPTION>";
$form .="<OPTION VALUE=\"2\" >"._PMLSERIALS." </OPTION>";
$form .="<OPTION VALUE=\"3\" >"._PMLMAPS." </OPTION>";
$form .="<OPTION VALUE=\"4\" >"._PMLMUSIC."</OPTION>";
$form .="<OPTION VALUE=\"5\" >"._PMLVISUALMATERIAL." </OPTION>";
$form .="<OPTION VALUE=\"6\" >"._PMLCOMPUTERFILES." </OPTION>";
$form .="<OPTION VALUE=\"7\" >"._PMLMIXEDMATERIAL." </OPTION>";
$form .="<OPTION VALUE=\"8\" >"._PMLTHESIS."</OPTION>";
$form .="</SELECT>";
$form .="<br><br>";
$form .="<input type=\"checkbox\" name=\"fromisis\" value=\"y\"> <b>"._PMLIFISISPLEASEENCODESEPARATORS."!</b>";
$form .="<br> <input type=\"text\" name=\"fromisisrec\" value=\"##\" size=\"1\"> "._PMLARECORDSEPARATOR."";
$form .="<br> <input type=\"text\" name=\"fromisisflds\" value=\"#\" size=\"1\"> "._PMLBFIELDSSEPARATOR."";
$form .="<br> <input type=\"text\" name=\"fromisissubflds\" value=\"^\" size=\"1\"> "._PMLCSUBFIELDSSEPARATOR."";
$form .="<br><br> <b>"._PMLPLEASEINDICATEISISTOMARCTAGSCONVERSION."!</b>";
$form .="<br> <b>"._PMLSEPARATEITWITHCOMMAEX." 123=100, 333=245, . . .</b>";
$form .="<br> <input type=\"text\" name=\"isistomarc\" value=\"\" size=\"45\">";
$form .="<br><br>";
$form .="<input type=\"checkbox\" name=\"view_marc\" value=\"y\" checked=\"checked\"> ";
$form .=""._PMLSHOWTHEACTUALMARCAGAIN.".<br>";
$form .="<i>"._PMLOR."</i> "._PMLLOCATIONOFTHETEXTFILE." :<br>";
$form .="<input type=\"file\" name=\"fupload\" /><br>";
$form .="<input type=\"hidden\" name=\"posted\" value=\"y\">";
$form .="<input type=\"hidden\" name=\"_a\" value=\"1\">";
$form .="<input type=\"submit\" name=\"SQL\" value=\""._PMLGO."\">";
$form .="</form>";
//echo $form;
$getmoduleurl = Polerio::GetModuleURL();
$getbaseurl = Polerio::GetBaseURL();
$template = polTemplate::LoadTemplate(Polerio::GetModuleURI().'templates/import.html');
$vars = array( "pol::getmoduleulr","pol::pleasepasteyourmarcbelow","pol::browselocationofile",
"pol::pmlselectmediatype","pol::pmlbooks","pol::pmlserials","pol::pmlmaps","pol::pmlmusic",
"pol::pmlvisualmaterial","pol::pmlcomputerfiles","pol::pmlfixematerial",
"pol::pmlthesis","pol::pleaseencodeseparators","pol::pmlrecordseparator",
"pol::pmlfieldseparator","pol::pmlsubfieldseparator","pol::indicateisistomarcconversion",
"pol::separateitwithcomma","pol::pmlshowactualmarcagain","pol::pmlor",
"pol::pmlocationoftxtfle","pol::pmlgo"
);
$vals = array( "$GetModuleURL",_PMLPLEASEPASTEYOURMARCDATABELOWOR,_PMLBROWSETHEFILELOCATIONOFYOURMARC,
_PMLSELECTMEDIATYPE,_PMLBOOKS,_PMLSERIALS,_PMLMAPS,_PMLMUSIC,
_PMLVISUALMATERIAL,_PMLCOMPUTERFILES,_PMLMIXEDMATERIAL,_PMLTHESIS,
_PMLIFISISPLEASEENCODESEPARATORS,_PMLARECORDSEPARATOR,_PMLBFIELDSSEPARATOR,_PMLCSUBFIELDSSEPARATOR,
_PMLPLEASEINDICATEISISTOMARCTAGSCONVERSION,_PMLSEPARATEITWITHCOMMAEX,_PMLSHOWTHEACTUALMARCAGAIN,
_PMLOR,_PMLLOCATIONOFTHETEXTFILE,_PMLGO
);
$template = polTemplate::ReplaceStatic($template, $vars, $vals);
echo $template;
}
if($marc_values)
{
//print"$fromisis,$fromisisrec,$fromisisflds,$fromisissubflds,$isistomarc";
if($fromisis=="y") {
$marc_values = explode("$fromisisrec",$marc_values);
$marc_values = implode(chr(29),$marc_values);
$marc_values = explode("$fromisisflds",$marc_values);
$marc_values = implode(chr(30),$marc_values);
$marc_values = explode("$fromisissubflds",$marc_values);
$marc_values = implode(chr(31),$marc_values);
$marc_values = File::IsisToMarc($isistomarc,$marc_values);
}
$marc = $marc_values;
if($Media==1) $Mediatype = _PMLBOOKS;
if($Media==2) $Mediatype = _PMLSERIALS;
if($Media==3) $Mediatype = _PMLMAPS;
if($Media==4) $Mediatype = _PMLMUSIC;
if($Media==5) $Mediatype = _PMLVISUALMATERIAL;
if($Media==6) $Mediatype = _PMLCOMPUTERFILES;
if($Media==7) $Mediatype = _PMLMIXEDMATERIALS;
if($Media==8) $Mediatype = _PMLTHESIS;
print"<br><br>"._PMLALLRECORDEXPLODINGMEDIATYPEIS." <b>$Mediatype</b><br><br>";
$marc_records_explode = explode(chr(29),$marc);
$marc_records_explode_count = (count($marc_records_explode)-1);
print"<br>"._PMLTOTALNUMBEROFRECORDSTOREAD." : $marc_records_explode_count<br>";
$record_no = 0;
$_marc_records_explode_count = $marc_records_explode_count-1;
while ( $record_no <= $_marc_records_explode_count )
{
global $config;
list($dbconn) = Polerio::DBGetConn();
$table = Polerio::DBGetTables();
$holdings = $table['holdings'];
$holdings_col = $table['holdings_column'];
$TblBib = $table['tblbib'];
$TblBibCol = &$table['tblbib_column'];
$TblAnyIdx = $table['tblanyindex'];
$TblAnyIdxCol = &$table['tblanyindex_column'];
$TblAnyBib = $table['tblanybibrelation'];
$TblAnyBibCol = &$table['tblanybibrelation_column'];
$TblAuthorIdx = $table['tblauthorindex'];
$TblAuthorIdxCol = &$table['tblauthorindex_column'];
$TblAuthorBib = $table['tblauthorbibrelation'];
$TblAuthorBibCol = &$table['tblauthorbibrelation_column'];
$TblTitleIdx = $table['tbltitleindex'];
$TblTitleIdxCol = &$table['tbltitleindex_column'];
$TblTitleBib = $table['tbltitlebibrelation'];
$TblTitleBibCol = &$table['tbltitlebibrelation_column'];
$TblPublisherIdx = $table['tblpublisherindex'];
$TblPublisherIdxCol = &$table['tblpublisherindex_column'];
$TblPublisherBib = $table['tblpublisherbibrelation'];
$TblPublisherBibCol = &$table['tblpublisherbibrelation_column'];
$TblSubjectIdx = $table['tblsubjectindex'];
$TblSubjectIdxCol = &$table['tblsubjectindex_column'];
$TblSubjectBib = $table['tblsubjectbibrelation'];
$TblSubjectBibCol = &$table['tblsubjectbibrelation_column'];
$TblNotesIdx = $table['tblnotesindex'];
$TblNotesIdxCol = &$table['tblnotesindex_column'];
$TblNotesBib = $table['tblnotesbibrelation'];
$TblNotesBibCol = &$table['tblnotesbibrelation_column'];
$catid = $Media;
print'<table border=1 width=100% cellspacing=0 bordercolordark=white bordercolorlight=black>
<tr><td>';
$number = $record_no+1;
print"<br>"._PMLEVALUATINGRECORDNO.". $number "._PMLSTARTS."!<br><br>";
$marc_data = addslashes($marc_records_explode[$record_no]);
$accessid = Polerio::TimeAndRandom();
$query = "INSERT INTO $TblBib ($TblBibCol[id], $TblBibCol[marc], $TblBibCol[catid],$TblBibCol[accessid]) values ('$accessid','$marc_data','$catid','$accessid')";
$recordSet = $dbconn->Execute($query);
//print"$query\n";
$_marcid = $accessid;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -