cvs: peardoc /ja/package/database/db-dataobject/db-dataobject setfrom.xml toarray.xml /ja/package/database/db-nestedset intro.xml /ja/package/http/http-session2 cookies.xml intro.xml /ja/package/structures/structures-datagrid faq.xml /ja/package/structures/structures-datagrid/structures-datagrid-datasource dbtable.xml

[email protected] ("TAKAGI Masahiro")
Newsgroups php.pear.doc
Message-ID <cvstakagi1198208812@cvsserver>
takagi		Fri Dec 21 03:46:52 2007 UTC

  Modified files:              
    /peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource	
                                                                                     	dbtable.xml 
    /peardoc/ja/package/structures/structures-datagrid	faq.xml 
    /peardoc/ja/package/http/http-session2	intro.xml cookies.xml 
    /peardoc/ja/package/database/db-nestedset	intro.xml 
    /peardoc/ja/package/database/db-dataobject/db-dataobject	
                                                            	toarray.xml 
                                                            	setfrom.xml 
  Log:
  sync with en.
takagi-20071221034652.txt (text/plain, 13.6 KB)
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource/dbtable.xml?r1=1.5&r2=1.6&diff_format=u
Index: peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource/dbtable.xml
diff -u peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource/dbtable.xml:1.5 peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource/dbtable.xml:1.6
--- peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource/dbtable.xml:1.5	Fri Jul 27 03:18:47 2007
+++ peardoc/ja/package/structures/structures-datagrid/structures-datagrid-datasource/dbtable.xml	Fri Dec 21 03:46:51 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- $Revision: 1.5 $ -->
-<!-- EN-Revision: 1.9 Maintainer: takagi Status: ready -->
+<!-- $Revision: 1.6 $ -->
+<!-- EN-Revision: 1.10 Maintainer: takagi Status: ready -->
 <refentry id="package.structures.structures-datagrid.structures-datagrid-datasource.dbtable">
  <refnamediv>
   <refname>Structures_DataGrid_DataSource_DBTable</refname>
@@ -139,6 +139,78 @@
    を設定していない場合は、オプション 'primaryKey'
    を使用して主キーフィールドを定義することができます。
   </para>
+  <para>
+  </para>
+ </refsect1>
+ <refsect1 id="package.structures.structures-datagrid.structures-datagrid-datasource.dbtable.examples">
+  <title>例</title>
+  <example>
+   <title>DB_Table クラスを Structures_DataGrid にバインドする</title>
+   <programlisting role="php">
+<![CDATA[
+<?php
+// DB_Table を継承した、基本的な guestbook クラス
+class GuestBook_Table extends DB_Table
+{
+    var $col = array(
+        // 一意な行 ID
+        'id' => array(
+            'type'    => 'integer',
+            'require' => true
+        ),
+        // 名
+        'fname' => array(
+            'type'    => 'varchar',
+            'size'    => 32
+        ),
+        // 姓
+        'lname' => array(
+            'type'    => 'varchar',
+            'size'    => 64
+        ),
+        // メールアドレス
+        'email' => array(
+            'type'    => 'varchar',
+            'size'    => 128,
+            'require' => true
+        ),
+        // 登録日
+        'signdate' => array(
+            'type'    => 'date',
+            'require' => true
+        )
+    );
+    var $idx = array();  // インデックスは今回は気にしません
+    var $sql = array(
+        // リストに表示する行
+        'list' => array( 
+            'select' => 'id, signdate, CONCAT(fname, " ", lname) AS fullname',
+            'order'  => 'signdate DESC'
+        )
+    );
+}
+
+// DB_Table を継承したクラスのインスタンスを作成します
+// (既存のデータベース接続を用い、テーブル名は 'guestbook' となります)
+$guestbook =& new GuestBook_Table($db, 'guestbook');
+
+// bind() 用のオプションを設定します
+// ($sql 配列の定義済みクエリ 'list' と where 条件を使用します)
+$options = array('view' => 'list', 'where' => 'YEAR(signdate) = 2100');
+
+// guestbook オブジェクトをバインドします
+// (レンダリングの前にカラムを作成していない場合は、
+// id, signdate, fullname の 3 つのカラムが生成されます)
+$test = $datagrid->bind($guestbook, $options);
+
+// バインド時にエラーが発生したら、それを表示します
+if (PEAR::isError($test)) {
+    echo $test->getMessage(); 
+}
+?>
+]]>
+   </programlisting>
+  </example>
  </refsect1>
 </refentry>
 <!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/structures/structures-datagrid/faq.xml?r1=1.7&r2=1.8&diff_format=u
