Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62241615
FlexElink.inc.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, May 11, 21:24
Size
3 KB
Mime Type
text/x-c++
Expires
Mon, May 13, 21:24 (2 d)
Engine
blob
Format
Raw Data
Handle
17623652
Attached To
R3600 invenio-infoscience
FlexElink.inc.php
View Options
<?
## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002, 2003, 2004, 2005, 2006 CERN.
##
## The CDSware 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.
##
## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
//Main class
include
(
RECORD_SEP
);
include
(
VARIABLE_EXT
);
include
(
PROCESSOR
);
class
CreateOAIMARCXMLFactory
{
function
CreateOAIMARCXMLFactory
()
{
$this
->
error
=
""
;
}
function
error
()
{
return
$this
->
error
;
}
function
&
createSeparator
(
$ifile
=
""
)
{
$sep
=
new
XMLSimpleRecSeparator
();
$error
=
$sep
->
setIFile
(
$ifile
);
if
(
$error
)
{
$this
->
error
=
$error
;
return
""
;
}
$sep
->
setTag
(
"record"
);
return
$sep
;
}
function
&
createExtractor
()
{
$ext
=
new
OAIVarExtractor
();
return
$ext
;
}
}
class
FlexElink
{
function
FlexElink
()
{
}
function
initialise
(
$itype
,
$ifile
=
""
)
{
$this
->
itype
=
trim
(
strtoupper
(
$itype
));
if
(
$itype
==
"OAIMARC"
)
$this
->
factory
=
new
CreateOAIMARCXMLFactory
();
else
return
"Not suported input type: $itype"
;
$this
->
separator
=&
$this
->
factory
->
createSeparator
(
$ifile
);
if
(!
$this
->
separator
)
return
"Error while creating the Record Separator: "
.
$this
->
factory
->
error
();
$this
->
extractor
=&
$this
->
factory
->
createExtractor
();
if
(!
$this
->
extractor
)
return
"Error while creating the Variable Extractor: "
.
$this
->
factory
->
error
();
$this
->
processor
=
new
Processor
();
return
""
;
}
function
getRecordResult
(
$otypes
,
$debug
=
0
)
{
$record
=
$this
->
clean
(
$this
->
separator
->
getRecord
());
//No more records
if
(
$record
==
""
)
return
array
(-
1
,
""
);
//More records
set_time_limit
(
TIMELIMIT
);
$vars
=
$this
->
extractor
->
getVars
(
"DEFAULT"
,
$record
);
if
(
$vars
==
null
)
return
array
(
0
,
$this
->
extractor
->
getError
());
if
(
$debug
)
$vars
->
debug
();
$result
=
""
;
foreach
(
$otypes
as
$otype
)
{
if
(
trim
(
$otype
)==
""
)
continue
;
list
(
$ok
,
$msg
)=
$this
->
processor
->
getOutput
(
$vars
,
$otype
,
$record
);
if
(
$ok
)
$result
.=
$msg
;
else
return
array
(
0
,
"Error processing record with otype '$otype':"
.
$msg
);
}
return
array
(
1
,
$result
);
}
function
getResult
(
$otype
,
$itype
,
$ifile
=
""
)
{
}
function
clean
(
$text
)
{
$text
=
str_replace
(
"
\0
16"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
17"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
18"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
19"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
20"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
21"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
22"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
23"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
24"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
25"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
26"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
27"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
28"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
29"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
30"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
31"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
32"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
33"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
34"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
35"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
36"
,
""
,
$text
);
$text
=
str_replace
(
"
\0
37"
,
""
,
$text
);
return
$text
;
}
}
?>
Event Timeline
Log In to Comment