cvs: peardoc /ja/chapters contributing.xml /ja/package/database/db-dataobject/db-dataobject joinadd.xml /ja/package/fileformats file-marc.xml
/ja/package/fileformats/file-marc formatting.xml reading.xml /ja/package/http http-request.xml /ja/package/http/http-request listeners.xml
| From: | TAKAGI Masahiro | Date: | Sat, 24 Feb 2007 01:36:03 +0000 |
| Subject: | cvs: peardoc /ja/chapters contributing.xml /ja/package/database/db-dataobject/db-dataobject joinadd.xml /ja/package/fileformats file-marc.xml /ja/package/fileformats/file-marc formatting.xml reading.xml /ja/package/http http-request.xml /ja/package/http/http-request listeners.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-9466@lists.php.net to get a copy of this message | ||
takagi Sat Feb 24 01:36:03 2007 UTC
Added files:
/peardoc/ja/package/http/http-request listeners.xml
/peardoc/ja/package/fileformats/file-marc formatting.xml
Modified files:
/peardoc/ja/package/http http-request.xml
/peardoc/ja/package/fileformats/file-marc reading.xml
/peardoc/ja/package/fileformats file-marc.xml
/peardoc/ja/package/database/db-dataobject/db-dataobject
joinadd.xml
/peardoc/ja/chapters contributing.xml
Log:
sync with en.
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/http/http-request.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/http/http-request.xml diff -u peardoc/ja/package/http/http-request.xml:1.1 peardoc/ja/package/http/http-request.xml:1.2 --- peardoc/ja/package/http/http-request.xml:1.1 Sun Oct 3 15:14:50 2004 +++ peardoc/ja/package/http/http-request.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.2 Maintainer: shimooka Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: shimooka Status: ready --> <sect1 id="package.http.http-request"> <title>HTTP_Request</title> @@ -17,6 +17,7 @@ &package.http.http-request.headers; &package.http.http-request.proxy-auth; &package.http.http-request.response-eval; + &package.http.http-request.listeners; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/ja/package/fileformats/file-marc/reading.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/fileformats/file-marc/reading.xml diff -u peardoc/ja/package/fileformats/file-marc/reading.xml:1.1 peardoc/ja/package/fileformats/file-marc/reading.xml:1.2 --- peardoc/ja/package/fileformats/file-marc/reading.xml:1.1 Tue Feb 13 13:21:22 2007 +++ peardoc/ja/package/fileformats/file-marc/reading.xml Sat Feb 24 01:36:03 2007 @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <refentry id="package.fileformats.file-marc.reading"> <refnamediv> - <refname>å°å ¥</refname> + <refname>MARC ãã¼ã¿ã®èªã¿è¾¼ã¿</refname> <refpurpose> - <classname>File_MARC</classname> ã«ã¤ã㦠+ <classname>File_MARC</classname> ã«ãã MARC ãã¼ã¿ã®èªã¿è¾¼ã¿ </refpurpose> </refnamediv> @@ -18,19 +18,37 @@ <classname>File_MARC</classname> ã«å梱ããã¦ãã <classname>File_MARCXML</classname> ã使ç¨ããã¨ã MARCXML å½¢å¼ã®ãã¼ã¿ãèªã¿è¾¼ããã¨ãã§ãã¾ãã - å ¥åå ã¯ãPHP ã®ã¹ããªã¼ã (SOURCE_FILE) ãããã¯æåå - (SOURCE_STRING) ã¨ãªãã¾ããã³ã³ã¹ãã©ã¯ã¿ã§ã - ãããã対å¿ãã宿°ãæå®ãã¾ãã + </para> + </refsect1> + + <refsect1 id="package.fileformats.file-marc.reading.source"> + <title>ãã¾ãã¾ãªã½ã¼ã¹ããã® MARC ãã¼ã¿ã®èªã¿è¾¼ã¿</title> + <para> + å ¥åå ã¯ãPHP ã®ã¹ããªã¼ã (<constant>SOURCE_FILE</constant>) ãããã¯æåå + (<constant>SOURCE_STRING</constant>) ã¨ãªãã¾ãã + <classname>File_MARC</classname> ããã³ <classname>File_MARCXML</classname> + ã®ã³ã³ã¹ãã©ã¯ã¿ã§ãæåã®å¼æ°ã¨ãã¦ã½ã¼ã¹ã®ä½ç½®ãã + äºçªç®ã®å¼æ°ã¨ãã¦ã½ã¼ã¹ã®å½¢å¼ãæå®ãã¾ãã </para> <example> <title>ãã¡ã¤ã«ããã® MARC 21 ãã¼ã¿ã®èªã¿è¾¼ã¿</title> + <para> + ãã®ä¾ã§ã¯ãMARC21 ãã¼ã¿ã <filename>journals.mrc</filename> + ã¨ããååã§ãã£ã¹ã¯ä¸ã«ä¿åããã¦ãããã®ã¨ãã¾ãã + MARCX21 ãã¼ã¿ãèªã¿è¾¼ãã«ã¯ã<classname>File_MARC</classname> + ã®ã³ã³ã¹ãã©ã¯ã¿ãã³ã¼ã«ãã¾ããFile_MARC ã«å¯¾ãã¦ã + <filename>journals.mrc</filename> ããã¡ã¤ã«åãªã®ã MARC + ãã¼ã¿ã¹ããªã¼ã ãæãã¦ããã®ããæå®ããå¿ è¦ã¯ããã¾ããã + <classname>File_MARC</classname> ã®ã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬äºå¼æ°ã¯ã + ããã©ã«ãã§ <constant>SOURCE_FILE</constant> ã¨ãªãããã§ãã + </para> <programlisting role="php"><![CDATA[ require 'File/MARC.php'; // MARC ã¬ã³ã¼ãããã¡ã¤ã«ããåå¾ãã¾ã -$journals = new File_MARC('journals.mrc', SOURCE_FILE); +$journals = new File_MARC('journals.mrc'); // åå¾ããã¬ã³ã¼ããé ã«å¦çãã¾ã while ($record = $journals->next()) { @@ -44,6 +62,16 @@ <example> <title>æååããã® MARCXML ãã¼ã¿ã®èªã¿è¾¼ã¿</title> + <para> + ãã®ä¾ã§ã¯ãããã¦ã§ããµã¼ãã¹ããè¿ããã MARCXML + ãã¼ã¿ã PHP ã®å¤æ° <varname>$xml_data</varname> + ã«æååã§æ ¼ç´ããã¦ãããã®ã¨ãã¾ãã + MARCXML ãã¼ã¿ãèªã¿è¾¼ãã«ã¯ã<classname>File_MARCXML</classname> + ã®ã³ã³ã¹ãã©ã¯ã¿ãã³ã¼ã«ãã¾ãã<varname>$xml_data</varname> + ãæååã§ãããã¨ã File_MARCXML ã«æããããã + ã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬äºå¼æ°ã§ <constant>SOURCE_STRING</constant> + ãæå®ãã¾ãã + </para> <programlisting role="php"><![CDATA[ require 'File/MARCXML.php'; @@ -60,23 +88,59 @@ ]]> </programlisting> </example> + </refsect1> + <refsect1 id="package.fileformats.file-marc.reading.structure"> + <title>ãã¾ãã¾ãªã½ã¼ã¹ããã® MARC ãã¼ã¿ã®èªã¿è¾¼ã¿</title> <para> <classname>File_MARC</classname> ãªãã¸ã§ã¯ãã¯ãå é é¨ã®æ å ±ã®å¾ã« <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ããé ã«ä¸¦ã¶å½¢å¼ã¨ãªãã¾ãã ããã MARC ã¬ã³ã¼ãã表ãã¾ããã¾ããåã¬ã³ã¼ããªãã¸ã§ã¯ãã¯ããããã - <classname>File_MARC_DataField</classname> ããã㯠- <classname>File_MARC_ControlField</classname> ãªãã¸ã§ã¯ãã®ç¹°ãè¿ãã«ãªãã¾ãã + <classname>File_MARC_Data_Field</classname> ããã㯠+ <classname>File_MARC_Control_Field</classname> ãªãã¸ã§ã¯ãã®ç¹°ãè¿ãã«ãªãã¾ãã ããã MARC ãã£ã¼ã«ãã表ãã¾ãã - <classname>File_MARC_DataField</classname> ã®ä¸èº«ã¯ + <classname>File_MARC_Data_Field</classname> ã®ä¸èº«ã¯ <classname>File_MARC_Subfield</classname> ãªãã¸ã§ã¯ãã®ç¹°ãè¿ãã¨ãªãã ããã MARC ãµããã£ã¼ã«ãã表ãã¾ãã </para> + <example> + <title>ã¬ã³ã¼ãã®è¦ç´ ã®è¡¨ç¤º</title> + + <programlisting role="php"><![CDATA[ +require 'File/MARC.php'; + +// MARC ã¬ã³ã¼ã群ãåå¾ãã¾ã +$bibrecords = new File_MARC('catdump.mrc', SOURCE_FILE); + +// åå¾ããã¬ã³ã¼ããé ã«å¦çãã¾ã +while ($record = $bibrecords->next()) { + // å é é¨ã表示ãã¾ã + print $record->getLeader(); + $subjects = $record->getFields('650'); + if ($subjects) { + // æåã® 24_ ãã£ã¼ã«ããåå¾ãã¾ã + print $record->getField('24.', true); + print "\n"; + + // åå¾ããä»¶åããã¹ã¦è¡¨ç¤ºãã¾ã + foreach ($subjects as $field) { + print $field; + print "\n"; + } + print "\n"; + } +} +]]> + </programlisting> + + </example> + + <para> - ã¤ã¾ãã<classname>File_MARC</classname> ã使ç¨ããã¨ã - MARC ã¬ã³ã¼ããèªã¿è¾¼ãã§ãã®ä¸ã®ç¹å®ã®ãã£ã¼ã«ãããµããã£ã¼ã«ãã®å 容ãåå¾ãããã¨ã - é常ã«ç°¡åã«ã§ãã¾ãã + ã¤ã¾ãã<classname>File_MARC</classname> ã使ç¨ããã¨ãMARC ã¬ã³ã¼ããèªã¿è¾¼ãã§ + ãã®ä¸ã®ç¹å®ã®ãã£ã¼ã«ãããµããã£ã¼ã«ãã®å 容ãåå¾ãããã¨ãç°¡åã«ã§ãã¾ãã + <classname>File_MARC</classname> ã«ã¯ããã¡ãã¡é 次å¦çãããªãã¦ã ç¹å®ã®ãã£ã¼ã«ããç°¡åã«èªã¿è¾¼ããããã«ããã¡ã½ãããããã¾ãã <methodname>getField</methodname> ã¯ã @@ -116,6 +180,88 @@ ]]> </programlisting> </example> + </refsect1> + + <refsect1 id="package.fileformats.file-marc.reading.iterating"> + <title>ãã£ã¼ã«ãããã³ãµããã£ã¼ã«ãã®é 次å¦ç</title> + <para> + <classname>File_MARC_Data_Field</classname> ãªãã¸ã§ã¯ãã + <function>foreach</function> ã§é ã«å¦çããéã«ã¯ã + æå®ãããã£ã¼ã«ãã® MARC ã¿ã°ããã¼ã¨ãã¦è¿ããã¾ãã + ã¾ãã対å¿ããå¤ã«ã¯ããµããã£ã¼ã«ã群ãè¿ããã¾ãã + </para> + <para> + åæ§ã«ã<classname>File_MARC_Subfield</classname> ãªãã¸ã§ã¯ãã + <function>foreach</function> ã§é ã«å¦çããéã«ã¯ã + æå®ãããµããã£ã¼ã«ãã®ã³ã¼ãããã¼ã¨ãã¦è¿ããã¾ãã + ã¾ãã対å¿ããå¤ã«ã¯ããã®ãµããã£ã¼ã«ãã®å¤ãè¿ããã¾ãã + </para> + + <example> + <title>MARC ã¬ã³ã¼ãå ã®ãã£ã¼ã«ãã¨ãµããã£ã¼ã«ãã®é 次å¦ç</title> + <para> + ãã®ä¾ã§ã¯ã650 ãã£ã¼ã«ããé ã«å¦çããåãã£ã¼ã«ãã® + ãµããã£ã¼ã«ãã«ããä»¶åã®è¦åºãã表示ãã¾ãã + </para> + <programlisting role="php"><![CDATA[ +require 'File/MARC.php'; + +// z39 çµææååãã MARC ã¬ã³ã¼ã群ãåå¾ãã¾ã +$bibrecords = new File_MARC($z39_result, SOURCE_STRING); + +// åã¬ã³ã¼ããå¦çãã¾ã +while ($record = $bibrecords->next()) { + // ãã£ã¼ã«ããé ã«å¦çãã¾ã + foreach ($record as $tag => $subfields) { + // 650 ãã£ã¼ã«ã以å¤ã¯èªã¿é£ã°ãã¾ã + if ($tag == '650') { + print "Subject:"; + foreach ($subfields as $code => $value) { + print " $value"; + } + print "\n"; + } + } +} +]]> + </programlisting> + + </example> + + </refsect1> + + <refsect1 id="package.fileformats.file-marc.reading.indicators"> + <title>ãã£ã¼ã«ãã¤ã³ã¸ã±ã¼ã¿ã®åå¾</title> + <para> + ãã¼ã¿ãã£ã¼ã«ã㯠<classname>File_MARC_Data_Field</classname> ã¯ã©ã¹ã§è¡¨ããã¾ãã + ãã®ã¯ã©ã¹ã®é¢æ° <function>getIndicator</function> ã使ç¨ããã¨ã + ã¤ã³ã¸ã±ã¼ã¿ã®å¤ãåå¾ãããã¨ãã§ãã¾ãã + </para> + + <example> + <title>ã¤ã³ã¸ã±ã¼ã¿ã®åå¾</title> + <para> + ãã®ä¾ã§ã¯ãMARC ã¬ã³ã¼ãã®ã¿ã¤ãã« (245) ãã£ã¼ã«ããåå¾ãã + ãã®ãã£ã¼ã«ãã®äºçªç®ã®ã¤ã³ã¸ã±ã¼ã¿ã調ã¹ã¾ããããã«ãã£ã¦ããã®ãã£ã¼ã«ãã« + ä¸¦ã¹æ¿ãã®éã«ç¡è¦ãã¹ãéãã¡ã¤ãªã³ã°ã¤ã³ã¸ã±ã¼ã¿ããããã©ããã夿ãã¾ãã + </para> + <programlisting role="php"><![CDATA[ +require 'File/MARC.php'; + +$titleField = $record->getField('245'); +$nonfiling = $titleField->getIndicator(2); + +if ($nonfiling) { + // $a ãµããã£ã¼ã«ãã®ä¸é¨ã使ç¨ãã¦ä¸¦ã¹æ¿ãã¾ã + $title = substr($titleField->getSubfield('a), $nonfiling); +} else { + // $a ãµããã£ã¼ã«ãå ¨ä½ã使ç¨ãã¦ä¸¦ã¹æ¿ãã¾ã + $title = $titleField->getSubfield('a'); +} +]]> + </programlisting> + + </example> </refsect1> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/fileformats/file-marc.xml?r1=1.2&r2=1.3&diff_format=u Index: peardoc/ja/package/fileformats/file-marc.xml diff -u peardoc/ja/package/fileformats/file-marc.xml:1.2 peardoc/ja/package/fileformats/file-marc.xml:1.3 --- peardoc/ja/package/fileformats/file-marc.xml:1.2 Tue Feb 13 13:21:22 2007 +++ peardoc/ja/package/fileformats/file-marc.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <sect1 id="package.fileformats.file-marc"> <title>File_MARC</title> @@ -11,10 +11,10 @@ <!-- &package.fileformats.file-marc.intro; - &package.fileformats.file-marc.creating; &package.fileformats.file-marc.modifying; --> &package.fileformats.file-marc.reading; + &package.fileformats.file-marc.formatting; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml diff -u peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml:1.1 peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml:1.2 --- peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml:1.1 Fri Apr 1 23:47:47 2005 +++ peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.9 Maintainer: shimooka Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.10 Maintainer: shimooka Status: ready --> <refentry id="package.database.db-dataobject.db-dataobject.joinadd"> <refnamediv> <refname>->joinAdd()</refname> @@ -127,16 +127,16 @@ <title>æ¬å½ã«ã·ã³ãã«ãªçµå</title> <programlisting role="php"><![CDATA[ -// (requires links.ini to be set up correctly) -// get all the images for product 24 +// (links.ini ãæ£ããè¨å®ããã¦ãããã¨ãåæã«) +// 24 çªã®è£½åã®ãã¹ã¦ã®ç»åãåå¾ãã¾ã $i = new DataObject_Image(); $pi = new DataObjects_Product_image(); -$pi->product_id = 24; // set the product id to 24 -$i->joinAdd($pi); // add the product_image connectoin +$pi->product_id = 24; // 製å ID ã 24 ã«è¨å®ãã¾ã +$i->joinAdd($pi); // product_image ãæ¥ç¶ãã¾ã $i->find(); while ($i->fetch()) { -// do stuff +// ä½ãã®å¦çãè¡ãã¾ã } ]]> @@ -146,10 +146,10 @@ <title>çµæã® SQL</title> <programlisting> <![CDATA[ -SELECT * FROM image,product_image - LEFT JOIN image ON product_image +SELECT * FROM image + LEFT JOIN product_image + ON (image.id = product_image.image_id) WHERE product_image.id = 24 - AND product_image.pid = product.id ]]> </programlisting> </example> @@ -158,8 +158,8 @@ <title>ããè¤é㪠JOIN ã¯ã¨ãª</title> <programlisting role="php"><![CDATA[ -// an example with 2 joins -// get all the images linked with products or productgroups +// ãµãã¤ã® JOIN ã使ç¨ããä¾ +// 製åãããã¯è£½åã°ã«ã¼ãã«é¢é£ãããã¹ã¦ã®ç»åãåå¾ãã¾ã $i = new DataObject_Image(); $pi = new DataObject_Product_image(); $pgi = new DataObject_Productgroup_image(); @@ -167,7 +167,7 @@ $i->joinAdd($pgi); $i->find(); while ($i->fetch()) { -// do stuff +// ä½ãã®å¦çãè¡ãã¾ã } @@ -178,13 +178,12 @@ <title>çµæã® SQL</title> <programlisting> <![CDATA[ -SELECT * FROM image,product_image - LEFT JOIN image ON product_image - LEFT JOIN image ON productgroup_image - WHERE product - AND product.id = product_image.pid - AND product.id = productgroup_image.pid -]]> +SELECT * FROM image + LEFT JOIN product_image + ON (image.id = product_image.image_id) + LEFT JOIN productgroup + ON (image.id = productgroup_image.image_id); + ]]> </programlisting> </example> </refsect1> http://cvs.php.net/viewvc.cgi/peardoc/ja/chapters/contributing.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/ja/chapters/contributing.xml diff -u peardoc/ja/chapters/contributing.xml:1.5 peardoc/ja/chapters/contributing.xml:1.6 --- peardoc/ja/chapters/contributing.xml:1.5 Tue May 2 13:42:58 2006 +++ peardoc/ja/chapters/contributing.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.16 Maintainer: Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.17 Maintainer: Status: ready --> <chapter id="contributing"> <chapterinfo> <author> @@ -77,8 +77,12 @@ </para> <para> - 次ã®ã¹ãããã¯ããããã®éä»ã§ããããã±ã¼ã¸ã®ã¡ã³ããã« CC ãã¤ãã¦ã - &email.pear.dev; ã«ã¡ã¼ã«ãæ¸ãã¦ãã ãããã¡ã¼ã«ã®ä»¶åã¯ã + 次ã®ã¹ãããã¯ããããã®æç¨¿ã§ããããã«ã¯ãåºæ¬çã«äºéãã®æ¹æ³ãããã¾ãã + æåã®æ¹æ³ã¯ãå½è©²ããã±ã¼ã¸ã«ã¤ãã¦ã®ãã°ã¬ãã¼ãã使ãã¦ããããæç¨¿ãããã¨ã§ãã + ãããè¡ãã«ã¯ãpear.php.net ä¸ã®ããã±ã¼ã¸ã®ãã¼ã ãã¼ã¸ã«è¡ãã + ãã¼ã¸ã®ä¸ã®ã»ãã«ããã¿ã "Bugs" ãã¯ãªãã¯ãã¾ãã + ããã²ã¨ã¤ã®æ¹æ³ã¯ãããã±ã¼ã¸ã®ã¡ã³ããã« Cc ãã¤ãã¦ã + &email.pear.dev; ã«ã¡ã¼ã«ãæ¸ããã¨ã§ããã¡ã¼ã«ã®ä»¶åã¯ã '[Patch]' ããã¯ããã¦ããããã®æç¨¿ã§ãããã¨ãå¤ããããããã¨è¯ãã§ãããã ã¾ãããããã®å 容ã®è©³ãã説æãæ¸ãã¦ãã ããã .diff ãã¡ã¤ã«ãã¡ã¼ã«ã«æ·»ä»ããã®ãå¿ããªãããã«ã http://cvs.php.net/viewvc.cgi/peardoc/ja/package/http/http-request/listeners.xml?view=markup&rev=1.1 Index: peardoc/ja/package/http/http-request/listeners.xml +++ peardoc/ja/package/http/http-request/listeners.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="package.http.http-request.listeners"> <refnamediv> <refname>HTTP_Request_Listener</refname> <refpurpose> HTTP_Request æä½ã«ãªã¹ãã¼ãã¢ã¿ãããã </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.listeners.intro"> <title>HTTP_Request_Listener ã«ã¤ãã¦</title> <titleabbrev>å°å ¥</titleabbrev> <para> <classname>HTTP_Request_Listener</classname> ã¯æ½è±¡ã¯ã©ã¹ã§ãã ãããç¶æ¿ããã¨ãçºçããã¤ãã³ããåãåã£ã¦ããã«å¯¾ããå¿çãè¿ããã¨ãã§ãã¾ãã HTTP_Request ã«ã¯ãã³ã³ã½ã¼ã«ãã¼ã¹ã®ããã°ã¬ã¹ãã¼ã®ãµã³ãã«ãå«ã¾ãã¦ãã¾ãã ãããå®è£ ããã«ã¯ã<classname>HTTP_Request_DownloadListener</classname> ã¯ã©ã¹ã使ç¨ãã¾ããããã¯ã <link linkend="package.console.console-progressbar">Console_ProgressBar</link> ããã±ã¼ã¸ã使ç¨ãã¦ãã¦ã³ãã¼ãã®é²æã¡ã¼ã¿ã¼ã表示ãã¾ãã </para> </refsect1> <refsect1 id="package.http.http-request.listeners.usage"> <title>HTTP_Request_Listener ã®ä½¿ç¨ä¾</title> <para> ãªã¹ãã¼ã使ç¨ããã«ã¯ã確èªãããç¹å®ã® <classname>HTTP_Request</classname> ããã㯠<classname>HTTP_Response</classname> ãªãã¸ã§ã¯ãã«å¯¾ãã¦ãªã¹ãã¼ãã¢ã¿ããããå¿ è¦ãããã¾ãã ã¢ã¿ããããã³ã¼ãã¯ããµã³ãã«ã®ä¸çªæå¾ã«ããã¾ãã ãããããã ãã¦ãããã¨ããã<classname>HTTP_Request</classname> ãããã®é ä¸ã®ãã¹ã¦ã® <classname>HTTP_Response</classname> ãªãã¸ã§ã¯ãã«å¯¾ãã¦ã¤ãã³ããªã¹ãã¼ã伿ãã¾ãã ããã¦æåã® <classname>HTTP_Request</classname> ãªãã¸ã§ã¯ãã«å¯¾ãã¦ã®ã¿ã¢ã¿ãããå¿ è¦ã¨ãªãã¾ãã </para> <example> <title>HTTP_Request_Listener ã使ç¨ãããã¦ã³ãã¼ã鲿ãã¼</title> <programlisting role="php"> <![CDATA[ <?php /** * HTTP_Request ã§ã®ãªã¹ãã¼ã®ä½¿ç¨ä¾ã§ããããã¯ããã¡ã¤ã«ã® * ãã¦ã³ãã¼ãã¨ä¿åãè¡ãã¨åæã«ãå¦çã®é²æç¶æ³ããã¼ã§è¡¨ç¤ºãã¾ã * * 注æãã¹ãç¹ã¯ä»¥ä¸ã®ã¨ããã§ã * 1) ãã©ã¦ã¶ã§ãªããã³ã³ã½ã¼ã«ããå®è¡ããªãã¨ããã¾ãã * 2) åºåãããã¡ãªã³ã°ã OFF ã«ããªãã¨æ£å¸¸ã«åä½ãã¾ãã */ require_once 'HTTP/Request.php'; require_once 'HTTP/Request/Listener.php'; require_once 'Console/ProgressBar.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); set_time_limit(0); class HTTP_Request_DownloadListener extends HTTP_Request_Listener { /** * 対象ã¨ãªããã¡ã¤ã«ã®ãã³ãã« * @var int */ var $_fp; /** * ã¤ã³ã¸ã±ã¼ã¿ã®è¡¨ç¤ºã«ä½¿ç¨ãã Console_ProgressBar ã®ã¤ã³ã¹ã¿ã³ã¹ * @var object */ var $_bar; /** * 対象ã¨ãªããã¡ã¤ã«ã®åå * @var string */ var $_target; /** * åä¿¡ãããã¡ã¤ã«ã®ãã¤ãæ° * @var int */ var $_size = 0; function HTTP_Request_DownloadListener() { $this->HTTP_Request_Listener(); } /** * 対象ã¨ãªããã¡ã¤ã«ããªã¼ãã³ãã * @param string ãã¡ã¤ã«å * @throws PEAR_Error */ function setTarget($target) { $this->_target = $target; $this->_fp = @fopen($target, 'wb'); if (!$this->_fp) { PEAR::raiseError("'{$target}' ããªã¼ãã³ã§ãã¾ãã"); } } function update(&$subject, $event, $data = null) { switch ($event) { case 'sentRequest': $this->_target = basename($subject->_url->path); break; case 'gotHeaders': if (isset($data['content-disposition']) && preg_match('/filename="([^"]+)"/', $data['content-disposition'], $matches)) { $this->setTarget(basename($matches[1])); } else { $this->setTarget($this->_target); } $this->_bar =& new Console_ProgressBar( '* ' . $this->_target . ' %fraction% KB [%bar%] %percent%', '=>', '-', 79, (isset($data['content-length'])? round($data['content-length'] / 1024): 100) ); $this->_size = 0; break; case 'tick': $this->_size += strlen($data); $this->_bar->update(round($this->_size / 1024)); fwrite($this->_fp, $data); break; case 'gotBody': fclose($this->_fp); break; default: PEAR::raiseError("ã¤ãã³ã '{$event}' ãå¦çã§ãã¾ãã"); } // switch } } // å¥ã®ããã±ã¼ã¸ã使ç¨ãã¦ããã¾ãã¾ããããã§ããã ã大ãç®ã®ãã®ã // é¸ã°ãªãã¨é²æãã¼ãè¦ãã¾ãã $url = 'http://pear.php.net/get/HTML_QuickForm-stable'; $req =& new HTTP_Request($url); $download =& new HTTP_Request_DownloadListener(); $req->attach($download); $req->sendRequest(false); ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.http.http-request.listeners.detail"> <title>ææã§ããã¤ãã³ã</title> <para> <classname>HTTP_Request</classname> ã¯ã©ã¹ã¯ãããã®ã¤ãã³ããéä¿¡ãã¾ãã <itemizedlist> <listitem> <para> <literal>connect</literal> - ãµã¼ãã¨æ¥ç¶ããéã«ãã®ã¤ãã³ããéä¿¡ãã¾ãã </para> </listitem> <listitem> <para> <literal>sentRequest</literal> - ãªã¯ã¨ã¹ããéä¿¡ããå¾ã§ãã®ã¤ãã³ããéä¿¡ãã¾ãã </para> </listitem> <listitem> <para> <literal>disconnect</literal> - ãµã¼ãã¨ã®æ¥ç¶ãåæããå¾ã§ãã®ã¤ãã³ããéä¿¡ãã¾ãã </para> </listitem> </itemizedlist> </para> <para> <classname>HTTP_Response</classname> ã¯ã©ã¹ã¯ãããã®ã¤ãã³ããéä¿¡ãã¾ãã <itemizedlist> <listitem> <para> <literal>gotHeaders</literal> - ã¬ã¹ãã³ã¹ããããåä¿¡ãããã¨ã§ãã®ã¤ãã³ããéä¿¡ãã¾ã (ãããã飿³é åã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> <listitem> <para> <literal>tick</literal> - ã¬ã¹ãã³ã¹æ¬æã®ä¸é¨ãåä¿¡ããéã«ãã®ã¤ãã³ããéä¿¡ãã¾ã (åä¿¡ããå 容ãæååã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> <listitem> <para> <literal>gzTick</literal> - gzip å§ç¸®ãããã¬ã¹ãã³ã¹æ¬æã®ä¸é¨ãåä¿¡ããéã«ãã®ã¤ãã³ããéä¿¡ãã¾ã (åä¿¡ããå 容ãæååã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> <listitem> <para> <literal>gotBody</literal> - ã¬ã¹ãã³ã¹å ¨ä½ãåä¿¡ãçµããå¾ã§ãã®ã¤ãã³ããéä¿¡ãã¾ã (gzip å§ç¸®ããã¦ããå ´åãããããã³ã¼ãããå 容ãæååã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/fileformats/file-marc/formatting.xml?view=markup&rev=1.1 Index: peardoc/ja/package/fileformats/file-marc/formatting.xml +++ peardoc/ja/package/fileformats/file-marc/formatting.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="package.fileformats.file-marc.formatting"> <refnamediv> <refname>MARC ãã¼ã¿ã®ãã©ã¼ããã</refname> <refpurpose> <classname>File_MARC</classname> ã使ç¨ãã MARC ãã¼ã¿ã®æ´å½¢ </refpurpose> </refnamediv> <refsect1 id="package.fileformats.file-marc.formatting.overview"> <title>æ¦è¦</title> <para> <classname>File_MARC_Record</classname> ã¯ã©ã¹ã使ç¨ããã¨ã Machine Readable Cataloging (<acronym>MARC</acronym>) ãã¼ã¿ã MARC 21 å½¢å¼ãå¯èªå½¢å¼ã®æååããã³ (å¶éã¯ããã¾ãã) MARCXML å½¢å¼ã§æ¸ãåºããã¨ãã§ãã¾ãã </para> </refsect1> <refsect1 id="package.fileformats.file-marc.formatting.marc21"> <title>MARC 21 å½¢å¼ã¸ã®æ´å½¢</title> <para> ã¬ã³ã¼ãã MARC 21 å½¢å¼ã§è¿ãã«ã¯ã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>toRaw()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã </para> <example> <title>MARC 21 ãã¼ã¿ã®ãã¡ã¤ã«ã¸ã®æ¸ãè¾¼ã¿</title> <para> ãã®ä¾ã§ã¯ã<classname>File_MARC_Record</classname> ã§è¡¨ããã MARC ã¬ã³ã¼ãã使ããé å <varname>$records</varname> ã«ä¿åãã¾ãã ãã®ãã¼ã¿ã MARC 21 å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ãã«ã¯ã ã¾ããã¡ã¤ã«ããã¤ããªã¢ã¼ãã§ãªã¼ãã³ãã¾ãã ããã¦é åå ã®ã¬ã³ã¼ãã®å 容ããã¡ã¤ã«ã«æ¸ãè¾¼ãããã« <function>toRaw()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã ãããã¬ã³ã¼ããã¨ã«ç¹°ãè¿ãã¾ãã </para> <programlisting role="php"><![CDATA[ require 'File/MARC.php'; // convert_metadata_to_marc() ã¯æ¶ç©ºã®ã¡ã½ããã§ã // File_MARC_Record ãªãã¸ã§ã¯ãã®é åãè¿ãã¾ã $records = convert_metadata_to_marc(); // ãã¤ããªæ¸ãè¾¼ã¿ã¢ã¼ãã§ãã¡ã¤ã«ããªã¼ãã³ãã¾ã $marc21_file = fopen("records.mrc", "wb"); // ã¬ã³ã¼ããé ã«å¦çãã¾ã while ($record = $records->next()) { // åã¬ã³ã¼ãããMARC 21 å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ã fwrite($marc21_file, $record->toRaw()); } // ãã¡ã¤ã«ãéãã¾ã fclose($marc21_file); ]]> </programlisting> </example> </refsect1> <refsect1 id="package.fileformats.file-marc.formatting.human"> <title>MARC ãã¼ã¿ããã®å¯èªå½¢å¼ã®åºåã®ä½æ</title> <para> å¯èªå½¢å¼ã§ MARC 21 ããã㯠MARCXML ã¬ã³ã¼ããè¿ãã«ã¯ã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>__toString()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>print()</function> 颿°ãã³ã¼ã«ããéã«ã¯ãæé»çã« <function>__toString()</function> ã¡ã½ãããã³ã¼ã«ãã¦ãããã¨ã«æ³¨æãã¾ãããã </para> <example> <title>MARC ã®å¯èªå½¢å¼ãè¿ã</title> <para> ãã®ä¾ã§ã¯ãå MARC ã¬ã³ã¼ãã®å 容ãå¯èªå½¢å¼ã§è¡¨ç¤ºãã¾ãã ã¾ããæç¤ºçã« <function>__toString()</function> ã¡ã½ãããã³ã¼ã«ãã å¯èªå½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ããå ¥åå½¢å¼ã MARC ããã㯠MARCXML ã®ã©ã¡ãã§ãã£ã¦ããåºåç¨ã«ãã¼ã¿ãæ´å½¢ããã¡ã½ããã¯åãã§ãããã¨ã«æ³¨æãã¾ãããã </para> <programlisting role="php"><![CDATA[ require 'File/MARCXML.php'; // MARCXML ã¬ã³ã¼ã群ãæååããåå¾ãã¾ã $journals = new File_MARCXML($xml_data, SOURCE_STRING); // ãã¤ããªæ¸ãè¾¼ã¿ã¢ã¼ãã§ãã¡ã¤ã«ããªã¼ãã³ãã¾ã $marc21_file = fopen("records.mrc", "wb"); // åå¾ããã¬ã³ã¼ããé ã«å¦çãã¾ã while ($record = $journals->next()) { // åã¬ã³ã¼ãããããã«è¡¨ç¤ºãã¾ã print $record; print "\n"; // ãããã«æ´å½¢ããã¬ã³ã¼ãããã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ã fwrite($marc21_file, $record->__toString() . "\n"); } // ãã¡ã¤ã«ãéãã¾ã fclose($marc21_file); ]]> </programlisting> </example> </refsect1> <refsect1 id="package.fileformats.file-marc.writing.marcxml"> <title>MARCXML å½¢å¼ã¸ã®æ´å½¢</title> <para> ã¬ã³ã¼ãã MARCXML å½¢å¼ã§è¿ãã«ã¯ã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>toXML()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã </para> <warning> <title><function>toXML()</function> ã¡ã½ããã®éè¦ãªå¶ç´</title> <itemizedlist> <listitem> <para> æãéè¦ãªã®ã¯ãPHP ã§ã¯ MARC8 ã¨ã³ã³ã¼ãã£ã³ã°ããã®å¤æãè¡ããªãã¨ãããã¨ã§ãã ãã®ã¨ã³ã³ã¼ãã£ã³ã°ã¯æ¢åã® MARC ã¬ã³ã¼ãã®å¤ãã§ç¨ãããã¦ãã¾ããã ããã XML ã§æå¹ãªã¨ã³ã³ã¼ãã£ã³ã°ããã¨ãã° UTF-8 ãªã©ã«å¤æãããã¨ã¯ããã¾ãããä»è¨èªçã® MARC ã©ã¤ãã©ãªã¯ã ç¬èªã®æåã¨ã³ã³ã¼ãã£ã³ã°å¤æã©ã¤ãã©ãªã使ãããã¨ã§ãã®åé¡ã«å¯¾å¿ãã¦ããããã§ãã ç¾æç¹ã§ã¯ã<classname>File_MARC</classname> ã®ä½è ã¯åçã®æ©è½ã®ãµãã¼ãã PEAR ããã±ã¼ã¸ã¨ãã¦çµã¿è¾¼ãã ãã®åãããã¾ããã ã©ãªããæä¼ã£ã¦ãããæ¹ãåéä¸ã§ãã ããããããæã¾ããã®ã¯ãiconv ã ICU ãã¼ã«ãããã« ANSEL ããã³ MARC8 ã¨ã³ã³ã¼ãã£ã³ã°ã®ãµãã¼ãã追å ãããã¨ã§ãããã iconv ã ICU ãã¼ã«ãããã¯ããã¾ãã¾ãªè¨èªã®å¤ãã®ãªã¼ãã³ã½ã¼ã¹ããã¸ã§ã¯ãã§ ã¨ã³ã³ã¼ãã£ã³ã°å¤æã«ä½¿ç¨ããã¦ãã¾ãã </para> </listitem> <listitem> <para> <function>toXML()</function> ã¡ã½ããã¯ãç¾å¨ã¯ ã²ã¨ã¤ã® <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã«å¯¾ã㦠ã²ã¨ã¤ã®å¦¥å½ãª XML MARCXML ããã¥ã¡ã³ãã使ãã¾ãã ãµãã¤ã® <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã§ <function>toXML()</function> ãã³ã¼ã«ããçµæãåç´ã«é£çµãããã¨ã¯ã§ãã¾ããã ããããã¨ãåºæ¥ä¸ãã£ã XML ããã¥ã¡ã³ãã妥å½ãªå½¢å¼ã§ã¯ãªããªãããã§ãã è¤æ°ã®ã¬ã³ã¼ããå«ã MARCXML ããã¥ã¡ã³ãã使ãããå ´åã ç¾ç¶ã§ã¯éçºè èªèº«ã§ãããè¡ãå¿ è¦ãããã¾ããã¤ã¾ããå MARCXML ããã¥ã¡ã³ãã® <varname>record</varname> ãã¼ããåãåºããããã ã«ã¼ãè¦ç´ <varname>collection</varname> ã®ä¸ã§é£çµããã®ã§ãã </para> </listitem> </itemizedlist> </warning> <example> <title>MARCXML ãã¼ã¿ã®ãã¡ã¤ã«ã¸ã®æ¸ãè¾¼ã¿</title> <para> ãã®ä¾ã§ã¯ã<classname>File_MARC_Record</classname> ã§è¡¨ããã MARC ã¬ã³ã¼ãã使ããé å <varname>$records</varname> ã«ä¿åãã¾ãã ãã®ãã¼ã¿ã MARCXML å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ãã«ã¯ã ã¾ããã¡ã¤ã«ããã¤ããªã¢ã¼ãã§ãªã¼ãã³ãã¾ãã ããã¦é åå ã®ã¬ã³ã¼ãã®å 容ããã¡ã¤ã«ã«æ¸ãè¾¼ãããã« <function>toXML()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã </para> <programlisting role="php"><![CDATA[ require 'File/MARC.php'; // MARC ã¬ã³ã¼ãã使ãã¾ã $record = create_a_marc_record(); // ãã¤ããªæ¸ãè¾¼ã¿ã¢ã¼ãã§ãã¡ã¤ã«ããªã¼ãã³ãã¾ã $marcxml_file = fopen("records.mrc", "wb"); // ã¬ã³ã¼ãã MARCXML å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ã fwrite($marcxml_file, $record->toXML()); // ãã¡ã¤ã«ãéãã¾ã fclose($marcxml_file); ]]> </programlisting> </example> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/http/http-request.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/http/http-request.xml diff -u peardoc/ja/package/http/http-request.xml:1.1 peardoc/ja/package/http/http-request.xml:1.2 --- peardoc/ja/package/http/http-request.xml:1.1 Sun Oct 3 15:14:50 2004 +++ peardoc/ja/package/http/http-request.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.2 Maintainer: shimooka Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: shimooka Status: ready --> <sect1 id="package.http.http-request"> <title>HTTP_Request</title> @@ -17,6 +17,7 @@ &package.http.http-request.headers; &package.http.http-request.proxy-auth; &package.http.http-request.response-eval; + &package.http.http-request.listeners; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/ja/package/fileformats/file-marc/reading.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/fileformats/file-marc/reading.xml diff -u peardoc/ja/package/fileformats/file-marc/reading.xml:1.1 peardoc/ja/package/fileformats/file-marc/reading.xml:1.2 --- peardoc/ja/package/fileformats/file-marc/reading.xml:1.1 Tue Feb 13 13:21:22 2007 +++ peardoc/ja/package/fileformats/file-marc/reading.xml Sat Feb 24 01:36:03 2007 @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <refentry id="package.fileformats.file-marc.reading"> <refnamediv> - <refname>å°å ¥</refname> + <refname>MARC ãã¼ã¿ã®èªã¿è¾¼ã¿</refname> <refpurpose> - <classname>File_MARC</classname> ã«ã¤ã㦠+ <classname>File_MARC</classname> ã«ãã MARC ãã¼ã¿ã®èªã¿è¾¼ã¿ </refpurpose> </refnamediv> @@ -18,19 +18,37 @@ <classname>File_MARC</classname> ã«å梱ããã¦ãã <classname>File_MARCXML</classname> ã使ç¨ããã¨ã MARCXML å½¢å¼ã®ãã¼ã¿ãèªã¿è¾¼ããã¨ãã§ãã¾ãã - å ¥åå ã¯ãPHP ã®ã¹ããªã¼ã (SOURCE_FILE) ãããã¯æåå - (SOURCE_STRING) ã¨ãªãã¾ããã³ã³ã¹ãã©ã¯ã¿ã§ã - ãããã対å¿ãã宿°ãæå®ãã¾ãã + </para> + </refsect1> + + <refsect1 id="package.fileformats.file-marc.reading.source"> + <title>ãã¾ãã¾ãªã½ã¼ã¹ããã® MARC ãã¼ã¿ã®èªã¿è¾¼ã¿</title> + <para> + å ¥åå ã¯ãPHP ã®ã¹ããªã¼ã (<constant>SOURCE_FILE</constant>) ãããã¯æåå + (<constant>SOURCE_STRING</constant>) ã¨ãªãã¾ãã + <classname>File_MARC</classname> ããã³ <classname>File_MARCXML</classname> + ã®ã³ã³ã¹ãã©ã¯ã¿ã§ãæåã®å¼æ°ã¨ãã¦ã½ã¼ã¹ã®ä½ç½®ãã + äºçªç®ã®å¼æ°ã¨ãã¦ã½ã¼ã¹ã®å½¢å¼ãæå®ãã¾ãã </para> <example> <title>ãã¡ã¤ã«ããã® MARC 21 ãã¼ã¿ã®èªã¿è¾¼ã¿</title> + <para> + ãã®ä¾ã§ã¯ãMARC21 ãã¼ã¿ã <filename>journals.mrc</filename> + ã¨ããååã§ãã£ã¹ã¯ä¸ã«ä¿åããã¦ãããã®ã¨ãã¾ãã + MARCX21 ãã¼ã¿ãèªã¿è¾¼ãã«ã¯ã<classname>File_MARC</classname> + ã®ã³ã³ã¹ãã©ã¯ã¿ãã³ã¼ã«ãã¾ããFile_MARC ã«å¯¾ãã¦ã + <filename>journals.mrc</filename> ããã¡ã¤ã«åãªã®ã MARC + ãã¼ã¿ã¹ããªã¼ã ãæãã¦ããã®ããæå®ããå¿ è¦ã¯ããã¾ããã + <classname>File_MARC</classname> ã®ã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬äºå¼æ°ã¯ã + ããã©ã«ãã§ <constant>SOURCE_FILE</constant> ã¨ãªãããã§ãã + </para> <programlisting role="php"><![CDATA[ require 'File/MARC.php'; // MARC ã¬ã³ã¼ãããã¡ã¤ã«ããåå¾ãã¾ã -$journals = new File_MARC('journals.mrc', SOURCE_FILE); +$journals = new File_MARC('journals.mrc'); // åå¾ããã¬ã³ã¼ããé ã«å¦çãã¾ã while ($record = $journals->next()) { @@ -44,6 +62,16 @@ <example> <title>æååããã® MARCXML ãã¼ã¿ã®èªã¿è¾¼ã¿</title> + <para> + ãã®ä¾ã§ã¯ãããã¦ã§ããµã¼ãã¹ããè¿ããã MARCXML + ãã¼ã¿ã PHP ã®å¤æ° <varname>$xml_data</varname> + ã«æååã§æ ¼ç´ããã¦ãããã®ã¨ãã¾ãã + MARCXML ãã¼ã¿ãèªã¿è¾¼ãã«ã¯ã<classname>File_MARCXML</classname> + ã®ã³ã³ã¹ãã©ã¯ã¿ãã³ã¼ã«ãã¾ãã<varname>$xml_data</varname> + ãæååã§ãããã¨ã File_MARCXML ã«æããããã + ã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬äºå¼æ°ã§ <constant>SOURCE_STRING</constant> + ãæå®ãã¾ãã + </para> <programlisting role="php"><![CDATA[ require 'File/MARCXML.php'; @@ -60,23 +88,59 @@ ]]> </programlisting> </example> + </refsect1> + <refsect1 id="package.fileformats.file-marc.reading.structure"> + <title>ãã¾ãã¾ãªã½ã¼ã¹ããã® MARC ãã¼ã¿ã®èªã¿è¾¼ã¿</title> <para> <classname>File_MARC</classname> ãªãã¸ã§ã¯ãã¯ãå é é¨ã®æ å ±ã®å¾ã« <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ããé ã«ä¸¦ã¶å½¢å¼ã¨ãªãã¾ãã ããã MARC ã¬ã³ã¼ãã表ãã¾ããã¾ããåã¬ã³ã¼ããªãã¸ã§ã¯ãã¯ããããã - <classname>File_MARC_DataField</classname> ããã㯠- <classname>File_MARC_ControlField</classname> ãªãã¸ã§ã¯ãã®ç¹°ãè¿ãã«ãªãã¾ãã + <classname>File_MARC_Data_Field</classname> ããã㯠+ <classname>File_MARC_Control_Field</classname> ãªãã¸ã§ã¯ãã®ç¹°ãè¿ãã«ãªãã¾ãã ããã MARC ãã£ã¼ã«ãã表ãã¾ãã - <classname>File_MARC_DataField</classname> ã®ä¸èº«ã¯ + <classname>File_MARC_Data_Field</classname> ã®ä¸èº«ã¯ <classname>File_MARC_Subfield</classname> ãªãã¸ã§ã¯ãã®ç¹°ãè¿ãã¨ãªãã ããã MARC ãµããã£ã¼ã«ãã表ãã¾ãã </para> + <example> + <title>ã¬ã³ã¼ãã®è¦ç´ ã®è¡¨ç¤º</title> + + <programlisting role="php"><![CDATA[ +require 'File/MARC.php'; + +// MARC ã¬ã³ã¼ã群ãåå¾ãã¾ã +$bibrecords = new File_MARC('catdump.mrc', SOURCE_FILE); + +// åå¾ããã¬ã³ã¼ããé ã«å¦çãã¾ã +while ($record = $bibrecords->next()) { + // å é é¨ã表示ãã¾ã + print $record->getLeader(); + $subjects = $record->getFields('650'); + if ($subjects) { + // æåã® 24_ ãã£ã¼ã«ããåå¾ãã¾ã + print $record->getField('24.', true); + print "\n"; + + // åå¾ããä»¶åããã¹ã¦è¡¨ç¤ºãã¾ã + foreach ($subjects as $field) { + print $field; + print "\n"; + } + print "\n"; + } +} +]]> + </programlisting> + + </example> + + <para> - ã¤ã¾ãã<classname>File_MARC</classname> ã使ç¨ããã¨ã - MARC ã¬ã³ã¼ããèªã¿è¾¼ãã§ãã®ä¸ã®ç¹å®ã®ãã£ã¼ã«ãããµããã£ã¼ã«ãã®å 容ãåå¾ãããã¨ã - é常ã«ç°¡åã«ã§ãã¾ãã + ã¤ã¾ãã<classname>File_MARC</classname> ã使ç¨ããã¨ãMARC ã¬ã³ã¼ããèªã¿è¾¼ãã§ + ãã®ä¸ã®ç¹å®ã®ãã£ã¼ã«ãããµããã£ã¼ã«ãã®å 容ãåå¾ãããã¨ãç°¡åã«ã§ãã¾ãã + <classname>File_MARC</classname> ã«ã¯ããã¡ãã¡é 次å¦çãããªãã¦ã ç¹å®ã®ãã£ã¼ã«ããç°¡åã«èªã¿è¾¼ããããã«ããã¡ã½ãããããã¾ãã <methodname>getField</methodname> ã¯ã @@ -116,6 +180,88 @@ ]]> </programlisting> </example> + </refsect1> + + <refsect1 id="package.fileformats.file-marc.reading.iterating"> + <title>ãã£ã¼ã«ãããã³ãµããã£ã¼ã«ãã®é 次å¦ç</title> + <para> + <classname>File_MARC_Data_Field</classname> ãªãã¸ã§ã¯ãã + <function>foreach</function> ã§é ã«å¦çããéã«ã¯ã + æå®ãããã£ã¼ã«ãã® MARC ã¿ã°ããã¼ã¨ãã¦è¿ããã¾ãã + ã¾ãã対å¿ããå¤ã«ã¯ããµããã£ã¼ã«ã群ãè¿ããã¾ãã + </para> + <para> + åæ§ã«ã<classname>File_MARC_Subfield</classname> ãªãã¸ã§ã¯ãã + <function>foreach</function> ã§é ã«å¦çããéã«ã¯ã + æå®ãããµããã£ã¼ã«ãã®ã³ã¼ãããã¼ã¨ãã¦è¿ããã¾ãã + ã¾ãã対å¿ããå¤ã«ã¯ããã®ãµããã£ã¼ã«ãã®å¤ãè¿ããã¾ãã + </para> + + <example> + <title>MARC ã¬ã³ã¼ãå ã®ãã£ã¼ã«ãã¨ãµããã£ã¼ã«ãã®é 次å¦ç</title> + <para> + ãã®ä¾ã§ã¯ã650 ãã£ã¼ã«ããé ã«å¦çããåãã£ã¼ã«ãã® + ãµããã£ã¼ã«ãã«ããä»¶åã®è¦åºãã表示ãã¾ãã + </para> + <programlisting role="php"><![CDATA[ +require 'File/MARC.php'; + +// z39 çµææååãã MARC ã¬ã³ã¼ã群ãåå¾ãã¾ã +$bibrecords = new File_MARC($z39_result, SOURCE_STRING); + +// åã¬ã³ã¼ããå¦çãã¾ã +while ($record = $bibrecords->next()) { + // ãã£ã¼ã«ããé ã«å¦çãã¾ã + foreach ($record as $tag => $subfields) { + // 650 ãã£ã¼ã«ã以å¤ã¯èªã¿é£ã°ãã¾ã + if ($tag == '650') { + print "Subject:"; + foreach ($subfields as $code => $value) { + print " $value"; + } + print "\n"; + } + } +} +]]> + </programlisting> + + </example> + + </refsect1> + + <refsect1 id="package.fileformats.file-marc.reading.indicators"> + <title>ãã£ã¼ã«ãã¤ã³ã¸ã±ã¼ã¿ã®åå¾</title> + <para> + ãã¼ã¿ãã£ã¼ã«ã㯠<classname>File_MARC_Data_Field</classname> ã¯ã©ã¹ã§è¡¨ããã¾ãã + ãã®ã¯ã©ã¹ã®é¢æ° <function>getIndicator</function> ã使ç¨ããã¨ã + ã¤ã³ã¸ã±ã¼ã¿ã®å¤ãåå¾ãããã¨ãã§ãã¾ãã + </para> + + <example> + <title>ã¤ã³ã¸ã±ã¼ã¿ã®åå¾</title> + <para> + ãã®ä¾ã§ã¯ãMARC ã¬ã³ã¼ãã®ã¿ã¤ãã« (245) ãã£ã¼ã«ããåå¾ãã + ãã®ãã£ã¼ã«ãã®äºçªç®ã®ã¤ã³ã¸ã±ã¼ã¿ã調ã¹ã¾ããããã«ãã£ã¦ããã®ãã£ã¼ã«ãã« + ä¸¦ã¹æ¿ãã®éã«ç¡è¦ãã¹ãéãã¡ã¤ãªã³ã°ã¤ã³ã¸ã±ã¼ã¿ããããã©ããã夿ãã¾ãã + </para> + <programlisting role="php"><![CDATA[ +require 'File/MARC.php'; + +$titleField = $record->getField('245'); +$nonfiling = $titleField->getIndicator(2); + +if ($nonfiling) { + // $a ãµããã£ã¼ã«ãã®ä¸é¨ã使ç¨ãã¦ä¸¦ã¹æ¿ãã¾ã + $title = substr($titleField->getSubfield('a), $nonfiling); +} else { + // $a ãµããã£ã¼ã«ãå ¨ä½ã使ç¨ãã¦ä¸¦ã¹æ¿ãã¾ã + $title = $titleField->getSubfield('a'); +} +]]> + </programlisting> + + </example> </refsect1> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/fileformats/file-marc.xml?r1=1.2&r2=1.3&diff_format=u Index: peardoc/ja/package/fileformats/file-marc.xml diff -u peardoc/ja/package/fileformats/file-marc.xml:1.2 peardoc/ja/package/fileformats/file-marc.xml:1.3 --- peardoc/ja/package/fileformats/file-marc.xml:1.2 Tue Feb 13 13:21:22 2007 +++ peardoc/ja/package/fileformats/file-marc.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <sect1 id="package.fileformats.file-marc"> <title>File_MARC</title> @@ -11,10 +11,10 @@ <!-- &package.fileformats.file-marc.intro; - &package.fileformats.file-marc.creating; &package.fileformats.file-marc.modifying; --> &package.fileformats.file-marc.reading; + &package.fileformats.file-marc.formatting; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml diff -u peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml:1.1 peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml:1.2 --- peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml:1.1 Fri Apr 1 23:47:47 2005 +++ peardoc/ja/package/database/db-dataobject/db-dataobject/joinadd.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.9 Maintainer: shimooka Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.10 Maintainer: shimooka Status: ready --> <refentry id="package.database.db-dataobject.db-dataobject.joinadd"> <refnamediv> <refname>->joinAdd()</refname> @@ -127,16 +127,16 @@ <title>æ¬å½ã«ã·ã³ãã«ãªçµå</title> <programlisting role="php"><![CDATA[ -// (requires links.ini to be set up correctly) -// get all the images for product 24 +// (links.ini ãæ£ããè¨å®ããã¦ãããã¨ãåæã«) +// 24 çªã®è£½åã®ãã¹ã¦ã®ç»åãåå¾ãã¾ã $i = new DataObject_Image(); $pi = new DataObjects_Product_image(); -$pi->product_id = 24; // set the product id to 24 -$i->joinAdd($pi); // add the product_image connectoin +$pi->product_id = 24; // 製å ID ã 24 ã«è¨å®ãã¾ã +$i->joinAdd($pi); // product_image ãæ¥ç¶ãã¾ã $i->find(); while ($i->fetch()) { -// do stuff +// ä½ãã®å¦çãè¡ãã¾ã } ]]> @@ -146,10 +146,10 @@ <title>çµæã® SQL</title> <programlisting> <![CDATA[ -SELECT * FROM image,product_image - LEFT JOIN image ON product_image +SELECT * FROM image + LEFT JOIN product_image + ON (image.id = product_image.image_id) WHERE product_image.id = 24 - AND product_image.pid = product.id ]]> </programlisting> </example> @@ -158,8 +158,8 @@ <title>ããè¤é㪠JOIN ã¯ã¨ãª</title> <programlisting role="php"><![CDATA[ -// an example with 2 joins -// get all the images linked with products or productgroups +// ãµãã¤ã® JOIN ã使ç¨ããä¾ +// 製åãããã¯è£½åã°ã«ã¼ãã«é¢é£ãããã¹ã¦ã®ç»åãåå¾ãã¾ã $i = new DataObject_Image(); $pi = new DataObject_Product_image(); $pgi = new DataObject_Productgroup_image(); @@ -167,7 +167,7 @@ $i->joinAdd($pgi); $i->find(); while ($i->fetch()) { -// do stuff +// ä½ãã®å¦çãè¡ãã¾ã } @@ -178,13 +178,12 @@ <title>çµæã® SQL</title> <programlisting> <![CDATA[ -SELECT * FROM image,product_image - LEFT JOIN image ON product_image - LEFT JOIN image ON productgroup_image - WHERE product - AND product.id = product_image.pid - AND product.id = productgroup_image.pid -]]> +SELECT * FROM image + LEFT JOIN product_image + ON (image.id = product_image.image_id) + LEFT JOIN productgroup + ON (image.id = productgroup_image.image_id); + ]]> </programlisting> </example> </refsect1> http://cvs.php.net/viewvc.cgi/peardoc/ja/chapters/contributing.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/ja/chapters/contributing.xml diff -u peardoc/ja/chapters/contributing.xml:1.5 peardoc/ja/chapters/contributing.xml:1.6 --- peardoc/ja/chapters/contributing.xml:1.5 Tue May 2 13:42:58 2006 +++ peardoc/ja/chapters/contributing.xml Sat Feb 24 01:36:03 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.16 Maintainer: Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.17 Maintainer: Status: ready --> <chapter id="contributing"> <chapterinfo> <author> @@ -77,8 +77,12 @@ </para> <para> - 次ã®ã¹ãããã¯ããããã®éä»ã§ããããã±ã¼ã¸ã®ã¡ã³ããã« CC ãã¤ãã¦ã - &email.pear.dev; ã«ã¡ã¼ã«ãæ¸ãã¦ãã ãããã¡ã¼ã«ã®ä»¶åã¯ã + 次ã®ã¹ãããã¯ããããã®æç¨¿ã§ããããã«ã¯ãåºæ¬çã«äºéãã®æ¹æ³ãããã¾ãã + æåã®æ¹æ³ã¯ãå½è©²ããã±ã¼ã¸ã«ã¤ãã¦ã®ãã°ã¬ãã¼ãã使ãã¦ããããæç¨¿ãããã¨ã§ãã + ãããè¡ãã«ã¯ãpear.php.net ä¸ã®ããã±ã¼ã¸ã®ãã¼ã ãã¼ã¸ã«è¡ãã + ãã¼ã¸ã®ä¸ã®ã»ãã«ããã¿ã "Bugs" ãã¯ãªãã¯ãã¾ãã + ããã²ã¨ã¤ã®æ¹æ³ã¯ãããã±ã¼ã¸ã®ã¡ã³ããã« Cc ãã¤ãã¦ã + &email.pear.dev; ã«ã¡ã¼ã«ãæ¸ããã¨ã§ããã¡ã¼ã«ã®ä»¶åã¯ã '[Patch]' ããã¯ããã¦ããããã®æç¨¿ã§ãããã¨ãå¤ããããããã¨è¯ãã§ãããã ã¾ãããããã®å 容ã®è©³ãã説æãæ¸ãã¦ãã ããã .diff ãã¡ã¤ã«ãã¡ã¼ã«ã«æ·»ä»ããã®ãå¿ããªãããã«ã http://cvs.php.net/viewvc.cgi/peardoc/ja/package/http/http-request/listeners.xml?view=markup&rev=1.1 Index: peardoc/ja/package/http/http-request/listeners.xml +++ peardoc/ja/package/http/http-request/listeners.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="package.http.http-request.listeners"> <refnamediv> <refname>HTTP_Request_Listener</refname> <refpurpose> HTTP_Request æä½ã«ãªã¹ãã¼ãã¢ã¿ãããã </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.listeners.intro"> <title>HTTP_Request_Listener ã«ã¤ãã¦</title> <titleabbrev>å°å ¥</titleabbrev> <para> <classname>HTTP_Request_Listener</classname> ã¯æ½è±¡ã¯ã©ã¹ã§ãã ãããç¶æ¿ããã¨ãçºçããã¤ãã³ããåãåã£ã¦ããã«å¯¾ããå¿çãè¿ããã¨ãã§ãã¾ãã HTTP_Request ã«ã¯ãã³ã³ã½ã¼ã«ãã¼ã¹ã®ããã°ã¬ã¹ãã¼ã®ãµã³ãã«ãå«ã¾ãã¦ãã¾ãã ãããå®è£ ããã«ã¯ã<classname>HTTP_Request_DownloadListener</classname> ã¯ã©ã¹ã使ç¨ãã¾ããããã¯ã <link linkend="package.console.console-progressbar">Console_ProgressBar</link> ããã±ã¼ã¸ã使ç¨ãã¦ãã¦ã³ãã¼ãã®é²æã¡ã¼ã¿ã¼ã表示ãã¾ãã </para> </refsect1> <refsect1 id="package.http.http-request.listeners.usage"> <title>HTTP_Request_Listener ã®ä½¿ç¨ä¾</title> <para> ãªã¹ãã¼ã使ç¨ããã«ã¯ã確èªãããç¹å®ã® <classname>HTTP_Request</classname> ããã㯠<classname>HTTP_Response</classname> ãªãã¸ã§ã¯ãã«å¯¾ãã¦ãªã¹ãã¼ãã¢ã¿ããããå¿ è¦ãããã¾ãã ã¢ã¿ããããã³ã¼ãã¯ããµã³ãã«ã®ä¸çªæå¾ã«ããã¾ãã ãããããã ãã¦ãããã¨ããã<classname>HTTP_Request</classname> ãããã®é ä¸ã®ãã¹ã¦ã® <classname>HTTP_Response</classname> ãªãã¸ã§ã¯ãã«å¯¾ãã¦ã¤ãã³ããªã¹ãã¼ã伿ãã¾ãã ããã¦æåã® <classname>HTTP_Request</classname> ãªãã¸ã§ã¯ãã«å¯¾ãã¦ã®ã¿ã¢ã¿ãããå¿ è¦ã¨ãªãã¾ãã </para> <example> <title>HTTP_Request_Listener ã使ç¨ãããã¦ã³ãã¼ã鲿ãã¼</title> <programlisting role="php"> <![CDATA[ <?php /** * HTTP_Request ã§ã®ãªã¹ãã¼ã®ä½¿ç¨ä¾ã§ããããã¯ããã¡ã¤ã«ã® * ãã¦ã³ãã¼ãã¨ä¿åãè¡ãã¨åæã«ãå¦çã®é²æç¶æ³ããã¼ã§è¡¨ç¤ºãã¾ã * * 注æãã¹ãç¹ã¯ä»¥ä¸ã®ã¨ããã§ã * 1) ãã©ã¦ã¶ã§ãªããã³ã³ã½ã¼ã«ããå®è¡ããªãã¨ããã¾ãã * 2) åºåãããã¡ãªã³ã°ã OFF ã«ããªãã¨æ£å¸¸ã«åä½ãã¾ãã */ require_once 'HTTP/Request.php'; require_once 'HTTP/Request/Listener.php'; require_once 'Console/ProgressBar.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); set_time_limit(0); class HTTP_Request_DownloadListener extends HTTP_Request_Listener { /** * 対象ã¨ãªããã¡ã¤ã«ã®ãã³ãã« * @var int */ var $_fp; /** * ã¤ã³ã¸ã±ã¼ã¿ã®è¡¨ç¤ºã«ä½¿ç¨ãã Console_ProgressBar ã®ã¤ã³ã¹ã¿ã³ã¹ * @var object */ var $_bar; /** * 対象ã¨ãªããã¡ã¤ã«ã®åå * @var string */ var $_target; /** * åä¿¡ãããã¡ã¤ã«ã®ãã¤ãæ° * @var int */ var $_size = 0; function HTTP_Request_DownloadListener() { $this->HTTP_Request_Listener(); } /** * 対象ã¨ãªããã¡ã¤ã«ããªã¼ãã³ãã * @param string ãã¡ã¤ã«å * @throws PEAR_Error */ function setTarget($target) { $this->_target = $target; $this->_fp = @fopen($target, 'wb'); if (!$this->_fp) { PEAR::raiseError("'{$target}' ããªã¼ãã³ã§ãã¾ãã"); } } function update(&$subject, $event, $data = null) { switch ($event) { case 'sentRequest': $this->_target = basename($subject->_url->path); break; case 'gotHeaders': if (isset($data['content-disposition']) && preg_match('/filename="([^"]+)"/', $data['content-disposition'], $matches)) { $this->setTarget(basename($matches[1])); } else { $this->setTarget($this->_target); } $this->_bar =& new Console_ProgressBar( '* ' . $this->_target . ' %fraction% KB [%bar%] %percent%', '=>', '-', 79, (isset($data['content-length'])? round($data['content-length'] / 1024): 100) ); $this->_size = 0; break; case 'tick': $this->_size += strlen($data); $this->_bar->update(round($this->_size / 1024)); fwrite($this->_fp, $data); break; case 'gotBody': fclose($this->_fp); break; default: PEAR::raiseError("ã¤ãã³ã '{$event}' ãå¦çã§ãã¾ãã"); } // switch } } // å¥ã®ããã±ã¼ã¸ã使ç¨ãã¦ããã¾ãã¾ããããã§ããã ã大ãç®ã®ãã®ã // é¸ã°ãªãã¨é²æãã¼ãè¦ãã¾ãã $url = 'http://pear.php.net/get/HTML_QuickForm-stable'; $req =& new HTTP_Request($url); $download =& new HTTP_Request_DownloadListener(); $req->attach($download); $req->sendRequest(false); ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.http.http-request.listeners.detail"> <title>ææã§ããã¤ãã³ã</title> <para> <classname>HTTP_Request</classname> ã¯ã©ã¹ã¯ãããã®ã¤ãã³ããéä¿¡ãã¾ãã <itemizedlist> <listitem> <para> <literal>connect</literal> - ãµã¼ãã¨æ¥ç¶ããéã«ãã®ã¤ãã³ããéä¿¡ãã¾ãã </para> </listitem> <listitem> <para> <literal>sentRequest</literal> - ãªã¯ã¨ã¹ããéä¿¡ããå¾ã§ãã®ã¤ãã³ããéä¿¡ãã¾ãã </para> </listitem> <listitem> <para> <literal>disconnect</literal> - ãµã¼ãã¨ã®æ¥ç¶ãåæããå¾ã§ãã®ã¤ãã³ããéä¿¡ãã¾ãã </para> </listitem> </itemizedlist> </para> <para> <classname>HTTP_Response</classname> ã¯ã©ã¹ã¯ãããã®ã¤ãã³ããéä¿¡ãã¾ãã <itemizedlist> <listitem> <para> <literal>gotHeaders</literal> - ã¬ã¹ãã³ã¹ããããåä¿¡ãããã¨ã§ãã®ã¤ãã³ããéä¿¡ãã¾ã (ãããã飿³é åã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> <listitem> <para> <literal>tick</literal> - ã¬ã¹ãã³ã¹æ¬æã®ä¸é¨ãåä¿¡ããéã«ãã®ã¤ãã³ããéä¿¡ãã¾ã (åä¿¡ããå 容ãæååã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> <listitem> <para> <literal>gzTick</literal> - gzip å§ç¸®ãããã¬ã¹ãã³ã¹æ¬æã®ä¸é¨ãåä¿¡ããéã«ãã®ã¤ãã³ããéä¿¡ãã¾ã (åä¿¡ããå 容ãæååã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> <listitem> <para> <literal>gotBody</literal> - ã¬ã¹ãã³ã¹å ¨ä½ãåä¿¡ãçµããå¾ã§ãã®ã¤ãã³ããéä¿¡ãã¾ã (gzip å§ç¸®ããã¦ããå ´åãããããã³ã¼ãããå 容ãæååã¨ã㦠$data ã«æ¸¡ããã¾ã)ã </para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/fileformats/file-marc/formatting.xml?view=markup&rev=1.1 Index: peardoc/ja/package/fileformats/file-marc/formatting.xml +++ peardoc/ja/package/fileformats/file-marc/formatting.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="package.fileformats.file-marc.formatting"> <refnamediv> <refname>MARC ãã¼ã¿ã®ãã©ã¼ããã</refname> <refpurpose> <classname>File_MARC</classname> ã使ç¨ãã MARC ãã¼ã¿ã®æ´å½¢ </refpurpose> </refnamediv> <refsect1 id="package.fileformats.file-marc.formatting.overview"> <title>æ¦è¦</title> <para> <classname>File_MARC_Record</classname> ã¯ã©ã¹ã使ç¨ããã¨ã Machine Readable Cataloging (<acronym>MARC</acronym>) ãã¼ã¿ã MARC 21 å½¢å¼ãå¯èªå½¢å¼ã®æååããã³ (å¶éã¯ããã¾ãã) MARCXML å½¢å¼ã§æ¸ãåºããã¨ãã§ãã¾ãã </para> </refsect1> <refsect1 id="package.fileformats.file-marc.formatting.marc21"> <title>MARC 21 å½¢å¼ã¸ã®æ´å½¢</title> <para> ã¬ã³ã¼ãã MARC 21 å½¢å¼ã§è¿ãã«ã¯ã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>toRaw()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã </para> <example> <title>MARC 21 ãã¼ã¿ã®ãã¡ã¤ã«ã¸ã®æ¸ãè¾¼ã¿</title> <para> ãã®ä¾ã§ã¯ã<classname>File_MARC_Record</classname> ã§è¡¨ããã MARC ã¬ã³ã¼ãã使ããé å <varname>$records</varname> ã«ä¿åãã¾ãã ãã®ãã¼ã¿ã MARC 21 å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ãã«ã¯ã ã¾ããã¡ã¤ã«ããã¤ããªã¢ã¼ãã§ãªã¼ãã³ãã¾ãã ããã¦é åå ã®ã¬ã³ã¼ãã®å 容ããã¡ã¤ã«ã«æ¸ãè¾¼ãããã« <function>toRaw()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã ãããã¬ã³ã¼ããã¨ã«ç¹°ãè¿ãã¾ãã </para> <programlisting role="php"><![CDATA[ require 'File/MARC.php'; // convert_metadata_to_marc() ã¯æ¶ç©ºã®ã¡ã½ããã§ã // File_MARC_Record ãªãã¸ã§ã¯ãã®é åãè¿ãã¾ã $records = convert_metadata_to_marc(); // ãã¤ããªæ¸ãè¾¼ã¿ã¢ã¼ãã§ãã¡ã¤ã«ããªã¼ãã³ãã¾ã $marc21_file = fopen("records.mrc", "wb"); // ã¬ã³ã¼ããé ã«å¦çãã¾ã while ($record = $records->next()) { // åã¬ã³ã¼ãããMARC 21 å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ã fwrite($marc21_file, $record->toRaw()); } // ãã¡ã¤ã«ãéãã¾ã fclose($marc21_file); ]]> </programlisting> </example> </refsect1> <refsect1 id="package.fileformats.file-marc.formatting.human"> <title>MARC ãã¼ã¿ããã®å¯èªå½¢å¼ã®åºåã®ä½æ</title> <para> å¯èªå½¢å¼ã§ MARC 21 ããã㯠MARCXML ã¬ã³ã¼ããè¿ãã«ã¯ã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>__toString()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>print()</function> 颿°ãã³ã¼ã«ããéã«ã¯ãæé»çã« <function>__toString()</function> ã¡ã½ãããã³ã¼ã«ãã¦ãããã¨ã«æ³¨æãã¾ãããã </para> <example> <title>MARC ã®å¯èªå½¢å¼ãè¿ã</title> <para> ãã®ä¾ã§ã¯ãå MARC ã¬ã³ã¼ãã®å 容ãå¯èªå½¢å¼ã§è¡¨ç¤ºãã¾ãã ã¾ããæç¤ºçã« <function>__toString()</function> ã¡ã½ãããã³ã¼ã«ãã å¯èªå½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ããå ¥åå½¢å¼ã MARC ããã㯠MARCXML ã®ã©ã¡ãã§ãã£ã¦ããåºåç¨ã«ãã¼ã¿ãæ´å½¢ããã¡ã½ããã¯åãã§ãããã¨ã«æ³¨æãã¾ãããã </para> <programlisting role="php"><![CDATA[ require 'File/MARCXML.php'; // MARCXML ã¬ã³ã¼ã群ãæååããåå¾ãã¾ã $journals = new File_MARCXML($xml_data, SOURCE_STRING); // ãã¤ããªæ¸ãè¾¼ã¿ã¢ã¼ãã§ãã¡ã¤ã«ããªã¼ãã³ãã¾ã $marc21_file = fopen("records.mrc", "wb"); // åå¾ããã¬ã³ã¼ããé ã«å¦çãã¾ã while ($record = $journals->next()) { // åã¬ã³ã¼ãããããã«è¡¨ç¤ºãã¾ã print $record; print "\n"; // ãããã«æ´å½¢ããã¬ã³ã¼ãããã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ã fwrite($marc21_file, $record->__toString() . "\n"); } // ãã¡ã¤ã«ãéãã¾ã fclose($marc21_file); ]]> </programlisting> </example> </refsect1> <refsect1 id="package.fileformats.file-marc.writing.marcxml"> <title>MARCXML å½¢å¼ã¸ã®æ´å½¢</title> <para> ã¬ã³ã¼ãã MARCXML å½¢å¼ã§è¿ãã«ã¯ã <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã® <function>toXML()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã </para> <warning> <title><function>toXML()</function> ã¡ã½ããã®éè¦ãªå¶ç´</title> <itemizedlist> <listitem> <para> æãéè¦ãªã®ã¯ãPHP ã§ã¯ MARC8 ã¨ã³ã³ã¼ãã£ã³ã°ããã®å¤æãè¡ããªãã¨ãããã¨ã§ãã ãã®ã¨ã³ã³ã¼ãã£ã³ã°ã¯æ¢åã® MARC ã¬ã³ã¼ãã®å¤ãã§ç¨ãããã¦ãã¾ããã ããã XML ã§æå¹ãªã¨ã³ã³ã¼ãã£ã³ã°ããã¨ãã° UTF-8 ãªã©ã«å¤æãããã¨ã¯ããã¾ãããä»è¨èªçã® MARC ã©ã¤ãã©ãªã¯ã ç¬èªã®æåã¨ã³ã³ã¼ãã£ã³ã°å¤æã©ã¤ãã©ãªã使ãããã¨ã§ãã®åé¡ã«å¯¾å¿ãã¦ããããã§ãã ç¾æç¹ã§ã¯ã<classname>File_MARC</classname> ã®ä½è ã¯åçã®æ©è½ã®ãµãã¼ãã PEAR ããã±ã¼ã¸ã¨ãã¦çµã¿è¾¼ãã ãã®åãããã¾ããã ã©ãªããæä¼ã£ã¦ãããæ¹ãåéä¸ã§ãã ããããããæã¾ããã®ã¯ãiconv ã ICU ãã¼ã«ãããã« ANSEL ããã³ MARC8 ã¨ã³ã³ã¼ãã£ã³ã°ã®ãµãã¼ãã追å ãããã¨ã§ãããã iconv ã ICU ãã¼ã«ãããã¯ããã¾ãã¾ãªè¨èªã®å¤ãã®ãªã¼ãã³ã½ã¼ã¹ããã¸ã§ã¯ãã§ ã¨ã³ã³ã¼ãã£ã³ã°å¤æã«ä½¿ç¨ããã¦ãã¾ãã </para> </listitem> <listitem> <para> <function>toXML()</function> ã¡ã½ããã¯ãç¾å¨ã¯ ã²ã¨ã¤ã® <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã«å¯¾ã㦠ã²ã¨ã¤ã®å¦¥å½ãª XML MARCXML ããã¥ã¡ã³ãã使ãã¾ãã ãµãã¤ã® <classname>File_MARC_Record</classname> ãªãã¸ã§ã¯ãã§ <function>toXML()</function> ãã³ã¼ã«ããçµæãåç´ã«é£çµãããã¨ã¯ã§ãã¾ããã ããããã¨ãåºæ¥ä¸ãã£ã XML ããã¥ã¡ã³ãã妥å½ãªå½¢å¼ã§ã¯ãªããªãããã§ãã è¤æ°ã®ã¬ã³ã¼ããå«ã MARCXML ããã¥ã¡ã³ãã使ãããå ´åã ç¾ç¶ã§ã¯éçºè èªèº«ã§ãããè¡ãå¿ è¦ãããã¾ããã¤ã¾ããå MARCXML ããã¥ã¡ã³ãã® <varname>record</varname> ãã¼ããåãåºããããã ã«ã¼ãè¦ç´ <varname>collection</varname> ã®ä¸ã§é£çµããã®ã§ãã </para> </listitem> </itemizedlist> </warning> <example> <title>MARCXML ãã¼ã¿ã®ãã¡ã¤ã«ã¸ã®æ¸ãè¾¼ã¿</title> <para> ãã®ä¾ã§ã¯ã<classname>File_MARC_Record</classname> ã§è¡¨ããã MARC ã¬ã³ã¼ãã使ããé å <varname>$records</varname> ã«ä¿åãã¾ãã ãã®ãã¼ã¿ã MARCXML å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ãã«ã¯ã ã¾ããã¡ã¤ã«ããã¤ããªã¢ã¼ãã§ãªã¼ãã³ãã¾ãã ããã¦é åå ã®ã¬ã³ã¼ãã®å 容ããã¡ã¤ã«ã«æ¸ãè¾¼ãããã« <function>toXML()</function> ã¡ã½ãããã³ã¼ã«ãã¾ãã </para> <programlisting role="php"><![CDATA[ require 'File/MARC.php'; // MARC ã¬ã³ã¼ãã使ãã¾ã $record = create_a_marc_record(); // ãã¤ããªæ¸ãè¾¼ã¿ã¢ã¼ãã§ãã¡ã¤ã«ããªã¼ãã³ãã¾ã $marcxml_file = fopen("records.mrc", "wb"); // ã¬ã³ã¼ãã MARCXML å½¢å¼ã§ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿ã¾ã fwrite($marcxml_file, $record->toXML()); // ãã¡ã¤ã«ãéãã¾ã fclose($marcxml_file); ]]> </programlisting> </example> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->