Index: peardoc/ja/package/structures/structures-datagrid/faq.xml
diff -u peardoc/ja/package/structures/structures-datagrid/faq.xml:1.7 peardoc/ja/package/structures/structures-datagrid/faq.xml:1.8
--- peardoc/ja/package/structures/structures-datagrid/faq.xml:1.7	Fri Dec 14 11:36:35 2007
+++ peardoc/ja/package/structures/structures-datagrid/faq.xml	Fri Dec 21 03:46:51 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- $Revision: 1.7 $ -->
-<!-- EN-Revision: 1.9 Maintainer: takagi Status: ready -->
+<!-- $Revision: 1.8 $ -->
+<!-- EN-Revision: 1.10 Maintainer: takagi Status: ready -->
 <refentry id="package.structures.structures-datagrid.faq">
  <refnamediv>
   <refname>FAQ</refname>
@@ -64,7 +64,7 @@
     </question>
     <answer>
      <para>
-      現時点では、効率を考慮すると次の 4 つのデータソースドライバがお勧めです。
+      現時点では、効率を考慮すると次の 5 つのデータソースドライバがお勧めです。
      </para>
      <itemizedlist>
       <listitem>
@@ -87,6 +87,11 @@
         MDB2
        </para>
       </listitem>
+      <listitem>
+       <para>
+        PDO
+       </para>
+      </listitem>
      </itemizedlist>
      <para>
       これら 4 つのドライバは、必要なレコードだけをデータベースから取得します。
@@ -208,8 +213,8 @@
    <qandaentry>
     <question>
      <para>
-     すべての行が 1 ページで表示されてしまいます。
-     ページ分けするにはどうしたらいいですか?
+      すべての行が 1 ページで表示されてしまいます。
+      ページ分けするにはどうしたらいいですか?
      </para>
     </question>
     <answer>
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/http/http-session2/intro.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/ja/package/http/http-session2/intro.xml
diff -u peardoc/ja/package/http/http-session2/intro.xml:1.2 peardoc/ja/package/http/http-session2/intro.xml:1.3
--- peardoc/ja/package/http/http-session2/intro.xml:1.2	Mon Dec 17 13:19:04 2007
+++ peardoc/ja/package/http/http-session2/intro.xml	Fri Dec 21 03:46:51 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.4 Maintainer: takagi Status: ready -->
 <refentry id="package.http.http-session2.intro">
  <refnamediv>
   <refname>導入</refname>
@@ -15,8 +15,11 @@
   <para>
    このパッケージは、セッションステートやセッションレベルにアクセスしたり
    有効期限の管理用メソッドを使用したりすることができます。
+  </para>
+
+  <para>
    標準の <acronym>PHP</acronym> のセッション管理機能をもとにしていますが、
-   データベースをコンテナに使用できたり、
+   HTTP_Session2 ではデータベースをコンテナに使用できたり
    有効期限やアイドル時間を管理したりといった追加機能も提供しています。
   </para>
 
@@ -33,9 +36,10 @@
 HTTP_Session2::start('MySessionID');
 HTTP_Session2::set('variable', 'The string');
 if (HTTP_Session2::isNew()) {
-    echo('現在のリクエストで新たなセッションが作成されました');
+    echo '現在のリクエストで新たなセッションが作成されました';
     $visitors++; // 訪問者数の更新
 }
+// 続く
    </programlisting>
   </example>
 
@@ -48,7 +52,7 @@
 HTTP_Session2::setExpire(time() + 60 * 60); // 有効期限は 1 時間
 HTTP_Session2::setIdle(time() + 10 * 60);   // アイドル時間は 10 分
 
-// 期限切れ
+// セッションの期限切れ
 if (HTTP_Session2::isExpired()) {
     echo 'セッションの有効期限が切れました!';
     HTTP_Session2::destroy();
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/http/http-session2/cookies.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/ja/package/http/http-session2/cookies.xml
diff -u peardoc/ja/package/http/http-session2/cookies.xml:1.2 peardoc/ja/package/http/http-session2/cookies.xml:1.3
--- peardoc/ja/package/http/http-session2/cookies.xml:1.2	Mon Dec 17 13:19:04 2007
+++ peardoc/ja/package/http/http-session2/cookies.xml	Fri Dec 21 03:46:51 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.5 Maintainer: takagi Status: ready -->
 <refentry id="package.http.http-session2.cookies">
  <refnamediv>
   <refname>セッションの永続化</refname>
@@ -14,22 +14,30 @@
   <title>解説</title>
 
   <para>
-   <classname>HTTP_Session2</classname> は、PHP の session_*
-   系の標準関数へのオブジェクト指向なインターフェイスを提供します。
-   セッションを作成したら、セッション ID でそれを参照することになります。
-   セッション ID は一般的にクッキーに保存され、
-   ブラウザが立ち上がっている間は有効となります。
-   このクッキーの有効期間を延長する
-   (標準では、ブラウザを閉じたら期限切れになります)
-   には、PHP の session_set_cookie_params を使用します。
+   セッションを作成したら、それを参照するためにセッション ID を使用することになります。
+   セッション ID は、一般的にはクッキーに保存したり URI に含めたりします。
   </para>
+
+  <para>
+   ブラウザを新たに立ち上げた際にセッション ID を覚えておけるようにするには、
+   クッキー方式がお勧めです。
+  </para>
+
+  <para>
+   クッキーの有効期限を延長する
+   (標準では、ブラウザを閉じた時点で期限切れとなります)
+   ために、PHP の
+   <ulink url="&url.php;session_set_cookie_params">session_set_cookie_params()</ulink>
+   を使用します。
+  </para>
+
  </refsect1>
 
  <refsect1 id="package.http.http-session2.cookies.examples">
   <title>例</title>
 
   <example>
-   <title>MDB2 によるセッションデータのデータベースへの保存</title>
+   <title>session_set_cookie_params の使用法</title>
 
    <programlisting role="php">
 require_once 'HTTP/Session2.php';
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/database/db-nestedset/intro.xml?r1=1.4&r2=1.5&diff_format=u
Index: peardoc/ja/package/database/db-nestedset/intro.xml
diff -u peardoc/ja/package/database/db-nestedset/intro.xml:1.4 peardoc/ja/package/database/db-nestedset/intro.xml:1.5
--- peardoc/ja/package/database/db-nestedset/intro.xml:1.4	Thu Dec 20 02:19:57 2007
+++ peardoc/ja/package/database/db-nestedset/intro.xml	Fri Dec 21 03:46:51 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.4 $ -->
-<!-- EN-Revision: 1.5 Maintainer: takagi Status: ready -->
+<!-- $Revision: 1.5 $ -->
+<!-- EN-Revision: 1.6 Maintainer: takagi Status: ready -->
 <refentry id="package.DB_NestedSet">
  <refnamediv>
   <refname>導入</refname>
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/database/db-dataobject/db-dataobject/toarray.xml?r1=1.4&r2=1.5&diff_format=u
Index: peardoc/ja/package/database/db-dataobject/db-dataobject/toarray.xml
diff -u peardoc/ja/package/database/db-dataobject/db-dataobject/toarray.xml:1.4 peardoc/ja/package/database/db-dataobject/db-dataobject/toarray.xml:1.5
--- peardoc/ja/package/database/db-dataobject/db-dataobject/toarray.xml:1.4	Fri Dec 14 11:36:35 2007
+++ peardoc/ja/package/database/db-dataobject/db-dataobject/toarray.xml	Fri Dec 21 03:46:52 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- $Revision: 1.4 $ -->
-<!-- EN-Revision: 1.5 Maintainer: shimooka Status: ready -->
+<!-- $Revision: 1.5 $ -->
+<!-- EN-Revision: 1.6 Maintainer: shimooka Status: ready -->
 <refentry id="package.database.db-dataobject.db-dataobject.toarray">
    <refnamediv>
     <refname>-&gt;toArray()</refname>
@@ -13,11 +13,11 @@
       <funcdef>array <function>$DB_DataObject-&gt;toArray</function></funcdef>
 
       <paramdef>
-       string <parameter><optional>$format</optional></parameter>
+       string <parameter><optional>$format = '%s'</optional></parameter>
       </paramdef>
 
       <paramdef>
-       bool <parameter><optional>$hideEmpty</optional></parameter>
+       bool <parameter><optional>$hideEmpty = &false;</optional></parameter>
       </paramdef>
 
      </funcprototype>
http://cvs.php.net/viewvc.cgi/peardoc/ja/package/database/db-dataobject/db-dataobject/setfrom.xml?r1=1.1&r2=1.2&diff_format=u
Index: peardoc/ja/package/database/db-dataobject/db-dataobject/setfrom.xml
diff -u peardoc/ja/package/database/db-dataobject/db-dataobject/setfrom.xml:1.1 peardoc/ja/package/database/db-dataobject/db-dataobject/setfrom.xml:1.2
--- peardoc/ja/package/database/db-dataobject/db-dataobject/setfrom.xml:1.1	Fri Apr  1 23:47:47 2005
+++ peardoc/ja/package/database/db-dataobject/db-dataobject/setfrom.xml	Fri Dec 21 03:46:52 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- $Revision: 1.1 $ -->
-<!-- EN-Revision: 1.7 Maintainer: shimooka Status: ready -->
+<!-- $Revision: 1.2 $ -->
+<!-- EN-Revision: 1.8 Maintainer: shimooka Status: ready -->
 <refentry id="package.database.db-dataobject.db-dataobject.setfrom">
    <refnamediv>
     <refname>-&gt;setFrom()</refname>
@@ -18,6 +18,9 @@
       <paramdef>
        string  <parameter><optional>$format = '%s'</optional></parameter>
       </paramdef>
+      <paramdef>
+       bool <parameter><optional>$skipEmpty = &false;</optional></parameter>
+      </paramdef>
 
      </funcprototype>
     </funcsynopsis>
@@ -73,6 +76,14 @@
         'prefix_%s' を指定します。
         </para>
       </listitem>
+      
+      <listitem>
+       <para>
+        <parameter>bool $skipEmpty</parameter> -
+        true にすると、DB_DataObject はカラムが空 ('' や 0 など)
+        の場合に空の値を代入しません。
+       </para>
+      </listitem>  
      </itemizedlist>
 
     </para>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.