dropbox
«前の日(03-11) 最新 次の日(03-13)» 追記

Yammy日記

私の日々の記録などです。この日記の内容は、私個人の意見/考えであり、所属する団体の意見/考えではありません。
RSS Web yammy.jpn.org
過去の日記
☆スキーウエアNOW ON SALE!!☆★2ピース上下スーツ★ 【エァウォーク】幼児用ウエアAWT‐5524 ピンク(桃色)サイズ:100・110・120 decorate
Plaitan 25リットル:Lサイズ 【MBRO】エムブロ 日産 セレナ
エムブロC25/CC25/NC25/CNC25
バルカンLEDハイマウントストップランプ クローム
【送料込】エムブロ MBRO
C25系セレナ スパークルLEDテール
クローム
【送料無料】ねばるパウダー
折れ脚伸長式テーブルGrande neo〔グランデネオ〕 大
佐藤錦 わけあり 1Kg
沖縄産スナックパイン1玉(500g〜800g)

N−95D23L/C3 互換インク CANON BCI-7e+9/5MP



track feed
Debian GNU/Linux
Apache
www.cacert.org
My Profile by iddy
technorati
RobotReplay

2004/09/30から

今日:
昨日:
最近のツッコミ10発


2008-03-12 EC-CUBE更新内容

_ [EC-CUBE] 2008/3/12の更新内容1

Date: 2008-03-12 17:01:51 +0900 (Wed, 12 Mar 2008)
New Revision: 19
 
Added:
   eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php
Modified:
   eccube2/trunk/data/module/Net/UserAgent/Mobile.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/Display.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php
Log:
auto commit
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php	2008-03-11 12:01:32 UTC (rev 18)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php	2008-03-12 08:01:51 UTC (rev 19)
@@ -1,447 +1,525 @@
-
- * @copyright  2003-2007 KUBO Atsuhiro 
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: Common.php 15532 2007-08-31 14:39:46Z nanasess $
- * @since      File available since Release 0.1
- */
-
-// {{{ Net_UserAgent_Mobile_Common
-
-/**
- * Base class that is extended by each user agents implementor
- *
- * Net_UserAgent_Mobile_Common is a class for mobile user agent
- * abstraction layer on Net_UserAgent_Mobile.
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro 
- * @copyright  2003-2007 KUBO Atsuhiro 
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
- * @since      Class available since Release 0.1
- */
-class Net_UserAgent_Mobile_Common extends PEAR
-{
-
-    // {{{ properties
-
-    /**#@+
-     * @access public
-     */
-
-    /**
-     * User-Agent name like 'DoCoMo'
-     * @var string
-     */
-    var $name = '';
-
-    /**
-     * User-Agent version number like '1.0'
-     * @var string
-     */
-    var $version = '';
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**
-     * {@link Net_UserAgent_Mobile_Display} object
-     * @var object {@link Net_UserAgent_Mobile_Display}
-     */
-    var $_display;
-
-    /**
-     * Net_UserAgent_Mobile_Request_XXX object
-     * @var object {@link Net_UserAgent_Mobile_Request_Env}
-     */
-    var $_request;
-
-    /**
-     * {@link Net_UserAgent_Mobile_Error} object for error handling in the
-     *     constructor
-     * @var object
-     **/
-    var $_error = null;
-
-    /**#@-*/
-
-    /**#@+
-     * @access public
-     */
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * constructor
-     *
-     * @param object $request a {@link Net_UserAgent_Mobile_Request_Env}
-     *     object
-     */
-    function Net_UserAgent_Mobile_Common($request)
-    {
-        parent::PEAR('Net_UserAgent_Mobile_Error');
-        $this->_request = $request;
-        if (Net_UserAgent_Mobile::isError($result = $this->parse())) {
-            $this->isError($result);
-        }
-    }
-
-    // }}}
-    // {{{ isError
-
-    /**
-     * Returns/set an error when the instance couldn't initialize properly
-     *
-     * @param object {@link Net_UserAgent_Mobile_Error} object when setting
-     *     an error
-     * @return object {@link Net_UserAgent_Mobile_Error} object
-     */
-    function &isError($error = null)
-    {
-        if ($error !== null) {
-            $this->_error = &$error;
-        }
-
-        return $this->_error;
-    }
-
-    // }}}
-    // {{{ raiseError()
-
-    /**
-     * This method is used to communicate an error and invoke error
-     * callbacks etc. Basically a wrapper for PEAR::raiseError without
-     * the message string.
-     *
-     * @param mixed $code integer error code, or a PEAR error object (all
-     *     other parameters are ignored if this parameter is an object
-     * @param int $mode error mode, see PEAR_Error docs
-     * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the
-     *     error level (E_USER_NOTICE etc). If error mode is
-     *     PEAR_ERROR_CALLBACK, this is the callback function, either as a
-     *     function name, or as an array of an object and method name. For
-     *     other error modes this parameter is ignored.
-     * @param string $userinfo Extra debug information. Defaults to the last
-     *     query and native error code.
-     * @return object a PEAR error object
-     * @see PEAR_Error
-     */
-    function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null,
-                         $options = null, $userinfo = null
-                         )
-    {
-
-        // The error is yet a Net_UserAgent_Mobile error object
-        if (is_object($code)) {
-            $error = &PEAR::raiseError($code, null, null, null, null, null,
-                                       true
-                                       );
-            return $error;
-        }
-
-        $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo,
-                                   'Net_UserAgent_Mobile_Error', true
-                                   );
-        return $error;
-    }
-
-    // }}}
-    // {{{ getUserAgent()
-
-    /**
-     * returns User-Agent string
-     *
-     * @return string
-     */
-    function getUserAgent()
-    {
-        return $this->getHeader('User-Agent');
-    }
-
-    // }}}
-    // {{{ getHeader()
-
-    /**
-     * returns a specified HTTP header
-     *
-     * @param string $header
-     * @return string
-     */
-    function getHeader($header)
-    {
-        return $this->_request->get($header);
-    }
-
-    // }}}
-    // {{{ getName()
-
-    /**
-     * returns User-Agent name like 'DoCoMo'
-     *
-     * @return string
-     */
-    function getName()
-    {
-        return $this->name;
-    }
-
-    // }}}
-    // {{{ getDisplay()
-
-    /**
-     * returns {@link Net_UserAgent_Mobile_Disply} object
-     *
-     * @return object a {@link Net_UserAgent_Mobile_Display} object, or a
-     *     PEAR error object on error
-     * @see Net_UserAgent_Mobile_Display
-     */
-    function getDisplay()
-    {
-        if (!is_object($this->_display)) {
-            $this->_display = $this->makeDisplay();
-        }
-        return $this->_display;
-    }
-
-    // }}}
-    // {{{ getVersion()
-
-    /**
-     * returns User-Agent version number like '1.0'
-     *
-     * @return string
-     */
-    function getVersion()
-    {
-        return $this->version;
-    }
-
-    // }}}
-    // {{{ noMatch()
-
-    /**
-     * generates a warning message for new variants
-     *
-     * @return object a PEAR error object
-     */
-    function noMatch()
-    {
-        return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null,
-                                 null, $this->getUserAgent() .
-                                 ': might be new variants. Please contact the author of Net_UserAgent_Mobile!'
-                                 );
-    }
-
-    // }}}
-    // {{{ parse()
-
-    /**
-     * parse HTTP_USER_AGENT string (should be implemented in subclasses)
-     *
-     * @abstract
-     */
-    function parse()
-    {
-        die();
-    }
-
-    // }}}
-    // {{{ makeDisplay()
-
-    /**
-     * create a new Net_UserAgent_Mobile_Display class instance (should be
-     * implemented in subclasses)
-     *
-     * @abstract
-     */
-    function makeDisplay()
-    {
-        die();
-    }
-
-    // }}}
-    // {{{ isDoCoMo()
-
-    /**
-     * returns true if the agent is DoCoMo
-     *
-     * @return boolean
-     */
-    function isDoCoMo()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isJPhone()
-
-    /**
-     * returns true if the agent is J-PHONE
-     *
-     * @return boolean
-     */
-    function isJPhone()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isVodafone()
-
-    /**
-     * returns true if the agent is Vodafone
-     *
-     * @return boolean
-     */
-    function isVodafone()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isEZweb()
-
-    /**
-     * returns true if the agent is EZweb
-     *
-     * @return boolean
-     */
-    function isEZweb()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isAirHPhone()
-
-    /**
-     * returns true if the agent is AirH"PHONE
-     *
-     * @return boolean
-     */
-    function isAirHPhone()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isNonMobile()
-
-    /**
-     * returns true if the agent is NonMobile
-     *
-     * @return boolean
-     */
-    function isNonMobile()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isTUKa()
-
-    /**
-     * returns true if the agent is TU-Ka
-     *
-     * @return boolean
-     */
-    function isTUKa()
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ isWAP1()
-
-    /**
-     * returns true if the agent can speak WAP1 protocol
-     *
-     * @return boolean
-     */
-    function isWAP1()
-    {
-        return $this->isEZweb() && !$this->isWAP2();
-    }
-
-    // }}}
-    // {{{ isWAP2()
-
-    /**
-     * returns true if the agent can speak WAP2 protocol
-     *
-     * @return boolean
-     */
-    function isWAP2()
-    {
-        return $this->isEZweb() && $this->isXHTMLCompliant();
-    }
-
-    // }}}
-    // {{{ getCarrierShortName()
-
-    /**
-     * returns the short name of the carrier
-     *
-     * @abstract
-     */
-    function getCarrierShortName()
-    {
-        die();
-    }
-
-    // }}}
-    // {{{ getCarrierLongName()
-
-    /**
-     * returns the long name of the carrier
-     *
-     * @abstract
-     */
-    function getCarrierLongName()
-    {
-        die();
-    }
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**#@-*/
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local Variables:
- * mode: php
- * coding: iso-8859-1
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * indent-tabs-mode: nil
- * End:
- */
-?>
+
+ * @copyright  2003-2008 KUBO Atsuhiro 
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Common.php 17127 2008-03-12 07:43:11Z satou $
+ * @since      File available since Release 0.1
+ */
+
+require_once 'Net/UserAgent/Mobile.php';
+
+// {{{ Net_UserAgent_Mobile_Common
+
+/**
+ * Base class that is extended by each user agents implementor
+ *
+ * Net_UserAgent_Mobile_Common is a class for mobile user agent
+ * abstraction layer on Net_UserAgent_Mobile.
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro 
+ * @copyright  2003-2008 KUBO Atsuhiro 
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.31.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Common extends PEAR
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**
+     * User-Agent name like 'DoCoMo'
+     * @var string
+     */
+    var $name;
+
+    /**
+     * User-Agent version number like '1.0'
+     * @var string
+     */
+    var $version;
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * {@link Net_UserAgent_Mobile_Display} object
+     * @var object {@link Net_UserAgent_Mobile_Display}
+     */
+    var $_display;
+
+    /**
+     * {@link Net_UserAgent_Mobile_Error} object for error handling in the
+     *     constructor
+     * @var object
+     **/
+    var $_error;
+
+    /**
+     * The User-Agent string.
+     * @var string
+     * @since Property available since Release 0.31.0
+     **/
+    var $_userAgent;
+
+    /**
+     * The model name of the user agent.
+     *
+     * @var string
+     * @since Property available since Release 0.31.0
+     */
+    var $_model;
+
+    /**
+     * The raw model name of the user agent.
+     *
+     * @var string
+     * @since Property available since Release 0.31.0
+     */
+    var $_rawModel;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * constructor
+     *
+     * @param string $userAgent User-Agent string
+     */
+    function Net_UserAgent_Mobile_Common($userAgent)
+    {
+        parent::PEAR('Net_UserAgent_Mobile_Error');
+
+        $result = $this->parse($userAgent);
+        if (Net_UserAgent_Mobile::isError($result)) {
+            $this->isError($result);
+        }
+
+        $this->_userAgent = $userAgent;
+    }
+
+    // }}}
+    // {{{ isError
+
+    /**
+     * Returns/set an error when the instance couldn't initialize properly
+     *
+     * @param object {@link Net_UserAgent_Mobile_Error} object when setting
+     *     an error
+     * @return object {@link Net_UserAgent_Mobile_Error} object
+     */
+    function &isError($error = null)
+    {
+        if ($error !== null) {
+            $this->_error = &$error;
+        }
+
+        return $this->_error;
+    }
+
+    // }}}
+    // {{{ raiseError()
+
+    /**
+     * This method is used to communicate an error and invoke error
+     * callbacks etc. Basically a wrapper for PEAR::raiseError without
+     * the message string.
+     *
+     * @param mixed $code integer error code, or a PEAR error object (all
+     *     other parameters are ignored if this parameter is an object
+     * @param int $mode error mode, see PEAR_Error docs
+     * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the
+     *     error level (E_USER_NOTICE etc). If error mode is
+     *     PEAR_ERROR_CALLBACK, this is the callback function, either as a
+     *     function name, or as an array of an object and method name. For
+     *     other error modes this parameter is ignored.
+     * @param string $userinfo Extra debug information. Defaults to the last
+     *     query and native error code.
+     * @return object a PEAR error object
+     * @see PEAR_Error
+     */
+    function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null,
+                         $options = null, $userinfo = null
+                         )
+    {
+
+        // The error is yet a Net_UserAgent_Mobile error object
+        if (is_object($code)) {
+            $error = &PEAR::raiseError($code, null, null, null, null, null,
+                                       true
+                                       );
+            return $error;
+        }
+
+        $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo,
+                                   'Net_UserAgent_Mobile_Error', true
+                                   );
+        return $error;
+    }
+
+    // }}}
+    // {{{ getUserAgent()
+
+    /**
+     * returns User-Agent string
+     *
+     * @return string
+     */
+    function getUserAgent()
+    {
+        return $this->_userAgent;
+    }
+
+    // }}}
+    // {{{ getHeader()
+
+    /**
+     * returns a specified HTTP header
+     *
+     * @param string $header
+     * @return string
+     */
+    function getHeader($header)
+    {
+        return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ];
+    }
+
+    // }}}
+    // {{{ getName()
+
+    /**
+     * returns User-Agent name like 'DoCoMo'
+     *
+     * @return string
+     */
+    function getName()
+    {
+        return $this->name;
+    }
+
+    // }}}
+    // {{{ getDisplay()
+
+    /**
+     * returns {@link Net_UserAgent_Mobile_Disply} object
+     *
+     * @return object a {@link Net_UserAgent_Mobile_Display} object, or a
+     *     PEAR error object on error
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function getDisplay()
+    {
+        if (!is_object($this->_display)) {
+            $this->_display = $this->makeDisplay();
+        }
+        return $this->_display;
+    }
+
+    // }}}
+    // {{{ getVersion()
+
+    /**
+     * returns User-Agent version number like '1.0'
+     *
+     * @return string
+     */
+    function getVersion()
+    {
+        return $this->version;
+    }
+
+    // }}}
+    // {{{ noMatch()
+
+    /**
+     * generates a warning message for new variants
+     *
+     * @return object a PEAR error object
+     */
+    function noMatch()
+    {
+        return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null,
+                                 null, $this->getUserAgent() .
+                                 ': might be new variants. Please contact the author of Net_UserAgent_Mobile!'
+                                 );
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
+     * @abstract
+     */
+    function parse($userAgent) {}
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new Net_UserAgent_Mobile_Display class instance (should be
+     * implemented in subclasses)
+     *
+     * @abstract
+     */
+    function makeDisplay()
+    {
+        die();
+    }
+
+    // }}}
+    // {{{ isDoCoMo()
+
+    /**
+     * returns true if the agent is DoCoMo
+     *
+     * @return boolean
+     */
+    function isDoCoMo()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isJPhone()
+
+    /**
+     * returns true if the agent is J-PHONE
+     *
+     * @return boolean
+     */
+    function isJPhone()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isVodafone()
+
+    /**
+     * returns true if the agent is Vodafone
+     *
+     * @return boolean
+     */
+    function isVodafone()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isEZweb()
+
+    /**
+     * returns true if the agent is EZweb
+     *
+     * @return boolean
+     */
+    function isEZweb()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isAirHPhone()
+
+    /**
+     * returns true if the agent is AirH"PHONE
+     *
+     * @return boolean
+     */
+    function isAirHPhone()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isNonMobile()
+
+    /**
+     * returns true if the agent is NonMobile
+     *
+     * @return boolean
+     */
+    function isNonMobile()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isTUKa()
+
+    /**
+     * returns true if the agent is TU-Ka
+     *
+     * @return boolean
+     */
+    function isTUKa()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isWAP1()
+
+    /**
+     * returns true if the agent can speak WAP1 protocol
+     *
+     * @return boolean
+     */
+    function isWAP1()
+    {
+        return $this->isEZweb() && !$this->isWAP2();
+    }
+
+    // }}}
+    // {{{ isWAP2()
+
+    /**
+     * returns true if the agent can speak WAP2 protocol
+     *
+     * @return boolean
+     */
+    function isWAP2()
+    {
+        return $this->isEZweb() && $this->isXHTMLCompliant();
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @abstract
+     */
+    function getCarrierShortName()
+    {
+        die();
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @abstract
+     */
+    function getCarrierLongName()
+    {
+        die();
+    }
+
+    // }}}
+    // {{{ isSoftBank()
+
+    /**
+     * Returns whether the agent is SoftBank or not.
+     *
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isSoftBank()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isWillcom()
+
+    /**
+     * Returns whether the agent is Willcom or not.
+     *
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isWillcom()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * Returns the model name of the user agent.
+     *
+     * @return string
+     * @since Method available since Release 0.31.0
+     */
+    function getModel()
+    {
+        if (is_null($this->_model)) {
+            return $this->_rawModel;
+        } else {
+            return $this->_model;
+        }
+    }
+
+    // }}}
+    // {{{ getRawModel()
+
+    /**
+     * Returns the raw model name of the user agent.
+     *
+     * @return string
+     * @since Method available since Release 0.31.0
+     */
+    function getRawModel()
+    {
+        return $this->_rawModel;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/Display.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/Display.php	2008-03-11 12:01:32 UTC (rev 18)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/Display.php	2008-03-12 08:01:51 UTC (rev 19)
@@ -1,268 +1,267 @@
-
- * @copyright  2003-2007 KUBO Atsuhiro 
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: Display.php 15532 2007-08-31 14:39:46Z nanasess $
- * @since      File available since Release 0.1
- */
-
-// {{{ Net_UserAgent_Mobile_Display
-
-/**
- * Display information for Net_UserAgent_Mobile
- *
- * Net_UserAgent_Mobile_Display is a class for display information on
- * {@link Net_UserAgent_Mobile}. Handy for image resizing or dispatching.
- *
- * SYNOPSIS:
- * 
- * require_once 'Net/UserAgent/Mobile.php';
- *
- * $agent = &Net_UserAgent_Mobile::factory();
- * $display = $agent->getDisplay();
- *
- * $width  = $display->getWidth();
- * $height = $display->getHeight();
- * list($width, $height) = $display->getSize();
- *
- * if ($display->isColor()) {
- *     $depth = $display->getDepth();
- * }
- *
- * // only available in DoCoMo 505i
- * $width_bytes  = $display->getWidthBytes();
- * $height_bytes = $display->getHeightBytes();
- * 
- *
- * USING EXTERNAL MAP FILE:
- * If the environment variable DOCOMO_MAP exists, the specified XML data will
- * be used for DoCoMo display information.
- *
- * ex) Please add the following code.
- * $_SERVER['DOCOMO_MAP'] = '/path/to/DoCoMoMap.xml';
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro 
- * @copyright  2003-2007 KUBO Atsuhiro 
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
- * @since      Class available since Release 0.1
- */
-class Net_UserAgent_Mobile_Display
-{
-
-    // {{{ properties
-
-    /**#@+
-     * @access public
-     */
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**
-     * width of the display
-     * @var integer
-     */
-    var $_width;
-
-    /**
-     * height of the display
-     * @var integer
-     */
-    var $_height;
-
-    /**
-     * depth of the display
-     * @var integer
-     */
-    var $_depth;
-
-    /**
-     * color capability of the display
-     * @var boolean
-     */
-    var $_color;
-
-    /**
-     * width (bytes) of the display
-     * @var integer
-     */
-    var $_widthBytes;
-
-    /**
-     * height (bytes) of the display
-     * @var integer
-     */
-    var $_heightBytes;
-
-    /**#@-*/
-
-    /**#@+
-     * @access public
-     */
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * constructor
-     *
-     * @param array $data display infomation
-     */
-    function Net_UserAgent_Mobile_Display($data)
-    {
-        $this->_width  = (integer)@$data['width'];
-        $this->_height = (integer)@$data['height'];
-        $this->_depth  = (integer)@$data['depth'];
-        $this->_color  = (boolean)@$data['color'];
-
-        $this->_widthBytes  = (integer)@$data['width_bytes'];
-        $this->_heightBytes = (integer)@$data['height_bytes'];
-    }
-
-    // }}}
-    // {{{ calcSize()
-
-    /**
-     * returns width * height of the display
-     *
-     * @return integer
-     */
-    function calcSize()
-    {
-        return $this->_width * $this->_height;
-    }
-
-    // }}}
-    // {{{ getSize()
-
-    /**
-     * returns width with height of the display
-     *
-     * @return array
-     */
-    function getSize()
-    {
-        return array($this->_width, $this->_height);
-    }
-
-    // }}}
-    // {{{ getWidth()
-
-    /**
-     * returns width of the display
-     *
-     * @return integer
-     */
-    function getWidth()
-    {
-        return $this->_width;
-    }
-
-    // }}}
-    // {{{ getHeight()
-
-    /**
-     * returns height of the display
-     *
-     * @return integer
-     */
-    function getHeight()
-    {
-        return $this->_height;
-    }
-
-    // }}}
-    // {{{ getDepth()
-
-    /**
-     * returns depth of the display
-     *
-     * @return integer
-     */
-    function getDepth()
-    {
-        return $this->_depth;
-    }
-
-    // }}}
-    // {{{ isColor()
-
-    /**
-     * returns true if the display has color capability
-     *
-     * @return boolean
-     */
-    function isColor()
-    {
-        return $this->_color;
-    }
-
-    // }}}
-    // {{{ getWidthBytes()
-
-    /**
-     * returns width (bytes) of the display
-     *
-     * @return integer
-     */
-    function getWidthBytes()
-    {
-        return $this->_widthBytes;
-    }
-
-    // }}}
-    // {{{ getHeightBytes()
-
-    /**
-     * returns height (bytes) of the display
-     *
-     * @return integer
-     */
-    function getHeightBytes()
-    {
-        return $this->_heightBytes;
-    }
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**#@-*/
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local Variables:
- * mode: php
- * coding: iso-8859-1
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * indent-tabs-mode: nil
- * End:
- */
-?>
+
+ * @copyright  2003-2007 KUBO Atsuhiro 
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Display.php 17127 2008-03-12 07:43:11Z satou $
+ * @since      File available since Release 0.1
+ */
+
+// {{{ Net_UserAgent_Mobile_Display
+
+/**
+ * Display information for Net_UserAgent_Mobile
+ *
+ * Net_UserAgent_Mobile_Display is a class for display information on
+ * {@link Net_UserAgent_Mobile}. Handy for image resizing or dispatching.
+ *
+ * SYNOPSIS:
+ * 
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $agent = &Net_UserAgent_Mobile::factory();
+ * $display = $agent->getDisplay();
+ *
+ * $width  = $display->getWidth();
+ * $height = $display->getHeight();
+ * list($width, $height) = $display->getSize();
+ *
+ * if ($display->isColor()) {
+ *     $depth = $display->getDepth();
+ * }
+ *
+ * // only available in DoCoMo 505i
+ * $width_bytes  = $display->getWidthBytes();
+ * $height_bytes = $display->getHeightBytes();
+ * 
+ *
+ * USING EXTERNAL MAP FILE:
+ * If the environment variable DOCOMO_MAP exists, the specified XML data will
+ * be used for DoCoMo display information.
+ *
+ * ex) Please add the following code.
+ * $_SERVER['DOCOMO_MAP'] = '/path/to/DoCoMoMap.xml';
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro 
+ * @copyright  2003-2007 KUBO Atsuhiro 
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.31.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Display
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * width of the display
+     * @var integer
+     */
+    var $_width;
+
+    /**
+     * height of the display
+     * @var integer
+     */
+    var $_height;
+
+    /**
+     * depth of the display
+     * @var integer
+     */
+    var $_depth;
+
+    /**
+     * color capability of the display
+     * @var boolean
+     */
+    var $_color;
+
+    /**
+     * width (bytes) of the display
+     * @var integer
+     */
+    var $_widthBytes;
+
+    /**
+     * height (bytes) of the display
+     * @var integer
+     */
+    var $_heightBytes;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * constructor
+     *
+     * @param array $data display infomation
+     */
+    function Net_UserAgent_Mobile_Display($data)
+    {
+        $this->_width  = (integer)@$data['width'];
+        $this->_height = (integer)@$data['height'];
+        $this->_depth  = (integer)@$data['depth'];
+        $this->_color  = (boolean)@$data['color'];
+
+        $this->_widthBytes  = (integer)@$data['width_bytes'];
+        $this->_heightBytes = (integer)@$data['height_bytes'];
+    }
+
+    // }}}
+    // {{{ calcSize()
+
+    /**
+     * returns width * height of the display
+     *
+     * @return integer
+     */
+    function calcSize()
+    {
+        return $this->_width * $this->_height;
+    }
+
+    // }}}
+    // {{{ getSize()
+
+    /**
+     * returns width with height of the display
+     *
+     * @return array
+     */
+    function getSize()
+    {
+        return array($this->_width, $this->_height);
+    }
+
+    // }}}
+    // {{{ getWidth()
+
+    /**
+     * returns width of the display
+     *
+     * @return integer
+     */
+    function getWidth()
+    {
+        return $this->_width;
+    }
+
+    // }}}
+    // {{{ getHeight()
+
+    /**
+     * returns height of the display
+     *
+     * @return integer
+     */
+    function getHeight()
+    {
+        return $this->_height;
+    }
+
+    // }}}
+    // {{{ getDepth()
+
+    /**
+     * returns depth of the display
+     *
+     * @return integer
+     */
+    function getDepth()
+    {
+        return $this->_depth;
+    }
+
+    // }}}
+    // {{{ isColor()
+
+    /**
+     * returns true if the display has color capability
+     *
+     * @return boolean
+     */
+    function isColor()
+    {
+        return $this->_color;
+    }
+
+    // }}}
+    // {{{ getWidthBytes()
+
+    /**
+     * returns width (bytes) of the display
+     *
+     * @return integer
+     */
+    function getWidthBytes()
+    {
+        return $this->_widthBytes;
+    }
+
+    // }}}
+    // {{{ getHeightBytes()
+
+    /**
+     * returns height (bytes) of the display
+     *
+     * @return integer
+     */
+    function getHeightBytes()
+    {
+        return $this->_heightBytes;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php	2008-03-11 12:01:32 UTC (rev 18)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php	2008-03-12 08:01:51 UTC (rev 19)
@@ -1,587 +1,575 @@
-
- * @copyright  2003-2007 KUBO Atsuhiro 
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: DoCoMo.php 15532 2007-08-31 14:39:46Z nanasess $
- * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html
- * @see        Net_UserAgent_Mobile_Common
- * @since      File available since Release 0.1
- */
-
-require_once dirname(__FILE__) . '/Common.php';
-require_once dirname(__FILE__) . '/Display.php';
-require_once dirname(__FILE__) . '/DoCoMoDisplayMap.php';
-
-// {{{ Net_UserAgent_Mobile_DoCoMo
-
-/**
- * NTT DoCoMo implementation
- *
- * Net_UserAgent_Mobile_DoCoMo is a subclass of
- * {@link Net_UserAgent_Mobile_Common}, which implements NTT docomo i-mode
- * user agents.
- *
- * SYNOPSIS:
- * 
- * require_once 'Net/UserAgent/Mobile.php';
- *
- * $_SERVER['HTTP_USER_AGENT'] = 'DoCoMo/1.0/P502i/c10';
- * $agent = &Net_UserAgent_Mobile::factory();
- *
- * printf("Name: %s\n", $agent->getName()); // 'DoCoMo'
- * printf("Version: %s\n", $agent->getVersion()); // 1.0
- * printf("HTML version: %s\n", $agent->getHTMLVersion()); // 2.0
- * printf("Model: %s\n", $agent->getModel()); // 'P502i'
- * printf("Cache: %dk\n", $agent->getCacheSize()); // 10
- * if ($agent->isFOMA()) {
- *     print "FOMA\n";             // false
- * }
- * printf("Vendor: %s\n", $agent->getVendor()); // 'P'
- * printf("Series: %s\n", $agent->getSeries()); // '502i'
- *
- * // only available with 
- * // e.g.) 'DoCoMo/1.0/P503i/c10/serNMABH200331'; - * printf("Serial: %s\n", $agent->getSerialNumber()); // 'NMABH200331' - * - * // e.g.) 'DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)'; - * printf("Serial: %s\n", $agent->getSerialNumber()); // '0123456789abcde' - * printf("Card ID: %s\n", $agent->getCardID()); // '01234567890123456789' - * - * // e.g.) 'DoCoMo/1.0/P502i (Google CHTML Proxy/1.0)' - * printf("Comment: %s\n", $agent->getComment()); // 'Google CHTML Proxy/1.0' - * - * // e.g.) 'DoCoMo/1.0/D505i/c20/TB/W20H10' - * printf("Status: %s\n", $agent->getStatus()); // 'TB' - * - * // only available in eggy/M-stage - * // e.g.) 'DoCoMo/1.0/eggy/c300/s32/kPHS-K' - * printf("Bandwidth: %dkbps\n", $agent->getBandwidth()); // 32 - * - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 0.30.0 - * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html - * @see Net_UserAgent_Mobile_Common - * @since Class available since Release 0.1 - */ -class Net_UserAgent_Mobile_DoCoMo extends Net_UserAgent_Mobile_Common -{ - - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private - */ - - /** - * name of the model like 'P502i' - * @var string - */ - var $_model = ''; - - /** - * status of the cache (TC, TB, TD, TJ) - * @var string - */ - var $_status = ''; - - /** - * bandwidth like 32 as kilobytes unit - * @var integer - */ - var $_bandwidth = null; - - /** - * hardware unique serial number - * @var string - */ - var $_serialNumber = null; - - /** - * whether it's FOMA or not - * @var boolean - */ - var $_isFOMA = false; - - /** - * FOMA Card ID (20 digit alphanumeric) - * @var string - */ - var $_cardID = null; - - /** - * comment on user agent string like 'Google Proxy' - * @var string - */ - var $_comment = null; - - /** - * cache size as killobytes unit - * @var integer - */ - var $_cacheSize; - - /** - * width and height of the display - * @var string - */ - var $_displayBytes = ''; - - /**#@-*/ - - /**#@+ - * @access public - */ - - // }}} - // {{{ isDoCoMo() - - /** - * returns true - * - * @return boolean - */ - function isDoCoMo() - { - return true; - } - - // }}} - // {{{ parse() - - /** - * parse HTTP_USER_AGENT string - * - * @return mixed void, or a PEAR error object on error - */ - function parse() - { - @list($main, $foma_or_comment) = - explode(' ', $this->getUserAgent(), 2); - - if ($foma_or_comment - && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches) - ) { - - // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0) - $this->_comment = $matches[1]; - $result = $this->_parseMain($main); - } elseif ($foma_or_comment) { - - // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) - $this->_isFOMA = true; - list($this->name, $this->version) = explode('/', $main); - $result = $this->_parseFOMA($foma_or_comment); - } else { - - // DoCoMo/1.0/R692i/c10 - $result = $this->_parseMain($main); - } - - if (Net_UserAgent_Mobile::isError($result)) { - return $result; - } - } - - // }}} - // {{{ makeDisplay() - - /** - * create a new {@link Net_UserAgent_Mobile_Display} class instance - * - * @return object a newly created {@link Net_UserAgent_Mobile_Display} - * object - * @see Net_UserAgent_Mobile_Display - * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() - */ - function makeDisplay() - { - $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->_model); - if ($this->_displayBytes !== '') { - list($widthBytes, $heightBytes) = - explode('*', $this->_displayBytes); - $display['width_bytes'] = $widthBytes; - $display['height_bytes'] = $heightBytes; - } - return new Net_UserAgent_Mobile_Display($display); - } - - // }}} - // {{{ getHTMLVersion() - - /** - * returns supported HTML version like '3.0'. retuns null if unknown. - * - * @return string - */ - function getHTMLVersion() - { - static $htmlVersionMap; - if (!isset($htmlVersionMap)) { - $htmlVersionMap = array( - '[DFNP]501i' => '1.0', - '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', - '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', - '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', - 'eggy|P751v' => '3.2', - '505i|252i|900i|506i|880i|253i|P213i|901i|700i|851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$' => '5.0', - '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$' => '6.0', - '903i|703i' => '7.0' - ); - } - - foreach ($htmlVersionMap as $key => $value) { - if (preg_match("/$key/", $this->_model)) { - return $value; - } - } - return null; - } - - // }}} - // {{{ getCacheSize() - - /** - * returns cache size as kilobytes unit. returns 5 if unknown. - * - * @return integer - */ - function getCacheSize() - { - if ($this->_cacheSize) { - return $this->_cacheSize; - } - - static $defaultCacheSize; - if (!isset($defaultCacheSize)) { - $defaultCacheSize = 5; - } - return $defaultCacheSize; - } - - // }}} - // {{{ getSeries() - - /** - * returns series name like '502i'. returns null if unknown. - * - * @return string - */ - function getSeries() - { - if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_model)) { - return 'FOMA'; - } - - if (preg_match('/(\d{3}i)/', $this->_model, $matches)) { - return $matches[1]; - } - - if ($this->_model == 'P651ps') { - return '651'; - } - - return null; - } - - // }}} - // {{{ getVendor() - - /** - * returns vender code like 'SO' for Sony. returns null if unknown. - * - * @return string - */ - function getVendor() - { - if (preg_match('/([A-Z]+)\d/', $this->_model, $matches)) { - return $matches[1]; - } - return null; - } - - // }}} - // {{{ getModel() - - /** - * returns name of the model like 'P502i' - * - * @return string - */ - function getModel() - { - return $this->_model; - } - - // }}} - // {{{ getStatus() - - /** - * returns status like "TB", "TC", "TD" or "TJ", which means: - * - * TB | Browsers - * TC | Browsers with image off (only Available in HTML 5.0) - * TD | Fetching JAR - * TJ | i-Appli - * - * @return string - */ - function getStatus() - { - return $this->_status; - } - - // }}} - // {{{ getBandwidth() - - /** - * returns bandwidth like 32 as killobytes unit. Only vailable in eggy, - * returns null otherwise. - * - * @return integer - */ - function getBandwidth() - { - return $this->_bandwidth; - } - - // }}} - // {{{ getSerialNumber() - - /** - * returns hardware unique serial number (15 digit in FOMA, 11 digit - * otherwise alphanumeric). Only available with form utn attribute. - * returns null otherwise. - * - * @return string - */ - function getSerialNumber() - { - return $this->_serialNumber; - } - - // }}} - // {{{ isFOMA() - - /** - * retuns whether it's FOMA or not - * - * @return boolean - */ - function isFOMA() - { - return $this->_isFOMA; - } - - // }}} - // {{{ getComment() - - /** - * returns comment on user agent string like 'Google Proxy'. returns null - * otherwise. - * - * @return string - */ - function getComment() - { - return $this->_comment; - } - - // }}} - // {{{ getCardID() - - /** - * returns FOMA Card ID (20 digit alphanumeric). Only available in FOMA - * with attribute. returns null otherwise. - * - * @return string - */ - function getCardID() - { - return $this->_cardID; - } - - // }}} - // {{{ isGPS() - - /** - * @return boolean - */ - function isGPS() - { - static $gpsModels; - if (!isset($gpsModels)) { - $gpsModels = array('F661i', 'F505iGPS'); - } - return in_array($this->_model, $gpsModels); - } - - // }}} - // {{{ getCarrierShortName() - - /** - * returns the short name of the carrier - * - * @return string - */ - function getCarrierShortName() - { - return 'I'; - } - - // }}} - // {{{ getCarrierLongName() - - /** - * returns the long name of the carrier - * - * @return string - */ - function getCarrierLongName() - { - return 'DoCoMo'; - } - - /**#@-*/ - - /**#@+ - * @access private - */ - - // }}} - // {{{ _parseMain() - - /** - * parse main part of HTTP_USER_AGENT string (not FOMA) - * - * @param string $main main part of HTTP_USER_AGENT string - * @return mixed void, or a PEAR error object on error - */ - function _parseMain($main) - { - @list($this->name, $this->version, $this->_model, $cache, $rest) = - explode('/', $main, 5); - if ($this->_model === 'SH505i2') { - $this->_model = 'SH505i'; - } - - if ($cache) { - if (!preg_match('/^c(\d+)/', $cache, $matches)) { - return $this->noMatch(); - } - $this->_cacheSize = (integer)$matches[1]; - } - - if ($rest) { - $rest = explode('/', $rest); - foreach ($rest as $value) { - if (preg_match('/^ser(\w{11})$/', $value, $matches)) { - $this->_serialNumber = $matches[1]; - continue; - } - if (preg_match('/^(T[CDBJ])$/', $value, $matches)) { - $this->_status = $matches[1]; - continue; - } - if (preg_match('/^s(\d+)$/', $value, $matches)) { - $this->_bandwidth = (integer)$matches[1]; - continue; - } - if (preg_match('/^W(\d+)H(\d+)$/', $value, $matches)) { - $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; - continue; - } - } - } - } - - // }}} - // {{{ _parseFOMA() - - /** - * parse main part of HTTP_USER_AGENT string (FOMA) - * - * @param string $foma main part of HTTP_USER_AGENT string - * @return mixed void, or a PEAR error object on error - */ - function _parseFOMA($foma) - { - if (!preg_match('/^([^(]+)/', $foma, $matches)) { - return $this->noMatch(); - } - $this->_model = $matches[1]; - if ($matches[1] === 'MST_v_SH2101V') { - $this->_model = 'SH2101V'; - } - - if (preg_match('/^[^(]+\((.*?)\)$/', $foma, $matches)) { - $rest = explode(';', $matches[1]); - foreach ($rest as $value) { - if (preg_match('/^c(\d+)/', $value, $matches)) { - $this->_cacheSize = (integer)$matches[1]; - continue; - } - if (preg_match('/^ser(\w{15})$/', $value, $matches)) { - $this->_serialNumber = $matches[1]; - continue; - } - if (preg_match('/^(T[CDBJ])$/', $value, $matches)) { - $this->_status = $matches[1]; - continue; - } - if (preg_match('/^icc(\w{20})?$/', $value, $matches)) { - if (count($matches) == 2) { - $this->_cardID = $matches[1]; - } - continue; - } - if (preg_match('/^W(\d+)H(\d+)$/', $value, $matches)) { - $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; - continue; - } - return $this->noMatch(); - } - } - } - - /**#@-*/ - - // }}} -} - -// }}} - -/* - * Local Variables: - * mode: php - * coding: iso-8859-1 - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * indent-tabs-mode: nil - * End: - */ -?> + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: DoCoMo.php 17127 2008-03-12 07:43:11Z satou $ + * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html + * @see Net_UserAgent_Mobile_Common + * @since File available since Release 0.1 + */ + +require_once 'Net/UserAgent/Mobile/Common.php'; +require_once 'Net/UserAgent/Mobile/Display.php'; +require_once 'Net/UserAgent/Mobile/DoCoMoDisplayMap.php'; + +// {{{ Net_UserAgent_Mobile_DoCoMo + +/** + * NTT DoCoMo implementation + * + * Net_UserAgent_Mobile_DoCoMo is a subclass of + * {@link Net_UserAgent_Mobile_Common}, which implements NTT docomo i-mode + * user agents. + * + * SYNOPSIS: + * + * require_once 'Net/UserAgent/Mobile.php'; + * + * $_SERVER['HTTP_USER_AGENT'] = 'DoCoMo/1.0/P502i/c10'; + * $agent = &Net_UserAgent_Mobile::factory(); + * + * printf("Name: %s\n", $agent->getName()); // 'DoCoMo' + * printf("Version: %s\n", $agent->getVersion()); // 1.0 + * printf("HTML version: %s\n", $agent->getHTMLVersion()); // 2.0 + * printf("Model: %s\n", $agent->getModel()); // 'P502i' + * printf("Cache: %dk\n", $agent->getCacheSize()); // 10 + * if ($agent->isFOMA()) { + * print "FOMA\n"; // false + * } + * printf("Vendor: %s\n", $agent->getVendor()); // 'P' + * printf("Series: %s\n", $agent->getSeries()); // '502i' + * + * // only available with + * // e.g.) 'DoCoMo/1.0/P503i/c10/serNMABH200331'; + * printf("Serial: %s\n", $agent->getSerialNumber()); // 'NMABH200331' + * + * // e.g.) 'DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)'; + * printf("Serial: %s\n", $agent->getSerialNumber()); // '0123456789abcde' + * printf("Card ID: %s\n", $agent->getCardID()); // '01234567890123456789' + * + * // e.g.) 'DoCoMo/1.0/P502i (Google CHTML Proxy/1.0)' + * printf("Comment: %s\n", $agent->getComment()); // 'Google CHTML Proxy/1.0' + * + * // e.g.) 'DoCoMo/1.0/D505i/c20/TB/W20H10' + * printf("Status: %s\n", $agent->getStatus()); // 'TB' + * + * // only available in eggy/M-stage + * // e.g.) 'DoCoMo/1.0/eggy/c300/s32/kPHS-K' + * printf("Bandwidth: %dkbps\n", $agent->getBandwidth()); // 32 + * + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html + * @see Net_UserAgent_Mobile_Common + * @since Class available since Release 0.1 + */ +class Net_UserAgent_Mobile_DoCoMo extends Net_UserAgent_Mobile_Common +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /** + * status of the cache (TC, TB, TD, TJ) + * @var string + */ + var $_status; + + /** + * bandwidth like 32 as kilobytes unit + * @var integer + */ + var $_bandwidth; + + /** + * hardware unique serial number + * @var string + */ + var $_serialNumber; + + /** + * whether it's FOMA or not + * @var boolean + */ + var $_isFOMA = false; + + /** + * FOMA Card ID (20 digit alphanumeric) + * @var string + */ + var $_cardID; + + /** + * comment on user agent string like 'Google Proxy' + * @var string + */ + var $_comment; + + /** + * cache size as killobytes unit + * @var integer + */ + var $_cacheSize; + + /** + * width and height of the display + * @var string + */ + var $_displayBytes; + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ isDoCoMo() + + /** + * returns true + * + * @return boolean + */ + function isDoCoMo() + { + return true; + } + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @return mixed void, or a PEAR error object on error + */ + function parse($userAgent) + { + @list($main, $foma_or_comment) = explode(' ', $userAgent, 2); + + if ($foma_or_comment + && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches) + ) { + + // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0) + $this->_comment = $matches[1]; + $result = $this->_parseMain($main); + } elseif ($foma_or_comment) { + + // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) + $this->_isFOMA = true; + list($this->name, $this->version) = explode('/', $main); + $result = $this->_parseFOMA($foma_or_comment); + } else { + + // DoCoMo/1.0/R692i/c10 + $result = $this->_parseMain($main); + } + + if (Net_UserAgent_Mobile::isError($result)) { + return $result; + } + } + + // }}} + // {{{ makeDisplay() + + /** + * create a new {@link Net_UserAgent_Mobile_Display} class instance + * + * @return object a newly created {@link Net_UserAgent_Mobile_Display} + * object + * @see Net_UserAgent_Mobile_Display + * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() + */ + function makeDisplay() + { + $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); + if (!is_null($this->_displayBytes)) { + list($widthBytes, $heightBytes) = + explode('*', $this->_displayBytes); + $display['width_bytes'] = $widthBytes; + $display['height_bytes'] = $heightBytes; + } + return new Net_UserAgent_Mobile_Display($display); + } + + // }}} + // {{{ getHTMLVersion() + + /** + * returns supported HTML version like '3.0'. retuns null if unknown. + * + * @return string + */ + function getHTMLVersion() + { + static $htmlVersionMap; + if (!isset($htmlVersionMap)) { + $htmlVersionMap = array( + '[DFNP]501i' => '1.0', + '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', + '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', + '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', + 'eggy|P751v' => '3.2', + '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0', + '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0', + '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0', + '905i|705i' => '7.1' + ); + } + + foreach ($htmlVersionMap as $key => $value) { + if (preg_match("/$key/", $this->_rawModel)) { + return $value; + } + } + return null; + } + + // }}} + // {{{ getCacheSize() + + /** + * returns cache size as kilobytes unit. returns 5 if unknown. + * + * @return integer + */ + function getCacheSize() + { + if ($this->_cacheSize) { + return $this->_cacheSize; + } + + static $defaultCacheSize; + if (!isset($defaultCacheSize)) { + $defaultCacheSize = 5; + } + return $defaultCacheSize; + } + + // }}} + // {{{ getSeries() + + /** + * returns series name like '502i'. returns null if unknown. + * + * @return string + */ + function getSeries() + { + if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { + return 'FOMA'; + } + + if (preg_match('/(\d{3}i)/', $this->_rawModel, $matches)) { + return $matches[1]; + } + + if ($this->_rawModel == 'P651ps') { + return '651'; + } + + return null; + } + + // }}} + // {{{ getVendor() + + /** + * returns vender code like 'SO' for Sony. returns null if unknown. + * + * @return string + */ + function getVendor() + { + if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) { + return $matches[1]; + } + + return null; + } + + // }}} + // {{{ getStatus() + + /** + * returns status like "TB", "TC", "TD" or "TJ", which means: + * + * TB | Browsers + * TC | Browsers with image off (only Available in HTML 5.0) + * TD | Fetching JAR + * TJ | i-Appli + * + * @return string + */ + function getStatus() + { + return $this->_status; + } + + // }}} + // {{{ getBandwidth() + + /** + * returns bandwidth like 32 as killobytes unit. Only vailable in eggy, + * returns null otherwise. + * + * @return integer + */ + function getBandwidth() + { + return $this->_bandwidth; + } + + // }}} + // {{{ getSerialNumber() + + /** + * returns hardware unique serial number (15 digit in FOMA, 11 digit + * otherwise alphanumeric). Only available with form utn attribute. + * returns null otherwise. + * + * @return string + */ + function getSerialNumber() + { + return $this->_serialNumber; + } + + // }}} + // {{{ isFOMA() + + /** + * retuns whether it's FOMA or not + * + * @return boolean + */ + function isFOMA() + { + return $this->_isFOMA; + } + + // }}} + // {{{ getComment() + + /** + * returns comment on user agent string like 'Google Proxy'. returns null + * otherwise. + * + * @return string + */ + function getComment() + { + return $this->_comment; + } + + // }}} + // {{{ getCardID() + + /** + * returns FOMA Card ID (20 digit alphanumeric). Only available in FOMA + * with attribute. returns null otherwise. + * + * @return string + */ + function getCardID() + { + return $this->_cardID; + } + + // }}} + // {{{ isGPS() + + /** + * @return boolean + */ + function isGPS() + { + static $gpsModels; + if (!isset($gpsModels)) { + $gpsModels = array('F661i', 'F505iGPS'); + } + return in_array($this->_rawModel, $gpsModels); + } + + // }}} + // {{{ getCarrierShortName() + + /** + * returns the short name of the carrier + * + * @return string + */ + function getCarrierShortName() + { + return 'I'; + } + + // }}} + // {{{ getCarrierLongName() + + /** + * returns the long name of the carrier + * + * @return string + */ + function getCarrierLongName() + { + return 'DoCoMo'; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + // }}} + // {{{ _parseMain() + + /** + * parse main part of HTTP_USER_AGENT string (not FOMA) + * + * @param string $main main part of HTTP_USER_AGENT string + * @return mixed void, or a PEAR error object on error + */ + function _parseMain($main) + { + @list($this->name, $this->version, $this->_rawModel, $cache, $rest) = + explode('/', $main, 5); + if ($this->_rawModel == 'SH505i2') { + $this->_model = 'SH505i'; + } + + if ($cache) { + if (!preg_match('/^c(\d+)$/', $cache, $matches)) { + return $this->noMatch(); + } + $this->_cacheSize = (integer)$matches[1]; + } + + if ($rest) { + $rest = explode('/', $rest); + foreach ($rest as $value) { + if (preg_match('/^ser(\w{11})$/', $value, $matches)) { + $this->_serialNumber = $matches[1]; + continue; + } + if (preg_match('/^(T[CDBJ])$/', $value, $matches)) { + $this->_status = $matches[1]; + continue; + } + if (preg_match('/^s(\d+)$/', $value, $matches)) { + $this->_bandwidth = (integer)$matches[1]; + continue; + } + if (preg_match('/^W(\d+)H(\d+)$/', $value, $matches)) { + $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; + continue; + } + } + } + } + + // }}} + // {{{ _parseFOMA() + + /** + * parse main part of HTTP_USER_AGENT string (FOMA) + * + * @param string $foma main part of HTTP_USER_AGENT string + * @return mixed void, or a PEAR error object on error + */ + function _parseFOMA($foma) + { + if (!preg_match('/^([^(\s]+)/', $foma, $matches)) { + return $this->noMatch(); + } + + $this->_rawModel = $matches[1]; + if ($this->_rawModel == 'MST_v_SH2101V') { + $this->_model = 'SH2101V'; + } + + if (preg_match('/^[^(\s]+\s?\((.*?)\)$/', $foma, $matches)) { + if (preg_match('/^compatible/', $matches[1])) { // The user-agent is DoCoMo compatible. + $this->_comment = $matches[1]; + return; + } + + $rest = explode(';', $matches[1]); + foreach ($rest as $value) { + if (preg_match('/^c(\d+)$/', $value, $matches)) { + $this->_cacheSize = (integer)$matches[1]; + continue; + } + if (preg_match('/^ser(\w{15})$/', $value, $matches)) { + $this->_serialNumber = $matches[1]; + continue; + } + if (preg_match('/^(T[CDBJ])$/', $value, $matches)) { + $this->_status = $matches[1]; + continue; + } + if (preg_match('/^icc(\w{20})?$/', $value, $matches)) { + if (count($matches) == 2) { + $this->_cardID = $matches[1]; + } + continue; + } + if (preg_match('/^W(\d+)H(\d+)$/', $value, $matches)) { + $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; + continue; + } + return $this->noMatch(); + } + } + } + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */ Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php =================================================================== --- eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php 2008-03-11 12:01:32 UTC (rev 18) +++ eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php 2008-03-12 08:01:51 UTC (rev 19) @@ -1,1471 +1,1689 @@ - - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMoDisplayMap.php 15532 2007-08-31 14:39:46Z nanasess $ - * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html - * @see Net_UserAgent_Mobile_Display - * @since File available since Release 0.1 - */ - -// {{{ Net_UserAgent_Mobile_DoCoMoDisplayMap - -/** - * Display information mapping for DoCoMo. - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 0.30.0 - * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html - * @see Net_UserAgent_Mobile_Display - * @since Class available since Release 0.1 - */ -class Net_UserAgent_Mobile_DoCoMoDisplayMap -{ - - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - /**#@+ - * @access public - */ - - // }}} - // {{{ get() - - /** - * Returns the display information of the model. - * - * @param string $model the name of the model - * @return array - * @static - */ - function get($model) - { - static $displayMap; - if (!isset($displayMap)) { - if (isset($_SERVER['DOCOMO_MAP'])) { - - // using the specified XML data - while (true) { - if (!function_exists('xml_parser_create') - || !is_readable($_SERVER['DOCOMO_MAP']) - ) { - break; - } - $xml = file_get_contents($_SERVER['DOCOMO_MAP']); - $parser = xml_parser_create(); - if ($parser === false) { - break; - } - xml_parse_into_struct($parser, $xml, $values, $indexes); - if (!xml_parser_free($parser)) { - break; - } - if (isset($indexes['OPT'])) { - unset($indexes['OPT']); - } - foreach ($indexes as $modelName => $modelIndexes) { - $displayMap[$modelName] = array(); - foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) { - $displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue; - } - } - break; - } - } - - if (!isset($displayMap)) { - $displayMap = array( - - // i-mode compliant HTML 1.0 - 'D501I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 2, - 'color' => 0 - ), - 'F501I' => array( - 'width' => 112, - 'height' => 84, - 'depth' => 2, - 'color' => 0 - ), - 'N501I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 2, - 'color' => 0 - ), - 'P501I' => array( - 'width' => 96, - 'height' => 120, - 'depth' => 2, - 'color' => 0 - ), - - // i-mode compliant HTML 2.0 - 'D502I' => array( - 'width' => 96, - 'height' => 90, - 'depth' => 256, - 'color' => 1 - ), - 'F502I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'N502I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'P502I' => array( - 'width' => 96, - 'height' => 117, - 'depth' => 4, - 'color' => 0 - ), - 'NM502I' => array( - 'width' => 111, - 'height' => 106, - 'depth' => 2, - 'color' => 0 - ), - 'SO502I' => array( - 'width' => 120, - 'height' => 120, - 'depth' => 4, - 'color' => 0 - ), - 'F502IT' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'N502IT' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 256, - 'color' => 1 - ), - 'SO502IWM' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'SH821I' => array( - 'width' => 96, - 'height' => 78, - 'depth' => 256, - 'color' => 1 - ), - 'N821I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'P821I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'D209I' => array( - 'width' => 96, - 'height' => 90, - 'depth' => 256, - 'color' => 1 - ), - 'ER209I' => array( - 'width' => 120, - 'height' => 72, - 'depth' => 2, - 'color' => 0 - ), - 'F209I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'KO209I' => array( - 'width' => 96, - 'height' => 96, - 'depth' => 256, - 'color' => 1 - ), - 'N209I' => array( - 'width' => 108, - 'height' => 82, - 'depth' => 4, - 'color' => 0 - ), - 'P209I' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 4, - 'color' => 0 - ), - 'P209IS' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 256, - 'color' => 1 - ), - 'R209I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 4, - 'color' => 0 - ), - 'P651PS' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 4, - 'color' => 0 - ), - 'R691I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 4, - 'color' => 0 - ), - 'F671I' => array( - 'width' => 120, - 'height' => 126, - 'depth' => 256, - 'color' => 1 - ), - 'F210I' => array( - 'width' => 96, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'N210I' => array( - 'width' => 118, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'P210I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'KO210I' => array( - 'width' => 96, - 'height' => 96, - 'depth' => 256, - 'color' => 1 - ), - - // i-mode compliant HTML 3.0 - 'F503I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'F503IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 4096, - 'color' => 1 - ), - 'P503I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'P503IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'N503I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N503IS' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'SO503I' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 65536, - 'color' => 1 - ), - 'SO503IS' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 65536, - 'color' => 1 - ), - 'D503I' => array( - 'width' => 132, - 'height' => 126, - 'depth' => 4096, - 'color' => 1 - ), - 'D503IS' => array( - 'width' => 132, - 'height' => 126, - 'depth' => 4096, - 'color' => 1 - ), - 'D210I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'SO210I' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'F211I' => array( - 'width' => 96, - 'height' => 113, - 'depth' => 4096, - 'color' => 1 - ), - 'D211I' => array( - 'width' => 100, - 'height' => 91, - 'depth' => 4096, - 'color' => 1 - ), - 'N211I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N211IS' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'P211I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'P211IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'SO211I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 4096, - 'color' => 1 - ), - 'R211I' => array( - 'width' => 96, - 'height' => 98, - 'depth' => 4096, - 'color' => 1 - ), - 'SH251I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'SH251IS' => array( - 'width' => 176, - 'height' => 187, - 'depth' => 65536, - 'color' => 1 - ), - 'R692I' => array( - 'width' => 96, - 'height' => 98, - 'depth' => 4096, - 'color' => 1 - ), - - // i-mode compliant HTML 3.0 - // (FOMA 2001/2002/2101V) - 'N2001' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N2002' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 65536, - 'color' => 1 - ), - 'P2002' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 65536, - 'color' => 1 - ), - 'D2101V' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 262144, - 'color' => 1 - ), - 'P2101V' => array( - 'width' => 163, - 'height' => 182, - 'depth' => 262144, - 'color' => 1 - ), - 'SH2101V' => array( - 'width' => 800, - 'height' => 600, - 'depth' => 65536, - 'color' => 1 - ), - 'T2101V' => array( - 'width' => 176, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 4.0 - 'D504I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'F504I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'F504IS' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'N504I' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'N504IS' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'SO504I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'P504I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'P504IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D251I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'D251IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'F251I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'N251I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'N251IS' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'P251IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'F671IS' => array( - 'width' => 160, - 'height' => 120, - 'depth' => 65536, - 'color' => 1 - ), - 'F212I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'SO212I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'F661I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'F672I' => array( - 'width' => 160, - 'height' => 120, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213IS' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213IWR' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 4.0 - // (FOMA 2051/2102V/2701 etc.) - 'F2051' => array( - 'width' => 176, - 'height' => 182, - 'depth' => 65536, - 'color' => 1 - ), - 'N2051' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'P2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'P2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'F2102V' => array( - 'width' => 176, - 'height' => 182, - 'depth' => 65536, - 'color' => 1 - ), - 'N2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'N2701' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'NM850IG' => array( - 'width' => 176, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 5.0 (505i etc.) - 'D505I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO505I' => array( - 'width' => 256, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH505I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'N505I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F505I' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'P505I' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'D505IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P505IS' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'N505IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO505IS' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH505IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F505IGPS' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'D252I' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'SH252I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'P252I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'N252I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'P252IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D506I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F506I' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'N506I' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'P506IC' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'SH506IC' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506IC' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'N506IS' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506IS' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'N506ISII' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'P506ICII' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'D253I' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'N253I' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'P253I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D253IWM' => array( - 'width' => 220, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'P253IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'P213I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 5.0 - // (FOMA 900i etc.) - 'F900I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N900I' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'P900I' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'SH900I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F900IT' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P900IV' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 262144, - 'color' => 1 - ), - 'N900IS' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'D900I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F900IC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'F880IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'N900IL' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'N900IG' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'SH901IC' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F901IC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N901IC' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D901I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P901I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F700I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH700I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'N700I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P700I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F700IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH700IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'SA700IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - - 'SH901IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F901IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D901IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P901IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'N901IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P901ITV' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'SH851I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'P851I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F881IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'D701I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 65536, - 'color' => 1 - ), - 'N701I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P701ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D701IWM' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 65536, - 'color' => 1 - ), - 'N701IECO' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'SA800I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - 'L600I' => array( - 'width' => 176, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - 'N600I' => array( - 'width' => 176, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'L601I' => array( - 'width' => 176, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - 'M702IS' => array( - 'width' => 240, - 'height' => 267, - 'depth' => 262144, - 'color' => 1 - ), - 'M702IG' => array( - 'width' => 240, - 'height' => 267, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 6.0 - // (FOMA 902i etc.) - 'F902I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D902I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N902I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P902I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO902I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902IS' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P902IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D902IS' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F902IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO902IWP+' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902ISL' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IX' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IL' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P702I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N702ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F702ID' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH702ID' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D702I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO702I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'D702IBCL' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SA702I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - 'SH702IS' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N702IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P702ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D702IF' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D851IWM' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F882IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'N601I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D800IDS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P703IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 7.0 - // (FOMA 903i etc.) - 'SH903I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P903I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N903I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D903I' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO903I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'D903ITV' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903IX' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P903ITV' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'N703ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F703I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P703I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D703I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH703I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH703I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N703IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO703I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ) - ); - } - } - - return @$displayMap[ strtoupper($model) ]; - } - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - // }}} -} - -// }}} - -/* - * Local Variables: - * mode: php - * coding: iso-8859-1 - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * indent-tabs-mode: nil - * End: - */ -?> + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: DoCoMoDisplayMap.php 17127 2008-03-12 07:43:11Z satou $ + * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html + * @see Net_UserAgent_Mobile_Display + * @since File available since Release 0.1 + */ + +// {{{ Net_UserAgent_Mobile_DoCoMoDisplayMap + +/** + * Display information mapping for DoCoMo. + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html + * @see Net_UserAgent_Mobile_Display + * @since Class available since Release 0.1 + */ +class Net_UserAgent_Mobile_DoCoMoDisplayMap +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ get() + + /** + * Returns the display information of the model. + * + * @param string $model the name of the model + * @return array + * @static + */ + function get($model) + { + static $displayMap; + if (!isset($displayMap)) { + if (isset($_SERVER['DOCOMO_MAP'])) { + + // using the specified XML data + while (true) { + if (!function_exists('xml_parser_create') + || !is_readable($_SERVER['DOCOMO_MAP']) + ) { + break; + } + $xml = file_get_contents($_SERVER['DOCOMO_MAP']); + $parser = xml_parser_create(); + if ($parser === false) { + break; + } + xml_parse_into_struct($parser, $xml, $values, $indexes); + if (!xml_parser_free($parser)) { + break; + } + if (isset($indexes['OPT'])) { + unset($indexes['OPT']); + } + foreach ($indexes as $modelName => $modelIndexes) { + $displayMap[$modelName] = array(); + foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) { + $displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue; + } + } + break; + } + } + + if (!isset($displayMap)) { + $displayMap = array( + + // i-mode compliant HTML 1.0 + 'D501I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 2, + 'color' => 0 + ), + 'F501I' => array( + 'width' => 112, + 'height' => 84, + 'depth' => 2, + 'color' => 0 + ), + 'N501I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 2, + 'color' => 0 + ), + 'P501I' => array( + 'width' => 96, + 'height' => 120, + 'depth' => 2, + 'color' => 0 + ), + + // i-mode compliant HTML 2.0 + 'D502I' => array( + 'width' => 96, + 'height' => 90, + 'depth' => 256, + 'color' => 1 + ), + 'F502I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'N502I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'P502I' => array( + 'width' => 96, + 'height' => 117, + 'depth' => 4, + 'color' => 0 + ), + 'NM502I' => array( + 'width' => 111, + 'height' => 106, + 'depth' => 2, + 'color' => 0 + ), + 'SO502I' => array( + 'width' => 120, + 'height' => 120, + 'depth' => 4, + 'color' => 0 + ), + 'F502IT' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'N502IT' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 256, + 'color' => 1 + ), + 'SO502IWM' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'SH821I' => array( + 'width' => 96, + 'height' => 78, + 'depth' => 256, + 'color' => 1 + ), + 'N821I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'P821I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'D209I' => array( + 'width' => 96, + 'height' => 90, + 'depth' => 256, + 'color' => 1 + ), + 'ER209I' => array( + 'width' => 120, + 'height' => 72, + 'depth' => 2, + 'color' => 0 + ), + 'F209I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'KO209I' => array( + 'width' => 96, + 'height' => 96, + 'depth' => 256, + 'color' => 1 + ), + 'N209I' => array( + 'width' => 108, + 'height' => 82, + 'depth' => 4, + 'color' => 0 + ), + 'P209I' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 4, + 'color' => 0 + ), + 'P209IS' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 256, + 'color' => 1 + ), + 'R209I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 4, + 'color' => 0 + ), + 'P651PS' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 4, + 'color' => 0 + ), + 'R691I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 4, + 'color' => 0 + ), + 'F671I' => array( + 'width' => 120, + 'height' => 126, + 'depth' => 256, + 'color' => 1 + ), + 'F210I' => array( + 'width' => 96, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'N210I' => array( + 'width' => 118, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'P210I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'KO210I' => array( + 'width' => 96, + 'height' => 96, + 'depth' => 256, + 'color' => 1 + ), + + // i-mode compliant HTML 3.0 + 'F503I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'F503IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 4096, + 'color' => 1 + ), + 'P503I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'P503IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'N503I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N503IS' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'SO503I' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 65536, + 'color' => 1 + ), + 'SO503IS' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 65536, + 'color' => 1 + ), + 'D503I' => array( + 'width' => 132, + 'height' => 126, + 'depth' => 4096, + 'color' => 1 + ), + 'D503IS' => array( + 'width' => 132, + 'height' => 126, + 'depth' => 4096, + 'color' => 1 + ), + 'D210I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'SO210I' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'F211I' => array( + 'width' => 96, + 'height' => 113, + 'depth' => 4096, + 'color' => 1 + ), + 'D211I' => array( + 'width' => 100, + 'height' => 91, + 'depth' => 4096, + 'color' => 1 + ), + 'N211I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N211IS' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'P211I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'P211IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'SO211I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 4096, + 'color' => 1 + ), + 'R211I' => array( + 'width' => 96, + 'height' => 98, + 'depth' => 4096, + 'color' => 1 + ), + 'SH251I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'SH251IS' => array( + 'width' => 176, + 'height' => 187, + 'depth' => 65536, + 'color' => 1 + ), + 'R692I' => array( + 'width' => 96, + 'height' => 98, + 'depth' => 4096, + 'color' => 1 + ), + + // i-mode compliant HTML 3.0 + // (FOMA 2001/2002/2101V) + 'N2001' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N2002' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 65536, + 'color' => 1 + ), + 'P2002' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 65536, + 'color' => 1 + ), + 'D2101V' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 262144, + 'color' => 1 + ), + 'P2101V' => array( + 'width' => 163, + 'height' => 182, + 'depth' => 262144, + 'color' => 1 + ), + 'SH2101V' => array( + 'width' => 800, + 'height' => 600, + 'depth' => 65536, + 'color' => 1 + ), + 'T2101V' => array( + 'width' => 176, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 4.0 + 'D504I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'F504I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'F504IS' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'N504I' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'N504IS' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'SO504I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'P504I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'P504IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D251I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'D251IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'F251I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'N251I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'N251IS' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'P251IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'F671IS' => array( + 'width' => 160, + 'height' => 120, + 'depth' => 65536, + 'color' => 1 + ), + 'F212I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'SO212I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'F661I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'F672I' => array( + 'width' => 160, + 'height' => 120, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213IS' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213IWR' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 4.0 + // (FOMA 2051/2102V/2701 etc.) + 'F2051' => array( + 'width' => 176, + 'height' => 182, + 'depth' => 65536, + 'color' => 1 + ), + 'N2051' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'P2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'P2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'F2102V' => array( + 'width' => 176, + 'height' => 182, + 'depth' => 65536, + 'color' => 1 + ), + 'N2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'N2701' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'NM850IG' => array( + 'width' => 176, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 5.0 (505i etc.) + 'D505I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO505I' => array( + 'width' => 256, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH505I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'N505I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F505I' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'P505I' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'D505IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P505IS' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'N505IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO505IS' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH505IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F505IGPS' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'D252I' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'SH252I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'P252I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'N252I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'P252IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D506I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F506I' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'N506I' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'P506IC' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'SH506IC' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506IC' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'N506IS' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506IS' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'N506IS2' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'P506ICII' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'D253I' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'N253I' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'P253I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D253IWM' => array( + 'width' => 220, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'P253IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'P213I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 5.0 + // (FOMA 900i etc.) + 'F900I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N900I' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'P900I' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'SH900I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F900IT' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P900IV' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 262144, + 'color' => 1 + ), + 'N900IS' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'D900I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F900IC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'F880IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'N900IL' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'N900IG' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'SH901IC' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F901IC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N901IC' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D901I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P901I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F700I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH700I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'N700I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P700I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F700IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH700IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'SA700IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + + 'SH901IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F901IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D901IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P901IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'N901IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P901ITV' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'SH851I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'P851I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F881IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'D701I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 65536, + 'color' => 1 + ), + 'N701I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P701ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D701IWM' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 65536, + 'color' => 1 + ), + 'N701IECO' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'SA800I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'L600I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + 'N600I' => array( + 'width' => 176, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'L601I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + 'M702IS' => array( + 'width' => 240, + 'height' => 267, + 'depth' => 262144, + 'color' => 1 + ), + 'M702IG' => array( + 'width' => 240, + 'height' => 267, + 'depth' => 262144, + 'color' => 1 + ), + 'L602I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 6.0 + // (FOMA 902i etc.) + 'F902I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D902I' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N902I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P902I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO902I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902IS' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P902IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D902IS' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F902IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO902IWP+' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902ISL' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IX' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IL' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P702I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N702ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F702ID' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH702ID' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D702I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO702I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'D702IBCL' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SA702I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'SH702IS' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N702IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P702ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D702IF' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D851IWM' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F882IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'N601I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D800IDS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P703IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F883I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'P704IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'L704I' => array( + 'width' => 240, + 'height' => 280, + 'depth' => 262144, + 'color' => 1 + ), + 'L705I' => array( + 'width' => 240, + 'height' => 280, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 7.0 + // (FOMA 903i etc.) + 'SH903I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P903I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N903I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D903I' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO903I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'D903ITV' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903IX' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P903ITV' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'SH903ITV' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903IBSC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P903IX' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO903ITV' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'N703ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F703I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P703I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D703I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH703I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH703I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N703IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO703I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'P904I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'D904I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F904I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'N904I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'SH904I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P704I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D704I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH704I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N704IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F704I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO704I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'F883IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'F801I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 65536, + 'color' => 1 + ), + 'F705I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'D705I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'D705IMYU' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 7.1 + // (FOMA 905i etc.) + 'SH905I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 16777216, + 'color' => 1 + ), + 'D905I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'N905I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P905I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'F905I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 16777216, + 'color' => 1 + ), + 'SO905I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 16777216, + 'color' => 1 + ), + 'N905IMYU' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N905IBIZ' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'SH905ITV' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 16777216, + 'color' => 1 + ), + 'P705I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'N705I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ) + ); + } + } + + return @$displayMap[ strtoupper($model) ]; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */ Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php =================================================================== --- eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php 2008-03-11 12:01:32 UTC (rev 18) +++ eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php 2008-03-12 08:01:51 UTC (rev 19) @@ -1,347 +1,319 @@ - - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: EZweb.php 15532 2007-08-31 14:39:46Z nanasess $ - * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html - * @link http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html - * @see Net_UserAgent_Mobile_Common - * @since File available since Release 0.1.0 - */ - -require_once(dirname(__FILE__) . '/Common.php'); -require_once(dirname(__FILE__) . '/Display.php'); - -// {{{ Net_UserAgent_Mobile_EZweb - -/** - * EZweb implementation - * - * Net_UserAgent_Mobile_EZweb is a subclass of - * {@link Net_UserAgent_Mobile_Common}, which implements EZweb (WAP1.0/2.0) - * user agents. - * - * SYNOPSIS: - * - * require_once 'Net/UserAgent/Mobile.php'; - * - * $_SERVER['HTTP_USER_AGENT'] = 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2'; - * $agent = &Net_UserAgent_Mobile::factory(); - * - * printf("Name: %s\n", $agent->getName()); // 'UP.Browser' - * printf("Version: %s\n", $agent->getVersion()); // 3.01 - * printf("DeviceID: %s\n", $agent->getDeviceID()); // 'HI02' - * printf("Server: %s\n", $agent->getServer()); // 'UP.Link/3.2.1.2' - * - * e.g.) 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2 (Google WAP Proxy/1.0)' - * printf("Comment: %s\n", $agent->getComment()); // 'Google WAP Proxy/1.0' - * - * e.g.) 'KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1' - * if ($agent->isXHTMLCompliant()) { - * print "XHTML compliant!\n"; // true - * } - * - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 0.30.0 - * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html - * @link http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html - * @see Net_UserAgent_Mobile_Common - * @since Class available since Release 0.1.0 - */ -class Net_UserAgent_Mobile_EZweb extends Net_UserAgent_Mobile_Common -{ - - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private - */ - - /** - * name of the model like 'P502i' - * @var string - */ - var $_model = ''; - - /** - * device ID like 'TS21' - * @var string - */ - var $_deviceID = ''; - - /** - * server string like 'UP.Link/3.2.1.2' - * @var string - */ - var $_serverName = ''; - - /** - * comment like 'Google WAP Proxy/1.0' - * @var string - */ - var $_comment = null; - - /** - * whether it's XHTML compliant or not - * @var boolean - */ - var $_xhtmlCompliant = false; - - /**#@-*/ - - /**#@+ - * @access public - */ - - // }}} - // {{{ isEZweb() - - /** - * returns true - * - * @return boolean - */ - function isEZweb() - { - return true; - } - - // }}} - // {{{ isTUKa() - - /** - * returns true if the agent is TU-Ka - * - * @return boolean - */ - function isTUKa() - { - $tuka = substr($this->_deviceID, 2, 1); - if ($this->isWAP2()) { - if ($tuka == 'U') { - return true; - } - } else { - if ($tuka == 'T') { - return true; - } - } - - return false; - } - - // }}} - // {{{ parse() - - /** - * parse HTTP_USER_AGENT string - */ - function parse() - { - $agent = $this->getUserAgent(); - - if (preg_match('/^KDDI-(.*)/', $agent, $matches)) { - - // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 - $this->_xhtmlCompliant = true; - list($this->_deviceID, $browser, $opt, $this->_serverName) = - explode(' ', $matches[1], 4); - list($this->name, $version) = explode('/', $browser); - $this->version = "$version $opt"; - } else { - - // UP.Browser/3.01-HI01 UP.Link/3.4.5.2 - @list($browser, $this->_serverName, $comment) = - explode(' ', $agent, 3); - list($this->name, $software) = explode('/', $browser); - list($this->version, $this->_deviceID) = - explode('-', $software); - if ($comment) { - $this->_comment = - preg_replace('/^\((.*)\)$/', '$1', $comment); - } - } - - $this->_model = $this->_deviceID; - } - - // }}} - // {{{ makeDisplay() - - /** - * create a new {@link Net_UserAgent_Mobile_Display} class instance - * - * @return object a newly created {@link Net_UserAgent_Mobile_Display} - * object - * @see Net_UserAgent_Mobile_Display - */ - function makeDisplay() - { - @list($width, $height) = - explode(',', $this->getHeader('x-up-devcap-screenpixels')); - $screenDepth = - explode(',', $this->getHeader('x-up-devcap-screendepth')); - $depth = $screenDepth[0] ? pow(2, (integer)$screenDepth[0]) : 0; - $color = - $this->getHeader('x-up-devcap-iscolor') === '1' ? true : false; - return new Net_UserAgent_Mobile_Display(array( - 'width' => $width, - 'height' => $height, - 'color' => $color, - 'depth' => $depth - ) - ); - } - - // }}} - // {{{ getModel() - - /** - * returns name of the model (device ID) like 'TS21' - * - * @return string - */ - function getModel() - { - return $this->_model; - } - - // }}} - // {{{ getDeviceID() - - /** - * returns device ID like 'TS21' - * - * @return string - */ - function getDeviceID() - { - return $this->_deviceID; - } - - // }}} - // {{{ getServer() - - /** - * returns server string like 'UP.Link/3.2.1.2' - * - * @return string - */ - function getServer() - { - return $this->_serverName; - } - - // }}} - // {{{ getComment() - - /** - * returns comment like 'Google WAP Proxy/1.0'. returns null if nothinng. - * - * @return boolean - */ - function getComment() - { - return $this->_comment; - } - - // }}} - // {{{ isXHTMLCompliant() - - /** - * returns whether it's XHTML compliant or not - * - * @return boolean - */ - function isXHTMLCompliant() - { - return $this->_xhtmlCompliant; - } - - // }}} - // {{{ getCarrierShortName() - - /** - * returns the short name of the carrier - * - * @return string - */ - function getCarrierShortName() - { - return 'E'; - } - - // }}} - // {{{ getCarrierLongName() - - /** - * returns the long name of the carrier - * - * @return string - */ - function getCarrierLongName() - { - return 'EZweb'; - } - - // }}} - // {{{ isWIN() - - /** - * Returns whether the agent is CDMA 1X WIN or not. - * - * @return boolean - */ - function isWIN() - { - return substr($this->_deviceID, 2, 1) == 3 ? true : false; - } - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - // }}} -} - -// }}} - -/* - * Local Variables: - * mode: php - * coding: iso-8859-1 - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * indent-tabs-mode: nil - * End: - */ -?> + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: EZweb.php 17127 2008-03-12 07:43:11Z satou $ + * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html + * @link http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html + * @see Net_UserAgent_Mobile_Common + * @since File available since Release 0.1.0 + */ + +require_once 'Net/UserAgent/Mobile/Common.php'; +require_once 'Net/UserAgent/Mobile/Display.php'; + +// {{{ Net_UserAgent_Mobile_EZweb + +/** + * EZweb implementation + * + * Net_UserAgent_Mobile_EZweb is a subclass of + * {@link Net_UserAgent_Mobile_Common}, which implements EZweb (WAP1.0/2.0) + * user agents. + * + * SYNOPSIS: + * + * require_once 'Net/UserAgent/Mobile.php'; + * + * $_SERVER['HTTP_USER_AGENT'] = 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2'; + * $agent = &Net_UserAgent_Mobile::factory(); + * + * printf("Name: %s\n", $agent->getName()); // 'UP.Browser' + * printf("Version: %s\n", $agent->getVersion()); // 3.01 + * printf("DeviceID: %s\n", $agent->getDeviceID()); // 'HI02' + * printf("Server: %s\n", $agent->getServer()); // 'UP.Link/3.2.1.2' + * + * e.g.) 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2 (Google WAP Proxy/1.0)' + * printf("Comment: %s\n", $agent->getComment()); // 'Google WAP Proxy/1.0' + * + * e.g.) 'KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1' + * if ($agent->isXHTMLCompliant()) { + * print "XHTML compliant!\n"; // true + * } + * + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html + * @link http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html + * @see Net_UserAgent_Mobile_Common + * @since Class available since Release 0.1.0 + */ +class Net_UserAgent_Mobile_EZweb extends Net_UserAgent_Mobile_Common +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /** + * server string like 'UP.Link/3.2.1.2' + * @var string + */ + var $_serverName = ''; + + /** + * comment like 'Google WAP Proxy/1.0' + * @var string + */ + var $_comment = null; + + /** + * whether it's XHTML compliant or not + * @var boolean + */ + var $_xhtmlCompliant = false; + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ isEZweb() + + /** + * returns true + * + * @return boolean + */ + function isEZweb() + { + return true; + } + + // }}} + // {{{ isTUKa() + + /** + * returns true if the agent is TU-Ka + * + * @return boolean + */ + function isTUKa() + { + $tuka = substr($this->_rawModel, 2, 1); + if ($this->isWAP2()) { + if ($tuka == 'U') { + return true; + } + } else { + if ($tuka == 'T') { + return true; + } + } + + return false; + } + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + function parse($userAgent) + { + if (preg_match('/^KDDI-(.*)/', $userAgent, $matches)) { + + // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 + $this->_xhtmlCompliant = true; + list($this->_rawModel, $browser, $opt, $this->_serverName) = + explode(' ', $matches[1], 4); + list($this->name, $version) = explode('/', $browser); + $this->version = "$version $opt"; + } else { + + // UP.Browser/3.01-HI01 UP.Link/3.4.5.2 + @list($browser, $this->_serverName, $comment) = + explode(' ', $userAgent, 3); + list($this->name, $software) = explode('/', $browser); + list($this->version, $this->_rawModel) = + explode('-', $software); + if ($comment) { + $this->_comment = + preg_replace('/^\((.*)\)$/', '$1', $comment); + } + } + } + + // }}} + // {{{ makeDisplay() + + /** + * create a new {@link Net_UserAgent_Mobile_Display} class instance + * + * @return object a newly created {@link Net_UserAgent_Mobile_Display} + * object + * @see Net_UserAgent_Mobile_Display + */ + function makeDisplay() + { + @list($width, $height) = + explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS')); + $screenDepth = + explode(',', $this->getHeader('X-UP-DEVCAP-SCREENDEPTH')); + $depth = $screenDepth[0] ? pow(2, (integer)$screenDepth[0]) : 0; + $color = + $this->getHeader('X-UP-DEVCAP-ISCOLOR') === '1' ? true : false; + return new Net_UserAgent_Mobile_Display(array( + 'width' => $width, + 'height' => $height, + 'color' => $color, + 'depth' => $depth + ) + ); + } + + // }}} + // {{{ getDeviceID() + + /** + * Returns the device ID of the user agent. + * + * @return string + */ + function getDeviceID() + { + return $this->_rawModel; + } + + // }}} + // {{{ getServer() + + /** + * returns server string like 'UP.Link/3.2.1.2' + * + * @return string + */ + function getServer() + { + return $this->_serverName; + } + + // }}} + // {{{ getComment() + + /** + * returns comment like 'Google WAP Proxy/1.0'. returns null if nothinng. + * + * @return boolean + */ + function getComment() + { + return $this->_comment; + } + + // }}} + // {{{ isXHTMLCompliant() + + /** + * returns whether it's XHTML compliant or not + * + * @return boolean + */ + function isXHTMLCompliant() + { + return $this->_xhtmlCompliant; + } + + // }}} + // {{{ getCarrierShortName() + + /** + * returns the short name of the carrier + * + * @return string + */ + function getCarrierShortName() + { + return 'E'; + } + + // }}} + // {{{ getCarrierLongName() + + /** + * returns the long name of the carrier + * + * @return string + */ + function getCarrierLongName() + { + return 'EZweb'; + } + + // }}} + // {{{ isWIN() + + /** + * Returns whether the agent is CDMA 1X WIN or not. + * + * @return boolean + */ + function isWIN() + { + return substr($this->_rawModel, 2, 1) == 3 ? true : false; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */ Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php =================================================================== --- eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php 2008-03-11 12:01:32 UTC (rev 18) +++ eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php 2008-03-12 08:01:51 UTC (rev 19) @@ -1,188 +1,162 @@ - - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: NonMobile.php 15532 2007-08-31 14:39:46Z nanasess $ - * @see Net_UserAgent_Mobile_Common - * @since File available since Release 0.1.0 - */ - -require_once(dirname(__FILE__) . '/Common.php'); -require_once(dirname(__FILE__) . '/Display.php'); - -// {{{ Net_UserAgent_Mobile_NonMobile - -/** - * Non-Mobile Agent implementation - * - * Net_UserAgent_Mobile_NonMobile is a subclass of - * {@link Net_UserAgent_Mobile_Common}, which implements non-mobile or - * unimplemented user agents. - * - * SYNOPSIS: - * - * require_once 'Net/UserAgent/Mobile.php'; - * - * $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0'; - * $agent = &Net_UserAgent_Mobile::factory(); - * - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 0.30.0 - * @see Net_UserAgent_Mobile_Common - * @since Class available since Release 0.1.0 - */ -class Net_UserAgent_Mobile_NonMobile extends Net_UserAgent_Mobile_Common -{ - - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - /**#@+ - * @access public - */ - - // }}} - // {{{ isNonMobile() - - /** - * returns true - * - * @return boolean - */ - function isNonMobile() - { - return true; - } - - // }}} - // {{{ parse() - - /** - * parse HTTP_USER_AGENT string - */ - function parse() - { - @list($this->name, $this->version) = - explode('/', $this->getUserAgent()); - } - - // }}} - // {{{ makeDisplay() - - /** - * create a new {@link Net_UserAgent_Mobile_Display} class instance - * - * @return object a newly created {@link Net_UserAgent_Mobile_Display} - * object - * @see Net_UserAgent_Mobile_Display - */ - function makeDisplay() - { - return new Net_UserAgent_Mobile_Display(null); - } - - // }}} - // {{{ getModel() - - /** - * returns name of the model - * - * @return string - */ - function getModel() - { - return ''; - } - - // }}} - // {{{ getDeviceID() - - /** - * returns device ID - * - * @return string - */ - function getDeviceID() - { - return ''; - } - - // }}} - // {{{ getCarrierShortName() - - /** - * returns the short name of the carrier - * - * @return string - */ - function getCarrierShortName() - { - return 'N'; - } - - // }}} - // {{{ getCarrierLongName() - - /** - * returns the long name of the carrier - * - * @return string - */ - function getCarrierLongName() - { - return 'NonMobile'; - } - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - // }}} -} - -// }}} - -/* - * Local Variables: - * mode: php - * coding: iso-8859-1 - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * indent-tabs-mode: nil - * End: - */ -?> + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: NonMobile.php 17127 2008-03-12 07:43:11Z satou $ + * @see Net_UserAgent_Mobile_Common + * @since File available since Release 0.1.0 + */ + +require_once 'Net/UserAgent/Mobile/Common.php'; +require_once 'Net/UserAgent/Mobile/Display.php'; + +// {{{ Net_UserAgent_Mobile_NonMobile + +/** + * Non-Mobile Agent implementation + * + * Net_UserAgent_Mobile_NonMobile is a subclass of + * {@link Net_UserAgent_Mobile_Common}, which implements non-mobile or + * unimplemented user agents. + * + * SYNOPSIS: + * + * require_once 'Net/UserAgent/Mobile.php'; + * + * $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0'; + * $agent = &Net_UserAgent_Mobile::factory(); + * + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @see Net_UserAgent_Mobile_Common + * @since Class available since Release 0.1.0 + */ +class Net_UserAgent_Mobile_NonMobile extends Net_UserAgent_Mobile_Common +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ isNonMobile() + + /** + * returns true + * + * @return boolean + */ + function isNonMobile() + { + return true; + } + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + function parse($userAgent) + { + @list($this->name, $this->version) = explode('/', $userAgent); + } + + // }}} + // {{{ makeDisplay() + + /** + * create a new {@link Net_UserAgent_Mobile_Display} class instance + * + * @return object a newly created {@link Net_UserAgent_Mobile_Display} + * object + * @see Net_UserAgent_Mobile_Display + */ + function makeDisplay() + { + return new Net_UserAgent_Mobile_Display(null); + } + + // }}} + // {{{ getCarrierShortName() + + /** + * returns the short name of the carrier + * + * @return string + */ + function getCarrierShortName() + { + return 'N'; + } + + // }}} + // {{{ getCarrierLongName() + + /** + * returns the long name of the carrier + * + * @return string + */ + function getCarrierLongName() + { + return 'NonMobile'; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */ Added: eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php =================================================================== --- eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php (rev 0) +++ eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php 2008-03-12 08:01:51 UTC (rev 19) @@ -0,0 +1,562 @@ + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: SoftBank.php 17127 2008-03-12 07:43:11Z satou $ + * @since File available since Release 0.20.0 + */ + +require_once 'Net/UserAgent/Mobile/Common.php'; +require_once 'Net/UserAgent/Mobile/Display.php'; + +// {{{ Net_UserAgent_Mobile_SoftBank + +/** + * SoftBank implementation + * + * Net_UserAgent_Mobile_SoftBank is a subclass of + * {@link Net_UserAgent_Mobile_Common}, which implements SoftBank user agents. + * + * SYNOPSIS: + * + * require_once 'Net/UserAgent/Mobile.php'; + * + * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02'; + * $agent = &Net_UserAgent_Mobile::factory(); + * + * printf("Name: %s\n", $agent->getName()); // 'J-PHONE' + * printf("Version: %s\n", $agent->getVersion()); // 2.0 + * printf("Model: %s\n", $agent->getModel()); // 'J-DN02' + * if ($agent->isPacketCompliant()) { + * print "Packet is compliant.\n"; // false + * } + * + * // only availabe in Java compliant + * // e.g.) 'J-PHONE/4.0/J-SH51/SNXXXXXXXXX SH/0001a Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0' + * printf("Serial: %s\n", $agent->getSerialNumber()); // XXXXXXXXX + * printf("Vendor: %s\n", $agent->getVendor()); // 'SH' + * printf("Vendor Version: %s\n", $agent->getVendorVersion()); // '0001a' + * + * $info = $agent->getJavaInfo(); // array + * foreach ($info as $key => $value) { + * print "$key: $value\n"; + * } + * + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @link http://developers.vodafone.jp/dp/tool_dl/web/useragent.php + * @link http://developers.vodafone.jp/dp/tool_dl/web/position.php + * @see Net_UserAgent_Mobile_Common + * @since Class available since Release 0.20.0 + */ +class Net_UserAgent_Mobile_SoftBank extends Net_UserAgent_Mobile_Common +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /** + * whether the agent is packet connection complicant or not + * @var boolean + */ + var $_packetCompliant = false; + + /** + * terminal unique serial number + * @var string + */ + var $_serialNumber = null; + + /** + * vendor code like 'SH' + * @var string + */ + var $_vendor = ''; + + /** + * vendor version like '0001a' + * @var string + */ + var $_vendorVersion = null; + + /** + * Java profiles + * @var array + */ + var $_javaInfo = array(); + + /** + * whether the agent is 3G + * @var boolean + */ + var $_is3G = true; + + /** + * the name of the mobile phone + * @var string + */ + var $_msname = ''; + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ isJPhone() + + /** + * returns true + * + * @return boolean + */ + function isJPhone() + { + return $this->isSoftBank(); + } + + // }}} + // {{{ isVodafone() + + /** + * returns true + * + * @return boolean + */ + function isVodafone() + { + return $this->isSoftBank(); + } + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @return mixed void, or a PEAR error object on error + */ + function parse($userAgent) + { + $agent = explode(' ', $userAgent); + preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!', + $agent[0], $matches + ); + if (count($matches) > 1) { + $carrier = $matches[1]; + } else { + $carrier = 'Motorola'; + } + + switch ($carrier) { + case 'SoftBank': + case 'Semulator': + case 'Vodafone': + case 'Vemulator': + $result = $this->_parseVodafone($agent); + break; + case 'J-PHONE': + case 'J-EMULATOR': + $result = $this->_parseJphone($agent); + break; + case 'Motorola': + case 'MOTEMULATOR': + $result = $this->_parseMotorola($agent); + break; + } + + if (Net_UserAgent_Mobile::isError($result)) { + return $result; + } + + $this->_msname = $this->getHeader('X-JPHONE-MSNAME'); + } + + // }}} + // {{{ makeDisplay() + + /** + * create a new {@link Net_UserAgent_Mobile_Display} class instance + * + * @return object a newly created {@link Net_UserAgent_Mobile_Display} + * object + * @see Net_UserAgent_Mobile_Display + */ + function makeDisplay() + { + @list($width, $height) = + explode('*', $this->getHeader('X-JPHONE-DISPLAY')); + $color = false; + $depth = 0; + if ($color_string = $this->getHeader('X-JPHONE-COLOR')) { + preg_match('!^([CG])(\d+)$!', $color_string, $matches); + $color = $matches[1] === 'C' ? true : false; + $depth = $matches[2]; + } + return new Net_UserAgent_Mobile_Display(array( + 'width' => $width, + 'height' => $height, + 'depth' => $depth, + 'color' => $color) + ); + } + + // }}} + // {{{ isPacketCompliant() + + /** + * returns whether the agent is packet connection complicant or not + * + * @return boolean + */ + function isPacketCompliant() + { + return $this->_packetCompliant; + } + + // }}} + // {{{ getSerialNumber() + + /** + * return terminal unique serial number. returns null if user forbids to + * send his/her serial number. + * + * @return string + */ + function getSerialNumber() + { + return $this->_serialNumber; + } + + // }}} + // {{{ getVendor() + + /** + * returns vendor code like 'SH' + * + * @return string + */ + function getVendor() + { + return $this->_vendor; + } + + // }}} + // {{{ getVendorVersion() + + /** + * returns vendor version like '0001a'. returns null if unknown. + * + * @return string + */ + function getVendorVersion() + { + return $this->_vendorVersion; + } + + // }}} + // {{{ getJavaInfo() + + /** + * returns array of Java profiles + * + * Array structure is something like: + * + * - 'Profile' => 'MIDP-1.0', + * - 'Configuration' => 'CLDC-1.0', + * - 'Ext-Profile' => 'JSCL-1.1.0' + * + * @return array + */ + function getJavaInfo() + { + return $this->_javaInfo; + } + + // }}} + // {{{ getCarrierShortName() + + /** + * returns the short name of the carrier + * + * @return string + */ + function getCarrierShortName() + { + return 'S'; + } + + // }}} + // {{{ getCarrierLongName() + + /** + * returns the long name of the carrier + * + * @return string + */ + function getCarrierLongName() + { + return 'SoftBank'; + } + + // }}} + // {{{ isTypeC() + + /** + * returns true if the type is C + * + * @return boolean + */ + function isTypeC() + { + if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) { + return false; + } + + return true; + } + + // }}} + // {{{ isTypeP() + + /** + * returns true if the type is P + * + * @return boolean + */ + function isTypeP() + { + if ($this->_is3G || !preg_match('!^4\.!', $this->version)) { + return false; + } + + return true; + } + + // }}} + // {{{ isTypeW() + + /** + * returns true if the type is W + * + * @return boolean + */ + function isTypeW() + { + if ($this->_is3G || !preg_match('!^5\.!', $this->version)) { + return false; + } + + return true; + } + + // }}} + // {{{ isType3GC() + + /** + * returns true if the type is 3GC + * + * @return boolean + */ + function isType3GC() + { + return $this->_is3G; + } + + // }}} + // {{{ getMsname() + + /** + * returns the name of the mobile phone + * + * @return string the name of the mobile phone + */ + function getMsname() + { + return $this->_msname; + } + + // }}} + // {{{ isSoftBank() + + /** + * returns true if the agent is SoftBank. + * + * @return boolean + */ + function isSoftBank() + { + return true; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + // }}} + // {{{ _parseVodafone() + + /** + * parse HTTP_USER_AGENT string for the Vodafone 3G aegnt + * + * @param array $agent parts of the User-Agent string + * @return mixed void, or a PEAR error object on error + */ + function _parseVodafone(&$agent) + { + $count = count($agent); + $this->_packetCompliant = true; + + // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 + // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 + // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 + @list($this->name, $this->version, $this->_rawModel, $modelVersion, + $serialNumber) = explode('/', $agent[0]); + if ($serialNumber) { + if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { + return $this->noMatch(); + } + $this->_serialNumber = $matches[1]; + } + + if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) { + return $this->noMatch(); + } + + $this->_vendor = $matches[1]; + $this->_vendorVersion = $matches[2]; + + for ($i = 2; $i < $count; ++$i) { + list($key, $value) = explode('/', $agent[$i]); + $this->_javaInfo[$key] = $value; + } + } + + // }}} + // {{{ _parseJphone() + + /** + * parse HTTP_USER_AGENT string for the ancient agent + * + * @param array $agent parts of the User-Agent string + * @return mixed void, or a PEAR error object on error + */ + function _parseJphone(&$agent) + { + $count = count($agent); + $this->_is3G = false; + + if ($count > 1) { + + // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 + $this->_packetCompliant = true; + @list($this->name, $this->version, $this->_rawModel, + $serialNumber) = explode('/', $agent[0]); + if ($serialNumber) { + if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { + return $this->noMatch(); + } + $this->_serialNumber = $matches[1]; + } + + list($this->_vendor, $this->_vendorVersion) = + explode('/', $agent[1]); + for ($i = 2; $i < $count; ++$i) { + list($key, $value) = explode('/', $agent[$i]); + $this->_javaInfo[$key] = $value; + } + } else { + + // J-PHONE/2.0/J-DN02 + @list($this->name, $this->version, $this->_rawModel, + $serialNumber) = explode('/', $agent[0]); + if ($serialNumber) { + if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { + return $this->noMatch(); + } + $this->_serialNumber = $matches[1]; + } + + if ($this->_rawModel) { + if (preg_match('!V\d+([A-Z]+)!', $this->_rawModel, $matches)) { + $this->_vendor = $matches[1]; + } elseif (preg_match('!J-([A-Z]+)!', $this->_rawModel, $matches)) { + $this->_vendor = $matches[1]; + } + } + } + } + + // }}} + // {{{ _parseMotorola() + + /** + * parse HTTP_USER_AGENT string for the Motorola 3G aegnt + * + * @param array $agent parts of the User-Agent string + * @return mixed void, or a PEAR error object on error + */ + function _parseMotorola(&$agent) + { + $count = count($agent); + $this->_packetCompliant = true; + $this->_vendor = 'MOT'; + + // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 + list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]); + $this->_model = substr(strrchr($this->_rawModel, '-'), 1); + + for ($i = 2; $i < $count; ++$i) { + list($key, $value) = explode('/', $agent[$i]); + $this->_javaInfo[$key] = $value; + } + } + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */ Added: eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php =================================================================== --- eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php (rev 0) +++ eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php 2008-03-12 08:01:51 UTC (rev 19) @@ -0,0 +1,279 @@ + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: Willcom.php 17127 2008-03-12 07:43:11Z satou $ + * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html + * @since File available since Release 0.5 + */ + +require_once 'Net/UserAgent/Mobile/Common.php'; +require_once 'Net/UserAgent/Mobile/Display.php'; + +// {{{ Net_UserAgent_Mobile_Willcom + +/** + * AirH"PHONE implementation + * + * Net_UserAgent_Mobile_Willcom is a subclass of + * {@link Net_UserAgent_Mobile_Common}, which implements Willcom's user + * agents. + * + * SYNOPSIS: + * + * require_once 'Net/UserAgent/Mobile.php'; + * + * $_SERVER['HTTP_USER_AGENT'] = + * 'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0'; + * $agent = &Net_UserAgent_Mobile::factory(); + * + * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET' + * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC' + * printf("Model: %s\n", $agent->getModel()); // 'AH-J3001V,AH-J3002V' + * printf("Model Version: %s\n", $agent->getModelVersion()); // '1.0' + * printf("Browser Version: %s\n", $agent->getBrowserVersion()); // '0100' + * printf("Cache Size: %s\n", $agent->getCacheSize()); // 50 + * + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html + * @see Net_UserAgent_Mobile_Common + * @since Class available since Release 0.5 + */ +class Net_UserAgent_Mobile_Willcom extends Net_UserAgent_Mobile_Common +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /** + * User-Agent name + * @var string + */ + var $name = 'WILLCOM'; + + /**#@-*/ + + /**#@+ + * @access private + */ + + /** + * vendor name + * @var string + */ + var $_vendor; + + /** + * version number of the model + * @var string + */ + var $_modelVersion; + + /** + * version number of the browser + * @var string + */ + var $_browserVersion; + + /** + * cache size as killobytes unit + * @var integer + */ + var $_cacheSize; + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ isAirHPhone() + + /** + * returns true + * + * @return boolean + */ + function isAirHPhone() + { + return $this->isWillcom(); + } + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + function parse($userAgent) + { + if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!', + $userAgent, $matches) + ) { + list($this->_vendor, $this->_rawModel, $this->_modelVersion, + $this->_browserVersion, $cache) = + explode('/', $matches[1]); + if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) { + return $this->noMatch(); + } + $this->_cacheSize = (integer)$matches[1]; + } else { + $this->noMatch(); + } + } + + // }}} + // {{{ makeDisplay() + + /** + * create a new {@link Net_UserAgent_Mobile_Display} class instance + * + * @return object a newly created {@link Net_UserAgent_Mobile_Display} + * object + * @see Net_UserAgent_Mobile_Display + */ + function makeDisplay() + { + return new Net_UserAgent_Mobile_Display(null); + } + + // }}} + // {{{ getVendor() + + /** + * returns vendor name + * + * @return string + */ + function getVendor() + { + return $this->_vendor; + } + + // }}} + // {{{ getModelVersion() + + /** + * returns version number of the model + * + * @return string + */ + function getModelVersion() + { + return $this->_modelVersion; + } + + // }}} + // {{{ getBrowserVersion() + + /** + * returns version number of the browser + * + * @return string + */ + function getBrowserVersion() + { + return $this->_browserVersion; + } + + // }}} + // {{{ getCacheSize() + + /** + * returns cache size as killobytes unit + * + * @return integer + */ + function getCacheSize() + { + return $this->_cacheSize; + } + + // }}} + // {{{ getCarrierShortName() + + /** + * returns the short name of the carrier + * + * @return string + */ + function getCarrierShortName() + { + return 'W'; + } + + // }}} + // {{{ getCarrierLongName() + + /** + * returns the long name of the carrier + * + * @return string + */ + function getCarrierLongName() + { + return 'WILLCOM'; + } + + // }}} + // {{{ isWillcom() + + /** + * Returns whether the agent is Willcom or not. + * + * @return boolean + * @since Method available since Release 0.31.0 + */ + function isWillcom() + { + return true; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */ Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile.php =================================================================== --- eccube2/trunk/data/module/Net/UserAgent/Mobile.php 2008-03-11 12:01:32 UTC (rev 18) +++ eccube2/trunk/data/module/Net/UserAgent/Mobile.php 2008-03-12 08:01:51 UTC (rev 19) @@ -1,358 +1,497 @@ - - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Mobile.php 15532 2007-08-31 14:39:46Z nanasess $ - * @since File available since Release 0.1 - */ - -require_once dirname(__FILE__) . '/../../PEAR.php'; -require_once dirname(__FILE__) . '/Mobile/Request.php'; - -// {{{ constants - -/** - * Constants for error handling. - */ -define('NET_USERAGENT_MOBILE_OK', 1); -define('NET_USERAGENT_MOBILE_ERROR', -1); -define('NET_USERAGENT_MOBILE_ERROR_NOMATCH', -2); -define('NET_USERAGENT_MOBILE_ERROR_NOT_FOUND', -3); - -// }}} -// {{{ GLOBALS - -/** - * globals for fallback on no match - * - * @global boolean $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] - */ -$GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] = false; - -// }}} -// {{{ Net_UserAgent_Mobile - -/** - * HTTP mobile user agent string parser - * - * Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) - * mobile HTTP user agents. It'll be useful in page dispatching by user - * agents. - * This package was ported from Perl's HTTP::MobileAgent. - * See {@link http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent} - * The author of the HTTP::MobileAgent module is Tatsuhiko Miyagawa - * - * - * SYNOPSIS: - * - * require_once 'Net/UserAgent/Mobile.php'; - * - * $agent = &Net_UserAgent_Mobile::factory($agent_string); - * // or $agent = &Net_UserAgent_Mobile::factory(); // to get from $_SERVER - * - * if ($agent->isDoCoMo()) { - * // or if ($agent->getName() == 'DoCoMo') - * // or if (strtolower(get_class($agent)) == 'http_mobileagent_docomo') - * // it's NTT DoCoMo i-mode - * // see what's available in Net_UserAgent_Mobile_DoCoMo - * } elseif ($agent->isVodafone()) { - * // it's Vodafone(J-PHONE) - * // see what's available in Net_UserAgent_Mobile_Vodafone - * } elseif ($agent->isEZweb()) { - * // it's KDDI/EZWeb - * // see what's available in Net_UserAgent_Mobile_EZweb - * } else { - * // may be PC - * // $agent is Net_UserAgent_Mobile_NonMobile - * } - * - * $display = $agent->getDisplay(); // Net_UserAgent_Mobile_Display - * if ($display->isColor()) { - * ... - * } - * - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 0.30.0 - * @since Class available since Release 0.1 - */ -class Net_UserAgent_Mobile -{ - - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - /**#@+ - * @access public - * @static - */ - - // }}} - // {{{ factory() - - /** - * create a new {@link Net_UserAgent_Mobile_Common} subclass instance - * - * parses HTTP headers and constructs {@link Net_UserAgent_Mobile_Common} - * subclass instance. - * If no argument is supplied, $_SERVER{'HTTP_*'} is used. - * - * @param mixed $stuff User-Agent string or object that works with - * HTTP_Request (not implemented) - * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR - * error object on error - * @see Net_UserAgent_Mobile_Request::factory() - */ - function &factory($stuff = null) - { - static $mobileRegex; - if (!isset($mobileRegex)) { - $docomoRegex = '^DoCoMo/\d\.\d[ /]'; - $vodafoneRegex = '^(?:(?:SoftBank|Vodafone|J-PHONE|Vemulator|J-EMULATOR)/\d\.\d|(?:MOT|MOTEMULATOR)-)'; - $ezwebRegex = '^(?:KDDI-[A-Z]+\d+[A-Z]? )?UP\.Browser\/'; - $airhphoneRegex = '^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);'; - $mobileRegex = - "(?:($docomoRegex)|($vodafoneRegex)|($ezwebRegex)|($airhphoneRegex))"; - } - - $request = &Net_UserAgent_Mobile_Request::factory($stuff); - - // parse User-Agent string - $ua = $request->get('User-Agent'); - $sub = 'NonMobile'; - if (preg_match("!$mobileRegex!", $ua, $matches)) { - $sub = @$matches[1] ? 'DoCoMo' : - (@$matches[2] ? 'Vodafone' : - (@$matches[3] ? 'EZweb' : 'AirHPhone')); - } - $className = "Net_UserAgent_Mobile_{$sub}"; - - if (!class_exists($className)) { - $file = dirname(__FILE__) . "/Mobile/{$sub}.php"; - if (!include_once $file) { - return PEAR::raiseError(null, - NET_USERAGENT_MOBILE_ERROR_NOT_FOUND, - null, null, - "Unable to include the $file file", - 'Net_UserAgent_Mobile_Error', true - ); - } - } - - $instance = &new $className($request); - $error = &$instance->isError(); - if (Net_UserAgent_Mobile::isError($error)) { - if ($GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] - && $error->getCode() == NET_USERAGENT_MOBILE_ERROR_NOMATCH - ) { - $instance = &Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_Fallback_On_NoMatch'); - return $instance; - } - - $instance = &$error; - } - - return $instance; - } - - // }}} - // {{{ singleton() - - /** - * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or - * returns a instance from existent ones - * - * @param mixed $stuff User-Agent string or object that works with - * HTTP_Request (not implemented) - * @return mixed a newly created or a existent Net_UserAgent_Mobile - * object, or a PEAR error object on error - * @see Net_UserAgent_Mobile::factory() - */ - function &singleton($stuff = null) - { - static $instance; - if (!isset($instance)) { - $instance = Net_UserAgent_Mobile::factory($stuff); - } - - return $instance; - } - - // }}} - // {{{ isError() - - /** - * tell whether a result code from a Net_UserAgent_Mobile method - * is an error - * - * @param integer $value result code - * @return boolean whether $value is an {@link Net_UserAgent_Mobile_Error} - */ - function isError($value) - { - return is_a($value, 'Net_UserAgent_Mobile_Error'); - } - - // }}} - // {{{ errorMessage() - - /** - * return a textual error message for a Net_UserAgent_Mobile error code - * - * @param integer $value error code - * @return string error message, or false if the error code was not - * recognized - */ - function errorMessage($value) - { - static $errorMessages; - if (!isset($errorMessages)) { - $errorMessages = array( - NET_USERAGENT_MOBILE_ERROR => 'unknown error', - NET_USERAGENT_MOBILE_ERROR_NOMATCH => 'no match', - NET_USERAGENT_MOBILE_ERROR_NOT_FOUND => 'not found', - NET_USERAGENT_MOBILE_OK => 'no error' - ); - } - - if (Net_UserAgent_Mobile::isError($value)) { - $value = $value->getCode(); - } - - return isset($errorMessages[$value]) ? - $errorMessages[$value] : - $errorMessages[NET_USERAGENT_MOBILE_ERROR]; - } - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - // }}} -} - -// }}} -// {{{ Net_UserAgent_Mobile_Error - -/** - * Net_UserAgent_Mobile_Error implements a class for reporting user - * agent error messages - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro - * @copyright 2003-2007 KUBO Atsuhiro - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 0.30.0 - * @since Class available since Release 0.1 - */ -class Net_UserAgent_Mobile_Error extends PEAR_Error -{ - - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - /**#@+ - * @access public - */ - - // }}} - // {{{ constructor - - /** - * constructor - * - * @param mixed $code Net_UserAgent_Mobile error code, or string - * with error message. - * @param integer $mode what 'error mode' to operate in - * @param integer $level what error level to use for $mode and - * PEAR_ERROR_TRIGGER - * @param mixed $userinfo additional user/debug info - * @access public - */ - function Net_UserAgent_Mobile_Error($code = NET_USERAGENT_MOBILE_ERROR, - $mode = PEAR_ERROR_RETURN, - $level = E_USER_NOTICE, - $userinfo = null - ) - { - if (is_int($code)) { - $this->PEAR_Error('Net_UserAgent_Mobile Error: ' . - Net_UserAgent_Mobile::errorMessage($code), - $code, $mode, $level, $userinfo - ); - } else { - $this->PEAR_Error("Net_UserAgent_Mobile Error: $code", - NET_USERAGENT_MOBILE_ERROR, $mode, $level, - $userinfo - ); - } - } - - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - - // }}} -} - -// }}} - -/* - * Local Variables: - * mode: php - * coding: iso-8859-1 - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * indent-tabs-mode: nil - * End: - */ -?> + + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: $Id: Mobile.php 17127 2008-03-12 07:43:11Z satou $ + * @since File available since Release 0.1 + */ + +require_once 'PEAR.php'; + +// {{{ constants + +/** + * Constants for error handling. + */ +define('NET_USERAGENT_MOBILE_OK', 1); +define('NET_USERAGENT_MOBILE_ERROR', -1); +define('NET_USERAGENT_MOBILE_ERROR_NOMATCH', -2); +define('NET_USERAGENT_MOBILE_ERROR_NOT_FOUND', -3); + +// }}} +// {{{ GLOBALS + +/** + * globals for fallback on no match + * + * @global boolean $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] + */ +$GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] = false; + +// }}} +// {{{ Net_UserAgent_Mobile + +/** + * HTTP mobile user agent string parser + * + * Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) + * mobile HTTP user agents. It'll be useful in page dispatching by user + * agents. + * This package was ported from Perl's HTTP::MobileAgent. + * See {@link http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent} + * The author of the HTTP::MobileAgent module is Tatsuhiko Miyagawa + * + * + * SYNOPSIS: + * + * require_once 'Net/UserAgent/Mobile.php'; + * + * $agent = &Net_UserAgent_Mobile::factory($agent_string); + * // or $agent = &Net_UserAgent_Mobile::factory(); // to get from $_SERVER + * + * if ($agent->isDoCoMo()) { + * // or if ($agent->getName() == 'DoCoMo') + * // or if (strtolower(get_class($agent)) == 'http_mobileagent_docomo') + * // it's NTT DoCoMo i-mode + * // see what's available in Net_UserAgent_Mobile_DoCoMo + * } elseif ($agent->isVodafone()) { + * // it's Vodafone(J-PHONE) + * // see what's available in Net_UserAgent_Mobile_Vodafone + * } elseif ($agent->isEZweb()) { + * // it's KDDI/EZWeb + * // see what's available in Net_UserAgent_Mobile_EZweb + * } else { + * // may be PC + * // $agent is Net_UserAgent_Mobile_NonMobile + * } + * + * $display = $agent->getDisplay(); // Net_UserAgent_Mobile_Display + * if ($display->isColor()) { + * ... + * } + * + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2008 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @since Class available since Release 0.1 + */ +class Net_UserAgent_Mobile +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + /**#@+ + * @access public + * @static + */ + + // }}} + // {{{ factory() + + /** + * create a new {@link Net_UserAgent_Mobile_Common} subclass instance + * + * parses HTTP headers and constructs {@link Net_UserAgent_Mobile_Common} + * subclass instance. + * If no argument is supplied, $_SERVER{'HTTP_*'} is used. + * + * @param string $userAgent User-Agent string + * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR + * error object on error + */ + function &factory($userAgent = null) + { + if (is_null($userAgent)) { + $userAgent = $_SERVER['HTTP_USER_AGENT']; + } + + // parse User-Agent string + if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) { + $driver = 'DoCoMo'; + } elseif (Net_UserAgent_Mobile::isEZweb($userAgent)) { + $driver = 'EZweb'; + } elseif (Net_UserAgent_Mobile::isSoftBank($userAgent)) { + $driver = 'SoftBank'; + } elseif (Net_UserAgent_Mobile::isWillcom($userAgent)) { + $driver = 'Willcom'; + } else { + $driver = 'NonMobile'; + } + + $class = "Net_UserAgent_Mobile_$driver"; + + if (!class_exists($class)) { + $file = str_replace('_', '/', $class) . '.php'; + if (!include_once $file) { + return PEAR::raiseError(null, + NET_USERAGENT_MOBILE_ERROR_NOT_FOUND, + null, null, + "Unable to include the $file file", + 'Net_UserAgent_Mobile_Error', true + ); + } + } + + $instance = &new $class($userAgent); + $error = &$instance->isError(); + if (Net_UserAgent_Mobile::isError($error)) { + if ($GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] + && $error->getCode() == NET_USERAGENT_MOBILE_ERROR_NOMATCH + ) { + $instance = &Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_Fallback_On_NoMatch'); + return $instance; + } + + $instance = &$error; + } + + return $instance; + } + + // }}} + // {{{ singleton() + + /** + * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or + * returns a instance from existent ones + * + * @param string $userAgent User-Agent string + * @return mixed a newly created or a existent Net_UserAgent_Mobile + * object, or a PEAR error object on error + * @see Net_UserAgent_Mobile::factory() + */ + function &singleton($userAgent = null) + { + static $instances; + + if (!isset($instances)) { + $instances = array(); + } + + if (is_null($userAgent)) { + $userAgent = $_SERVER['HTTP_USER_AGENT']; + } + + if (!array_key_exists($userAgent, $instances)) { + $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); + } + + return $instances[$userAgent]; + } + + // }}} + // {{{ isError() + + /** + * tell whether a result code from a Net_UserAgent_Mobile method + * is an error + * + * @param integer $value result code + * @return boolean whether $value is an {@link Net_UserAgent_Mobile_Error} + */ + function isError($value) + { + return is_a($value, 'Net_UserAgent_Mobile_Error'); + } + + // }}} + // {{{ errorMessage() + + /** + * return a textual error message for a Net_UserAgent_Mobile error code + * + * @param integer $value error code + * @return string error message, or false if the error code was not + * recognized + */ + function errorMessage($value) + { + static $errorMessages; + if (!isset($errorMessages)) { + $errorMessages = array( + NET_USERAGENT_MOBILE_ERROR => 'unknown error', + NET_USERAGENT_MOBILE_ERROR_NOMATCH => 'no match', + NET_USERAGENT_MOBILE_ERROR_NOT_FOUND => 'not found', + NET_USERAGENT_MOBILE_OK => 'no error' + ); + } + + if (Net_UserAgent_Mobile::isError($value)) { + $value = $value->getCode(); + } + + return isset($errorMessages[$value]) ? + $errorMessages[$value] : + $errorMessages[NET_USERAGENT_MOBILE_ERROR]; + } + + // }}} + // {{{ isMobile() + + /** + * Checks whether or not the user agent is mobile by a given user agent + * string. + * + * @param string $userAgent + * @return boolean + * @since Method available since Release 0.31.0 + */ + function isMobile($userAgent = null) + { + if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) { + return true; + } elseif (Net_UserAgent_Mobile::isEZweb($userAgent)) { + return true; + } elseif (Net_UserAgent_Mobile::isSoftBank($userAgent)) { + return true; + } elseif (Net_UserAgent_Mobile::isWillcom($userAgent)) { + return true; + } + + return false; + } + + // }}} + // {{{ isDoCoMo() + + /** + * Checks whether or not the user agent is DoCoMo by a given user agent + * string. + * + * @param string $userAgent + * @return boolean + * @since Method available since Release 0.31.0 + */ + function isDoCoMo($userAgent = null) + { + if (is_null($userAgent)) { + $userAgent = $_SERVER['HTTP_USER_AGENT']; + } + + if (preg_match('!^DoCoMo!', $userAgent)) { + return true; + } + + return false; + } + + // }}} + // {{{ isEZweb() + + /** + * Checks whether or not the user agent is EZweb by a given user agent + * string. + * + * @param string $userAgent + * @return boolean + * @since Method available since Release 0.31.0 + */ + function isEZweb($userAgent = null) + { + if (is_null($userAgent)) { + $userAgent = $_SERVER['HTTP_USER_AGENT']; + } + + if (preg_match('!^KDDI-!', $userAgent)) { + return true; + } elseif (preg_match('!^UP\.Browser!', $userAgent)) { + return true; + } + + return false; + } + + // }}} + // {{{ isSoftBank() + + /** + * Checks whether or not the user agent is SoftBank by a given user agent + * string. + * + * @param string $userAgent + * @return boolean + * @since Method available since Release 0.31.0 + */ + function isSoftBank($userAgent = null) + { + if (is_null($userAgent)) { + $userAgent = $_SERVER['HTTP_USER_AGENT']; + } + + if (preg_match('!^SoftBank!', $userAgent)) { + return true; + } elseif (preg_match('!^Semulator!', $userAgent)) { + return true; + } elseif (preg_match('!^Vodafone!', $userAgent)) { + return true; + } elseif (preg_match('!^Vemulator!', $userAgent)) { + return true; + } elseif (preg_match('!^MOT-!', $userAgent)) { + return true; + } elseif (preg_match('!^MOTEMULATOR!', $userAgent)) { + return true; + } elseif (preg_match('!^J-PHONE!', $userAgent)) { + return true; + } elseif (preg_match('!^J-EMULATOR!', $userAgent)) { + return true; + } + + return false; + } + + // }}} + // {{{ isWillcom() + + /** + * Checks whether or not the user agent is Willcom by a given user agent + * string. + * + * @param string $userAgent + * @return boolean + * @since Method available since Release 0.31.0 + */ + function isWillcom($userAgent = null) + { + if (is_null($userAgent)) { + $userAgent = $_SERVER['HTTP_USER_AGENT']; + } + + if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);!', $userAgent)) { + return true; + } + + return false; + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + // }}} +} + +// }}} +// {{{ Net_UserAgent_Mobile_Error + +/** + * Net_UserAgent_Mobile_Error implements a class for reporting user + * agent error messages + * + * @category Networking + * @package Net_UserAgent_Mobile + * @author KUBO Atsuhiro + * @copyright 2003-2007 KUBO Atsuhiro + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: 0.31.0 + * @since Class available since Release 0.1 + */ +class Net_UserAgent_Mobile_Error extends PEAR_Error +{ + + // {{{ properties + + /**#@+ + * @access public + */ + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + /**#@+ + * @access public + */ + + // }}} + // {{{ constructor + + /** + * constructor + * + * @param mixed $code Net_UserAgent_Mobile error code, or string + * with error message. + * @param integer $mode what 'error mode' to operate in + * @param integer $level what error level to use for $mode and + * PEAR_ERROR_TRIGGER + * @param mixed $userinfo additional user/debug info + * @access public + */ + function Net_UserAgent_Mobile_Error($code = NET_USERAGENT_MOBILE_ERROR, + $mode = PEAR_ERROR_RETURN, + $level = E_USER_NOTICE, + $userinfo = null + ) + { + if (is_int($code)) { + $this->PEAR_Error('Net_UserAgent_Mobile Error: ' . + Net_UserAgent_Mobile::errorMessage($code), + $code, $mode, $level, $userinfo + ); + } else { + $this->PEAR_Error("Net_UserAgent_Mobile Error: $code", + NET_USERAGENT_MOBILE_ERROR, $mode, $level, + $userinfo + ); + } + } + + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: iso-8859-1 + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * indent-tabs-mode: nil + * End: + */

_ [EC-CUBE] 2008/3/12の更新内容2

Date: 2008-03-12 18:01:36 +0900 (Wed, 12 Mar 2008)
New Revision: 20
 
Modified:
   eccube2/trunk/data/module/Net/UserAgent/Mobile.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php
   eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php
Log:
auto commit
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/Common.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,12 +15,12 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: Common.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: Common.php 17128 2008-03-12 08:32:34Z satou $
  * @since      File available since Release 0.1
  */
+
+require_once dirname(__FILE__) . '/../Mobile.php';
 
-require_once 'Net/UserAgent/Mobile.php';
-
 // {{{ Net_UserAgent_Mobile_Common
 
 /**
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/DoCoMo.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,15 +15,15 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: DoCoMo.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: DoCoMo.php 17128 2008-03-12 08:32:34Z satou $
  * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html
  * @see        Net_UserAgent_Mobile_Common
  * @since      File available since Release 0.1
  */
 
-require_once 'Net/UserAgent/Mobile/Common.php';
-require_once 'Net/UserAgent/Mobile/Display.php';
-require_once 'Net/UserAgent/Mobile/DoCoMoDisplayMap.php';
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
+require_once dirname(__FILE__) . '/DoCoMoDisplayMap.php';
 
 // {{{ Net_UserAgent_Mobile_DoCoMo
 
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/EZweb.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,15 +15,15 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: EZweb.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: EZweb.php 17128 2008-03-12 08:32:34Z satou $
  * @link       http://www.au.kddi.com/ezfactory/tec/spec/4_4.html
  * @link       http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html
  * @see        Net_UserAgent_Mobile_Common
  * @since      File available since Release 0.1.0
  */
 
-require_once 'Net/UserAgent/Mobile/Common.php';
-require_once 'Net/UserAgent/Mobile/Display.php';
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
 
 // {{{ Net_UserAgent_Mobile_EZweb
 
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/NonMobile.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,13 +15,13 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: NonMobile.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: NonMobile.php 17128 2008-03-12 08:32:34Z satou $
  * @see        Net_UserAgent_Mobile_Common
  * @since      File available since Release 0.1.0
  */
 
-require_once 'Net/UserAgent/Mobile/Common.php';
-require_once 'Net/UserAgent/Mobile/Display.php';
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
 
 // {{{ Net_UserAgent_Mobile_NonMobile
 
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/SoftBank.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,12 +15,12 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: SoftBank.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: SoftBank.php 17128 2008-03-12 08:32:34Z satou $
  * @since      File available since Release 0.20.0
  */
 
-require_once 'Net/UserAgent/Mobile/Common.php';
-require_once 'Net/UserAgent/Mobile/Display.php';
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
 
 // {{{ Net_UserAgent_Mobile_SoftBank
 
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile/Willcom.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,13 +15,13 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: Willcom.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: Willcom.php 17128 2008-03-12 08:32:34Z satou $
  * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
  * @since      File available since Release 0.5
  */
 
-require_once 'Net/UserAgent/Mobile/Common.php';
-require_once 'Net/UserAgent/Mobile/Display.php';
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
 
 // {{{ Net_UserAgent_Mobile_Willcom
 
 
Modified: eccube2/trunk/data/module/Net/UserAgent/Mobile.php
===================================================================
--- eccube2/trunk/data/module/Net/UserAgent/Mobile.php	2008-03-12 08:01:51 UTC (rev 19)
+++ eccube2/trunk/data/module/Net/UserAgent/Mobile.php	2008-03-12 09:01:36 UTC (rev 20)
@@ -15,11 +15,11 @@
  * @author     KUBO Atsuhiro 
  * @copyright  2003-2008 KUBO Atsuhiro 
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: Mobile.php 17127 2008-03-12 07:43:11Z satou $
+ * @version    CVS: $Id: Mobile.php 17128 2008-03-12 08:32:34Z satou $
  * @since      File available since Release 0.1
  */
 
-require_once 'PEAR.php';
+require_once dirname(__FILE__) . '/../../PEAR.php';
 
 // {{{ constants
 
@@ -149,8 +149,9 @@
 
         $class = "Net_UserAgent_Mobile_$driver";
 
-        if (!class_exists($class)) {
-            $file = str_replace('_', '/', $class) . '.php';
+        if (!class_exists($class)) {
+        	
+            $file = dirname(__FILE__) . "/Mobile/{$driver}.php";
             if (!include_once $file) {
                 return PEAR::raiseError(null,
                                         NET_USERAGENT_MOBILE_ERROR_NOT_FOUND,

_ [EC-CUBE] 2008/3/12の更新内容3

Date: 2008-03-12 20:01:39 +0900 (Wed, 12 Mar 2008)
New Revision: 21
 
Modified:
   eccube2/trunk/data/class/batch/SC_Batch_Update.php
Log:
auto commit
 
Modified: eccube2/trunk/data/class/batch/SC_Batch_Update.php
===================================================================
--- eccube2/trunk/data/class/batch/SC_Batch_Update.php	2008-03-12 09:01:36 UTC (rev 20)
+++ eccube2/trunk/data/class/batch/SC_Batch_Update.php	2008-03-12 11:01:39 UTC (rev 21)
@@ -52,6 +52,7 @@
      * @return void
      */
     function execute($target = ".") {
+        $msg = '';
         $oldMask = umask(0);
         $bkupDistInfoArray = array(); //バックアップファイル用のdistinfoファイル内容
         $bkupPath = DATA_PATH . 'downloads/backup/update_' . time() . '/';
@@ -65,7 +66,9 @@
         );
 
         if (!is_writable($bkupPath) || !is_writable($bkupPathFile)) {
-            $arrLog['err'][] = 'バックアップディレクトリの作成に失敗しました';
+            $msg = 'バックアップディレクトリの作成に失敗しました';
+            $arrLog['err'][] = $msg;
+            $this->printLog($msg);
             return $arrLog;
         }
 
@@ -92,7 +95,9 @@
 
                 // 除外ファイルをスキップ
                 if (in_array($fileName, $excludeArray)) {
-                    $arrLog['ok'][] = "次のファイルは除外されました: " . $path;
+                    //$arrLog['ok'][] = "次のファイルは除外されました: " . $path;
+                    $msg = "次のファイルは除外されました: " . $path;
+                    $this->printLog($msg);
                     continue;
                 }
 
@@ -112,21 +117,16 @@
                         if (!empty($distinfo[$sha1])) {
                             $out = $distinfo[$sha1];
                         } else {
-                            $arrLog['err'][] = "ハッシュ値が一致しないため, コピー先が取得できません: " . $path;
+                            $msg = "ハッシュ値が一致しないため, コピー先が取得できません: " . $path;
+                            $arrLog['err'][] = $msg;
+                            $this->printLog($msg);
                             break 2;
                         }
 
-                        // パーミッションチェック
-                        /**
-                        if ($check_only) {
-                            if(!is_writable($out)) {
-                                $this->mkdir_p($out);
-                                if (!is_writable($out)) {
-                                    $arrLog['err'][] = "コピー先に書き込み権限がありません: " . $out;
-                                }
-                            }
-                            continue;
-                        }**/
+                        if ($sha1 == sha1_file($out)) {
+                            $msg = "同じ内容のファイルをスキップしました: " . $out;
+                            $this->printLog($msg);
+                        }
 
                         // バックアップを作成
                         if (file_exists($out)) {
@@ -134,11 +134,13 @@
                             $bkupDistInfoArray[sha1_file($out)] = $out;
 
                             if (!@copy($out, $bkupTo)) {
-                                $arrLog['err'][] = "バックアップファイルの作成に失敗しました: " . $out . ' -> ' . $bkupTo;
+                                $msg = "バックアップファイルの作成に失敗しました: " . $out . ' -> ' . $bkupTo;
+                                $arrLog['err'][] = $msg;
+                                $this->printLog($msg);
                                 break 2;
                             }
-                            $arrLog['ok'][]
-                                 = "バックアップファイルの作成に成功しました: " . $out . ' -> ' . $bkupTo;
+                            $msg = "バックアップファイルの作成に成功しました: " . $out . ' -> ' . $bkupTo;
+                            $this->printLog($msg);
                         }
 
                         // ファイルを書き出しモードで開く
@@ -148,18 +150,24 @@
                             $this->mkdir_p($out);
                             $handle = @fopen($out, "w");
                             if (!$handle) {
-                                $arrLog['err'][] = "コピー先に書き込み権限がありません: " . $out;
+                                $msg = "コピー先に書き込み権限がありません: " . $out;
+                                $arrLog['err'][] = $msg;
+                                $this->printLog($msg);
                                 continue;
                             }
                         }
 
                         // 取得した内容を書き込む
                         if (fwrite($handle, $contents) === false) {
-                            $arrLog['err'][] = "コピー先に書き込み権限がありません: " . $out;
+                            $msg = "コピー先に書き込み権限がありません: " . $out;
+                            $arrLog['err'][] = $msg;
+                            $this->printLog($msg);
                             continue;
                         }
 
-                        $arrLog['ok'][] =  "ファイルのコピーに成功しました: " . $out;
+                        $msg =  "ファイルのコピーに成功しました: " . $out;
+                        $arrLog['ok'][] = $msg;
+                        $this->printLog($msg);
                         // ファイルを閉じる
                         fclose($handle);
                     }
@@ -171,9 +179,12 @@
             $handle = @fopen($bkupPath . 'distinfo.php', "w");
             @fwrite($handle, $src);
             @fclose($handle);
-            $arrLog['ok'][] =  "distinfoファイルの作成に成功しました: " . $bkupPath . 'distinfo.php';
+            $msg = "distinfoファイルの作成に成功しました: " . $bkupPath . 'distinfo.php';
+            $this->printLog($msg);
         } else {
-            $arrLog['err'][] = "distinfoファイルの作成に失敗しました: " . $bkupPath . 'distinfo.php';
+            $msg = "distinfoファイルの作成に失敗しました: " . $bkupPath . 'distinfo.php';
+            $arrLog['err'][] = $msg;
+            $this->printLog($msg);
         }
         umask($oldMask);
         return $arrLog;
@@ -229,5 +240,9 @@
 
         return $src;
     }
+
+    function printLog($msg) {
+        GC_Utils::gfPrintLog($msg, DATA_PATH . 'logs/ownersstore_batch_update.log');
+    }
 }
 ?>

_ [EC-CUBE] 2008/3/12の更新内容4

Date: 2008-03-12 21:01:13 +0900 (Wed, 12 Mar 2008)
New Revision: 22
 
Modified:
   eccube2/trunk/data/include/module.inc
Log:
auto commit
 
Modified: eccube2/trunk/data/include/module.inc
===================================================================
--- eccube2/trunk/data/include/module.inc	2008-03-12 11:01:39 UTC (rev 21)
+++ eccube2/trunk/data/include/module.inc	2008-03-12 12:01:13 UTC (rev 22)
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-if (!defined('ECCUBE_INSTALLE')) {
+if (!defined('ECCUBE_INSTALL')) {
     return;
 }
 
@@ -43,7 +43,7 @@
 
 /**
  * インクルードするモジュールの一覧
- * XXX dtb_moduleとかに保持したい...
+ * FIXME dtb_moduleとかに保持する
  */
 $_arrModule = array(
     'mdl_a8',
@@ -58,7 +58,7 @@
 if (is_array($_arrModuleCode)) {
     foreach ($_arrModuleCode as $_moduleCode) {
         $_file = MODULE_PATH . "$_moduleCode/include.php";
-        if (isset($_arrModule[$_moduleCode]) && file_exists($_file)) {
+        if (in_array($_moduleCode, $_arrModule) && file_exists($_file)) {
             include_once($_file);
         }
     }

_ [EC-CUBE] 2008/3/12の更新内容5

私がコミットしたカレンダー機能(休日管理機能付き)が取り込まれたようです。

Date: 2008-03-12 22:01:28 +0900 (Wed, 12 Mar 2008)
New Revision: 23
 
Added:
   eccube2/trunk/data/Smarty/templates/default/admin/basis/holiday.tpl
   eccube2/trunk/data/Smarty/templates/default/bloc/calendar.tpl
   eccube2/trunk/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php
   eccube2/trunk/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php
   eccube2/trunk/data/class_extends/page_extends/admin/basis/LC_Page_Admin_Basis_Holiday_Ex.php
   eccube2/trunk/data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar_Ex.php
   eccube2/trunk/data/module/Calendar/
   eccube2/trunk/data/module/Calendar/Calendar.php
   eccube2/trunk/data/module/Calendar/Day.php
   eccube2/trunk/data/module/Calendar/Decorator.php
   eccube2/trunk/data/module/Calendar/Decorator/
   eccube2/trunk/data/module/Calendar/Decorator/Textual.php
   eccube2/trunk/data/module/Calendar/Decorator/Uri.php
   eccube2/trunk/data/module/Calendar/Decorator/Weekday.php
   eccube2/trunk/data/module/Calendar/Decorator/Wrapper.php
   eccube2/trunk/data/module/Calendar/Engine/
   eccube2/trunk/data/module/Calendar/Engine/Interface.php
   eccube2/trunk/data/module/Calendar/Engine/PearDate.php
   eccube2/trunk/data/module/Calendar/Engine/UnixTS.php
   eccube2/trunk/data/module/Calendar/Factory.php
   eccube2/trunk/data/module/Calendar/Hour.php
   eccube2/trunk/data/module/Calendar/Minute.php
   eccube2/trunk/data/module/Calendar/Month.php
   eccube2/trunk/data/module/Calendar/Month/
   eccube2/trunk/data/module/Calendar/Month/Weekdays.php
   eccube2/trunk/data/module/Calendar/Month/Weeks.php
   eccube2/trunk/data/module/Calendar/Second.php
   eccube2/trunk/data/module/Calendar/Table/
   eccube2/trunk/data/module/Calendar/Table/Helper.php
   eccube2/trunk/data/module/Calendar/Util/
   eccube2/trunk/data/module/Calendar/Util/Textual.php
   eccube2/trunk/data/module/Calendar/Util/Uri.php
   eccube2/trunk/data/module/Calendar/Validator.php
   eccube2/trunk/data/module/Calendar/Week.php
   eccube2/trunk/data/module/Calendar/Year.php
   eccube2/trunk/data/module/Calendar/docs/
   eccube2/trunk/data/module/Calendar/docs/Readme
   eccube2/trunk/data/module/Calendar/docs/examples/
   eccube2/trunk/data/module/Calendar/docs/examples/1.php
   eccube2/trunk/data/module/Calendar/docs/examples/1.phps
   eccube2/trunk/data/module/Calendar/docs/examples/10.php
   eccube2/trunk/data/module/Calendar/docs/examples/10.phps
   eccube2/trunk/data/module/Calendar/docs/examples/11.php
   eccube2/trunk/data/module/Calendar/docs/examples/11.phps
   eccube2/trunk/data/module/Calendar/docs/examples/12.php
   eccube2/trunk/data/module/Calendar/docs/examples/12.phps
   eccube2/trunk/data/module/Calendar/docs/examples/13.php
   eccube2/trunk/data/module/Calendar/docs/examples/13.phps
   eccube2/trunk/data/module/Calendar/docs/examples/14.php
   eccube2/trunk/data/module/Calendar/docs/examples/14.phps
   eccube2/trunk/data/module/Calendar/docs/examples/15.php
   eccube2/trunk/data/module/Calendar/docs/examples/15.phps
   eccube2/trunk/data/module/Calendar/docs/examples/16.php
   eccube2/trunk/data/module/Calendar/docs/examples/16.phps
   eccube2/trunk/data/module/Calendar/docs/examples/17.php
   eccube2/trunk/data/module/Calendar/docs/examples/17.phps
   eccube2/trunk/data/module/Calendar/docs/examples/18.php
   eccube2/trunk/data/module/Calendar/docs/examples/18.phps
   eccube2/trunk/data/module/Calendar/docs/examples/19.php
   eccube2/trunk/data/module/Calendar/docs/examples/19.phps
   eccube2/trunk/data/module/Calendar/docs/examples/2.php
   eccube2/trunk/data/module/Calendar/docs/examples/2.phps
   eccube2/trunk/data/module/Calendar/docs/examples/20.php
   eccube2/trunk/data/module/Calendar/docs/examples/20.phps
   eccube2/trunk/data/module/Calendar/docs/examples/21.php
   eccube2/trunk/data/module/Calendar/docs/examples/21.phps
   eccube2/trunk/data/module/Calendar/docs/examples/22.php
   eccube2/trunk/data/module/Calendar/docs/examples/22.phps
   eccube2/trunk/data/module/Calendar/docs/examples/23.php
   eccube2/trunk/data/module/Calendar/docs/examples/23.phps
   eccube2/trunk/data/module/Calendar/docs/examples/3.php
   eccube2/trunk/data/module/Calendar/docs/examples/3.phps
   eccube2/trunk/data/module/Calendar/docs/examples/4.php
   eccube2/trunk/data/module/Calendar/docs/examples/4.phps
   eccube2/trunk/data/module/Calendar/docs/examples/5.php
   eccube2/trunk/data/module/Calendar/docs/examples/5.phps
   eccube2/trunk/data/module/Calendar/docs/examples/6.php
   eccube2/trunk/data/module/Calendar/docs/examples/6.phps
   eccube2/trunk/data/module/Calendar/docs/examples/7.php
   eccube2/trunk/data/module/Calendar/docs/examples/7.phps
   eccube2/trunk/data/module/Calendar/docs/examples/8.php
   eccube2/trunk/data/module/Calendar/docs/examples/8.phps
   eccube2/trunk/data/module/Calendar/docs/examples/9.php
   eccube2/trunk/data/module/Calendar/docs/examples/9.phps
   eccube2/trunk/data/module/Calendar/docs/examples/index.html
   eccube2/trunk/data/module/Calendar/tests/
   eccube2/trunk/data/module/Calendar/tests/README
   eccube2/trunk/data/module/Calendar/tests/all_tests.php
   eccube2/trunk/data/module/Calendar/tests/calendar_engine_tests.php
   eccube2/trunk/data/module/Calendar/tests/calendar_include.php
   eccube2/trunk/data/module/Calendar/tests/calendar_tabular_tests.php
   eccube2/trunk/data/module/Calendar/tests/calendar_test.php
   eccube2/trunk/data/module/Calendar/tests/calendar_tests.php
   eccube2/trunk/data/module/Calendar/tests/day_test.php
   eccube2/trunk/data/module/Calendar/tests/decorator_test.php
   eccube2/trunk/data/module/Calendar/tests/decorator_tests.php
   eccube2/trunk/data/module/Calendar/tests/decorator_textual_test.php
   eccube2/trunk/data/module/Calendar/tests/decorator_uri_test.php
   eccube2/trunk/data/module/Calendar/tests/helper_test.php
   eccube2/trunk/data/module/Calendar/tests/hour_test.php
   eccube2/trunk/data/module/Calendar/tests/minute_test.php
   eccube2/trunk/data/module/Calendar/tests/month_test.php
   eccube2/trunk/data/module/Calendar/tests/month_weekdays_test.php
   eccube2/trunk/data/module/Calendar/tests/month_weeks_test.php
   eccube2/trunk/data/module/Calendar/tests/peardate_engine_test.php
   eccube2/trunk/data/module/Calendar/tests/second_test.php
   eccube2/trunk/data/module/Calendar/tests/simple_include.php
   eccube2/trunk/data/module/Calendar/tests/table_helper_tests.php
   eccube2/trunk/data/module/Calendar/tests/unixts_engine_test.php
   eccube2/trunk/data/module/Calendar/tests/util_tests.php
   eccube2/trunk/data/module/Calendar/tests/util_textual_test.php
   eccube2/trunk/data/module/Calendar/tests/util_uri_test.php
   eccube2/trunk/data/module/Calendar/tests/validator_error_test.php
   eccube2/trunk/data/module/Calendar/tests/validator_tests.php
   eccube2/trunk/data/module/Calendar/tests/validator_unit_test.php
   eccube2/trunk/data/module/Calendar/tests/week_firstday_0_test.php
   eccube2/trunk/data/module/Calendar/tests/week_test.php
   eccube2/trunk/data/module/Calendar/tests/year_test.php
   eccube2/trunk/html/admin/basis/holiday.php
   eccube2/trunk/html/frontparts/bloc/calendar.php
Modified:
   eccube2/trunk/data/Smarty/templates/default/admin/basis/subnavi.tpl
   eccube2/trunk/html/install/sql/create_table_mysql.sql
   eccube2/trunk/html/install/sql/create_table_pgsql.sql
   eccube2/trunk/html/install/sql/drop_table.sql
   eccube2/trunk/html/install/sql/insert_data.sql
   eccube2/trunk/html/user_data/packages/default/css/index.css
Log:
auto commit
 
Added: eccube2/trunk/data/Smarty/templates/default/admin/basis/holiday.tpl
===================================================================
--- eccube2/trunk/data/Smarty/templates/default/admin/basis/holiday.tpl	                        (rev 0)
+++ eccube2/trunk/data/Smarty/templates/default/admin/basis/holiday.tpl	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,179 @@
+<!--{*
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+*}-->
+<!--★★メインコンテンツ★★-->
+<table width="878" border="0" cellspacing="0" cellpadding="0" summary=" ">
+<form name="form1" id="form1" method="post" action="./holiday.php">
+<input type="hidden" name="mode" value="edit">
+<input type="hidden" name="holiday_id" value="<!--{$tpl_holiday_id}-->">
+	<tr valign="top">
+		<td background="<!--{$TPL_DIR}-->img/contents/navi_bg.gif" height="402">
+			<!--▼SUB NAVI-->
+			<!--{include file=$tpl_subnavi}-->
+			<!--▲SUB NAVI-->
+		</td>
+		<td class="mainbg" >
+		<table width="737" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<!--メインエリア-->
+			<tr>
+				<td align="center">
+				<table width="706" border="0" cellspacing="0" cellpadding="0" summary=" ">
+
+					<tr><td height="14"></td></tr>
+					<tr>
+						<td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_top.jpg" width="706" height="14" alt=""></td>
+					</tr>
+					<tr>
+						<td background="<!--{$TPL_DIR}-->img/contents/main_left.jpg"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="14" height="1" alt=""></td>
+						<td bgcolor="#cccccc">
+						
+						<!--登録テーブルここから-->
+						<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+							<tr>
+								<td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_top.gif" width="678" height="7" alt=""></td>
+							</tr>
+							<tr>
+								<td background="<!--{$TPL_DIR}-->img/contents/contents_title_left_bg.gif"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_left.gif" width="22" height="12" alt=""></td>
+								<td bgcolor="#636469" width="638" class="fs14n"><span class="white"><!--コンテンツタイトル-->定休日登録</span></td>
+								<td background="<!--{$TPL_DIR}-->img/contents/contents_title_right_bg.gif"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="18" height="1" alt=""></td>
+							</tr>
+							<tr>
+								<td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_bottom.gif" width="678" height="7" alt=""></td>
+							</tr>
+							<tr>
+								<td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td>
+							</tr>
+						</table>
+
+						<table width="678" border="0" cellspacing="1" cellpadding="8" summary=" ">
+							<tr>
+								<td bgcolor="#f2f1ec" width="160" class="fs12n">タイトル<span class="red"> *</span></td>
+								<td bgcolor="#ffffff" width="557" class="fs10n">
+								<span class="red12"><!--{$arrErr.title}--></span>
+								<input type="text" name="title" value="<!--{$arrForm.title|escape}-->" maxlength="<!--{$smarty.const.SMTEXT_LEN}-->" style="" size="60" class="box60"/>
+								<span class="red"> (上限<!--{$smarty.const.SMTEXT_LEN}-->文字)</span>
+								</td>
+							</tr>
+							<tr>
+								<td bgcolor="#f2f1ec" width="160" class="fs12n">日付<span class="red"> *</span></td>
+								<td bgcolor="#ffffff" width="557" class="fs10n">
+								<span class="red12"><!--{$arrErr.date}--></span>
+								<span class="red12"><!--{$arrErr.month}--></span>
+								<span class="red12"><!--{$arrErr.day}--></span>
+								<select name="month" style="<!--{$arrErr.month|sfGetErrorColor}-->">
+								<option value="">--</option>
+								<!--{html_options options=$arrMonth selected=$arrForm.month}-->
+								</select>月
+								<select name="day" style="<!--{$arrErr.day|sfGetErrorColor}-->">
+								<option value="">--</option>
+								<!--{html_options options=$arrDay selected=$arrForm.day}-->
+								</select>日
+                <br />
+                <span class="red">振替え休日は自動設定されないので、振替え先の日付を設定してください。</span>
+								</td>
+							</tr>
+						</table>
+						
+						<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+							<tr>
+								<td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="5" alt=""></td>
+								<td><img src="<!--{$TPL_DIR}-->img/contents/tbl_top.gif" width="676" height="7" alt=""></td>
+								<td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="5" alt=""></td>
+							</tr>
+							<tr>
+								<td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="10" alt=""></td>
+								<td bgcolor="#e9e7de" align="center">
+								<table border="0" cellspacing="0" cellpadding="0" summary=" ">
+									<tr>
+										<td><input type="image" onMouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist.jpg',this)" src="<!--{$TPL_DIR}-->img/contents/btn_regist.jpg" width="123" height="24" alt="この内容で登録する" border="0" name="subm"></td>
+									</tr>
+								</table>
+								</td>
+								<td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="10" alt=""></td>
+							</tr>
+							<tr>
+								<td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/tbl_bottom.gif" width="678" height="8" alt=""></td>
+							</tr>
+						</table>
+						
+						<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+							<tr><td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td></tr>
+						</table>
+												
+						<table width="678" border="0" cellspacing="1" cellpadding="8" summary=" ">
+							<tr bgcolor="#f2f1ec" align="center" class="fs12n">
+								<td width="371">タイトル</td>
+								<td width="100">日付</td>
+								<td width="50">編集</td>
+								<td width="50">削除</td>
+								<td width="70">移動</td>
+							</tr>
+							<!--{section name=cnt loop=$arrHoliday}-->
+							<tr bgcolor="<!--{if $tpl_class_id != $arrHoliday[cnt].holiday_id}-->#ffffff<!--{else}--><!--{$smarty.const.SELECT_RGB}--><!--{/if}-->" class="fs12">
+								<!--{assign var=holiday_id value=$arrHoliday[cnt].holiday_id}-->
+								<td><!--{$arrHoliday[cnt].title|escape}--></td>
+								<td><!--{$arrHoliday[cnt].month|escape}-->月<!--{$arrHoliday[cnt].day|escape}-->日</td>
+								<td align="center">
+								<!--{if $tpl_holiday_id != $arrHoliday[cnt].holiday_id}-->
+								<a href="<!--{$smarty.server.PHP_SELF|escape}-->" onclick="fnModeSubmit('pre_edit', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;">編集</a>
+								<!--{else}-->
+								編集中
+								<!--{/if}-->
+								</td>
+								<td align="center">
+								<!--{if $arrClassCatCount[$class_id] > 0}-->
+								-
+								<!--{else}-->
+								<a href="<!--{$smarty.server.PHP_SELF|escape}-->" onclick="fnModeSubmit('delete', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;">削除</a>
+								<!--{/if}-->
+								</td>
+								<td align="center">
+								<!--{if $smarty.section.cnt.iteration != 1}-->
+								<a href="<!--{$smarty.server.PHP_SELF|escape}-->" onclick="fnModeSubmit('up', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;" />上へ</a>
+								<!--{/if}-->
+								<!--{if $smarty.section.cnt.iteration != $smarty.section.cnt.last}-->
+								<a href="<!--{$smarty.server.PHP_SELF|escape}-->" onclick="fnModeSubmit('down', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;" />下へ</a>
+								<!--{/if}-->
+								</td>
+							</tr>
+							<!--{/section}-->
+						</table>
+						<!--登録テーブルここまで-->
+						</td>
+						<td background="<!--{$TPL_DIR}-->img/contents/main_right.jpg"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="14" height="1" alt=""></td>
+					</tr>
+					<tr>
+						<td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_bottom.jpg" width="706" height="14" alt=""></td>
+					</tr>
+					<tr><td height="30"></td></tr>
+
+				</table>
+				</td>
+			</tr>
+			<!--メインエリア-->
+		</table>
+		</td>
+	</tr>
+</form>
+</table>
+<!--★★メインコンテンツ★★-->		
 
Modified: eccube2/trunk/data/Smarty/templates/default/admin/basis/subnavi.tpl
===================================================================
--- eccube2/trunk/data/Smarty/templates/default/admin/basis/subnavi.tpl	2008-03-12 12:01:13 UTC (rev 22)
+++ eccube2/trunk/data/Smarty/templates/default/admin/basis/subnavi.tpl	2008-03-12 13:01:28 UTC (rev 23)
@@ -42,8 +42,12 @@
 	<tr><td class=<!--{if $tpl_subno != 'zip_install'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="#" onclick="win03('<!--{$smarty.const.URL_DIR}-->admin/basis/zip_install.php', 'install', '750', '350');" onMouseOver="naviStyleChange('zip_install', '#a5a5a5')" <!--{if $tpl_subno != 'zip_install'}-->onMouseOut="naviStyleChange('zip_install', '#636469')"<!--{/if}--> id="zip_install"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">郵便番号DB登録</span></a></td></tr>
 	<tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr>
 		<tr><td class=<!--{if $tpl_subno != 'control'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./control.php" onMouseOver="naviStyleChange('control', '#a5a5a5')" <!--{if $tpl_subno != 'control'}-->onMouseOut="naviStyleChange('control', '#636469')"<!--{/if}--> id="control"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">サイト管理設定</span></a></td></tr>
+	<tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr>
 		<tr><td class=<!--{if $tpl_subno != 'parameter'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./parameter.php" onMouseOver="naviStyleChange('parameter', '#a5a5a5')" <!--{if $tpl_subno != 'parameter'}-->onMouseOut="naviStyleChange('parameter', '#636469')"<!--{/if}--> id="parameter"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">パラメータ設定</span></a></td></tr>
+	<tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr>
 		<tr><td class=<!--{if $tpl_subno != 'masterdata'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./masterdata.php" onMouseOver="naviStyleChange('masterdata', '#a5a5a5')" <!--{if $tpl_subno != 'masterdata'}-->onMouseOut="naviStyleChange('masterdata', '#636469')"<!--{/if}--> id="masterdata"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">マスタデータ管理</span></a></td></tr>
 	<tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr>
+		<tr><td class=<!--{if $tpl_subno != 'holiday'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./holiday.php" onMouseOver="naviStyleChange('holiday', '#a5a5a5')" <!--{if $tpl_subno != 'holiday'}-->onMouseOut="naviStyleChange('holiday', '#636469')"<!--{/if}--> id="holiday"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">定休日管理</span></a></td></tr>
+	<tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr>
 	<!--ナビ-->
 </table>
 
Added: eccube2/trunk/data/Smarty/templates/default/bloc/calendar.tpl
===================================================================
--- eccube2/trunk/data/Smarty/templates/default/bloc/calendar.tpl	                        (rev 0)
+++ eccube2/trunk/data/Smarty/templates/default/bloc/calendar.tpl	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,61 @@
+<!--{*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ *}-->
+<!--▼カレンダーここから-->
+<div id="block-calendar" class="block-contents">
+<h2><img src="<!--{$TPL_DIR}-->img/top/calendar.jpg" width="400" height="29" alt="カレンダー" /></h2>
+
+
+<!--{section name=num loop=$arrCalendar}-->
+<!--{assign var=arrCal value=`$arrCalendar[num]`}-->
+<!--{section name=cnt loop=$arrCal}-->
+
+<!--{if $smarty.section.cnt.first}-->
+<table>
+<caption><!--{$arrCal[cnt].year}-->年<!--{$arrCal[cnt].month}-->月の定休日</caption>
+<thead><tr><th>日</th><th>月</th><th>火</th><th>水</th><th>木</th><th>金</th><th>土</th></tr></thead>
+<!--{/if}-->
+
+<!--{if $arrCal[cnt].first}-->
+<tr>
+<!--{/if}-->
+
+<!--{if !$arrCal[cnt].in_month}-->
+<td></td>
+<!--{elseif $arrCal[cnt].holiday}-->
+<td class="off"><!--{$arrCal[cnt].day}--></td>
+<!--{else}-->
+<td><!--{$arrCal[cnt].day}--></td>
+<!--{/if}-->
+
+<!--{if $arrCal[cnt].last}-->
+</tr>
+<!--{/if}-->
+
+<!--{/section}-->
+<!--{if $smarty.section.cnt.last}-->
+</table>
+<!--{/if}-->
+<!--{/section}-->
+
+
+</div>
+<!--▲カレンダーここまで-->
 
Added: eccube2/trunk/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php
===================================================================
--- eccube2/trunk/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php	                        (rev 0)
+++ eccube2/trunk/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,217 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * 会員規約設定 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id: LC_Page_Admin_Basis_Holiday.php 16741 2007-11-08 00:43:24Z adachi $
+ */
+class LC_Page_Admin_Basis_Holiday extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'basis/holiday.tpl';
+        $this->tpl_subnavi = 'basis/subnavi.tpl';
+        $this->tpl_subno = 'holiday';
+        $this->tpl_subtitle = '定休日登録';
+        $this->tpl_mainno = 'basis';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $conn = new SC_DBConn();
+        $objView = new SC_AdminView();
+        $objSess = new SC_Session();
+        $objQuery = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
+
+        $objDate = new SC_Date();
+        $this->arrMonth = $objDate->getMonth();
+        $this->arrDay = $objDate->getDay();
+
+        // 認証可否の判定
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        if (!isset($_POST['mode'])) $_POST['mode'] = "";
+
+        // 要求判定
+        switch($_POST['mode']) {
+        // 編集処理
+        case 'edit':
+            // POST値の引き継ぎ
+            $this->arrForm = $_POST;
+            // 入力文字の変換
+            $this->arrForm = $this->lfConvertParam($this->arrForm);
+
+            // エラーチェック
+            $this->arrErr = $this->lfErrorCheck();
+            if(count($this->arrErr) <= 0) {
+                if($_POST['holiday_id'] == "") {
+                    $this->lfInsertClass($this->arrForm);	// 新規作成
+                } else {
+                    $this->lfUpdateClass($this->arrForm);	// 既存編集
+                }
+                // 再表示
+                $this->reload();
+            } else {
+                // POSTデータを引き継ぐ
+                $this->tpl_holiday_id = $_POST['holiday_id'];
+            }
+            break;
+        // 削除
+        case 'delete':
+            $objDb->sfDeleteRankRecord("dtb_holiday", "holiday_id", $_POST['holiday_id'], "", true);
+            // 再表示
+            $this->reload();
+            break;
+        // 編集前処理
+        case 'pre_edit':
+            // 編集項目をDBより取得する。
+            $where = "holiday_id = ?";
+            $arrRet = $objQuery->select("title, month, day", "dtb_holiday", $where, array($_POST['holiday_id']));
+            // 入力項目にカテゴリ名を入力する。
+            $this->arrForm['title'] = $arrRet[0]['title'];
+            $this->arrForm['month'] = $arrRet[0]['month'];
+            $this->arrForm['day'] = $arrRet[0]['day'];
+            // POSTデータを引き継ぐ
+            $this->tpl_holiday_id = $_POST['holiday_id'];
+        break;
+        case 'down':
+            $objDb->sfRankDown("dtb_holiday", "holiday_id", $_POST['holiday_id']);
+            // 再表示
+            $this->reload();
+            break;
+        case 'up':
+            $objDb->sfRankUp("dtb_holiday", "holiday_id", $_POST['holiday_id']);
+            // 再表示
+            $this->reload();
+            break;
+        default:
+            break;
+        }
+
+        // 規格の読込
+        $where = "del_flg <> 1";
+        $objQuery->setorder("rank DESC");
+        $this->arrHoliday = $objQuery->select("holiday_id, title, month, day", "dtb_holiday", $where);
+
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* DBへの挿入 */
+    function lfInsertClass($arrData) {
+        $objQuery = new SC_Query();
+        // INSERTする値を作成する。
+        $sqlval['title'] = $arrData['title'];
+        $sqlval['month'] = $arrData['month'];
+        $sqlval['day'] = $arrData['day'];
+        $sqlval['creator_id'] = $_SESSION['member_id'];
+        $sqlval['rank'] = $objQuery->max("dtb_holiday", "rank") + 1;
+        $sqlval['update_date'] = "Now()";
+        $sqlval['create_date'] = "Now()";
+        // INSERTの実行
+        $ret = $objQuery->insert("dtb_holiday", $sqlval);
+        return $ret;
+    }
+
+    /* DBへの更新 */
+    function lfUpdateClass($arrData) {
+        $objQuery = new SC_Query();
+        // UPDATEする値を作成する。
+        $sqlval['title'] = $arrData['title'];
+        $sqlval['month'] = $arrData['month'];
+        $sqlval['day'] = $arrData['day'];
+        $sqlval['update_date'] = "Now()";
+        $where = "holiday_id = ?";
+        // UPDATEの実行
+        $ret = $objQuery->update("dtb_holiday", $sqlval, $where, array($_POST['holiday_id']));
+        return $ret;
+    }
+
+    /* 取得文字列の変換 */
+    function lfConvertParam($array) {
+        // 文字変換
+        $arrConvList['title'] = "KVa";
+        $arrConvList['month'] = "n";
+        $arrConvList['day'] = "n";
+
+        foreach ($arrConvList as $key => $val) {
+            // POSTされてきた値のみ変換する。
+            if(isset($array[$key])) {
+                $array[$key] = mb_convert_kana($array[$key] ,$val);
+            }
+        }
+        return $array;
+    }
+
+    /* 入力エラーチェック */
+    function lfErrorCheck() {
+        $objErr = new SC_CheckError();
+        $objErr->doFunc(array("タイトル", "title", SMTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("月", "month", INT_LEN), array("SELECT_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("日", "day", INT_LEN), array("SELECT_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        if(!isset($objErr->arrErr['date'])) {
+            $objQuery = new SC_Query();
+            $where = "del_flg = 0 AND month = ? AND day = ?";
+            $arrval = array($_POST['month'], $_POST['day']);
+            if (!empty($_POST['holiday_id'])) {
+                $where .= " AND holiday_id <> ?";
+                $arrval[] = $_POST['holiday_id'];
+            }
+            $arrRet = $objQuery->select("count(holiday_id)", "dtb_holiday", $where, $arrval);
+            // 編集中のレコード以外に同じ日付が存在する場合
+            if ($arrRet[0]['count'] > 0) {
+                $objErr->arrErr['date'] = "※ 既に同じ日付の登録が存在します。<br>";
+            }
+        }
+        return $objErr->arrErr;
+    }
+}
+?>
 
Added: eccube2/trunk/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php
===================================================================
--- eccube2/trunk/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php	                        (rev 0)
+++ eccube2/trunk/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,165 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+
+// {{{ requires
+$current_dir = realpath(dirname(__FILE__));
+define('CALENDAR_ROOT', DATA_PATH.'module/Calendar'.DIRECTORY_SEPARATOR);
+require_once($current_dir . "/../../../../module/Calendar/Month/Weekdays.php");
+require_once(CLASS_PATH . "pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php");
+
+/**
+ * Calendar のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $ $
+ */
+class LC_Page_FrontParts_Bloc_Calendar extends LC_Page_FrontParts_Bloc {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $bloc_file = 'calendar.tpl';
+        $this->setTplMainpage($bloc_file);
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        if (defined("MOBILE_SITE") && MOBILE_SITE) {
+            $objView = new SC_MobileView();
+        } else {
+            $objView = new SC_SiteView();
+        }
+
+        // 定休日取得取得
+        $this->arrHoliday = $this->lfGetHoliday();
+
+        // カレンダーデータ取得
+        $this->arrCalendar = $this->lfGetCalendar(2);
+
+        $objView->assignobj($this);
+        $objView->display($this->tpl_mainpage);
+    }
+
+    /**
+     * モバイルページを初期化する.
+     *
+     * @return void
+     */
+    function mobileInit() {
+         $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "frontparts/"
+            . BLOC_DIR . 'best5.tpl';
+    }
+
+    /**
+     * Page のプロセス(モバイル).
+     *
+     * @return void
+     */
+    function mobileProcess() {
+        $this->process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    // カレンダー情報取得
+    function lfGetCalendar($disp_month = 1){
+
+        for ($j = 0; $j <= $disp_month-1; ++$j) {
+            $year = date('Y');
+            $month = date('n') + $j;
+            if ($month > 12) {
+                $month = $month%12;
+                $year = $year + $month%12;
+            }
+
+            $Month = new Calendar_Month_Weekdays($year, $month, 0);
+            $Month->build();
+            $i = 0;
+            while ($Day = $Month->fetch()) {
+                if ($month == $Day->month) {
+                    $arrCalendar[$j][$i]['in_month'] = true;
+                } else {
+                    $arrCalendar[$j][$i]['in_month'] = false;
+                }
+                $arrCalendar[$j][$i]['first'] = $Day->first;
+                $arrCalendar[$j][$i]['last'] = $Day->last;
+                $arrCalendar[$j][$i]['empty'] = $Day->empty;
+                $arrCalendar[$j][$i]['year'] = $year;
+                $arrCalendar[$j][$i]['month'] = $month;
+                $arrCalendar[$j][$i]['day'] = $Day->day;
+                if ($this->lfCheckHoliday($month, $Day->day) || $Day->first || $Day->last) {
+                    $arrCalendar[$j][$i]['holiday'] = true;
+                } else {
+                    $arrCalendar[$j][$i]['holiday'] = false;
+                }
+                ++$i;
+            }
+        }
+
+        return $arrCalendar;
+    }
+
+    // 休日取得
+    function lfGetHoliday() {
+        $objQuery = new SC_Query();
+        $objQuery->setorder("rank DESC");
+
+        $where = "del_flg <> 1";
+        $arrRet = $objQuery->select("month, day", "dtb_holiday", $where);
+        foreach ($arrRet AS $key=>$val) {
+            $arrHoliday[$val['month']][] = $val['day'];
+        }
+        return $arrHoliday;
+    }
+
+    // 休日チェック
+    function lfCheckHoliday($month, $day) {
+        if (!empty($this->arrHoliday[$month])) {
+            if (in_array($day, $this->arrHoliday[$month])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}
+?>
 
Added: eccube2/trunk/data/class_extends/page_extends/admin/basis/LC_Page_Admin_Basis_Holiday_Ex.php
===================================================================
--- eccube2/trunk/data/class_extends/page_extends/admin/basis/LC_Page_Admin_Basis_Holiday_Ex.php	                        (rev 0)
+++ eccube2/trunk/data/class_extends/page_extends/admin/basis/LC_Page_Admin_Basis_Holiday_Ex.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,68 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/admin/basis/LC_Page_Admin_Basis_Holiday.php");
+
+/**
+ * マスタデータ管理 のページクラス(拡張).
+ *
+ * LC_Page_Admin_Basis_Holiday をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id:LC_Page_Admin_Basis_Ex.php 15532 2007-08-31 14:39:46Z nanasess $
+ */
+class LC_Page_Admin_Basis_Holiday_Ex extends LC_Page_Admin_Basis_Holiday {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
 
Added: eccube2/trunk/data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar_Ex.php
===================================================================
--- eccube2/trunk/data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar_Ex.php	                        (rev 0)
+++ eccube2/trunk/data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar_Ex.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,68 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php");
+
+/**
+ * Calendar のページクラス(拡張).
+ *
+ * LC_Page_FrontParts_Bloc_Calendar をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $ $
+ */
+class LC_Page_FrontParts_Bloc_Calendar_Ex extends LC_Page_FrontParts_Bloc_Calendar {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
 
Added: eccube2/trunk/data/module/Calendar/Calendar.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Calendar.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Calendar.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,685 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Calendar.php,v 1.3 2005/10/22 10:07:11 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Calendar.php,v 1.3 2005/10/22 10:07:11 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Constant which defines the calculation engine to use
+ */
+if (!defined('CALENDAR_ENGINE')) {
+    define('CALENDAR_ENGINE', 'UnixTS');
+}
+
+/**
+ * Define Calendar Month states
+ */
+define('CALENDAR_USE_MONTH',          1);
+define('CALENDAR_USE_MONTH_WEEKDAYS', 2);
+define('CALENDAR_USE_MONTH_WEEKS',    3);
+
+/**
+ * Contains a factory method to return a Singleton instance of a class
+ * implementing the Calendar_Engine_Interface.<br>
+ * <b>Note:</b> this class must be modified to "register" alternative
+ * Calendar_Engines. The engine used can be controlled with the constant
+ * CALENDAR_ENGINE
+ * @see Calendar_Engine_Interface
+ * @package Calendar
+ * @access protected
+ */
+class Calendar_Engine_Factory
+{
+    /**
+     * Returns an instance of the engine
+     * @return object instance of a calendar calculation engine
+     * @access protected
+     */
+    function & getEngine()
+    {
+        static $engine = false;
+        switch (CALENDAR_ENGINE) {
+            case 'PearDate':
+                $class = 'Calendar_Engine_PearDate';
+                break;
+            case 'UnixTS':
+            default:
+                $class = 'Calendar_Engine_UnixTS';
+            break;
+        }
+        if (!$engine) {
+            if (!class_exists($class)) {
+                require_once CALENDAR_ROOT.'Engine'.DIRECTORY_SEPARATOR.CALENDAR_ENGINE.'.php';
+            }
+            $engine = new $class;
+        }
+        return $engine;
+    }
+}
+
+/**
+ * Base class for Calendar API. This class should not be instantiated
+ * directly.
+ * @abstract
+ * @package Calendar
+ */
+class Calendar
+{
+    /**
+     * Instance of class implementing calendar engine interface
+     * @var object
+     * @access private
+     */
+    var $cE;
+
+    /**
+     * Instance of Calendar_Validator (lazy initialized when isValid() or
+     * getValidor() is called
+     * @var Calendar_Validator
+     * @access private
+     */
+    var $validator;
+
+    /**
+     * Year for this calendar object e.g. 2003
+     * @access private
+     * @var int
+     */
+   var $year;
+
+    /**
+     * Month for this calendar object e.g. 9
+     * @access private
+     * @var int
+     */
+    var $month;
+
+    /**
+     * Day of month for this calendar object e.g. 23
+     * @access private
+     * @var int
+     */
+    var $day;
+
+    /**
+     * Hour of day for this calendar object e.g. 13
+     * @access private
+     * @var int
+     */
+    var $hour;
+
+    /**
+     * Minute of hour this calendar object e.g. 46
+     * @access private
+     * @var int
+     */
+    var $minute;
+
+    /**
+     * Second of minute this calendar object e.g. 34
+     * @access private
+     * @var int
+     */
+    var $second;
+
+    /**
+     * Marks this calendar object as selected (e.g. 'today')
+     * @access private
+     * @var boolean
+     */
+    var $selected = false;
+
+    /**
+     * Collection of child calendar objects created from subclasses
+     * of Calendar. Type depends on the object which created them.
+     * @access private
+     * @var array
+     */
+    var $children = array();
+
+    /**
+     * Constructs the Calendar
+     * @param int year
+     * @param int month
+     * @param int day
+     * @param int hour
+     * @param int minute
+     * @param int second
+     * @access protected
+     */
+    function Calendar($y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0)
+    {
+        static $cE = null;
+        if (!isset($cE)) {
+            $cE = & Calendar_Engine_Factory::getEngine();
+        }
+        $this->cE = & $cE;
+        $this->year   = (int)$y;
+        $this->month  = (int)$m;
+        $this->day    = (int)$d;
+        $this->hour   = (int)$h;
+        $this->minute = (int)$i;
+        $this->second = (int)$s;
+    }
+
+    /**
+     * Defines the calendar by a timestamp (Unix or ISO-8601), replacing values
+     * passed to the constructor
+     * @param int|string Unix or ISO-8601 timestamp
+     * @return void
+     * @access public
+     */
+    function setTimestamp($ts)
+    {
+        $this->year   = $this->cE->stampToYear($ts);
+        $this->month  = $this->cE->stampToMonth($ts);
+        $this->day    = $this->cE->stampToDay($ts);
+        $this->hour   = $this->cE->stampToHour($ts);
+        $this->minute = $this->cE->stampToMinute($ts);
+        $this->second = $this->cE->stampToSecond($ts);
+    }
+
+    /**
+     * Returns a timestamp from the current date / time values. Format of
+     * timestamp depends on Calendar_Engine implementation being used
+     * @return int|string timestamp
+     * @access public
+     */
+    function getTimestamp()
+    {
+        return $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute, $this->second);
+    }
+
+    /**
+     * Defines calendar object as selected (e.g. for today)
+     * @param boolean state whether Calendar subclass
+     * @return void
+     * @access public
+     */
+    function setSelected($state = true)
+    {
+        $this->selected = $state;
+    }
+
+    /**
+     * True if the calendar subclass object is selected (e.g. today)
+     * @return boolean
+     * @access public
+     */
+    function isSelected()
+    {
+        return $this->selected;
+    }
+
+    /**
+     * Adjusts the date (helper method)
+     * @return void
+     * @access public
+     */
+    function adjust()
+    {
+        $stamp = $this->getTimeStamp();
+        $this->year   = $this->cE->stampToYear($stamp);
+        $this->month  = $this->cE->stampToMonth($stamp);
+        $this->day    = $this->cE->stampToDay($stamp);
+        $this->hour   = $this->cE->stampToHour($stamp);
+        $this->minute = $this->cE->stampToMinute($stamp);
+        $this->second = $this->cE->stampToSecond($stamp);
+    }
+
+    /**
+     * Returns the date as an associative array (helper method)
+     * @param mixed timestamp (leave empty for current timestamp)
+     * @return array
+     * @access public
+     */
+    function toArray($stamp=null)
+    {
+        if (is_null($stamp)) {
+            $stamp = $this->getTimeStamp();
+        }
+        return array(
+            'year'   => $this->cE->stampToYear($stamp),
+            'month'  => $this->cE->stampToMonth($stamp),
+            'day'    => $this->cE->stampToDay($stamp),
+            'hour'   => $this->cE->stampToHour($stamp),
+            'minute' => $this->cE->stampToMinute($stamp),
+            'second' => $this->cE->stampToSecond($stamp)
+        );
+    }
+
+    /**
+     * Returns the value as an associative array (helper method)
+     * @param string type of date object that return value represents
+     * @param string $format ['int' | 'array' | 'timestamp' | 'object']
+     * @param mixed timestamp (depending on Calendar engine being used)
+     * @param int integer default value (i.e. give me the answer quick)
+     * @return mixed
+     * @access private
+     */
+    function returnValue($returnType, $format, $stamp, $default)
+    {
+        switch (strtolower($format)) {
+            case 'int':
+                return $default;
+            case 'array':
+                return $this->toArray($stamp);
+                break;
+            case 'object':
+                require_once CALENDAR_ROOT.'Factory.php';
+                return Calendar_Factory::createByTimestamp($returnType,$stamp);
+                break;
+            case 'timestamp':
+            default:
+                return $stamp;
+                break;
+        }
+    }
+
+    /**
+     * Abstract method for building the children of a calendar object.
+     * Implemented by Calendar subclasses
+     * @param array containing Calendar objects to select (optional)
+     * @return boolean
+     * @access public
+     * @abstract
+     */
+    function build($sDates = array())
+    {
+        require_once 'PEAR.php';
+        PEAR::raiseError(
+            'Calendar::build is abstract', null, PEAR_ERROR_TRIGGER,
+            E_USER_NOTICE, 'Calendar::build()');
+        return false;
+    }
+
+    /**
+     * Abstract method for selected data objects called from build
+     * @param array
+     * @return boolean
+     * @access public
+     * @abstract
+     */
+    function setSelection($sDates)
+    {
+        require_once 'PEAR.php';
+        PEAR::raiseError(
+            'Calendar::setSelection is abstract', null, PEAR_ERROR_TRIGGER,
+            E_USER_NOTICE, 'Calendar::setSelection()');
+        return false;
+    }
+
+    /**
+     * Iterator method for fetching child Calendar subclass objects
+     * (e.g. a minute from an hour object). On reaching the end of
+     * the collection, returns false and resets the collection for
+     * further iteratations.
+     * @return mixed either an object subclass of Calendar or false
+     * @access public
+     */
+    function fetch()
+    {
+        $child = each($this->children);
+        if ($child) {
+            return $child['value'];
+        } else {
+            reset($this->children);
+            return false;
+        }
+    }
+
+    /**
+     * Fetches all child from the current collection of children
+     * @return array
+     * @access public
+     */
+    function fetchAll()
+    {
+        return $this->children;
+    }
+
+    /**
+     * Get the number Calendar subclass objects stored in the internal
+     * collection.
+     * @return int
+     * @access public
+     */
+    function size()
+    {
+        return count($this->children);
+    }
+
+    /**
+     * Determine whether this date is valid, with the bounds determined by
+     * the Calendar_Engine. The call is passed on to
+     * Calendar_Validator::isValid
+     * @return boolean
+     * @access public
+     */
+    function isValid()
+    {
+        $validator = & $this->getValidator();
+        return $validator->isValid();
+    }
+
+    /**
+     * Returns an instance of Calendar_Validator
+     * @return Calendar_Validator
+     * @access public
+     */
+    function & getValidator()
+    {
+        if (!isset($this->validator)) {
+            require_once CALENDAR_ROOT.'Validator.php';
+            $this->validator = & new Calendar_Validator($this);
+        }
+        return $this->validator;
+    }
+
+    /**
+     * Returns a reference to the current Calendar_Engine being used. Useful
+     * for Calendar_Table_Helper and Calendar_Validator
+     * @return object implementing Calendar_Engine_Inteface
+     * @access protected
+     */
+    function & getEngine()
+    {
+        return $this->cE;
+    }
+
+    /**
+     * Set the CALENDAR_FIRST_DAY_OF_WEEK constant to the $firstDay value
+     * if the constant is not set yet.
+     * @throws E_USER_WARNING this method throws a WARNING if the
+     *    CALENDAR_FIRST_DAY_OF_WEEK constant is already defined and
+     *    the $firstDay parameter is set to a different value
+     * @param integer $firstDay first day of the week (0=sunday, 1=monday, ...)
+     * @return integer
+     * @access protected
+     */
+    function defineFirstDayOfWeek($firstDay = null)
+    {
+        if (defined('CALENDAR_FIRST_DAY_OF_WEEK')) {
+            if (!is_null($firstDay) && ($firstDay != CALENDAR_FIRST_DAY_OF_WEEK)) {
+                $msg = 'CALENDAR_FIRST_DAY_OF_WEEK constant already defined.'
+                  .' The $firstDay parameter will be ignored.';
+                trigger_error($msg, E_USER_WARNING);
+            }
+            return CALENDAR_FIRST_DAY_OF_WEEK;
+        }
+        if (is_null($firstDay)) {
+            $firstDay = $this->cE->getFirstDayOfWeek(
+                $this->thisYear(),
+                $this->thisMonth(),
+                $this->thisDay()
+            );
+        }
+        define ('CALENDAR_FIRST_DAY_OF_WEEK', $firstDay);
+        return CALENDAR_FIRST_DAY_OF_WEEK;
+    }
+
+    /**
+     * Returns the value for the previous year
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 2002 or timestamp
+     * @access public
+     */
+    function prevYear($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp($this->year-1, 1, 1, 0, 0, 0);
+        return $this->returnValue('Year', $format, $ts, $this->year-1);
+    }
+
+    /**
+     * Returns the value for this year
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 2003 or timestamp
+     * @access public
+     */
+    function thisYear($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp($this->year, 1, 1, 0, 0, 0);
+        return $this->returnValue('Year', $format, $ts, $this->year);
+    }
+
+    /**
+     * Returns the value for next year
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 2004 or timestamp
+     * @access public
+     */
+    function nextYear($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp($this->year+1, 1, 1, 0, 0, 0);
+        return $this->returnValue('Year', $format, $ts, $this->year+1);
+    }
+
+    /**
+     * Returns the value for the previous month
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 4 or Unix timestamp
+     * @access public
+     */
+    function prevMonth($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp($this->year, $this->month-1, 1, 0, 0, 0);
+        return $this->returnValue('Month', $format, $ts, $this->cE->stampToMonth($ts));
+    }
+
+    /**
+     * Returns the value for this month
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 5 or timestamp
+     * @access public
+     */
+    function thisMonth($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp($this->year, $this->month, 1, 0, 0, 0);
+        return $this->returnValue('Month', $format, $ts, $this->month);
+    }
+
+    /**
+     * Returns the value for next month
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 6 or timestamp
+     * @access public
+     */
+    function nextMonth($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp($this->year, $this->month+1, 1, 0, 0, 0);
+        return $this->returnValue('Month', $format, $ts, $this->cE->stampToMonth($ts));
+    }
+
+    /**
+     * Returns the value for the previous day
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 10 or timestamp
+     * @access public
+     */
+    function prevDay($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day-1, 0, 0, 0);
+        return $this->returnValue('Day', $format, $ts, $this->cE->stampToDay($ts));
+    }
+
+    /**
+     * Returns the value for this day
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 11 or timestamp
+     * @access public
+     */
+    function thisDay($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day, 0, 0, 0);
+        return $this->returnValue('Day', $format, $ts, $this->day);
+    }
+
+    /**
+     * Returns the value for the next day
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 12 or timestamp
+     * @access public
+     */
+    function nextDay($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day+1, 0, 0, 0);
+        return $this->returnValue('Day', $format, $ts, $this->cE->stampToDay($ts));
+    }
+
+    /**
+     * Returns the value for the previous hour
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 13 or timestamp
+     * @access public
+     */
+    function prevHour($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day, $this->hour-1, 0, 0);
+        return $this->returnValue('Hour', $format, $ts, $this->cE->stampToHour($ts));
+    }
+
+    /**
+     * Returns the value for this hour
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 14 or timestamp
+     * @access public
+     */
+    function thisHour($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day, $this->hour, 0, 0);
+        return $this->returnValue('Hour', $format, $ts, $this->hour);
+    }
+
+    /**
+     * Returns the value for the next hour
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 14 or timestamp
+     * @access public
+     */
+    function nextHour($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day, $this->hour+1, 0, 0);
+        return $this->returnValue('Hour', $format, $ts, $this->cE->stampToHour($ts));
+    }
+
+    /**
+     * Returns the value for the previous minute
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 23 or timestamp
+     * @access public
+     */
+    function prevMinute($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute-1, 0);
+        return $this->returnValue('Minute', $format, $ts, $this->cE->stampToMinute($ts));
+    }
+
+    /**
+     * Returns the value for this minute
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 24 or timestamp
+     * @access public
+     */
+    function thisMinute($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute, 0);
+        return $this->returnValue('Minute', $format, $ts, $this->minute);
+    }
+
+    /**
+    * Returns the value for the next minute
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 25 or timestamp
+     * @access public
+     */
+    function nextMinute($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute+1, 0);
+        return $this->returnValue('Minute', $format, $ts, $this->cE->stampToMinute($ts));
+    }
+
+    /**
+     * Returns the value for the previous second
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 43 or timestamp
+     * @access public
+     */
+    function prevSecond($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute, $this->second-1);
+        return $this->returnValue('Second', $format, $ts, $this->cE->stampToSecond($ts));
+    }
+
+    /**
+     * Returns the value for this second
+    * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 44 or timestamp
+     * @access public
+     */
+    function thisSecond($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute, $this->second);
+        return $this->returnValue('Second', $format, $ts, $this->second);
+    }
+
+    /**
+     * Returns the value for the next second
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 45 or timestamp
+     * @access public
+     */
+    function nextSecond($format = 'int')
+    {
+        $ts = $this->cE->dateToStamp(
+            $this->year, $this->month, $this->day,
+            $this->hour, $this->minute, $this->second+1);
+        return $this->returnValue('Second', $format, $ts, $this->cE->stampToSecond($ts));
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Day.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Day.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Day.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,197 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Day.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Day.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents a Day and builds Hours.
+ * <code>
+ * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Day.php';
+ * $Day = & new Calendar_Day(2003, 10, 21); // Oct 21st 2003
+ * while ($Hour = & $Day->fetch()) {
+ *    echo $Hour->thisHour().'<br />';
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Day extends Calendar
+{
+    /**
+     * Marks the Day at the beginning of a week
+     * @access private
+     * @var boolean
+     */
+    var $first = false;
+
+    /**
+     * Marks the Day at the end of a week
+    * @access private
+     * @var boolean
+     */
+    var $last = false;
+
+
+    /**
+     * Used for tabular calendars
+     * @access private
+     * @var boolean
+     */
+    var $empty = false;
+
+    /**
+     * Constructs Calendar_Day
+     * @param int year e.g. 2003
+     * @param int month e.g. 8
+     * @param int day e.g. 15
+     * @access public
+     */
+    function Calendar_Day($y, $m, $d)
+    {
+        Calendar::Calendar($y, $m, $d);
+    }
+
+    /**
+     * Builds the Hours of the Day
+     * @param array (optional) Caledar_Hour objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates = array())
+    {
+        require_once CALENDAR_ROOT.'Hour.php';
+
+        $hID = $this->cE->getHoursInDay($this->year, $this->month, $this->day);
+        for ($i=0; $i < $hID; $i++) {
+            $this->children[$i]=
+                new Calendar_Hour($this->year, $this->month, $this->day, $i);
+        }
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates)
+    {
+        foreach ($sDates as $sDate) {
+            if ($this->year == $sDate->thisYear()
+                && $this->month == $sDate->thisMonth()
+                && $this->day == $sDate->thisDay())
+            {
+                $key = (int)$sDate->thisHour();
+                if (isset($this->children[$key])) {
+                    $sDate->setSelected();
+                    $this->children[$key] = $sDate;
+                }
+            }
+        }
+    }
+
+    /**
+     * Defines Day object as first in a week
+     * Only used by Calendar_Month_Weekdays::build()
+     * @param boolean state
+     * @return void
+     * @access private
+     */
+    function setFirst ($state = true)
+    {
+        $this->first = $state;
+    }
+
+    /**
+     * Defines Day object as last in a week
+     * Used only following Calendar_Month_Weekdays::build()
+     * @param boolean state
+     * @return void
+     * @access private
+     */
+    function setLast($state = true)
+    {
+        $this->last = $state;
+    }
+
+    /**
+     * Returns true if Day object is first in a Week
+     * Only relevant when Day is created by Calendar_Month_Weekdays::build()
+     * @return boolean
+     * @access public
+     */
+    function isFirst() {
+        return $this->first;
+    }
+
+    /**
+     * Returns true if Day object is last in a Week
+     * Only relevant when Day is created by Calendar_Month_Weekdays::build()
+     * @return boolean
+     * @access public
+     */
+    function isLast()
+    {
+        return $this->last;
+    }
+
+    /**
+     * Defines Day object as empty
+     * Only used by Calendar_Month_Weekdays::build()
+     * @param boolean state
+     * @return void
+     * @access private
+     */
+    function setEmpty ($state = true)
+    {
+        $this->empty = $state;
+    }
+
+    /**
+     * @return boolean
+     * @access public
+     */
+    function isEmpty()
+    {
+        return $this->empty;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Decorator/Textual.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Decorator/Textual.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Decorator/Textual.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,169 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Textual.php,v 1.3 2004/08/16 13:02:44 hfuecks Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Textual.php,v 1.3 2004/08/16 13:02:44 hfuecks Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar decorator base class
+ */
+require_once CALENDAR_ROOT.'Decorator.php';
+
+/**
+ * Load the Uri utility
+ */
+require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
+
+/**
+ * Decorator to help with fetching textual representations of months and
+ * days of the week.
+ * <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you
+ * have a specific need to use a decorator
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Decorator_Textual extends Calendar_Decorator
+{
+    /**
+     * Constructs Calendar_Decorator_Textual
+     * @param object subclass of Calendar
+     * @access public
+     */
+    function Calendar_Decorator_Textual(&$Calendar)
+    {
+        parent::Calendar_Decorator($Calendar);
+    }
+
+    /**
+     * Returns an array of 12 month names (first index = 1)
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return array
+     * @access public
+     * @static
+     */
+    function monthNames($format='long')
+    {
+        return Calendar_Util_Textual::monthNames($format);
+    }
+
+    /**
+     * Returns an array of 7 week day names (first index = 0)
+     * @param string (optional) format of returned days (one,two,short or long)
+     * @return array
+     * @access public
+     * @static
+     */
+    function weekdayNames($format='long')
+    {
+        return Calendar_Util_Textual::weekdayNames($format);
+    }
+
+    /**
+     * Returns textual representation of the previous month of the decorated calendar object
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     */
+    function prevMonthName($format='long')
+    {
+        return Calendar_Util_Textual::prevMonthName($this->calendar,$format);
+    }
+
+    /**
+     * Returns textual representation of the month of the decorated calendar object
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     */
+    function thisMonthName($format='long')
+    {
+        return Calendar_Util_Textual::thisMonthName($this->calendar,$format);
+    }
+
+    /**
+     * Returns textual representation of the next month of the decorated calendar object
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     */
+    function nextMonthName($format='long')
+    {
+        return Calendar_Util_Textual::nextMonthName($this->calendar,$format);
+    }
+
+    /**
+     * Returns textual representation of the previous day of week of the decorated calendar object
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     */
+    function prevDayName($format='long')
+    {
+        return Calendar_Util_Textual::prevDayName($this->calendar,$format);
+    }
+
+    /**
+     * Returns textual representation of the day of week of the decorated calendar object
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     */
+    function thisDayName($format='long')
+    {
+        return Calendar_Util_Textual::thisDayName($this->calendar,$format);
+    }
+
+    /**
+     * Returns textual representation of the next day of week of the decorated calendar object
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     */
+    function nextDayName($format='long')
+    {
+        return Calendar_Util_Textual::nextDayName($this->calendar,$format);
+    }
+
+    /**
+     * Returns the days of the week using the order defined in the decorated
+     * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
+     * and Calendar_Week. Otherwise the returned array will begin on Sunday
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return array ordered array of week day names
+     * @access public
+     */
+    function orderedWeekdays($format='long')
+    {
+        return Calendar_Util_Textual::orderedWeekdays($this->calendar,$format);
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Decorator/Uri.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Decorator/Uri.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Decorator/Uri.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,151 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Uri.php,v 1.3 2004/08/16 09:04:20 hfuecks Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Uri.php,v 1.3 2004/08/16 09:04:20 hfuecks Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar decorator base class
+ */
+require_once CALENDAR_ROOT.'Decorator.php';
+
+/**
+ * Load the Uri utility
+ */
+require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Uri.php';
+
+/**
+ * Decorator to help with building HTML links for navigating the calendar<br />
+ * <b>Note:</b> for performance you should prefer Calendar_Util_Uri unless you
+ * have a specific need to use a decorator
+ * <code>
+ * $Day = new Calendar_Day(2003, 10, 23);
+ * $Uri = & new Calendar_Decorator_Uri($Day);
+ * $Uri->setFragments('year', 'month', 'day');
+ * echo $Uri->getPrev(); // Displays year=2003&month=10&day=22
+ * </code>
+ * @see Calendar_Util_Uri
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Decorator_Uri extends Calendar_Decorator
+{
+
+    /**
+    * @var Calendar_Util_Uri
+    * @access private
+    */
+    var $Uri;
+
+    /**
+     * Constructs Calendar_Decorator_Uri
+     * @param object subclass of Calendar
+     * @access public
+     */
+    function Calendar_Decorator_Uri(&$Calendar)
+    {
+        parent::Calendar_Decorator($Calendar);
+    }
+
+    /**
+     * Sets the URI fragment names
+     * @param string URI fragment for year
+     * @param string (optional) URI fragment for month
+     * @param string (optional) URI fragment for day
+     * @param string (optional) URI fragment for hour
+     * @param string (optional) URI fragment for minute
+     * @param string (optional) URI fragment for second
+     * @return void
+     * @access public
+     */
+    function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) {
+        $this->Uri = & new Calendar_Util_Uri($y, $m, $d, $h, $i, $s);
+    }
+
+    /**
+     * Sets the separator string between fragments
+     * @param string separator e.g. /
+     * @return void
+     * @access public
+     */
+    function setSeparator($separator)
+    {
+        $this->Uri->separator = $separator;
+    }
+
+    /**
+     * Puts Uri decorator into "scalar mode" - URI variable names are not
+     * returned
+     * @param boolean (optional)
+     * @return void
+     * @access public
+     */
+    function setScalar($state=true)
+    {
+        $this->Uri->scalar = $state;
+    }
+
+    /**
+     * Gets the URI string for the previous calendar unit
+     * @param string calendar unit to fetch uri for (year,month,week or day etc)
+     * @return string
+     * @access public
+     */
+    function prev($method)
+    {
+        return $this->Uri->prev($this, $method);
+    }
+
+    /**
+     * Gets the URI string for the current calendar unit
+     * @param string calendar unit to fetch uri for (year,month,week or day etc)
+     * @return string
+     * @access public
+     */
+    function this($method)
+    {
+        return $this->Uri->this($this, $method);
+    }
+
+    /**
+     * Gets the URI string for the next calendar unit
+     * @param string calendar unit to fetch uri for (year,month,week or day etc)
+     * @return string
+     * @access public
+     */
+    function next($method)
+    {
+        return $this->Uri->next($this, $method);
+    }
+
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Decorator/Weekday.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Decorator/Weekday.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Decorator/Weekday.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,148 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Weekday.php,v 1.3 2004/08/16 12:25:15 hfuecks Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Weekday.php,v 1.3 2004/08/16 12:25:15 hfuecks Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar decorator base class
+ */
+require_once CALENDAR_ROOT.'Decorator.php';
+
+/**
+ * Load a Calendar_Day
+ */
+require_once CALENDAR_ROOT.'Day.php';
+/**
+ * Decorator for fetching the day of the week
+ * <code>
+ * $Day = new Calendar_Day(2003, 10, 23);
+ * $Weekday = & new Calendar_Decorator_Weekday($Day);
+ * $Weekday->setFirstDay(0); // Set first day of week to Sunday (default Mon)
+ * echo $Weekday->thisWeekDay(); // Displays 5 - fifth day of week relative to Sun
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Decorator_Weekday extends Calendar_Decorator
+{
+    /**
+     * First day of week
+     * @var int (default = 1 for Monday)
+     * @access private
+     */
+    var $firstDay = 1;
+
+    /**
+     * Constructs Calendar_Decorator_Weekday
+     * @param object subclass of Calendar
+     * @access public
+     */
+    function Calendar_Decorator_Weekday(& $Calendar)
+    {
+        parent::Calendar_Decorator($Calendar);
+    }
+
+    /**
+     * Sets the first day of the week (0 = Sunday, 1 = Monday (default) etc)
+     * @param int first day of week
+     * @return void
+     * @access public
+     */
+    function setFirstDay($firstDay) {
+        $this->firstDay = (int)$firstDay;
+    }
+
+    /**
+     * Returns the previous weekday
+     * @param string (default = 'int') return value format
+     * @return int numeric day of week or timestamp
+     * @access public
+     */
+    function prevWeekDay($format = 'int')
+    {
+        $ts = $this->calendar->prevDay('timestamp');
+        $Day = new Calendar_Day(2000,1,1);
+        $Day->setTimeStamp($ts);
+        $day = $this->calendar->cE->getDayOfWeek($Day->thisYear(),$Day->thisMonth(),$Day->thisDay());
+        $day = $this->adjustWeekScale($day);
+        return $this->returnValue('Day', $format, $ts, $day);
+    }
+
+    /**
+     * Returns the current weekday
+     * @param string (default = 'int') return value format
+     * @return int numeric day of week or timestamp
+     * @access public
+     */
+    function thisWeekDay($format = 'int')
+    {
+        $ts = $this->calendar->thisDay('timestamp');
+        $day = $this->calendar->cE->getDayOfWeek($this->calendar->year,$this->calendar->month,$this->calendar->day);
+        $day = $this->adjustWeekScale($day);
+        return $this->returnValue('Day', $format, $ts, $day);
+    }
+
+    /**
+     * Returns the next weekday
+     * @param string (default = 'int') return value format
+     * @return int numeric day of week or timestamp
+     * @access public
+     */
+    function nextWeekDay($format = 'int')
+    {
+        $ts = $this->calendar->nextDay('timestamp');
+        $Day = new Calendar_Day(2000,1,1);
+        $Day->setTimeStamp($ts);
+        $day = $this->calendar->cE->getDayOfWeek($Day->thisYear(),$Day->thisMonth(),$Day->thisDay());
+        $day = $this->adjustWeekScale($day);
+        return $this->returnValue('Day', $format, $ts, $day);
+    }
+
+    /**
+     * Adjusts the day of the week relative to the first day of the week
+     * @param int day of week calendar from Calendar_Engine
+     * @return int day of week adjusted to first day
+     * @access private
+     */
+    function adjustWeekScale($dayOfWeek) {
+        $dayOfWeek = $dayOfWeek - $this->firstDay;
+        if ( $dayOfWeek >= 0 ) {
+            return $dayOfWeek;
+        } else {
+            return $this->calendar->cE->getDaysInWeek(
+                $this->calendar->year,$this->calendar->month,$this->calendar->day
+                ) + $dayOfWeek;
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Decorator/Wrapper.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Decorator/Wrapper.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Decorator/Wrapper.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,90 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Wrapper.php,v 1.2 2005/11/03 20:35:03 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Wrapper.php,v 1.2 2005/11/03 20:35:03 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar decorator base class
+ */
+require_once CALENDAR_ROOT.'Decorator.php';
+
+/**
+ * Decorator to help with wrapping built children in another decorator
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Decorator_Wrapper extends Calendar_Decorator
+{
+    /**
+     * Constructs Calendar_Decorator_Wrapper
+     * @param object subclass of Calendar
+     * @access public
+     */
+    function Calendar_Decorator_Wrapper(&$Calendar)
+    {
+        parent::Calendar_Decorator($Calendar);
+    }
+
+    /**
+     * Wraps objects returned from fetch in the named Decorator class
+     * @param string name of Decorator class to wrap with
+     * @return object instance of named decorator
+     * @access public
+     */
+    function & fetch($decorator)
+    {
+        $Calendar = parent::fetch();
+        if ($Calendar) {
+            $ret =& new $decorator($Calendar);
+        } else {
+            $ret = false;
+        }
+        return $ret;
+    }
+
+    /**
+     * Wraps the returned calendar objects from fetchAll in the named decorator
+     * @param string name of Decorator class to wrap with
+     * @return array
+     * @access public
+     */
+    function fetchAll($decorator)
+    {
+        $children = parent::fetchAll();
+        foreach ($children as $key => $Calendar) {
+            $children[$key] = & new $decorator($Calendar);
+        }
+        return $children;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Decorator.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Decorator.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Decorator.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,558 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Decorator.php,v 1.3 2005/10/22 10:29:46 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Decorator.php,v 1.3 2005/10/22 10:29:46 quipo Exp $
+ */
+/**
+ * Decorates any calendar class.
+ * Create a subclass of this class for your own "decoration".
+ * Used for "selections"
+ * <code>
+ * class DayDecorator extends Calendar_Decorator
+ * {
+ *     function thisDay($format = 'int')
+ *     {
+.*         $day = parent::thisDay('timestamp');
+.*         return date('D', $day);
+ *     }
+ * }
+ * $Day = & new Calendar_Day(2003, 10, 25);
+ * $DayDecorator = & new DayDecorator($Day);
+ * echo $DayDecorator->thisDay(); // Outputs "Sat"
+ * </code>
+ * @abstract
+ * @package Calendar
+ */
+class Calendar_Decorator
+{
+    /**
+     * Subclass of Calendar being decorated
+     * @var object
+     * @access private
+     */
+    var $calendar;
+
+    /**
+     * Constructs the Calendar_Decorator
+     * @param object subclass to Calendar to decorate
+     */
+    function Calendar_Decorator(& $calendar)
+    {
+        $this->calendar = & $calendar;
+    }
+
+    /**
+     * Defines the calendar by a Unix timestamp, replacing values
+     * passed to the constructor
+     * @param int Unix timestamp
+     * @return void
+     * @access public
+     */
+    function setTimestamp($ts)
+    {
+        $this->calendar->setTimestamp($ts);
+    }
+
+    /**
+     * Returns a timestamp from the current date / time values. Format of
+     * timestamp depends on Calendar_Engine implementation being used
+     * @return int timestamp
+     * @access public
+     */
+    function getTimestamp()
+    {
+        return $this->calendar->getTimeStamp();
+    }
+
+    /**
+     * Defines calendar object as selected (e.g. for today)
+     * @param boolean state whether Calendar subclass
+     * @return void
+     * @access public
+     */
+    function setSelected($state = true)
+    {
+        $this->calendar->setSelected($state = true);
+    }
+
+    /**
+     * True if the calendar subclass object is selected (e.g. today)
+     * @return boolean
+     * @access public
+     */
+    function isSelected()
+    {
+        return $this->calendar->isSelected();
+    }
+
+    /**
+     * Adjusts the date (helper method)
+     * @return void
+     * @access public
+     */
+    function adjust()
+    {
+        $this->calendar->adjust();
+    }
+
+    /**
+     * Returns the date as an associative array (helper method)
+     * @param mixed timestamp (leave empty for current timestamp)
+     * @return array
+     * @access public
+     */
+    function toArray($stamp=null)
+    {
+        return $this->calendar->toArray($stamp);
+    }
+
+    /**
+     * Returns the value as an associative array (helper method)
+     * @param string type of date object that return value represents
+     * @param string $format ['int' | 'array' | 'timestamp' | 'object']
+     * @param mixed timestamp (depending on Calendar engine being used)
+     * @param int integer default value (i.e. give me the answer quick)
+     * @return mixed
+     * @access private
+     */
+    function returnValue($returnType, $format, $stamp, $default)
+    {
+        return $this->calendar->returnValue($returnType, $format, $stamp, $default);
+    }
+
+    /**
+     * Defines Day object as first in a week
+     * Only used by Calendar_Month_Weekdays::build()
+     * @param boolean state
+     * @return void
+     * @access private
+     */
+    function setFirst ($state = true)
+    {
+        if ( method_exists($this->calendar,'setFirst') ) {
+            $this->calendar->setFirst($state);
+        }
+    }
+
+    /**
+     * Defines Day object as last in a week
+     * Used only following Calendar_Month_Weekdays::build()
+     * @param boolean state
+     * @return void
+     * @access private
+     */
+    function setLast($state = true)
+    {
+        if ( method_exists($this->calendar,'setLast') ) {
+            $this->calendar->setLast($state);
+        }
+    }
+
+    /**
+     * Returns true if Day object is first in a Week
+     * Only relevant when Day is created by Calendar_Month_Weekdays::build()
+     * @return boolean
+     * @access public
+     */
+    function isFirst() {
+        if ( method_exists($this->calendar,'isFirst') ) {
+            return $this->calendar->isFirst();
+        }
+    }
+
+    /**
+     * Returns true if Day object is last in a Week
+     * Only relevant when Day is created by Calendar_Month_Weekdays::build()
+     * @return boolean
+     * @access public
+     */
+    function isLast()
+    {
+        if ( method_exists($this->calendar,'isLast') ) {
+            return $this->calendar->isLast();
+        }
+    }
+
+    /**
+     * Defines Day object as empty
+     * Only used by Calendar_Month_Weekdays::build()
+     * @param boolean state
+     * @return void
+     * @access private
+     */
+    function setEmpty ($state = true)
+    {
+        if ( method_exists($this->calendar,'setEmpty') ) {
+            $this->calendar->setEmpty($state);
+        }
+    }
+
+    /**
+     * @return boolean
+     * @access public
+     */
+    function isEmpty()
+    {
+        if ( method_exists($this->calendar,'isEmpty') ) {
+            return $this->calendar->isEmpty();
+        }
+    }
+
+    /**
+     * Build the children
+     * @param array containing Calendar objects to select (optional)
+     * @return boolean
+     * @access public
+     * @abstract
+     */
+    function build($sDates = array())
+    {
+        $this->calendar->build($sDates);
+    }
+
+    /**
+     * Iterator method for fetching child Calendar subclass objects
+     * (e.g. a minute from an hour object). On reaching the end of
+     * the collection, returns false and resets the collection for
+     * further iteratations.
+     * @return mixed either an object subclass of Calendar or false
+     * @access public
+     */
+    function fetch()
+    {
+        return $this->calendar->fetch();
+    }
+
+    /**
+     * Fetches all child from the current collection of children
+     * @return array
+     * @access public
+     */
+    function fetchAll()
+    {
+        return $this->calendar->fetchAll();
+    }
+
+    /**
+     * Get the number Calendar subclass objects stored in the internal
+     * collection.
+     * @return int
+     * @access public
+     */
+    function size()
+    {
+        return $this->calendar->size();
+    }
+
+    /**
+     * Determine whether this date is valid, with the bounds determined by
+     * the Calendar_Engine. The call is passed on to
+     * Calendar_Validator::isValid
+     * @return boolean
+     * @access public
+     */
+    function isValid()
+    {
+        return $this->calendar->isValid();
+    }
+
+    /**
+     * Returns an instance of Calendar_Validator
+     * @return Calendar_Validator
+     * @access public
+     */
+    function & getValidator()
+    {
+        $validator = $this->calendar->getValidator();
+        return $validator;
+    }
+
+    /**
+     * Returns a reference to the current Calendar_Engine being used. Useful
+     * for Calendar_Table_Helper and Calendar_Validator
+     * @return object implementing Calendar_Engine_Inteface
+     * @access private
+     */
+    function & getEngine()
+    {
+        return $this->calendar->getEngine();
+    }
+
+    /**
+     * Returns the value for the previous year
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 2002 or timestamp
+     * @access public
+     */
+    function prevYear($format = 'int')
+    {
+        return $this->calendar->prevYear($format);
+    }
+
+    /**
+     * Returns the value for this year
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 2003 or timestamp
+     * @access public
+     */
+    function thisYear($format = 'int')
+    {
+        return $this->calendar->thisYear($format);
+    }
+
+    /**
+     * Returns the value for next year
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 2004 or timestamp
+     * @access public
+     */
+    function nextYear($format = 'int')
+    {
+        return $this->calendar->nextYear($format);
+    }
+
+    /**
+     * Returns the value for the previous month
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 4 or Unix timestamp
+     * @access public
+      */
+    function prevMonth($format = 'int')
+    {
+        return $this->calendar->prevMonth($format);
+    }
+
+    /**
+     * Returns the value for this month
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 5 or timestamp
+     * @access public
+     */
+    function thisMonth($format = 'int')
+    {
+        return $this->calendar->thisMonth($format);
+    }
+
+    /**
+     * Returns the value for next month
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 6 or timestamp
+     * @access public
+     */
+    function nextMonth($format = 'int')
+    {
+        return $this->calendar->nextMonth($format);
+    }
+
+    /**
+     * Returns the value for the previous week
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 4 or Unix timestamp
+     * @access public
+      */
+    function prevWeek($format = 'n_in_month')
+    {
+        if ( method_exists($this->calendar,'prevWeek') ) {
+            return $this->calendar->prevWeek($format);
+        } else {
+            require_once 'PEAR.php';
+            PEAR::raiseError(
+                'Cannot call prevWeek on Calendar object of type: '.
+                get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
+                E_USER_NOTICE, 'Calendar_Decorator::prevWeek()');
+            return false;
+        }
+    }
+
+    /**
+     * Returns the value for this week
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 5 or timestamp
+     * @access public
+     */
+    function thisWeek($format = 'n_in_month')
+    {
+        if ( method_exists($this->calendar,'thisWeek') ) {
+            return $this->calendar->thisWeek($format);
+        } else {
+            require_once 'PEAR.php';
+            PEAR::raiseError(
+                'Cannot call thisWeek on Calendar object of type: '.
+                get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
+                E_USER_NOTICE, 'Calendar_Decorator::thisWeek()');
+            return false;
+        }
+    }
+
+    /**
+     * Returns the value for next week
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 6 or timestamp
+     * @access public
+     */
+    function nextWeek($format = 'n_in_month')
+    {
+        if ( method_exists($this->calendar,'nextWeek') ) {
+            return $this->calendar->nextWeek($format);
+        } else {
+            require_once 'PEAR.php';
+            PEAR::raiseError(
+                'Cannot call thisWeek on Calendar object of type: '.
+                get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
+                E_USER_NOTICE, 'Calendar_Decorator::nextWeek()');
+            return false;
+        }
+    }
+
+    /**
+     * Returns the value for the previous day
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 10 or timestamp
+     * @access public
+     */
+    function prevDay($format = 'int') {
+        return $this->calendar->prevDay($format);
+    }
+
+    /**
+     * Returns the value for this day
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 11 or timestamp
+     * @access public
+     */
+    function thisDay($format = 'int')
+    {
+        return $this->calendar->thisDay($format);
+    }
+
+    /**
+     * Returns the value for the next day
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 12 or timestamp
+     * @access public
+     */
+    function nextDay($format = 'int')
+    {
+        return $this->calendar->nextDay($format);
+    }
+
+    /**
+     * Returns the value for the previous hour
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 13 or timestamp
+     * @access public
+     */
+    function prevHour($format = 'int')
+    {
+        return $this->calendar->prevHour($format);
+    }
+
+    /**
+     * Returns the value for this hour
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 14 or timestamp
+     * @access public
+     */
+    function thisHour($format = 'int')
+    {
+        return $this->calendar->thisHour($format);
+    }
+
+    /**
+     * Returns the value for the next hour
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 14 or timestamp
+     * @access public
+     */
+    function nextHour($format = 'int')
+    {
+        return $this->calendar->nextHour($format);
+    }
+
+    /**
+     * Returns the value for the previous minute
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 23 or timestamp
+     * @access public
+     */
+    function prevMinute($format = 'int')
+    {
+        return $this->calendar->prevMinute($format);
+    }
+
+    /**
+     * Returns the value for this minute
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 24 or timestamp
+     * @access public
+     */
+    function thisMinute($format = 'int')
+    {
+        return $this->calendar->thisMinute($format);
+    }
+
+    /**
+     * Returns the value for the next minute
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 25 or timestamp
+     * @access public
+     */
+   function nextMinute($format = 'int')
+    {
+        return $this->calendar->nextMinute($format);
+    }
+
+    /**
+     * Returns the value for the previous second
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 43 or timestamp
+     * @access public
+     */
+    function prevSecond($format = 'int')
+    {
+        return $this->calendar->prevSecond($format);
+    }
+
+    /**
+     * Returns the value for this second
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 44 or timestamp
+     * @access public
+     */
+    function thisSecond($format = 'int')
+    {
+        return $this->calendar->thisSecond($format);
+    }
+
+    /**
+     * Returns the value for the next second
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
+     * @return int e.g. 45 or timestamp
+     * @access public
+     */
+    function nextSecond($format = 'int')
+    {
+        return $this->calendar->nextSecond($format);
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Engine/Interface.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Engine/Interface.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Engine/Interface.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,293 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Interface.php,v 1.5 2004/08/16 12:29:18 hfuecks Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Interface.php,v 1.5 2004/08/16 12:29:18 hfuecks Exp $
+ */
+/**
+ * The methods the classes implementing the Calendar_Engine must implement.
+ * Note this class is not used but simply to help development
+ * @package Calendar
+ * @access protected
+ */
+class Calendar_Engine_Interface
+{
+    /**
+     * Provides a mechansim to make sure parsing of timestamps
+     * into human dates is only performed once per timestamp.
+     * Typically called "internally" by methods like stampToYear.
+     * Return value can vary, depending on the specific implementation
+     * @param int timestamp (depending on implementation)
+     * @return mixed
+     * @access protected
+     */
+    function stampCollection($stamp)
+    {
+    }
+
+    /**
+     * Returns a numeric year given a timestamp
+     * @param int timestamp (depending on implementation)
+     * @return int year (e.g. 2003)
+     * @access protected
+     */
+    function stampToYear($stamp)
+    {
+    }
+
+    /**
+     * Returns a numeric month given a timestamp
+     * @param int timestamp (depending on implementation)
+     * @return int month (e.g. 9)
+     * @access protected
+     */
+    function stampToMonth($stamp)
+    {
+    }
+
+    /**
+     * Returns a numeric day given a timestamp
+     * @param int timestamp (depending on implementation)
+     * @return int day (e.g. 15)
+     * @access protected
+     */
+    function stampToDay($stamp)
+    {
+    }
+
+    /**
+     * Returns a numeric hour given a timestamp
+     * @param int timestamp (depending on implementation)
+     * @return int hour (e.g. 13)
+     * @access protected
+     */
+    function stampToHour($stamp)
+    {
+    }
+
+    /**
+     * Returns a numeric minute given a timestamp
+     * @param int timestamp (depending on implementation)
+     * @return int minute (e.g. 34)
+     * @access protected
+     */
+    function stampToMinute($stamp)
+    {
+    }
+
+    /**
+     * Returns a numeric second given a timestamp
+     * @param int timestamp (depending on implementation)
+     * @return int second (e.g. 51)
+     * @access protected
+     */
+    function stampToSecond($stamp)
+    {
+    }
+
+    /**
+     * Returns a timestamp. Can be worth "caching" generated
+     * timestamps in a static variable, identified by the
+     * params this method accepts, to timestamp will only
+     * be calculated once.
+     * @param int year (e.g. 2003)
+     * @param int month (e.g. 9)
+     * @param int day (e.g. 13)
+     * @param int hour (e.g. 13)
+     * @param int minute (e.g. 34)
+     * @param int second (e.g. 53)
+     * @return int (depends on implementation)
+     * @access protected
+     */
+    function dateToStamp($y,$m,$d,$h,$i,$s)
+    {
+    }
+
+    /**
+     * The upper limit on years that the Calendar Engine can work with
+     * @return int (e.g. 2037)
+     * @access protected
+     */
+    function getMaxYears()
+    {
+    }
+
+    /**
+     * The lower limit on years that the Calendar Engine can work with
+     * @return int (e.g 1902)
+     * @access protected
+     */
+    function getMinYears()
+    {
+    }
+
+    /**
+     * Returns the number of months in a year
+     * @param int (optional) year to get months for
+     * @return int (e.g. 12)
+     * @access protected
+     */
+    function getMonthsInYear($y=null)
+    {
+    }
+
+    /**
+     * Returns the number of days in a month, given year and month
+     * @param int year (e.g. 2003)
+     * @param int month (e.g. 9)
+     * @return int days in month
+     * @access protected
+     */
+    function getDaysInMonth($y, $m)
+    {
+    }
+
+    /**
+     * Returns numeric representation of the day of the week in a month,
+     * given year and month
+     * @param int year (e.g. 2003)
+     * @param int month (e.g. 9)
+     * @return int
+     * @access protected
+     */
+    function getFirstDayInMonth ($y, $m)
+    {
+    }
+
+    /**
+     * Returns the number of days in a week
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int (e.g. 7)
+     * @access protected
+     */
+    function getDaysInWeek($y=NULL, $m=NULL, $d=NULL)
+    {
+    }
+
+    /**
+     * Returns the number of the week in the year (ISO-8601), given a date
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int week number
+     * @access protected
+     */
+    function getWeekNInYear($y, $m, $d)
+    {
+    }
+
+    /**
+     * Returns the number of the week in the month, given a date
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @param int first day of the week (default: 1 - monday)
+     * @return int week number
+     * @access protected
+     */
+    function getWeekNInMonth($y, $m, $d, $firstDay=1)
+    {
+    }
+
+    /**
+     * Returns the number of weeks in the month
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int first day of the week (default: 1 - monday)
+     * @return int weeks number
+     * @access protected
+     */
+    function getWeeksInMonth($y, $m)
+    {
+    }
+
+    /**
+     * Returns the number of the day of the week (0=sunday, 1=monday...)
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int weekday number
+     * @access protected
+     */
+    function getDayOfWeek($y, $m, $d)
+    {
+    }
+
+    /**
+     * Returns the numeric values of the days of the week.
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return array list of numeric values of days in week, beginning 0
+     * @access protected
+     */
+    function getWeekDays($y=NULL, $m=NULL, $d=NULL)
+    {
+    }
+
+    /**
+     * Returns the default first day of the week as an integer. Must be a
+     * member of the array returned from getWeekDays
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int (e.g. 1 for Monday)
+     * @see getWeekDays
+     * @access protected
+     */
+    function getFirstDayOfWeek($y=NULL, $m=NULL, $d=NULL)
+    {
+    }
+
+    /**
+     * Returns the number of hours in a day<br>
+     * @param int (optional) day to get hours for
+     * @return int (e.g. 24)
+     * @access protected
+     */
+    function getHoursInDay($y=null,$m=null,$d=null)
+    {
+    }
+
+    /**
+     * Returns the number of minutes in an hour
+     * @param int (optional) hour to get minutes for
+     * @return int
+     * @access protected
+     */
+    function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
+    {
+    }
+
+    /**
+     * Returns the number of seconds in a minutes
+     * @param int (optional) minute to get seconds for
+     * @return int
+     * @access protected
+     */
+    function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
+    {
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Engine/PearDate.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Engine/PearDate.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Engine/PearDate.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,407 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: PearDate.php,v 1.8 2004/08/20 20:00:55 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: PearDate.php,v 1.8 2004/08/20 20:00:55 quipo Exp $
+ */
+/**
+ * Load PEAR::Date class
+ */
+require_once 'Date.php';
+
+/**
+ * Performs calendar calculations based on the PEAR::Date class
+ * Timestamps are in the ISO-8601 format (YYYY-MM-DD HH:MM:SS)
+ * @package Calendar
+ * @access protected
+ */
+class Calendar_Engine_PearDate /* implements Calendar_Engine_Interface */
+{
+    /**
+     * Makes sure a given timestamp is only ever parsed once
+     * Uses a static variable to prevent date() being used twice
+     * for a date which is already known
+     * @param mixed Any timestamp format recognized by Pear::Date
+     * @return object Pear::Date object
+     * @access protected
+     */
+    function stampCollection($stamp)
+    {
+        static $stamps = array();
+        if (!isset($stamps[$stamp])) {
+            $stamps[$stamp] = new Date($stamp);
+        }
+        return $stamps[$stamp];
+    }
+
+    /**
+     * Returns a numeric year given a iso-8601 datetime
+     * @param string iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
+     * @return int year (e.g. 2003)
+     * @access protected
+     */
+    function stampToYear($stamp)
+    {
+        $date = Calendar_Engine_PearDate::stampCollection($stamp);
+        return (int)$date->year;
+    }
+
+    /**
+     * Returns a numeric month given a iso-8601 datetime
+     * @param string iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
+     * @return int month (e.g. 9)
+     * @access protected
+     */
+    function stampToMonth($stamp)
+    {
+        $date = Calendar_Engine_PearDate::stampCollection($stamp);
+        return (int)$date->month;
+    }
+
+    /**
+     * Returns a numeric day given a iso-8601 datetime
+     * @param string iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
+     * @return int day (e.g. 15)
+     * @access protected
+     */
+    function stampToDay($stamp)
+    {
+        $date = Calendar_Engine_PearDate::stampCollection($stamp);
+        return (int)$date->day;
+    }
+
+    /**
+     * Returns a numeric hour given a iso-8601 datetime
+     * @param string iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
+     * @return int hour (e.g. 13)
+     * @access protected
+     */
+    function stampToHour($stamp)
+    {
+        $date = Calendar_Engine_PearDate::stampCollection($stamp);
+        return (int)$date->hour;
+    }
+
+    /**
+     * Returns a numeric minute given a iso-8601 datetime
+     * @param string iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
+     * @return int minute (e.g. 34)
+     * @access protected
+     */
+    function stampToMinute($stamp)
+    {
+        $date = Calendar_Engine_PearDate::stampCollection($stamp);
+        return (int)$date->minute;
+    }
+
+    /**
+     * Returns a numeric second given a iso-8601 datetime
+     * @param string iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
+     * @return int second (e.g. 51)
+     * @access protected
+     */
+    function stampToSecond($stamp)
+    {
+        $date = Calendar_Engine_PearDate::stampCollection($stamp);
+        return (int)$date->second;
+    }
+
+    /**
+     * Returns a iso-8601 datetime
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (13)
+     * @param int hour (13)
+     * @param int minute (34)
+     * @param int second (53)
+     * @return string iso-8601 datetime
+     * @access protected
+     */
+    function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0)
+    {
+        $r = array();
+        Calendar_Engine_PearDate::adjustDate($y, $m, $d, $h, $i, $s);
+        $key = $y.$m.$d.$h.$i.$s;
+        if (!isset($r[$key])) {
+            $r[$key] = sprintf("%04d-%02d-%02d %02d:%02d:%02d",
+                                $y, $m, $d, $h, $i, $s);
+        }
+        return $r[$key];
+    }
+
+    /**
+     * Set the correct date values (useful for math operations on dates)
+     * @param int year   (2003)
+     * @param int month  (9)
+     * @param int day    (13)
+     * @param int hour   (13)
+     * @param int minute (34)
+     * @param int second (53)
+     * @access protected
+     */
+    function adjustDate(&$y, &$m, &$d, &$h, &$i, &$s)
+    {
+        if ($s < 0) {
+            $m -= floor($s / 60);
+            $s = -$s % 60;
+        }
+        if ($s > 60) {
+            $m += floor($s / 60);
+            $s %= 60;
+        }
+        if ($i < 0) {
+            $h -= floor($i / 60);
+            $i = -$i % 60;
+        }
+        if ($i > 60) {
+            $h += floor($i / 60);
+            $i %= 60;
+        }
+        if ($h < 0) {
+            $d -= floor($h / 24);
+            $h = -$h % 24;
+        }
+        if ($h > 24) {
+            $d += floor($h / 24);
+            $h %= 24;
+        }
+        for(; $m < 1; $y--, $m+=12);
+        for(; $m > 12; $y++, $m-=12);
+
+        while ($d < 1) {
+            if ($m > 1) {
+                $m--;
+            } else {
+                $m = 12;
+                $y--;
+            }
+            $d += Date_Calc::daysInMonth($m, $y);
+        }
+        for ($max_days = Date_Calc::daysInMonth($m, $y); $d > $max_days; ) {
+            $d -= $max_days;
+            if ($m < 12) {
+                $m++;
+            } else {
+                $m = 1;
+                $y++;
+            }
+        }
+    }
+
+    /**
+     * The upper limit on years that the Calendar Engine can work with
+     * @return int 9999
+     * @access protected
+     */
+    function getMaxYears()
+    {
+        return 9999;
+    }
+
+    /**
+     * The lower limit on years that the Calendar Engine can work with
+     * @return int 0
+     * @access protected
+     */
+    function getMinYears()
+    {
+        return 0;
+    }
+
+    /**
+     * Returns the number of months in a year
+     * @return int (12)
+     * @access protected
+     */
+    function getMonthsInYear($y=null)
+    {
+        return 12;
+    }
+
+    /**
+     * Returns the number of days in a month, given year and month
+     * @param int year (2003)
+     * @param int month (9)
+     * @return int days in month
+     * @access protected
+     */
+    function getDaysInMonth($y, $m)
+    {
+        return (int)Date_Calc::daysInMonth($m, $y);
+    }
+
+    /**
+     * Returns numeric representation of the day of the week in a month,
+     * given year and month
+     * @param int year (2003)
+     * @param int month (9)
+     * @return int from 0 to 7
+     * @access protected
+     */
+    function getFirstDayInMonth($y, $m)
+    {
+        return (int)Date_Calc::dayOfWeek(1, $m, $y);
+    }
+
+    /**
+     * Returns the number of days in a week
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int (7)
+     * @access protected
+     */
+    function getDaysInWeek($y=NULL, $m=NULL, $d=NULL)
+    {
+        return 7;
+    }
+
+    /**
+     * Returns the number of the week in the year (ISO-8601), given a date
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int week number
+     * @access protected
+     */
+    function getWeekNInYear($y, $m, $d)
+    {
+        return Date_Calc::weekOfYear($d, $m, $y); //beware, Date_Calc doesn't follow ISO-8601 standard!
+    }
+
+    /**
+     * Returns the number of the week in the month, given a date
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @param int first day of the week (default: monday)
+     * @return int week number
+     * @access protected
+     */
+    function getWeekNInMonth($y, $m, $d, $firstDay=1)
+    {
+        $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek()-1 : $firstDay-1;
+        $end_of_week = (int)Date_Calc::nextDayOfWeek($weekEnd, 1, $m, $y, '%e', true);
+        $w = 1;
+        while ($d > $end_of_week) {
+            ++$w;
+            $end_of_week += $this->getDaysInWeek();
+        }
+        return $w;
+    }
+
+    /**
+     * Returns the number of weeks in the month
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int first day of the week (default: monday)
+     * @return int weeks number
+     * @access protected
+     */
+    function getWeeksInMonth($y, $m, $firstDay=1)
+    {
+        $FDOM = Date_Calc::firstOfMonthWeekday($m, $y);
+        if ($FDOM == 0) {
+            $FDOM = $this->getDaysInWeek();
+        }
+        if ($FDOM > $firstDay) {
+            $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
+            $weeks = 1;
+        } else {
+            $daysInTheFirstWeek = $firstDay - $FDOM;
+            $weeks = 0;
+        }
+        $daysInTheFirstWeek %= $this->getDaysInWeek();
+        return (int)(ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) /
+                           $this->getDaysInWeek()) + $weeks);
+    }
+
+    /**
+     * Returns the number of the day of the week (0=sunday, 1=monday...)
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int weekday number
+     * @access protected
+     */
+    function getDayOfWeek($y, $m, $d)
+    {
+        return Date_Calc::dayOfWeek($d, $m, $y);
+    }
+
+    /**
+     * Returns a list of integer days of the week beginning 0
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return array (0, 1, 2, 3, 4, 5, 6) 1 = Monday
+     * @access protected
+     */
+    function getWeekDays($y=NULL, $m=NULL, $d=NULL)
+    {
+        return array(0, 1, 2, 3, 4, 5, 6);
+    }
+
+    /**
+     * Returns the default first day of the week
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int (default 1 = Monday)
+     * @access protected
+     */
+    function getFirstDayOfWeek($y=NULL, $m=NULL, $d=NULL)
+    {
+        return 1;
+    }
+
+    /**
+     * Returns the number of hours in a day
+     * @return int (24)
+     * @access protected
+     */
+    function getHoursInDay($y=null,$m=null,$d=null)
+    {
+        return 24;
+    }
+
+    /**
+     * Returns the number of minutes in an hour
+     * @return int (60)
+     * @access protected
+     */
+    function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
+    {
+        return 60;
+    }
+
+    /**
+     * Returns the number of seconds in a minutes
+     * @return int (60)
+     * @access protected
+     */
+    function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
+    {
+        return 60;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Engine/UnixTS.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Engine/UnixTS.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Engine/UnixTS.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,365 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: UnixTS.php,v 1.9 2004/08/20 20:00:55 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: UnixTS.php,v 1.9 2004/08/20 20:00:55 quipo Exp $
+ */
+/**
+ * Performs calendar calculations based on the PHP date() function and
+ * Unix timestamps (using PHP's mktime() function).
+ * @package Calendar
+ * @access protected
+ */
+class Calendar_Engine_UnixTS /* implements Calendar_Engine_Interface */
+{
+    /**
+     * Makes sure a given timestamp is only ever parsed once
+     * <pre>
+     * array (
+     *  [0] => year (e.g 2003),
+     *  [1] => month (e.g 9),
+     *  [2] => day (e.g 6),
+     *  [3] => hour (e.g 14),
+     *  [4] => minute (e.g 34),
+     *  [5] => second (e.g 45),
+     *  [6] => num days in month (e.g. 31),
+     *  [7] => week in year (e.g. 50),
+     *  [8] => day in week (e.g. 0 for Sunday)
+     * )
+     * </pre>
+     * Uses a static variable to prevent date() being used twice
+     * for a date which is already known
+     * @param int Unix timestamp
+     * @return array
+     * @access protected
+     */
+    function stampCollection($stamp)
+    {
+        static $stamps = array();
+        if ( !isset($stamps[$stamp]) ) {
+            $date = @date('Y n j H i s t W w',$stamp);
+            $stamps[$stamp] = sscanf($date, "%d %d %d %d %d %d %d %d %d");
+        }
+        return $stamps[$stamp];
+    }
+
+    /**
+     * Returns a numeric year given a timestamp
+     * @param int Unix timestamp
+     * @return int year (e.g. 2003)
+     * @access protected
+     */
+    function stampToYear($stamp)
+    {
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return (int)$date[0];
+    }
+
+    /**
+     * Returns a numeric month given a timestamp
+     * @param int Unix timestamp
+     * @return int month (e.g. 9)
+     * @access protected
+     */
+    function stampToMonth($stamp)
+    {
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return (int)$date[1];
+    }
+
+    /**
+     * Returns a numeric day given a timestamp
+     * @param int Unix timestamp
+     * @return int day (e.g. 15)
+     * @access protected
+     */
+    function stampToDay($stamp)
+    {
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return (int)$date[2];
+    }
+
+    /**
+     * Returns a numeric hour given a timestamp
+     * @param int Unix timestamp
+     * @return int hour (e.g. 13)
+     * @access protected
+     */
+    function stampToHour($stamp)
+    {
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return (int)$date[3];
+    }
+
+    /**
+     * Returns a numeric minute given a timestamp
+     * @param int Unix timestamp
+     * @return int minute (e.g. 34)
+     * @access protected
+     */
+    function stampToMinute($stamp)
+    {
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return (int)$date[4];
+    }
+
+    /**
+     * Returns a numeric second given a timestamp
+     * @param int Unix timestamp
+     * @return int second (e.g. 51)
+     * @access protected
+     */
+    function stampToSecond($stamp)
+    {
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return (int)$date[5];
+    }
+
+    /**
+     * Returns a timestamp
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (13)
+     * @param int hour (13)
+     * @param int minute (34)
+     * @param int second (53)
+     * @return int Unix timestamp
+     * @access protected
+     */
+    function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0)
+    {
+        static $dates = array();
+        if ( !isset($dates[$y][$m][$d][$h][$i][$s]) ) {
+            $dates[$y][$m][$d][$h][$i][$s] = @mktime($h, $i, $s, $m, $d, $y);
+        }
+        return $dates[$y][$m][$d][$h][$i][$s];
+    }
+
+    /**
+     * The upper limit on years that the Calendar Engine can work with
+     * @return int (2037)
+     * @access protected
+     */
+    function getMaxYears()
+    {
+        return 2037;
+    }
+
+    /**
+     * The lower limit on years that the Calendar Engine can work with
+     * @return int (1970 if it's Windows and 1902 for all other OSs)
+     * @access protected
+     */
+    function getMinYears()
+    {
+        return $min = strpos(PHP_OS, 'WIN') === false ? 1902 : 1970;
+    }
+
+    /**
+     * Returns the number of months in a year
+     * @return int (12)
+    * @access protected
+     */
+    function getMonthsInYear($y=null)
+    {
+        return 12;
+    }
+
+    /**
+     * Returns the number of days in a month, given year and month
+     * @param int year (2003)
+     * @param int month (9)
+     * @return int days in month
+     * @access protected
+     */
+    function getDaysInMonth($y, $m)
+    {
+        $stamp = Calendar_Engine_UnixTS::dateToStamp($y,$m,1);
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return $date[6];
+    }
+
+    /**
+     * Returns numeric representation of the day of the week in a month,
+     * given year and month
+     * @param int year (2003)
+     * @param int month (9)
+     * @return int from 0 to 6
+     * @access protected
+     */
+    function getFirstDayInMonth($y, $m)
+    {
+        $stamp = Calendar_Engine_UnixTS::dateToStamp($y,$m,1);
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return $date[8];
+    }
+
+    /**
+     * Returns the number of days in a week
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int (7)
+     * @access protected
+     */
+    function getDaysInWeek($y=NULL, $m=NULL, $d=NULL)
+    {
+        return 7;
+    }
+
+    /**
+     * Returns the number of the week in the year (ISO-8601), given a date
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int week number
+     * @access protected
+     */
+    function getWeekNInYear($y, $m, $d)
+    {
+        $stamp = Calendar_Engine_UnixTS::dateToStamp($y,$m,$d);
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return $date[7];
+    }
+
+    /**
+     * Returns the number of the week in the month, given a date
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @param int first day of the week (default: monday)
+     * @return int week number
+     * @access protected
+     */
+    function getWeekNInMonth($y, $m, $d, $firstDay=1)
+    {
+        $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek()-1 : $firstDay-1;
+        $end_of_week = 1;
+        while (@date('w', @mktime(0, 0, 0, $m, $end_of_week, $y)) != $weekEnd) {
+            ++$end_of_week; //find first weekend of the month
+        }
+        $w = 1;
+        while ($d > $end_of_week) {
+            ++$w;
+            $end_of_week += $this->getDaysInWeek();
+        }
+        return $w;
+    }
+
+    /**
+     * Returns the number of weeks in the month
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int first day of the week (default: monday)
+     * @return int weeks number
+     * @access protected
+     */
+    function getWeeksInMonth($y, $m, $firstDay=1)
+    {
+        $FDOM = $this->getFirstDayInMonth($y, $m);
+        if ($FDOM == 0) {
+            $FDOM = $this->getDaysInWeek();
+        }
+        if ($FDOM > $firstDay) {
+            $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
+            $weeks = 1;
+        } else {
+            $daysInTheFirstWeek = $firstDay - $FDOM;
+            $weeks = 0;
+        }
+        $daysInTheFirstWeek %= $this->getDaysInWeek();
+        return (int)(ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) /
+                           $this->getDaysInWeek()) + $weeks);
+    }
+
+    /**
+     * Returns the number of the day of the week (0=sunday, 1=monday...)
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int weekday number
+     * @access protected
+     */
+    function getDayOfWeek($y, $m, $d)
+    {
+        $stamp = Calendar_Engine_UnixTS::dateToStamp($y,$m,$d);
+        $date = Calendar_Engine_UnixTS::stampCollection($stamp);
+        return $date[8];
+    }
+
+    /**
+     * Returns a list of integer days of the week beginning 0
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return array (0,1,2,3,4,5,6) 1 = Monday
+     * @access protected
+     */
+    function getWeekDays($y=NULL, $m=NULL, $d=NULL)
+    {
+        return array(0, 1, 2, 3, 4, 5, 6);
+    }
+
+    /**
+     * Returns the default first day of the week
+     * @param int year (2003)
+     * @param int month (9)
+     * @param int day (4)
+     * @return int (default 1 = Monday)
+     * @access protected
+     */
+    function getFirstDayOfWeek($y=NULL, $m=NULL, $d=NULL)
+    {
+        return 1;
+    }
+
+    /**
+     * Returns the number of hours in a day
+     * @return int (24)
+     * @access protected
+     */
+    function getHoursInDay($y=null,$m=null,$d=null)
+    {
+        return 24;
+    }
+
+    /**
+     * Returns the number of minutes in an hour
+     * @return int (60)
+     * @access protected
+     */
+    function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
+    {
+        return 60;
+    }
+
+    /**
+     * Returns the number of seconds in a minutes
+     * @return int (60)
+     * @access protected
+     */
+    function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
+    {
+        return 60;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Factory.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Factory.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Factory.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,145 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Factory.php,v 1.3 2005/10/22 10:08:47 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Factory.php,v 1.3 2005/10/22 10:08:47 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Contains a factory method to return a Singleton instance of a class
+ * implementing the Calendar_Engine_Interface.<br>
+ * For Month objects, to control type of month returned, use CALENDAR_MONTH_STATE
+ * constact e.g.;
+ * <code>
+ * require_once 'Calendar/Factory.php';
+ * define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays
+ * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks
+ * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month
+ * </code>
+ * It defaults to building Calendar_Month objects.<br>
+ * Use the constract CALENDAR_FIRST_DAY_OF_WEEK to control the first day of the week
+ * for Month or Week objects (e.g. 0 = Sunday, 6 = Saturday)
+ * @package Calendar
+ * @access protected
+ */
+class Calendar_Factory
+{
+    /**
+     * Creates a calendar object given the type and units
+     * @param string class of calendar object to create
+     * @param int year
+     * @param int month
+     * @param int day
+     * @param int hour
+     * @param int minute
+     * @param int second
+     * @return object subclass of Calendar
+     * @access public
+     * @static
+     */
+    function create($type, $y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0)
+    {
+        $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1;
+        switch ($type) {
+            case 'Day':
+                require_once CALENDAR_ROOT.'Day.php';
+                return new Calendar_Day($y,$m,$d);
+            case 'Month':
+                // Set default state for which month type to build
+                if (!defined('CALENDAR_MONTH_STATE')) {
+                    define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
+                }
+                switch (CALENDAR_MONTH_STATE) {
+                    case CALENDAR_USE_MONTH_WEEKDAYS:
+                        require_once CALENDAR_ROOT.'Month/Weekdays.php';
+                        $class = 'Calendar_Month_Weekdays';
+                        break;
+                    case CALENDAR_USE_MONTH_WEEKS:
+                        require_once CALENDAR_ROOT.'Month/Weeks.php';
+                        $class = 'Calendar_Month_Weeks';
+                        break;
+                    case CALENDAR_USE_MONTH:
+                    default:
+                        require_once CALENDAR_ROOT.'Month.php';
+                        $class = 'Calendar_Month';
+                        break;
+                }
+                return new $class($y, $m, $firstDay);
+            case 'Week':
+                require_once CALENDAR_ROOT.'Week.php';
+                return new Calendar_Week($y, $m, $d, $firstDay);
+            case 'Hour':
+                require_once CALENDAR_ROOT.'Hour.php';
+                return new Calendar_Hour($y, $m, $d, $h);
+            case 'Minute':
+                require_once CALENDAR_ROOT.'Minute.php';
+                return new Calendar_Minute($y, $m, $d, $h, $i);
+            case 'Second':
+                require_once CALENDAR_ROOT.'Second.php';
+                return new Calendar_Second($y,$m,$d,$h,$i,$s);
+            case 'Year':
+                require_once CALENDAR_ROOT.'Year.php';
+                return new Calendar_Year($y);
+            default:
+                require_once 'PEAR.php';
+                PEAR::raiseError(
+                    'Calendar_Factory::create() unrecognised type: '.$type, null, PEAR_ERROR_TRIGGER,
+                    E_USER_NOTICE, 'Calendar_Factory::create()');
+                return false;
+        }
+    }
+    /**
+     * Creates an instance of a calendar object, given a type and timestamp
+     * @param string type of object to create
+     * @param mixed timestamp (depending on Calendar engine being used)
+     * @return object subclass of Calendar
+     * @access public
+     * @static
+     */
+    function & createByTimestamp($type, $stamp)
+    {
+        $cE = & Calendar_Engine_Factory::getEngine();
+        $y = $cE->stampToYear($stamp);
+        $m = $cE->stampToMonth($stamp);
+        $d = $cE->stampToDay($stamp);
+        $h = $cE->stampToHour($stamp);
+        $i = $cE->stampToMinute($stamp);
+        $s = $cE->stampToSecond($stamp);
+        $cal = Calendar_Factory::create($type, $y, $m, $d, $h, $i, $s);
+        return $cal;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Hour.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Hour.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Hour.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,113 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Hour.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Hour.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents an Hour and builds Minutes
+ * <code>
+ * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Hour.php';
+ * $Hour = & new Calendar_Hour(2003, 10, 21, 15); // Oct 21st 2003, 3pm
+ * $Hour->build(); // Build Calendar_Minute objects
+ * while ($Minute = & $Hour->fetch()) {
+ *     echo $Minute->thisMinute().'<br />';
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Hour extends Calendar
+{
+    /**
+     * Constructs Calendar_Hour
+     * @param int year e.g. 2003
+     * @param int month e.g. 5
+     * @param int day e.g. 11
+     * @param int hour e.g. 13
+     * @access public
+     */
+    function Calendar_Hour($y, $m, $d, $h)
+    {
+        Calendar::Calendar($y, $m, $d, $h);
+    }
+
+   /**
+     * Builds the Minutes in the Hour
+     * @param array (optional) Calendar_Minute objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates=array())
+    {
+        require_once CALENDAR_ROOT.'Minute.php';
+        $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
+                           $this->hour);
+        for ($i=0; $i < $mIH; $i++) {
+            $this->children[$i]=
+                new Calendar_Minute($this->year, $this->month, $this->day,
+                           $this->hour, $i);
+        }
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates)
+    {
+        foreach ($sDates as $sDate) {
+            if ($this->year == $sDate->thisYear()
+                && $this->month == $sDate->thisMonth()
+                && $this->day == $sDate->thisDay()
+                && $this->hour == $sDate->thisHour())
+            {
+                $key = (int)$sDate->thisMinute();
+                if (isset($this->children[$key])) {
+                    $sDate->setSelected();
+                    $this->children[$key] = $sDate;
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Minute.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Minute.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Minute.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,114 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Minute.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Minute.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents a Minute and builds Seconds
+ * <code>
+ * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Minute.php';
+ * $Minute = & new Calendar_Minute(2003, 10, 21, 15, 31); // Oct 21st 2003, 3:31pm
+ * $Minute->build(); // Build Calendar_Second objects
+ * while ($Second = & $Minute->fetch()) {
+ *     echo $Second->thisSecond().'<br />';
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Minute extends Calendar
+{
+    /**
+     * Constructs Minute
+     * @param int year e.g. 2003
+     * @param int month e.g. 5
+     * @param int day e.g. 11
+     * @param int hour e.g. 13
+     * @param int minute e.g. 31
+     * @access public
+     */
+    function Calendar_Minute($y, $m, $d, $h, $i)
+    {
+        Calendar::Calendar($y, $m, $d, $h, $i);
+    }
+
+    /**
+     * Builds the Calendar_Second objects
+     * @param array (optional) Calendar_Second objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates=array())
+    {
+        require_once CALENDAR_ROOT.'Second.php';
+        $sIM = $this->cE->getSecondsInMinute($this->year, $this->month,
+                $this->day, $this->hour, $this->minute);
+        for ($i=0; $i < $sIM; $i++) {
+            $this->children[$i] = new Calendar_Second($this->year, $this->month,
+                $this->day, $this->hour, $this->minute, $i);
+        }
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates)
+    {
+        foreach ($sDates as $sDate) {
+            if ($this->year == $sDate->thisYear()
+                && $this->month == $sDate->thisMonth()
+                && $this->day == $sDate->thisDay()
+                && $this->hour == $sDate->thisHour()
+                && $this->minute == $sDate->thisMinute())
+            {
+                $key = (int)$sDate->thisSecond();
+                if (isset($this->children[$key])) {
+                    $sDate->setSelected();
+                    $this->children[$key] = $sDate;
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Month/Weekdays.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Month/Weekdays.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Month/Weekdays.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,189 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Weekdays.php,v 1.4 2005/10/22 10:28:49 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Weekdays.php,v 1.4 2005/10/22 10:28:49 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Load base month
+ */
+require_once CALENDAR_ROOT.'Month.php';
+
+/**
+ * Represents a Month and builds Days in tabular form<br>
+ * <code>
+ * require_once 'Calendar/Month/Weekdays.php';
+ * $Month = & new Calendar_Month_Weekdays(2003, 10); // Oct 2003
+ * $Month->build(); // Build Calendar_Day objects
+ * while ($Day = & $Month->fetch()) {
+ *     if ($Day->isFirst()) {
+ *         echo '<tr>';
+ *     }
+ *     if ($Day->isEmpty()) {
+ *         echo '<td> </td>';
+ *     } else {
+ *         echo '<td>'.$Day->thisDay().'</td>';
+ *     }
+ *     if ($Day->isLast()) {
+ *         echo '</tr>';
+ *     }
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Month_Weekdays extends Calendar_Month
+{
+    /**
+     * Instance of Calendar_Table_Helper
+     * @var Calendar_Table_Helper
+     * @access private
+     */
+    var $tableHelper;
+
+    /**
+     * First day of the week
+     * @access private
+     * @var string
+     */
+    var $firstDay;
+
+    /**
+     * Constructs Calendar_Month_Weekdays
+     * @param int year e.g. 2003
+     * @param int month e.g. 5
+     * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
+     * @access public
+     */
+    function Calendar_Month_Weekdays($y, $m, $firstDay=null)
+    {
+        Calendar_Month::Calendar_Month($y, $m, $firstDay);
+    }
+
+    /**
+     * Builds Day objects in tabular form, to allow display of calendar month
+     * with empty cells if the first day of the week does not fall on the first
+     * day of the month.
+     * @see Calendar_Day::isEmpty()
+     * @see Calendar_Day_Base::isFirst()
+     * @see Calendar_Day_Base::isLast()
+     * @param array (optional) Calendar_Day objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates=array())
+    {
+        require_once CALENDAR_ROOT.'Table/Helper.php';
+        $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
+        Calendar_Month::build($sDates);
+        $this->buildEmptyDaysBefore();
+        $this->shiftDays();
+        $this->buildEmptyDaysAfter();
+        $this->setWeekMarkers();
+        return true;
+    }
+
+    /**
+     * Prepends empty days before the real days in the month
+     * @return void
+     * @access private
+     */
+    function buildEmptyDaysBefore()
+    {
+        $eBefore = $this->tableHelper->getEmptyDaysBefore();
+        for ($i=0; $i < $eBefore; $i++) {
+            $stamp = $this->cE->dateToStamp($this->year, $this->month, -$i);
+            $Day = new Calendar_Day(
+                                $this->cE->stampToYear($stamp),
+                                $this->cE->stampToMonth($stamp),
+                                $this->cE->stampToDay($stamp));
+            $Day->setEmpty();
+            $Day->adjust();
+            array_unshift($this->children, $Day);
+        }
+    }
+
+    /**
+     * Shifts the array of children forward, if necessary
+     * @return void
+     * @access private
+     */
+    function shiftDays()
+    {
+        if (isset ($this->children[0])) {
+            array_unshift($this->children, null);
+            unset($this->children[0]);
+        }
+    }
+
+    /**
+     * Appends empty days after the real days in the month
+     * @return void
+     * @access private
+     */
+    function buildEmptyDaysAfter()
+    {
+        $eAfter = $this->tableHelper->getEmptyDaysAfter();
+        $sDOM = $this->tableHelper->getNumTableDaysInMonth();
+        for ($i = 1; $i <= $sDOM-$eAfter; $i++) {
+            $Day = new Calendar_Day($this->year, $this->month+1, $i);
+            $Day->setEmpty();
+            $Day->adjust();
+            array_push($this->children, $Day);
+        }
+    }
+
+    /**
+     * Sets the "markers" for the beginning and of a of week, in the
+     * built Calendar_Day children
+     * @return void
+     * @access private
+     */
+    function setWeekMarkers()
+    {
+        $dIW  = $this->cE->getDaysInWeek(
+            $this->thisYear(),
+            $this->thisMonth(),
+            $this->thisDay()
+        );
+        $sDOM = $this->tableHelper->getNumTableDaysInMonth();
+        for ($i=1; $i <= $sDOM; $i+= $dIW) {
+            $this->children[$i]->setFirst();
+            $this->children[$i+($dIW-1)]->setLast();
+        }
+    }
+}
+?>
 
Added: eccube2/trunk/data/module/Calendar/Month/Weeks.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Month/Weeks.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Month/Weeks.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,139 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Weeks.php,v 1.3 2005/10/22 10:28:49 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Weeks.php,v 1.3 2005/10/22 10:28:49 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Load base month
+ */
+require_once CALENDAR_ROOT.'Month.php';
+
+/**
+ * Represents a Month and builds Weeks
+ * <code>
+ * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Month'.DIRECTORY_SEPARATOR.'Weeks.php';
+ * $Month = & new Calendar_Month_Weeks(2003, 10); // Oct 2003
+ * $Month->build(); // Build Calendar_Day objects
+ * while ($Week = & $Month->fetch()) {
+ *     echo $Week->thisWeek().'<br />';
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Month_Weeks extends Calendar_Month
+{
+    /**
+     * Instance of Calendar_Table_Helper
+     * @var Calendar_Table_Helper
+     * @access private
+     */
+    var $tableHelper;
+
+    /**
+     * First day of the week
+     * @access private
+     * @var string
+     */
+    var $firstDay;
+
+    /**
+     * Constructs Calendar_Month_Weeks
+     * @param int year e.g. 2003
+     * @param int month e.g. 5
+     * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
+     * @access public
+     */
+    function Calendar_Month_Weeks($y, $m, $firstDay=null)
+    {
+        Calendar_Month::Calendar_Month($y, $m, $firstDay);
+    }
+
+    /**
+     * Builds Calendar_Week objects for the Month. Note that Calendar_Week
+     * builds Calendar_Day object in tabular form (with Calendar_Day->empty)
+     * @param array (optional) Calendar_Week objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates=array())
+    {
+        require_once CALENDAR_ROOT.'Table/Helper.php';
+        $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
+        require_once CALENDAR_ROOT.'Week.php';
+        $numWeeks = $this->tableHelper->getNumWeeks();
+        for ($i=1, $d=1; $i<=$numWeeks; $i++,
+            $d+=$this->cE->getDaysInWeek(
+                $this->thisYear(),
+                $this->thisMonth(),
+                $this->thisDay()) ) {
+            $this->children[$i] = new Calendar_Week(
+                $this->year, $this->month, $d, $this->tableHelper->getFirstDay());
+        }
+        //used to set empty days
+        $this->children[1]->setFirst(true);
+        $this->children[$numWeeks]->setLast(true);
+
+        // Handle selected weeks here
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates)
+    {
+        foreach ($sDates as $sDate) {
+            if ($this->year == $sDate->thisYear()
+                && $this->month == $sDate->thisMonth())
+            {
+                $key = $sDate->thisWeek('n_in_month');
+                if (isset($this->children[$key])) {
+                    $this->children[$key]->setSelected();
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Month.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Month.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Month.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,114 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Month.php,v 1.3 2005/10/22 10:10:26 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Month.php,v 1.3 2005/10/22 10:10:26 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents a Month and builds Days
+ * <code>
+ * require_once 'Calendar/Month.php';
+ * $Month = & new Calendar_Month(2003, 10); // Oct 2003
+ * $Month->build(); // Build Calendar_Day objects
+ * while ($Day = & $Month->fetch()) {
+ *     echo $Day->thisDay().'<br />';
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Month extends Calendar
+{
+    /**
+     * Constructs Calendar_Month
+     * @param int $y year e.g. 2003
+     * @param int $m month e.g. 5
+     * @param int $firstDay first day of the week [optional]
+     * @access public
+     */
+    function Calendar_Month($y, $m, $firstDay=null)
+    {
+        Calendar::Calendar($y, $m);
+        $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
+    }
+
+    /**
+     * Builds Day objects for this Month. Creates as many Calendar_Day objects
+     * as there are days in the month
+     * @param array (optional) Calendar_Day objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates=array())
+    {
+        require_once CALENDAR_ROOT.'Day.php';
+        $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
+        for ($i=1; $i<=$daysInMonth; $i++) {
+            $this->children[$i] = new Calendar_Day($this->year, $this->month, $i);
+        }
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates)
+    {
+        foreach ($sDates as $sDate) {
+            if ($this->year == $sDate->thisYear()
+                && $this->month == $sDate->thisMonth()
+            ) {
+                $key = $sDate->thisDay();
+                if (isset($this->children[$key])) {
+                    $sDate->setSelected();
+                    $class = strtolower(get_class($sDate));
+                    if ($class == 'calendar_day' || $class == 'calendar_decorator') {
+                        $sDate->setFirst($this->children[$key]->isFirst());
+                        $sDate->setLast($this->children[$key]->isLast());
+                    }
+                    $this->children[$key] = $sDate;
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Second.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Second.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Second.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,98 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Second.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Second.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents a Second<br />
+ * <b>Note:</b> Seconds do not build other objects
+ * so related methods are overridden to return NULL
+ * @package Calendar
+ */
+class Calendar_Second extends Calendar
+{
+    /**
+     * Constructs Second
+     * @param int year e.g. 2003
+     * @param int month e.g. 5
+     * @param int day e.g. 11
+     * @param int hour e.g. 13
+     * @param int minute e.g. 31
+     * @param int second e.g. 45
+     */
+    function Calendar_Second($y, $m, $d, $h, $i, $s)
+    {
+        Calendar::Calendar($y, $m, $d, $h, $i, $s);
+    }
+
+    /**
+     * Overwrite build
+     * @return NULL
+     */
+    function build()
+    {
+        return null;
+    }
+
+    /**
+     * Overwrite fetch
+     * @return NULL
+     */
+    function fetch()
+    {
+        return null;
+    }
+
+    /**
+     * Overwrite fetchAll
+     * @return NULL
+     */
+    function fetchAll()
+    {
+        return null;
+    }
+
+    /**
+     * Overwrite size
+     * @return NULL
+     */
+    function size()
+    {
+        return null;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Table/Helper.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Table/Helper.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Table/Helper.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,280 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Helper.php,v 1.5 2005/10/22 09:51:53 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Helper.php,v 1.5 2005/10/22 09:51:53 quipo Exp $
+ */
+
+/**
+ * Used by Calendar_Month_Weekdays, Calendar_Month_Weeks and Calendar_Week to
+ * help with building the calendar in tabular form
+ * @package Calendar
+ * @access protected
+ */
+class Calendar_Table_Helper
+{
+    /**
+     * Instance of the Calendar object being helped.
+     * @var object
+     * @access private
+     */
+    var $calendar;
+
+    /**
+     * Instance of the Calendar_Engine
+     * @var object
+     * @access private
+     */
+    var $cE;
+
+    /**
+     * First day of the week
+     * @access private
+     * @var string
+     */
+    var $firstDay;
+
+    /**
+     * The seven days of the week named
+     * @access private
+     * @var array
+     */
+    var $weekDays;
+
+    /**
+     * Days of the week ordered with $firstDay at the beginning
+     * @access private
+     * @var array
+     */
+    var $daysOfWeek = array();
+
+    /**
+     * Days of the month built from days of the week
+     * @access private
+     * @var array
+     */
+    var $daysOfMonth = array();
+
+    /**
+     * Number of weeks in month
+     * @var int
+     * @access private
+     */
+    var $numWeeks = null;
+
+    /**
+     * Number of emtpy days before real days begin in month
+     * @var int
+     * @access private
+     */
+    var $emptyBefore = 0;
+
+    /**
+     * Constructs Calendar_Table_Helper
+     * @param object Calendar_Month_Weekdays, Calendar_Month_Weeks, Calendar_Week
+     * @param int (optional) first day of the week e.g. 1 for Monday
+     * @access protected
+     */
+    function Calendar_Table_Helper(& $calendar, $firstDay=null)
+    {
+        $this->calendar = & $calendar;
+        $this->cE = & $calendar->getEngine();
+        if (is_null($firstDay)) {
+            $firstDay = $this->cE->getFirstDayOfWeek(
+                $this->calendar->thisYear(),
+                $this->calendar->thisMonth(),
+                $this->calendar->thisDay()
+            );
+        }
+        $this->firstDay = $firstDay;
+        $this->setFirstDay();
+        $this->setDaysOfMonth();
+    }
+
+    /**
+     * Constructs $this->daysOfWeek based on $this->firstDay
+     * @return void
+     * @access private
+     */
+    function setFirstDay()
+    {
+        $weekDays = $this->cE->getWeekDays(
+            $this->calendar->thisYear(),
+            $this->calendar->thisMonth(),
+            $this->calendar->thisDay()
+        );
+        $endDays  = array();
+        $tmpDays  = array();
+        $begin = false;
+        foreach ($weekDays as $day) {
+            if ($begin) {
+                $endDays[] = $day;
+            } else if ($day === $this->firstDay) {
+                $begin = true;
+                $endDays[] = $day;
+            } else {
+                $tmpDays[] = $day;
+            }
+        }
+        $this->daysOfWeek = array_merge($endDays, $tmpDays);
+    }
+
+    /**
+     * Constructs $this->daysOfMonth
+     * @return void
+     * @access private
+     */
+    function setDaysOfMonth()
+    {
+        $this->daysOfMonth = $this->daysOfWeek;
+        $daysInMonth = $this->cE->getDaysInMonth(
+            $this->calendar->thisYear(), $this->calendar->thisMonth());
+        $firstDayInMonth = $this->cE->getFirstDayInMonth(
+            $this->calendar->thisYear(), $this->calendar->thisMonth());
+        $this->emptyBefore=0;
+        foreach ($this->daysOfMonth as $dayOfWeek) {
+            if ($firstDayInMonth == $dayOfWeek) {
+                break;
+            }
+            $this->emptyBefore++;
+        }
+        $this->numWeeks = ceil(
+            ($daysInMonth + $this->emptyBefore)
+                /
+            $this->cE->getDaysInWeek(
+                $this->calendar->thisYear(),
+                $this->calendar->thisMonth(),
+                $this->calendar->thisDay()
+            )
+        );
+        for ($i=1; $i < $this->numWeeks; $i++) {
+            $this->daysOfMonth =
+                array_merge($this->daysOfMonth, $this->daysOfWeek);
+        }
+    }
+
+    /**
+     * Returns the first day of the month
+     * @see Calendar_Engine_Interface::getFirstDayOfWeek()
+     * @return int
+     * @access protected
+     */
+    function getFirstDay()
+    {
+        return $this->firstDay;
+    }
+
+    /**
+     * Returns the order array of days in a week
+     * @return int
+     * @access protected
+     */
+    function getDaysOfWeek()
+    {
+        return $this->daysOfWeek;
+    }
+
+    /**
+     * Returns the number of tabular weeks in a month
+     * @return int
+     * @access protected
+     */
+    function getNumWeeks()
+    {
+        return $this->numWeeks;
+    }
+
+    /**
+     * Returns the number of real days + empty days
+     * @return int
+     * @access protected
+     */
+    function getNumTableDaysInMonth()
+    {
+        return count($this->daysOfMonth);
+    }
+
+    /**
+     * Returns the number of empty days before the real days begin
+     * @return int
+     * @access protected
+     */
+    function getEmptyDaysBefore()
+    {
+        return $this->emptyBefore;
+    }
+
+    /**
+     * Returns the index of the last real day in the month
+     * @todo Potential performance optimization with static
+     * @return int
+     * @access protected
+     */
+    function getEmptyDaysAfter()
+    {
+        // Causes bug when displaying more than one month
+//        static $index;
+//        if (!isset($index)) {
+            $index = $this->getEmptyDaysBefore() + $this->cE->getDaysInMonth(
+                $this->calendar->thisYear(), $this->calendar->thisMonth());
+//        }
+        return $index;
+    }
+
+    /**
+     * Returns the index of the last real day in the month, relative to the
+     * beginning of the tabular week it is part of
+     * @return int
+     * @access protected
+     */
+    function getEmptyDaysAfterOffset()
+    {
+        $eAfter = $this->getEmptyDaysAfter();
+        return $eAfter - (
+            $this->cE->getDaysInWeek(
+                $this->calendar->thisYear(),
+                $this->calendar->thisMonth(),
+                $this->calendar->thisDay()
+            ) * ($this->numWeeks-1) );
+    }
+
+    /**
+     * Returns the timestamp of the first day of the current week
+     */
+    function getWeekStart($y, $m, $d, $firstDay=1)
+    {
+        $dow = $this->cE->getDayOfWeek($y, $m, $d);
+        if ($dow > $firstDay) {
+            $d -= ($dow - $firstDay);
+        }
+        if ($dow < $firstDay) {
+            $d -= (
+                $this->cE->getDaysInWeek(
+                    $this->calendar->thisYear(),
+                    $this->calendar->thisMonth(),
+                    $this->calendar->thisDay()
+                ) - $firstDay + $dow);
+        }
+        return $this->cE->dateToStamp($y, $m, $d);
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Util/Textual.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Util/Textual.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Util/Textual.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,239 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Textual.php,v 1.2 2004/08/16 13:13:09 hfuecks Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Textual.php,v 1.2 2004/08/16 13:13:09 hfuecks Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar decorator base class
+ */
+require_once CALENDAR_ROOT.'Decorator.php';
+
+/**
+ * Static utlities to help with fetching textual representations of months and
+ * days of the week.
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Util_Textual
+{
+
+    /**
+     * Returns an array of 12 month names (first index = 1)
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return array
+     * @access public
+     * @static
+     */
+    function monthNames($format='long')
+    {
+        $formats = array('one'=>'%b', 'two'=>'%b', 'short'=>'%b', 'long'=>'%B');
+        if (!array_key_exists($format,$formats)) {
+            $format = 'long';
+        }
+        $months = array();
+        for ($i=1; $i<=12; $i++) {
+            $stamp = mktime(0, 0, 0, $i, 1, 2003);
+            $month = strftime($formats[$format], $stamp);
+            switch($format) {
+                case 'one':
+                    $month = substr($month, 0, 1);
+                break;
+                case 'two':
+                    $month = substr($month, 0, 2);
+                break;
+            }
+            $months[$i] = $month;
+        }
+        return $months;
+    }
+
+    /**
+     * Returns an array of 7 week day names (first index = 0)
+     * @param string (optional) format of returned days (one,two,short or long)
+     * @return array
+     * @access public
+     * @static
+     */
+    function weekdayNames($format='long')
+    {
+        $formats = array('one'=>'%a', 'two'=>'%a', 'short'=>'%a', 'long'=>'%A');
+        if (!array_key_exists($format,$formats)) {
+            $format = 'long';
+        }
+        $days = array();
+        for ($i=0; $i<=6; $i++) {
+            $stamp = mktime(0, 0, 0, 11, $i+2, 2003);
+            $day = strftime($formats[$format], $stamp);
+            switch($format) {
+                case 'one':
+                    $day = substr($day, 0, 1);
+                break;
+                case 'two':
+                    $day = substr($day, 0, 2);
+                break;
+            }
+            $days[$i] = $day;
+        }
+        return $days;
+    }
+
+    /**
+     * Returns textual representation of the previous month of the decorated calendar object
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     * @static
+     */
+    function prevMonthName($Calendar, $format='long')
+    {
+        $months = Calendar_Util_Textual::monthNames($format);
+        return $months[$Calendar->prevMonth()];
+    }
+
+    /**
+     * Returns textual representation of the month of the decorated calendar object
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     * @static
+     */
+    function thisMonthName($Calendar, $format='long')
+    {
+        $months = Calendar_Util_Textual::monthNames($format);
+        return $months[$Calendar->thisMonth()];
+    }
+
+    /**
+     * Returns textual representation of the next month of the decorated calendar object
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     * @static
+     */
+    function nextMonthName($Calendar, $format='long')
+    {
+        $months = Calendar_Util_Textual::monthNames($format);
+        return $months[$Calendar->nextMonth()];
+    }
+
+    /**
+     * Returns textual representation of the previous day of week of the decorated calendar object
+     * <b>Note:</b> Requires PEAR::Date
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     * @static
+     */
+    function prevDayName($Calendar, $format='long')
+    {
+        $days = Calendar_Util_Textual::weekdayNames($format);
+        $stamp = $Calendar->prevDay('timestamp');
+        $cE = $Calendar->getEngine();
+        require_once 'Date/Calc.php';
+        $day = Date_Calc::dayOfWeek($cE->stampToDay($stamp),
+            $cE->stampToMonth($stamp), $cE->stampToYear($stamp));
+        return $days[$day];
+    }
+
+    /**
+     * Returns textual representation of the day of week of the decorated calendar object
+     * <b>Note:</b> Requires PEAR::Date
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     * @static
+     */
+    function thisDayName($Calendar, $format='long')
+    {
+        $days = Calendar_Util_Textual::weekdayNames($format);
+        require_once 'Date/Calc.php';
+        $day = Date_Calc::dayOfWeek($Calendar->thisDay(), $Calendar->thisMonth(), $Calendar->thisYear());
+        return $days[$day];
+    }
+
+    /**
+     * Returns textual representation of the next day of week of the decorated calendar object
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return string
+     * @access public
+     * @static
+     */
+    function nextDayName($Calendar, $format='long')
+    {
+        $days = Calendar_Util_Textual::weekdayNames($format);
+        $stamp = $Calendar->nextDay('timestamp');
+        $cE = $Calendar->getEngine();
+        require_once 'Date/Calc.php';
+        $day = Date_Calc::dayOfWeek($cE->stampToDay($stamp),
+            $cE->stampToMonth($stamp), $cE->stampToYear($stamp));
+        return $days[$day];
+    }
+
+    /**
+     * Returns the days of the week using the order defined in the decorated
+     * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
+     * and Calendar_Week. Otherwise the returned array will begin on Sunday
+     * @param object subclass of Calendar e.g. Calendar_Month
+     * @param string (optional) format of returned months (one,two,short or long)
+     * @return array ordered array of week day names
+     * @access public
+     * @static
+     */
+    function orderedWeekdays($Calendar, $format='long')
+    {
+        $days = Calendar_Util_Textual::weekdayNames($format);
+        
+        // Not so good - need methods to access this information perhaps...
+        if (isset($Calendar->tableHelper)) {
+            $ordereddays = $Calendar->tableHelper->daysOfWeek;
+        } else {
+            $ordereddays = array(0, 1, 2, 3, 4, 5, 6);
+        }
+        
+        $ordereddays = array_flip($ordereddays);
+        $i = 0;
+        $returndays = array();
+        foreach ($ordereddays as $key => $value) {
+            $returndays[$i] = $days[$key];
+            $i++;
+        }
+        return $returndays;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Util/Uri.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Util/Uri.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Util/Uri.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,169 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP                                                                  |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Uri.php,v 1.1 2004/08/16 09:03:55 hfuecks Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Uri.php,v 1.1 2004/08/16 09:03:55 hfuecks Exp $
+ */
+
+/**
+ * Utility to help building HTML links for navigating the calendar<br />
+ * <code>
+ * $Day = new Calendar_Day(2003, 10, 23);
+ * $Uri = & new Calendar_Util_Uri('year', 'month', 'day');
+ * echo $Uri->prev($Day,'month'); // Displays year=2003&month=10
+ * echo $Uri->prev($Day,'day'); // Displays year=2003&month=10&day=22
+ * $Uri->seperator = '/';
+ * $Uri->scalar = true;
+ * echo $Uri->prev($Day,'month'); // Displays 2003/10
+ * echo $Uri->prev($Day,'day'); // Displays 2003/10/22
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Util_Uri
+{
+    /**
+     * Uri fragments for year, month, day etc.
+     * @var array
+     * @access private
+     */
+    var $uris = array();
+
+    /**
+     * String to separate fragments with.
+     * Set to just & for HTML.
+     * For a scalar URL you might use / as the seperator
+     * @var string (default XHTML &)
+     * @access public
+     */
+    var $separator = '&';
+
+    /**
+     * To output a "scalar" string - variable names omitted.
+     * Used for urls like index.php/2004/8/12
+     * @var boolean (default false)
+     * @access public
+     */
+    var $scalar = false;
+
+    /**
+     * Constructs Calendar_Decorator_Uri
+     * The term "fragment" means <i>name</i> of a calendar GET variables in the URL
+     * @param string URI fragment for year
+     * @param string (optional) URI fragment for month
+     * @param string (optional) URI fragment for day
+     * @param string (optional) URI fragment for hour
+     * @param string (optional) URI fragment for minute
+     * @param string (optional) URI fragment for second
+     * @access public
+     */
+    function Calendar_Util_Uri($y, $m=null, $d=null, $h=null, $i=null, $s=null)
+    {
+        $this->setFragments($y, $m, $d, $h, $i, $s);
+    }
+
+    /**
+     * Sets the URI fragment names
+     * @param string URI fragment for year
+     * @param string (optional) URI fragment for month
+     * @param string (optional) URI fragment for day
+     * @param string (optional) URI fragment for hour
+     * @param string (optional) URI fragment for minute
+     * @param string (optional) URI fragment for second
+     * @return void
+     * @access public
+     */
+    function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) {
+        if (!is_null($y)) $this->uris['Year']   = $y;
+        if (!is_null($m)) $this->uris['Month']  = $m;
+        if (!is_null($d)) $this->uris['Day']    = $d;
+        if (!is_null($h)) $this->uris['Hour']   = $h;
+        if (!is_null($i)) $this->uris['Minute'] = $i;
+        if (!is_null($s)) $this->uris['Second'] = $s;
+    }
+
+    /**
+     * Gets the URI string for the previous calendar unit
+     * @param object subclassed from Calendar e.g. Calendar_Month
+     * @param string calendar unit ( must be year, month, week, day, hour, minute or second)
+     * @return string
+     * @access public
+     */
+    function prev($Calendar, $unit)
+    {
+        $method = 'prev'.$unit;
+        $stamp  = $Calendar->{$method}('timestamp');
+        return $this->buildUriString($Calendar, $method, $stamp);
+    }
+
+    /**
+     * Gets the URI string for the current calendar unit
+     * @param object subclassed from Calendar e.g. Calendar_Month
+     * @param string calendar unit ( must be year, month, week, day, hour, minute or second)
+     * @return string
+     * @access public
+     */
+    function this($Calendar, $unit)
+    {
+       $method = 'this'.$unit;
+        $stamp  = $Calendar->{$method}('timestamp');
+        return $this->buildUriString($Calendar, $method, $stamp);
+    }
+
+    /**
+     * Gets the URI string for the next calendar unit
+     * @param object subclassed from Calendar e.g. Calendar_Month
+     * @param string calendar unit ( must be year, month, week, day, hour, minute or second)
+     * @return string
+     * @access public
+     */
+    function next($Calendar, $unit)
+    {
+        $method = 'next'.$unit;
+        $stamp  = $Calendar->{$method}('timestamp');
+        return $this->buildUriString($Calendar, $method, $stamp);
+    }
+
+    /**
+     * Build the URI string
+     * @param string method substring
+     * @param int timestamp
+     * @return string build uri string
+     * @access private
+     */
+    function buildUriString($Calendar, $method, $stamp)
+    {
+        $uriString = '';
+        $cE = & $Calendar->getEngine();
+        $separator = '';
+        foreach ($this->uris as $unit => $uri) {
+            $call = 'stampTo'.$unit;
+            $uriString .= $separator;
+            if (!$this->scalar) $uriString .= $uri.'=';
+            $uriString .= $cE->{$call}($stamp);
+            $separator = $this->separator;
+        }
+        return $uriString;
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Validator.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Validator.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Validator.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,335 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Validator.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Validator.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
+ */
+
+/**
+ * Validation Error Messages
+ */
+if (!defined('CALENDAR_VALUE_TOOSMALL')) {
+    define('CALENDAR_VALUE_TOOSMALL', 'Too small: min = ');
+}
+if (!defined('CALENDAR_VALUE_TOOLARGE')) {
+    define('CALENDAR_VALUE_TOOLARGE', 'Too large: max = ');
+}
+
+/**
+ * Used to validate any given Calendar date object. Instances of this class
+ * can be obtained from any data object using the getValidator method
+ * @see Calendar::getValidator()
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Validator
+{
+    /**
+     * Instance of the Calendar date object to validate
+     * @var object
+     * @access private
+     */
+    var $calendar;
+
+    /**
+     * Instance of the Calendar_Engine
+     * @var object
+     * @access private
+     */
+    var $cE;
+
+    /**
+     * Array of errors for validation failures
+     * @var array
+     * @access private
+     */
+    var $errors = array();
+
+    /**
+     * Constructs Calendar_Validator
+     * @param object subclass of Calendar
+     * @access public
+     */
+    function Calendar_Validator(& $calendar)
+    {
+        $this->calendar = & $calendar;
+        $this->cE = & $calendar->getEngine();
+    }
+
+    /**
+     * Calls all the other isValidXXX() methods in the validator
+     * @return boolean
+     * @access public
+     */
+    function isValid()
+    {
+        $checks = array('isValidYear', 'isValidMonth', 'isValidDay',
+            'isValidHour', 'isValidMinute', 'isValidSecond');
+        $valid = true;
+        foreach ($checks as $check) {
+            if (!$this->{$check}()) {
+                $valid = false;
+            }
+        }
+        return $valid;
+    }
+
+    /**
+     * Check whether this is a valid year
+     * @return boolean
+     * @access public
+     */
+    function isValidYear()
+    {
+        $y = $this->calendar->thisYear();
+        $min = $this->cE->getMinYears();
+        if ($min > $y) {
+           $this->errors[] = new Calendar_Validation_Error(
+                'Year', $y, CALENDAR_VALUE_TOOSMALL.$min);
+            return false;
+        }
+        $max = $this->cE->getMaxYears();
+        if ($y > $max) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Year', $y, CALENDAR_VALUE_TOOLARGE.$max);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Check whether this is a valid month
+     * @return boolean
+     * @access public
+     */
+    function isValidMonth()
+    {
+        $m = $this->calendar->thisMonth();
+        $min = 1;
+        if ($min > $m) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Month', $m, CALENDAR_VALUE_TOOSMALL.$min);
+            return false;
+        }
+        $max = $this->cE->getMonthsInYear($this->calendar->thisYear());
+        if ($m > $max) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Month', $m, CALENDAR_VALUE_TOOLARGE.$max);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Check whether this is a valid day
+     * @return boolean
+     * @access public
+     */
+    function isValidDay()
+    {
+        $d = $this->calendar->thisDay();
+        $min = 1;
+        if ($min > $d) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Day', $d, CALENDAR_VALUE_TOOSMALL.$min);
+            return false;
+        }
+        $max = $this->cE->getDaysInMonth(
+            $this->calendar->thisYear(), $this->calendar->thisMonth());
+        if ($d > $max) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Day', $d, CALENDAR_VALUE_TOOLARGE.$max);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Check whether this is a valid hour
+     * @return boolean
+     * @access public
+     */
+    function isValidHour()
+    {
+        $h = $this->calendar->thisHour();
+        $min = 0;
+        if ($min > $h) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min);
+            return false;
+        }
+        $max = ($this->cE->getHoursInDay($this->calendar->thisDay())-1);
+        if ($h > $max) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Check whether this is a valid minute
+     * @return boolean
+     * @access public
+     */
+    function isValidMinute()
+    {
+        $i = $this->calendar->thisMinute();
+        $min = 0;
+        if ($min > $i) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min);
+            return false;
+        }
+        $max = ($this->cE->getMinutesInHour($this->calendar->thisHour())-1);
+        if ($i > $max) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Check whether this is a valid second
+     * @return boolean
+     * @access public
+     */
+    function isValidSecond()
+    {
+        $s = $this->calendar->thisSecond();
+        $min = 0;
+        if ($min > $s) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Second', $s, CALENDAR_VALUE_TOOSMALL.$min);
+            return false;
+        }
+        $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute())-1);
+        if ($s > $max) {
+            $this->errors[] = new Calendar_Validation_Error(
+                'Second', $s, CALENDAR_VALUE_TOOLARGE.$max);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Iterates over any validation errors
+     * @return mixed either Calendar_Validation_Error or false
+     * @access public
+     */
+    function fetch()
+    {
+        $error = each ($this->errors);
+        if ($error) {
+            return $error['value'];
+        } else {
+            reset($this->errors);
+            return false;
+        }
+    }
+}
+
+/**
+ * For Validation Error messages
+ * @see Calendar::fetch()
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Validation_Error
+{
+    /**
+     * Date unit (e.g. month,hour,second) which failed test
+     * @var string
+     * @access private
+     */
+    var $unit;
+
+    /**
+     * Value of unit which failed test
+     * @var int
+     * @access private
+     */
+    var $value;
+
+    /**
+     * Validation error message
+     * @var string
+     * @access private
+     */
+    var $message;
+
+    /**
+     * Constructs Calendar_Validation_Error
+     * @param string Date unit (e.g. month,hour,second)
+     * @param int Value of unit which failed test
+     * @param string Validation error message
+     * @access protected
+     */
+    function Calendar_Validation_Error($unit,$value,$message)
+    {
+        $this->unit    = $unit;
+        $this->value   = $value;
+        $this->message = $message;
+    }
+
+    /**
+     * Returns the Date unit
+     * @return string
+     * @access public
+     */
+    function getUnit()
+    {
+        return $this->unit;
+    }
+
+    /**
+     * Returns the value of the unit
+     * @return int
+     * @access public
+     */
+    function getValue()
+    {
+        return $this->value;
+    }
+
+    /**
+     * Returns the validation error message
+     * @return string
+     * @access public
+     */
+    function getMessage()
+    {
+        return $this->message;
+    }
+
+    /**
+     * Returns a string containing the unit, value and error message
+     * @return string
+     * @access public
+     */
+    function toString ()
+    {
+        return $this->unit.' = '.$this->value.' ['.$this->message.']';
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Week.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Week.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Week.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,394 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Week.php,v 1.7 2005/10/22 10:26:49 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Week.php,v 1.7 2005/10/22 10:26:49 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents a Week and builds Days in tabular format<br>
+ * <code>
+ * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Week.php';
+ * $Week = & new Calendar_Week(2003, 10, 1); Oct 2003, 1st tabular week
+ * echo '<tr>';
+ * while ($Day = & $Week->fetch()) {
+ *     if ($Day->isEmpty()) {
+ *         echo '<td> </td>';
+ *     } else {
+ *         echo '<td>'.$Day->thisDay().'</td>';
+ *      }
+ * }
+ * echo '</tr>';
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Week extends Calendar
+{
+    /**
+     * Instance of Calendar_Table_Helper
+     * @var Calendar_Table_Helper
+     * @access private
+     */
+    var $tableHelper;
+
+    /**
+     * Stores the timestamp of the first day of this week
+     * @access private
+     * @var object
+     */
+    var $thisWeek;
+
+    /**
+     * Stores the timestamp of first day of previous week
+     * @access private
+     * @var object
+     */
+    var $prevWeek;
+
+    /**
+     * Stores the timestamp of first day of next week
+     * @access private
+     * @var object
+     */
+    var $nextWeek;
+
+    /**
+     * Used by build() to set empty days
+     * @access private
+     * @var boolean
+     */
+    var $firstWeek = false;
+
+    /**
+     * Used by build() to set empty days
+     * @access private
+     * @var boolean
+     */
+    var $lastWeek = false;
+
+    /**
+     * First day of the week (0=sunday, 1=monday...)
+     * @access private
+     * @var boolean
+     */
+    var $firstDay = 1;
+
+    /**
+     * Constructs Week
+     * @param int year e.g. 2003
+     * @param int month e.g. 5
+     * @param int a day of the desired week
+     * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
+     * @access public
+     */
+    function Calendar_Week($y, $m, $d, $firstDay=null)
+    {
+        require_once CALENDAR_ROOT.'Table/Helper.php';
+        Calendar::Calendar($y, $m, $d);
+        $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
+        $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
+        $this->thisWeek = $this->tableHelper->getWeekStart($y, $m, $d, $this->firstDay);
+        $this->prevWeek = $this->tableHelper->getWeekStart($y, $m, $d - $this->cE->getDaysInWeek(
+            $this->thisYear(),
+            $this->thisMonth(),
+            $this->thisDay()), $this->firstDay);
+        $this->nextWeek = $this->tableHelper->getWeekStart($y, $m, $d + $this->cE->getDaysInWeek(
+            $this->thisYear(),
+            $this->thisMonth(),
+            $this->thisDay()), $this->firstDay);
+    }
+
+    /**
+     * Defines the calendar by a timestamp (Unix or ISO-8601), replacing values
+     * passed to the constructor
+     * @param int|string Unix or ISO-8601 timestamp
+     * @return void
+     * @access public
+     */
+    function setTimestamp($ts)
+    {
+        parent::setTimestamp($ts);
+        $this->thisWeek = $this->tableHelper->getWeekStart(
+            $this->year, $this->month, $this->day, $this->firstDay
+        );
+        $this->prevWeek = $this->tableHelper->getWeekStart(
+            $this->year, $this->month, $this->day - $this->cE->getDaysInWeek(
+                $this->thisYear(),
+                $this->thisMonth(),
+                $this->thisDay()), $this->firstDay
+        );
+        $this->nextWeek = $this->tableHelper->getWeekStart(
+            $this->year, $this->month, $this->day + $this->cE->getDaysInWeek(
+                $this->thisYear(),
+                $this->thisMonth(),
+                $this->thisDay()), $this->firstDay
+        );
+    }
+
+    /**
+     * Builds Calendar_Day objects for this Week
+     * @param array (optional) Calendar_Day objects representing selected dates
+     * @return boolean
+     * @access public
+     */
+    function build($sDates = array())
+    {
+        require_once CALENDAR_ROOT.'Day.php';
+        $year  = $this->cE->stampToYear($this->thisWeek);
+        $month = $this->cE->stampToMonth($this->thisWeek);
+        $day   = $this->cE->stampToDay($this->thisWeek);
+        $end   = $this->cE->getDaysInWeek(
+            $this->thisYear(),
+            $this->thisMonth(),
+            $this->thisDay()
+        );
+
+        for ($i=1; $i <= $end; $i++) {
+            $stamp = $this->cE->dateToStamp($year, $month, $day++);
+            $this->children[$i] = new Calendar_Day(
+                                $this->cE->stampToYear($stamp),
+                                $this->cE->stampToMonth($stamp),
+                                $this->cE->stampToDay($stamp));
+        }
+
+        //set empty days (@see Calendar_Month_Weeks::build())
+        if ($this->firstWeek) {
+            $eBefore = $this->tableHelper->getEmptyDaysBefore();
+            for ($i=1; $i <= $eBefore; $i++) {
+                $this->children[$i]->setEmpty();
+            }
+        }
+        if ($this->lastWeek) {
+            $eAfter = $this->tableHelper->getEmptyDaysAfterOffset();
+            for ($i = $eAfter+1; $i <= $end; $i++) {
+                $this->children[$i]->setEmpty();
+            }
+        }
+
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * @param boolean
+     * @return void
+     * @access private
+     */
+    function setFirst($state=true)
+    {
+        $this->firstWeek = $state;
+    }
+
+    /**
+     * @param boolean
+     * @return void
+     * @access private
+     */
+    function setLast($state=true)
+    {
+        $this->lastWeek = $state;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates)
+    {
+        foreach ($sDates as $sDate) {
+            foreach ($this->children as $key => $child) {
+                if ($child->thisDay() == $sDate->thisDay() &&
+                    $child->thisMonth() == $sDate->thisMonth() &&
+                    $child->thisYear() == $sDate->thisYear()
+                ) {
+                    $this->children[$key] = $sDate;
+                    $this->children[$key]->setSelected();
+                }
+            }
+        }
+        reset($this->children);
+    }
+
+    /**
+     * Gets the value of the previous week, according to the requested format
+     *
+     * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
+     * @return mixed
+     * @access public
+     */
+    function prevWeek($format = 'n_in_month')
+    {
+        switch (strtolower($format)) {
+            case 'int':
+            case 'n_in_month':
+                return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
+                break;
+            case 'n_in_year':
+                return $this->cE->getWeekNInYear(
+                    $this->cE->stampToYear($this->prevWeek),
+                    $this->cE->stampToMonth($this->prevWeek),
+                    $this->cE->stampToDay($this->prevWeek));
+                break;
+            case 'array':
+                return $this->toArray($this->prevWeek);
+                break;
+            case 'object':
+                require_once CALENDAR_ROOT.'Factory.php';
+                return Calendar_Factory::createByTimestamp('Week', $this->prevWeek);
+                break;
+            case 'timestamp':
+            default:
+                return $this->prevWeek;
+                break;
+        }
+    }
+
+    /**
+     * Gets the value of the current week, according to the requested format
+     *
+     * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
+     * @return mixed
+     * @access public
+     */
+    function thisWeek($format = 'n_in_month')
+    {
+        switch (strtolower($format)) {
+            case 'int':
+            case 'n_in_month':
+                if ($this->firstWeek) {
+                    return 1;
+                }
+                if ($this->lastWeek) {
+                    return $this->cE->getWeeksInMonth(
+                        $this->thisYear(),
+                        $this->thisMonth(),
+                        $this->firstDay);
+                }
+                return $this->cE->getWeekNInMonth(
+                    $this->thisYear(),
+                    $this->thisMonth(),
+                    $this->thisDay(),
+                    $this->firstDay);
+                break;
+            case 'n_in_year':
+                return $this->cE->getWeekNInYear(
+                    $this->cE->stampToYear($this->thisWeek),
+                    $this->cE->stampToMonth($this->thisWeek),
+                    $this->cE->stampToDay($this->thisWeek));
+                break;
+            case 'array':
+                return $this->toArray($this->thisWeek);
+                break;
+            case 'object':
+                require_once CALENDAR_ROOT.'Factory.php';
+                return Calendar_Factory::createByTimestamp('Week', $this->thisWeek);
+                break;
+            case 'timestamp':
+            default:
+                return $this->thisWeek;
+                break;
+        }
+    }
+
+    /**
+     * Gets the value of the following week, according to the requested format
+     *
+     * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
+     * @return mixed
+     * @access public
+     */
+    function nextWeek($format = 'n_in_month')
+    {
+        switch (strtolower($format)) {
+            case 'int':
+            case 'n_in_month':
+                return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
+                break;
+            case 'n_in_year':
+                return $this->cE->getWeekNInYear(
+                    $this->cE->stampToYear($this->nextWeek),
+                    $this->cE->stampToMonth($this->nextWeek),
+                    $this->cE->stampToDay($this->nextWeek));
+                break;
+            case 'array':
+                return $this->toArray($this->nextWeek);
+                break;
+            case 'object':
+                require_once CALENDAR_ROOT.'Factory.php';
+                return Calendar_Factory::createByTimestamp('Week', $this->nextWeek);
+                break;
+            case 'timestamp':
+            default:
+                    return $this->nextWeek;
+                    break;
+        }
+    }
+
+    /**
+     * Returns the instance of Calendar_Table_Helper.
+     * Called from Calendar_Validator::isValidWeek
+     * @return Calendar_Table_Helper
+     * @access protected
+     */
+    function & getHelper()
+    {
+        return $this->tableHelper;
+    }
+
+    /**
+     * Makes sure theres a value for $this->day
+     * @return void
+     * @access private
+     */
+    function findFirstDay()
+    {
+        if (!count($this->children) > 0) {
+            $this->build();
+            foreach ($this->children as $Day) {
+                if (!$Day->isEmpty()) {
+                    $this->day = $Day->thisDay();
+                    break;
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/Year.php
===================================================================
--- eccube2/trunk/data/module/Calendar/Year.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/Year.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,113 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id: Year.php,v 1.4 2005/10/22 10:25:39 quipo Exp $
+//
+/**
+ * @package Calendar
+ * @version $Id: Year.php,v 1.4 2005/10/22 10:25:39 quipo Exp $
+ */
+
+/**
+ * Allows Calendar include path to be redefined
+ * @ignore
+ */
+if (!defined('CALENDAR_ROOT')) {
+    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
+}
+
+/**
+ * Load Calendar base class
+ */
+require_once CALENDAR_ROOT.'Calendar.php';
+
+/**
+ * Represents a Year and builds Months<br>
+ * <code>
+ * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Year.php';
+ * $Year = & new Calendar_Year(2003, 10, 21); // 21st Oct 2003
+ * $Year->build(); // Build Calendar_Month objects
+ * while ($Month = & $Year->fetch()) {
+ *     echo $Month->thisMonth().'<br />';
+ * }
+ * </code>
+ * @package Calendar
+ * @access public
+ */
+class Calendar_Year extends Calendar
+{
+    /**
+     * Constructs Calendar_Year
+     * @param int year e.g. 2003
+     * @access public
+     */
+    function Calendar_Year($y)
+    {
+        Calendar::Calendar($y);
+    }
+
+    /**
+     * Builds the Months of the Year.<br>
+     * <b>Note:</b> by defining the constant CALENDAR_MONTH_STATE you can
+     * control what class of Calendar_Month is built e.g.;
+     * <code>
+     * require_once 'Calendar/Calendar_Year.php';
+     * define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays
+     * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks
+     * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month
+     * </code>
+     * It defaults to building Calendar_Month objects.
+     * @param array (optional) array of Calendar_Month objects representing selected dates
+     * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
+     * @return boolean
+     * @access public
+     */
+    function build($sDates = array(), $firstDay = null)
+    {
+        require_once CALENDAR_ROOT.'Factory.php';
+        $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
+        $monthsInYear = $this->cE->getMonthsInYear($this->thisYear());
+        for ($i=1; $i <= $monthsInYear; $i++) {
+            $this->children[$i] = Calendar_Factory::create('Month', $this->year, $i);
+        }
+        if (count($sDates) > 0) {
+            $this->setSelection($sDates);
+        }
+        return true;
+    }
+
+    /**
+     * Called from build()
+     * @param array
+     * @return void
+     * @access private
+     */
+    function setSelection($sDates) {
+        foreach ($sDates as $sDate) {
+            if ($this->year == $sDate->thisYear()) {
+                $key = $sDate->thisMonth();
+                if (isset($this->children[$key])) {
+                    $sDate->setSelected();
+                    $this->children[$key] = $sDate;
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/Readme
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/Readme	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/Readme	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,3 @@
+Readme
+
+See the PEAR manual at http://pear.php.net/manual/en/package.datetime.calendar.php for details.
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/1.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/1.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/1.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,92 @@
+<?php
+/**
+* Description: Passes through all main calendar classes, beginning with year
+* and down to seconds, skipping weeks. Useful to test Calendar is (basically)
+* working correctly
+*
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+if (!isset($_GET['y'])) $_GET['y'] = 2003;
+if (!isset($_GET['m'])) $_GET['m'] = 8;
+if (!isset($_GET['d'])) $_GET['d'] = 9;
+if (!isset($_GET['h'])) $_GET['h'] = 12;
+if (!isset($_GET['i'])) $_GET['i'] = 34;
+if (!isset($_GET['s'])) $_GET['s'] = 46;
+
+switch ( @$_GET['view'] ) {
+    default:
+        $_GET['view'] = 'calendar_year';
+    case 'calendar_year':
+        require_once CALENDAR_ROOT.'Year.php';
+        $c = new Calendar_Year($_GET['y']);
+    break;
+    case 'calendar_month':
+        require_once CALENDAR_ROOT.'Month.php';
+        $c = new Calendar_Month($_GET['y'],$_GET['m']);
+    break;
+    case 'calendar_day':
+        require_once CALENDAR_ROOT.'Day.php';
+        $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']);
+    break;
+    case 'calendar_hour':
+        require_once CALENDAR_ROOT.'Hour.php';
+        $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']);
+    break;
+    case 'calendar_minute':
+        require_once CALENDAR_ROOT.'Minute.php';
+        $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']);
+    break;
+    case 'calendar_second':
+        require_once CALENDAR_ROOT.'Second.php';
+        $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']);
+    break;
+}
+
+echo ( 'Viewing: '.@$_GET['view'].'<br />' );
+echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'<br >' );
+
+$i = 1;
+echo ( '<h1>First Iteration</h1>' );
+echo ( '<p>The first iteration is more "expensive", the calendar data
+        structures having to be built.</p>' );
+$start = getmicrotime();
+$c->build();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+
+$i = 1;
+echo ( '<h1>Second Iteration</h1>' );
+echo ( '<p>This second iteration is faster, the data structures
+        being re-used</p>' );
+$start = getmicrotime();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/1.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/1.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/1.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,92 @@
+<?php
+/**
+* Description: Passes through all main calendar classes, beginning with year
+* and down to seconds, skipping weeks. Useful to test Calendar is (basically)
+* working correctly
+*
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+if (!isset($_GET['y'])) $_GET['y'] = 2003;
+if (!isset($_GET['m'])) $_GET['m'] = 8;
+if (!isset($_GET['d'])) $_GET['d'] = 9;
+if (!isset($_GET['h'])) $_GET['h'] = 12;
+if (!isset($_GET['i'])) $_GET['i'] = 34;
+if (!isset($_GET['s'])) $_GET['s'] = 46;
+
+switch ( @$_GET['view'] ) {
+    default:
+        $_GET['view'] = 'calendar_year';
+    case 'calendar_year':
+        require_once CALENDAR_ROOT.'Year.php';
+        $c = new Calendar_Year($_GET['y']);
+    break;
+    case 'calendar_month':
+        require_once CALENDAR_ROOT.'Month.php';
+        $c = new Calendar_Month($_GET['y'],$_GET['m']);
+    break;
+    case 'calendar_day':
+        require_once CALENDAR_ROOT.'Day.php';
+        $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']);
+    break;
+    case 'calendar_hour':
+        require_once CALENDAR_ROOT.'Hour.php';
+        $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']);
+    break;
+    case 'calendar_minute':
+        require_once CALENDAR_ROOT.'Minute.php';
+        $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']);
+    break;
+    case 'calendar_second':
+        require_once CALENDAR_ROOT.'Second.php';
+        $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']);
+    break;
+}
+
+echo ( 'Viewing: '.@$_GET['view'].'<br />' );
+echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'<br >' );
+
+$i = 1;
+echo ( '<h1>First Iteration</h1>' );
+echo ( '<p>The first iteration is more "expensive", the calendar data
+        structures having to be built.</p>' );
+$start = getmicrotime();
+$c->build();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+
+$i = 1;
+echo ( '<h1>Second Iteration</h1>' );
+echo ( '<p>This second iteration is faster, the data structures
+        being re-used</p>' );
+$start = getmicrotime();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/10.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/10.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/10.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,93 @@
+<?php
+/**
+* Description: demonstrates a decorator to provide simple output formatting
+* on the month while still allowing the days to be accessed via the decorator
+* In practice you _wouldn't_ do this - each decorator comes with a performance
+* hit for extra method calls. For this example some simple functions could help
+* format the month while the days are accessed via the normal Month object
+*/
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Decorator.php';
+
+// Decorate a Month with methods to improve formatting
+class MonthDecorator extends Calendar_Decorator {
+    /**
+    * @param Calendar_Month
+    */
+    function MonthDecorator(& $Month) {
+        parent::Calendar_Decorator($Month);
+    }
+    /**
+    * Override the prevMonth method to format the output
+    */
+    function prevMonth() {
+        $prevStamp = parent::prevMonth(TRUE);
+        // Build the URL for the previous month
+        return $_SERVER['PHP_SELF'].'?y='.date('Y',$prevStamp).
+            '&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp);
+    }
+    /**
+    * Override the thisMonth method to format the output
+    */
+    function thisMonth() {
+        $thisStamp = parent::thisMonth(TRUE);
+        // A human readable string from this month
+        return date('F Y',$thisStamp);
+    }
+    /**
+    * Override the nextMonth method to format the output
+    */
+    function nextMonth() {
+        $nextStamp = parent::nextMonth(TRUE);
+        // Build the URL for next month
+        return $_SERVER['PHP_SELF'].'?y='.date('Y',$nextStamp).
+            '&m='.date('n',$nextStamp).'&d='.date('j',$nextStamp);
+    }
+}
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+
+// Creata a month as usual
+$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
+
+// Pass it to the decorator and use the decorator from now on...
+$MonthDecorator = new MonthDecorator($Month);
+$MonthDecorator->build();
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> A Simple Decorator </title>
+</head>
+<body>
+<h1>A Simple Decorator</h1>
+<table>
+<caption><?php echo ( $MonthDecorator->thisMonth() ); ?></caption>
+<?php
+while ( $Day = $MonthDecorator->fetch() ) {
+    if ( $Day->isFirst() ) {
+        echo ( "\n<tr>\n" );
+    }
+    if ( $Day->isEmpty() ) {
+        echo ( "<td> </td>" );
+    } else {
+        echo ( "<td>".$Day->thisDay()."</td>" );
+    }
+    if ( $Day->isLast() ) {
+        echo ( "\n</tr>\n" );
+    }
+}
+?>
+<tr>
+<td><a href="<?php echo ($MonthDecorator->prevMonth()); ?>">Prev</a></td>
+<td colspan="5"> </td>
+<td><a href="<?php echo ($MonthDecorator->nextMonth()); ?>">Next</a></td>
+</tr>
+</table>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/10.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/10.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/10.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,93 @@
+<?php
+/**
+* Description: demonstrates a decorator to provide simple output formatting
+* on the month while still allowing the days to be accessed via the decorator
+* In practice you _wouldn't_ do this - each decorator comes with a performance
+* hit for extra method calls. For this example some simple functions could help
+* format the month while the days are accessed via the normal Month object
+*/
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Decorator.php';
+
+// Decorate a Month with methods to improve formatting
+class MonthDecorator extends Calendar_Decorator {
+    /**
+    * @param Calendar_Month
+    */
+    function MonthDecorator(& $Month) {
+        parent::Calendar_Decorator($Month);
+    }
+    /**
+    * Override the prevMonth method to format the output
+    */
+    function prevMonth() {
+        $prevStamp = parent::prevMonth(TRUE);
+        // Build the URL for the previous month
+        return $_SERVER['PHP_SELF'].'?y='.date('Y',$prevStamp).
+            '&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp);
+    }
+    /**
+    * Override the thisMonth method to format the output
+    */
+    function thisMonth() {
+        $thisStamp = parent::thisMonth(TRUE);
+        // A human readable string from this month
+        return date('F Y',$thisStamp);
+    }
+    /**
+    * Override the nextMonth method to format the output
+    */
+    function nextMonth() {
+        $nextStamp = parent::nextMonth(TRUE);
+        // Build the URL for next month
+        return $_SERVER['PHP_SELF'].'?y='.date('Y',$nextStamp).
+            '&m='.date('n',$nextStamp).'&d='.date('j',$nextStamp);
+    }
+}
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+
+// Creata a month as usual
+$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
+
+// Pass it to the decorator and use the decorator from now on...
+$MonthDecorator = new MonthDecorator($Month);
+$MonthDecorator->build();
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> A Simple Decorator </title>
+</head>
+<body>
+<h1>A Simple Decorator</h1>
+<table>
+<caption><?php echo ( $MonthDecorator->thisMonth() ); ?></caption>
+<?php
+while ( $Day = $MonthDecorator->fetch() ) {
+    if ( $Day->isFirst() ) {
+        echo ( "\n<tr>\n" );
+    }
+    if ( $Day->isEmpty() ) {
+        echo ( "<td> </td>" );
+    } else {
+        echo ( "<td>".$Day->thisDay()."</td>" );
+    }
+    if ( $Day->isLast() ) {
+        echo ( "\n</tr>\n" );
+    }
+}
+?>
+<tr>
+<td><a href="<?php echo ($MonthDecorator->prevMonth()); ?>">Prev</a></td>
+<td colspan="5"> </td>
+<td><a href="<?php echo ($MonthDecorator->nextMonth()); ?>">Next</a></td>
+</tr>
+</table>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/11.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/11.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/11.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,109 @@
+<?php
+/**
+* Description: demonstrates a decorator used to "attach a payload" to a selection
+* to make it available when iterating over calendar children
+*/
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Hour.php';
+require_once CALENDAR_ROOT.'Decorator.php';
+
+// Decorator to "attach" functionality to selected hours
+class DiaryEvent extends Calendar_Decorator {
+    var $entry;
+    function DiaryEvent($calendar) {
+        Calendar_Decorator::Calendar_Decorator($calendar);
+    }
+    function setEntry($entry) {
+        $this->entry = $entry;
+    }
+    function getEntry() {
+        return $this->entry;
+    }
+}
+
+// Create a day to view the hours for
+$Day = & new Calendar_Day(2003,10,24);
+
+// A sample query to get the data for today (NOT ACTUALLY USED HERE)
+$sql = "
+        SELECT
+            *
+        FROM
+            diary
+        WHERE
+            eventtime >= '".$Day->thisDay(TRUE)."'
+        AND
+            eventtime < '".$Day->nextDay(TRUE)."';";
+
+// An array simulating data from a database
+$result = array (
+    array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'),
+    array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'),
+    array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors')
+    );
+
+// An array to place selected hours in
+$selection = array();
+
+// Loop through the "database result"
+foreach ( $result as $row ) {
+    $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values
+    $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp
+
+    // Create the decorator, passing it the Hour
+    $DiaryEvent = new DiaryEvent($Hour);
+
+    // Attach the payload
+    $DiaryEvent->setEntry($row['entry']);
+
+    // Add the decorator to the selection
+    $selection[] = $DiaryEvent;
+}
+
+// Build the hours in that day, passing the selection
+$Day->build($selection);
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Passing a Selection Payload with a Decorator </title>
+</head>
+<body>
+<h1>Passing a Selection "Payload" using a Decorator</h1>
+<table>
+<caption><b>Your Schedule for <?php echo ( date('D nS F Y',$Day->thisDay(TRUE)) ); ?></b></caption>
+<tr>
+<th width="5%">Time</th>
+<th>Entry</th>
+</tr>
+<?php
+while ( $Hour = & $Day->fetch() ) {
+
+    $hour = $Hour->thisHour();
+    $minute = $Hour->thisMinute();
+
+    // Office hours only...
+    if ( $hour >= 8 && $hour <= 18 ) {
+        echo ( "<tr>\n" );
+        echo ( "<td>$hour:$minute</td>\n" );
+
+        // If the hour is selected, call the decorator method...
+        if ( $Hour->isSelected() ) {
+            echo ( "<td bgcolor=\"silver\">".$Hour->getEntry()."</td>\n" );
+        } else {
+            echo ( "<td> </td>\n" );
+        }
+        echo ( "</tr>\n" );
+    }
+}
+?>
+</table>
+<p>The query to fetch this data, with help from PEAR::Calendar, might be;</p>
+<pre>
+<?php echo ( $sql ); ?>
+</pre>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/11.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/11.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/11.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,109 @@
+<?php
+/**
+* Description: demonstrates a decorator used to "attach a payload" to a selection
+* to make it available when iterating over calendar children
+*/
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Hour.php';
+require_once CALENDAR_ROOT.'Decorator.php';
+
+// Decorator to "attach" functionality to selected hours
+class DiaryEvent extends Calendar_Decorator {
+    var $entry;
+    function DiaryEvent($calendar) {
+        Calendar_Decorator::Calendar_Decorator($calendar);
+    }
+    function setEntry($entry) {
+        $this->entry = $entry;
+    }
+    function getEntry() {
+        return $this->entry;
+    }
+}
+
+// Create a day to view the hours for
+$Day = & new Calendar_Day(2003,10,24);
+
+// A sample query to get the data for today (NOT ACTUALLY USED HERE)
+$sql = "
+        SELECT
+            *
+        FROM
+            diary
+        WHERE
+            eventtime >= '".$Day->thisDay(TRUE)."'
+        AND
+            eventtime < '".$Day->nextDay(TRUE)."';";
+
+// An array simulating data from a database
+$result = array (
+    array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'),
+    array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'),
+    array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors')
+    );
+
+// An array to place selected hours in
+$selection = array();
+
+// Loop through the "database result"
+foreach ( $result as $row ) {
+    $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values
+    $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp
+
+    // Create the decorator, passing it the Hour
+    $DiaryEvent = new DiaryEvent($Hour);
+
+    // Attach the payload
+    $DiaryEvent->setEntry($row['entry']);
+
+    // Add the decorator to the selection
+    $selection[] = $DiaryEvent;
+}
+
+// Build the hours in that day, passing the selection
+$Day->build($selection);
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Passing a Selection Payload with a Decorator </title>
+</head>
+<body>
+<h1>Passing a Selection "Payload" using a Decorator</h1>
+<table>
+<caption><b>Your Schedule for <?php echo ( date('D nS F Y',$Day->thisDay(TRUE)) ); ?></b></caption>
+<tr>
+<th width="5%">Time</th>
+<th>Entry</th>
+</tr>
+<?php
+while ( $Hour = & $Day->fetch() ) {
+
+    $hour = $Hour->thisHour();
+    $minute = $Hour->thisMinute();
+
+    // Office hours only...
+    if ( $hour >= 8 && $hour <= 18 ) {
+        echo ( "<tr>\n" );
+        echo ( "<td>$hour:$minute</td>\n" );
+
+        // If the hour is selected, call the decorator method...
+        if ( $Hour->isSelected() ) {
+            echo ( "<td bgcolor=\"silver\">".$Hour->getEntry()."</td>\n" );
+        } else {
+            echo ( "<td> </td>\n" );
+        }
+        echo ( "</tr>\n" );
+    }
+}
+?>
+</table>
+<p>The query to fetch this data, with help from PEAR::Calendar, might be;</p>
+<pre>
+<?php echo ( $sql ); ?>
+</pre>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/12.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/12.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/12.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,116 @@
+<?php
+/**
+* Description: a complete year
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+require_once CALENDAR_ROOT.'Year.php';
+
+define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS);
+
+if ( !isset($_GET['year']) ) $_GET['year'] = date('Y');
+
+$Year = new Calendar_Year($_GET['year']);
+
+$Year->build();
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> <?php echo ( $Year->thisYear() ); ?> </title>
+<style type="text/css">
+body {
+    font-family: Georgia, serif;
+}
+caption.year {
+    font-weight: bold;
+    font-size: 120%;
+    font-color: navy;
+}
+caption.month {
+    font-size: 110%;
+    font-color: navy;
+}
+table.month {
+    border: thin groove #800080
+}
+tr {
+    vertical-align: top;
+}
+th, td {
+    text-align: right;
+    font-size: 70%;
+}
+#prev {
+    float: left;
+    font-size: 70%;
+}
+#next {
+    float: right;
+    font-size: 70%;
+}
+</style>
+</head>
+<body>
+<table>
+<caption class="year">
+<?php echo ( $Year->thisYear() ); ?>
+<div id="next">
+<a href="?year=<?php echo ( $Year->nextYear() ); ?>">>></a>
+</div>
+<div id="prev">
+<a href="?year=<?php echo ( $Year->prevYear() ); ?>"><<</a>
+</div>
+</caption>
+<?php
+$i = 0;
+while ( $Month = $Year->fetch() ) {
+
+    switch ( $i ) {
+        case 0:
+            echo ( "<tr>\n" );
+            break;
+        case 3:
+        case 6:
+        case 9:
+            echo ( "</tr>\n<tr>\n" );
+            break;
+        case 12:
+            echo ( "</tr>\n" );
+            break;
+    }
+
+    echo ( "<td>\n<table class=\"month\">\n" );
+    echo ( "<caption class=\"month\">".date('F',$Month->thisMonth(TRUE))."</caption>" );
+    echo ( "<tr>\n<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>" );
+    $Month->build();
+    while ( $Day = $Month->fetch() ) {
+        if ( $Day->isFirst() ) {
+            echo ( "<tr>\n" );
+        }
+        if ( $Day->isEmpty() ) {
+            echo ( "<td> </td>\n" );
+        } else {
+            echo ( "<td>".$Day->thisDay()."</td>\n" );
+        }
+        if ( $Day->isLast() ) {
+            echo ( "</tr>\n" );
+        }
+    }
+    echo ( "</table>\n</td>\n" );
+
+    $i++;
+}
+?>
+</table>
+<p>Took: <?php echo ((getmicrotime()-$start)); ?></p>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/12.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/12.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/12.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,116 @@
+<?php
+/**
+* Description: a complete year
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+require_once CALENDAR_ROOT.'Year.php';
+
+define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS);
+
+if ( !isset($_GET['year']) ) $_GET['year'] = date('Y');
+
+$Year = new Calendar_Year($_GET['year']);
+
+$Year->build();
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> <?php echo ( $Year->thisYear() ); ?> </title>
+<style type="text/css">
+body {
+    font-family: Georgia, serif;
+}
+caption.year {
+    font-weight: bold;
+    font-size: 120%;
+    font-color: navy;
+}
+caption.month {
+    font-size: 110%;
+    font-color: navy;
+}
+table.month {
+    border: thin groove #800080
+}
+tr {
+    vertical-align: top;
+}
+th, td {
+    text-align: right;
+    font-size: 70%;
+}
+#prev {
+    float: left;
+    font-size: 70%;
+}
+#next {
+    float: right;
+    font-size: 70%;
+}
+</style>
+</head>
+<body>
+<table>
+<caption class="year">
+<?php echo ( $Year->thisYear() ); ?>
+<div id="next">
+<a href="?year=<?php echo ( $Year->nextYear() ); ?>">>></a>
+</div>
+<div id="prev">
+<a href="?year=<?php echo ( $Year->prevYear() ); ?>"><<</a>
+</div>
+</caption>
+<?php
+$i = 0;
+while ( $Month = $Year->fetch() ) {
+
+    switch ( $i ) {
+        case 0:
+            echo ( "<tr>\n" );
+            break;
+        case 3:
+        case 6:
+        case 9:
+            echo ( "</tr>\n<tr>\n" );
+            break;
+        case 12:
+            echo ( "</tr>\n" );
+            break;
+    }
+
+    echo ( "<td>\n<table class=\"month\">\n" );
+    echo ( "<caption class=\"month\">".date('F',$Month->thisMonth(TRUE))."</caption>" );
+    echo ( "<tr>\n<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>" );
+    $Month->build();
+    while ( $Day = $Month->fetch() ) {
+        if ( $Day->isFirst() ) {
+            echo ( "<tr>\n" );
+        }
+        if ( $Day->isEmpty() ) {
+            echo ( "<td> </td>\n" );
+        } else {
+            echo ( "<td>".$Day->thisDay()."</td>\n" );
+        }
+        if ( $Day->isLast() ) {
+            echo ( "</tr>\n" );
+        }
+    }
+    echo ( "</table>\n</td>\n" );
+
+    $i++;
+}
+?>
+</table>
+<p>Took: <?php echo ((getmicrotime()-$start)); ?></p>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/13.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/13.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/13.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,99 @@
+<?php
+/**
+* Description: same as 1.php, but using the PEAR::Date engine
+* Notice the use of the CALENDAR_ENGINE constant, which
+* switches the calculation "engine"
+* Note: make sure PEAR::Date is a stable release!!!
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+
+// Switch to PEAR::Date engine
+define('CALENDAR_ENGINE','PearDate');
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+if (!isset($_GET['y'])) $_GET['y'] = 2003;
+if (!isset($_GET['m'])) $_GET['m'] = 8;
+if (!isset($_GET['d'])) $_GET['d'] = 9;
+if (!isset($_GET['h'])) $_GET['h'] = 12;
+if (!isset($_GET['i'])) $_GET['i'] = 34;
+if (!isset($_GET['s'])) $_GET['s'] = 46;
+
+switch ( @$_GET['view'] ) {
+    default:
+        $_GET['view'] = 'calendar_year';
+    case 'calendar_year':
+        require_once CALENDAR_ROOT.'Year.php';
+        $c = new Calendar_Year($_GET['y']);
+    break;
+    case 'calendar_month':
+        require_once CALENDAR_ROOT.'Month.php';
+        $c = new Calendar_Month($_GET['y'],$_GET['m']);
+    break;
+    case 'calendar_day':
+        require_once CALENDAR_ROOT.'Day.php';
+        $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']);
+    break;
+    case 'calendar_hour':
+        require_once CALENDAR_ROOT.'Hour.php';
+        $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']);
+    break;
+    case 'calendar_minute':
+        require_once CALENDAR_ROOT.'Minute.php';
+        $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']);
+    break;
+    case 'calendar_second':
+        require_once CALENDAR_ROOT.'Second.php';
+        $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']);
+    break;
+}
+
+// Convert timestamp to human readable date
+$date = new Date($c->getTimestamp());
+
+echo ( '<h1>Using PEAR::Date engine</h1>' );
+echo ( 'Viewing: '.@$_GET['view'].'<br />' );
+echo ( 'The time is now: '.$date->format('%Y %a %e %T').'<br >' );
+
+$i = 1;
+echo ( '<h1>First Iteration</h1>' );
+echo ( '<p>The first iteration is more "expensive", the calendar data
+        structures having to be built.</p>' );
+$start = getmicrotime();
+$c->build();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+
+$i = 1;
+echo ( '<h1>Second Iteration</h1>' );
+echo ( '<p>This second iteration is faster, the data structures
+        being re-used</p>' );
+$start = getmicrotime();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/13.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/13.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/13.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,99 @@
+<?php
+/**
+* Description: same as 1.php, but using the PEAR::Date engine
+* Notice the use of the CALENDAR_ENGINE constant, which
+* switches the calculation "engine"
+* Note: make sure PEAR::Date is a stable release!!!
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+
+// Switch to PEAR::Date engine
+define('CALENDAR_ENGINE','PearDate');
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+if (!isset($_GET['y'])) $_GET['y'] = 2003;
+if (!isset($_GET['m'])) $_GET['m'] = 8;
+if (!isset($_GET['d'])) $_GET['d'] = 9;
+if (!isset($_GET['h'])) $_GET['h'] = 12;
+if (!isset($_GET['i'])) $_GET['i'] = 34;
+if (!isset($_GET['s'])) $_GET['s'] = 46;
+
+switch ( @$_GET['view'] ) {
+    default:
+        $_GET['view'] = 'calendar_year';
+    case 'calendar_year':
+        require_once CALENDAR_ROOT.'Year.php';
+        $c = new Calendar_Year($_GET['y']);
+    break;
+    case 'calendar_month':
+        require_once CALENDAR_ROOT.'Month.php';
+        $c = new Calendar_Month($_GET['y'],$_GET['m']);
+    break;
+    case 'calendar_day':
+        require_once CALENDAR_ROOT.'Day.php';
+        $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']);
+    break;
+    case 'calendar_hour':
+        require_once CALENDAR_ROOT.'Hour.php';
+        $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']);
+    break;
+    case 'calendar_minute':
+        require_once CALENDAR_ROOT.'Minute.php';
+        $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']);
+    break;
+    case 'calendar_second':
+        require_once CALENDAR_ROOT.'Second.php';
+        $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']);
+    break;
+}
+
+// Convert timestamp to human readable date
+$date = new Date($c->getTimestamp());
+
+echo ( '<h1>Using PEAR::Date engine</h1>' );
+echo ( 'Viewing: '.@$_GET['view'].'<br />' );
+echo ( 'The time is now: '.$date->format('%Y %a %e %T').'<br >' );
+
+$i = 1;
+echo ( '<h1>First Iteration</h1>' );
+echo ( '<p>The first iteration is more "expensive", the calendar data
+        structures having to be built.</p>' );
+$start = getmicrotime();
+$c->build();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+
+$i = 1;
+echo ( '<h1>Second Iteration</h1>' );
+echo ( '<p>This second iteration is faster, the data structures
+        being re-used</p>' );
+$start = getmicrotime();
+while ( $e = $c->fetch() ) {
+    $class = strtolower(get_class($e));
+    $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
+        "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
+    $method = 'this'.str_replace('calendar_','',$class);
+    echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " );
+    if ( ($i % 10) == 0 ) {
+        echo ( '<br>' );
+    }
+    $i++;
+}
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/14.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/14.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/14.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,141 @@
+<?php
+/**
+* Description: same as 3.php, but using the PEAR::Date engine
+* Note: make sure PEAR::Date is a stable release!!!
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+// Switch to PEAR::Date engine
+define('CALENDAR_ENGINE', 'PearDate');
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+// Initialize GET variables if not set
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = date('d');
+
+// Build the month
+$month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']);
+
+// Create an array of days which are "selected"
+// Used for Week::build() below
+$selectedDays = array (
+    new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']),
+    new Calendar_Day($_GET['y'], 12, 25),
+    );
+
+// Build the days in the month
+$month->build($selectedDays);
+
+// Construct strings for next/previous links
+$PMonth = $month->prevMonth('object'); // Get previous month as object
+$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
+$NMonth = $month->nextMonth('object');
+$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
+
+$thisDate = new Date($month->thisMonth('timestamp'));
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar using PEAR::Date Engine </title>
+<style text="text/css">
+table {
+    background-color: silver;
+}
+caption {
+    font-family: verdana;
+    font-size: 12px;
+    background-color: while;
+}
+.prevMonth {
+    font-size: 10px;
+    text-align: left;
+}
+.nextMonth {
+    font-size: 10px;
+    text-align: right;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    color: navy;
+    text-align: right;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: right;
+}
+.selected {
+    background-color: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<h2>Calendar using PEAR::Date Engine</h2>
+<table class="calendar">
+<caption>
+<?php echo $thisDate->format('%B %Y'); ?>
+</caption>
+<tr>
+<th>M</th>
+<th>T</th>
+<th>W</th>
+<th>T</th>
+<th>F</th>
+<th>S</th>
+<th>S</th>
+</tr>
+<?php
+while ($day = $month->fetch()) {
+    // Build a link string for each day
+    $link = $_SERVER['PHP_SELF'].
+                '?y='.$day->thisYear().
+                '&m='.$day->thisMonth().
+                '&d='.$day->thisDay();
+
+    // isFirst() to find start of week
+    if ($day->isFirst())
+        echo "<tr>\n";
+
+    if ($day->isSelected()) {
+       echo '<td class="selected">'.$day->thisDay().'</td>'."\n";
+    } else if ($day->isEmpty()) {
+        echo '<td> </td>'."\n";
+    } else {
+        echo '<td><a href="'.$link.'">'.$day->thisDay().'</a></td>'."\n";
+    }
+
+    // isLast() to find end of week
+    if ($day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+<tr>
+<td>
+<a href="<?php echo $prev; ?>" class="prevMonth"><< </a>
+</td>
+<td colspan="5"> </td>
+<td>
+<a href="<?php echo $next; ?>" class="nextMonth"> >></a>
+</td>
+</tr>
+</table>
+<?php
+echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>';
+?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/14.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/14.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/14.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,141 @@
+<?php
+/**
+* Description: same as 3.php, but using the PEAR::Date engine
+* Note: make sure PEAR::Date is a stable release!!!
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+// Switch to PEAR::Date engine
+define('CALENDAR_ENGINE', 'PearDate');
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+// Initialize GET variables if not set
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = date('d');
+
+// Build the month
+$month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']);
+
+// Create an array of days which are "selected"
+// Used for Week::build() below
+$selectedDays = array (
+    new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']),
+    new Calendar_Day($_GET['y'], 12, 25),
+    );
+
+// Build the days in the month
+$month->build($selectedDays);
+
+// Construct strings for next/previous links
+$PMonth = $month->prevMonth('object'); // Get previous month as object
+$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
+$NMonth = $month->nextMonth('object');
+$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
+
+$thisDate = new Date($month->thisMonth('timestamp'));
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar using PEAR::Date Engine </title>
+<style text="text/css">
+table {
+    background-color: silver;
+}
+caption {
+    font-family: verdana;
+    font-size: 12px;
+    background-color: while;
+}
+.prevMonth {
+    font-size: 10px;
+    text-align: left;
+}
+.nextMonth {
+    font-size: 10px;
+    text-align: right;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    color: navy;
+    text-align: right;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: right;
+}
+.selected {
+    background-color: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<h2>Calendar using PEAR::Date Engine</h2>
+<table class="calendar">
+<caption>
+<?php echo $thisDate->format('%B %Y'); ?>
+</caption>
+<tr>
+<th>M</th>
+<th>T</th>
+<th>W</th>
+<th>T</th>
+<th>F</th>
+<th>S</th>
+<th>S</th>
+</tr>
+<?php
+while ($day = $month->fetch()) {
+    // Build a link string for each day
+    $link = $_SERVER['PHP_SELF'].
+                '?y='.$day->thisYear().
+                '&m='.$day->thisMonth().
+                '&d='.$day->thisDay();
+
+    // isFirst() to find start of week
+    if ($day->isFirst())
+        echo "<tr>\n";
+
+    if ($day->isSelected()) {
+       echo '<td class="selected">'.$day->thisDay().'</td>'."\n";
+    } else if ($day->isEmpty()) {
+        echo '<td> </td>'."\n";
+    } else {
+        echo '<td><a href="'.$link.'">'.$day->thisDay().'</a></td>'."\n";
+    }
+
+    // isLast() to find end of week
+    if ($day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+<tr>
+<td>
+<a href="<?php echo $prev; ?>" class="prevMonth"><< </a>
+</td>
+<td colspan="5"> </td>
+<td>
+<a href="<?php echo $next; ?>" class="nextMonth"> >></a>
+</td>
+</tr>
+</table>
+<?php
+echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>';
+?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/15.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/15.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/15.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,58 @@
+<?php
+/**
+* Shows more on how a week can be used
+*/
+function getmicrotime() {
+    list($usec, $sec) = explode(" ", microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Week.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = 1;
+
+// Build the month
+$Week = new Calendar_Week($_GET['y'], $_GET['m'], $_GET['d']);
+/*
+$Validator = $Week->getValidator();
+if (!$Validator->isValidWeek()) {
+    die ('Please enter a valid week!');
+}
+*/
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Paging Weeks </title>
+</head>
+<body>
+<h1>Paging Weeks</h1>
+<h2>Week: <?php echo $Week->thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?></h2>
+<?php
+$Week->build();
+while ($Day = $Week->fetch()) {
+    echo '<p>'.date('jS F',$Day->thisDay(true))."</p>\n";
+}
+$days = $Week->fetchAll();
+
+$prevWeek = $Week->prevWeek('array');
+$prevWeekLink = $_SERVER['PHP_SELF'].
+                    '?y='.$prevWeek['year'].
+                    '&m='.$prevWeek['month'].
+                    '&d='.$prevWeek['day'];
+
+$nextWeek = $Week->nextWeek('array');
+$nextWeekLink = $_SERVER['PHP_SELF'].
+                    '?y='.$nextWeek['year'].
+                    '&m='.$nextWeek['month'].
+                    '&d='.$nextWeek['day'];
+?>
+<p><a href="<?php echo $prevWeekLink; ?>"><<</a> | <a href="<?php echo $nextWeekLink; ?>">>></a></p>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/15.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/15.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/15.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,58 @@
+<?php
+/**
+* Shows more on how a week can be used
+*/
+function getmicrotime() {
+    list($usec, $sec) = explode(" ", microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Week.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = 1;
+
+// Build the month
+$Week = new Calendar_Week($_GET['y'], $_GET['m'], $_GET['d']);
+/*
+$Validator = $Week->getValidator();
+if (!$Validator->isValidWeek()) {
+    die ('Please enter a valid week!');
+}
+*/
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Paging Weeks </title>
+</head>
+<body>
+<h1>Paging Weeks</h1>
+<h2>Week: <?php echo $Week->thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?></h2>
+<?php
+$Week->build();
+while ($Day = $Week->fetch()) {
+    echo '<p>'.date('jS F',$Day->thisDay(true))."</p>\n";
+}
+$days = $Week->fetchAll();
+
+$prevWeek = $Week->prevWeek('array');
+$prevWeekLink = $_SERVER['PHP_SELF'].
+                    '?y='.$prevWeek['year'].
+                    '&m='.$prevWeek['month'].
+                    '&d='.$prevWeek['day'];
+
+$nextWeek = $Week->nextWeek('array');
+$nextWeekLink = $_SERVER['PHP_SELF'].
+                    '?y='.$nextWeek['year'].
+                    '&m='.$nextWeek['month'].
+                    '&d='.$nextWeek['day'];
+?>
+<p><a href="<?php echo $prevWeekLink; ?>"><<</a> | <a href="<?php echo $nextWeekLink; ?>">>></a></p>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/16.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/16.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/16.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,31 @@
+<?php
+/**
+* Description: demonstrates using the Uri decorator
+*/
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Decorator/Uri.php';
+
+if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y');
+if (!isset($_GET['monat'])) $_GET['monat'] = date('m');
+
+// Build the month
+$Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']);
+
+echo ( '<p>The current month is '
+        .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>');
+
+$Uri = & new Calendar_Decorator_Uri($Calendar);
+$Uri->setFragments('jahr','monat');
+// $Uri->setSeperator('/'); // Default is &
+// $Uri->setScalar(); // Omit variable names
+echo ( "<pre>Previous Uri:\t".$Uri->prev('month')."\n" );
+echo ( "This Uri:\t".$Uri->this('month')."\n" );
+echo ( "Next Uri:\t".$Uri->next('month')."\n</pre>" );
+?>
+<p>
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev('month'));?>">Prev</a> :
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next('month'));?>">Next</a>
+</p>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/16.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/16.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/16.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,31 @@
+<?php
+/**
+* Description: demonstrates using the Uri decorator
+*/
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Decorator/Uri.php';
+
+if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y');
+if (!isset($_GET['monat'])) $_GET['monat'] = date('m');
+
+// Build the month
+$Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']);
+
+echo ( '<p>The current month is '
+        .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>');
+
+$Uri = & new Calendar_Decorator_Uri($Calendar);
+$Uri->setFragments('jahr','monat');
+// $Uri->setSeperator('/'); // Default is &
+// $Uri->setScalar(); // Omit variable names
+echo ( "<pre>Previous Uri:\t".$Uri->prev('month')."\n" );
+echo ( "This Uri:\t".$Uri->this('month')."\n" );
+echo ( "Next Uri:\t".$Uri->next('month')."\n</pre>" );
+?>
+<p>
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev('month'));?>">Prev</a> :
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next('month'));?>">Next</a>
+</p>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/17.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/17.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/17.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,71 @@
+<?php
+/**
+* Description: demonstrates using the Textual decorator
+*/
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php';
+require_once CALENDAR_ROOT.'Decorator'.DIRECTORY_SEPARATOR.'Textual.php';
+
+// Could change language like this
+// setlocale (LC_TIME, "de_DE"); // Unix based (probably)
+// setlocale (LC_TIME, "ge"); // Windows
+
+echo "<hr>Calling: Calendar_Decorator_Textual::monthNames('long');<pre>";
+print_r(Calendar_Decorator_Textual::monthNames('long'));
+echo '</pre>';
+
+echo "<hr>Calling: Calendar_Decorator_Textual::weekdayNames('two');<pre>";
+print_r(Calendar_Decorator_Textual::weekdayNames('two'));
+echo '</pre>';
+
+echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />";
+$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
+
+// Decorate
+$Textual = & new Calendar_Decorator_Textual($Calendar);
+
+echo '<hr>Previous month is: '.$Textual->prevMonthName('two').'<br />';
+echo 'This month is: '.$Textual->thisMonthName('short').'<br />';
+echo 'Next month is: '.$Textual->nextMonthName().'<br /><hr />';
+echo 'Previous day is: '.$Textual->prevDayName().'<br />';
+echo 'This day is: '.$Textual->thisDayName('short').'<br />';
+echo 'Next day is: '.$Textual->nextDayName('one').'<br /><hr />';
+
+echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
+$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
+
+// Decorate
+$Textual = & new Calendar_Decorator_Textual($Calendar);
+?>
+<p>Rendering calendar....</p>
+<table>
+<caption><?php echo $Textual->thisMonthName().' '.$Textual->thisYear(); ?></caption>
+<tr>
+<?php
+$dayheaders = $Textual->orderedWeekdays('short');
+foreach ($dayheaders as $dayheader) {
+    echo '<th>'.$dayheader.'</th>';
+}
+?>
+</tr>
+<?php
+$Calendar->build();
+while ($Day = $Calendar->fetch()) {
+    if ($Day->isFirst()) {
+        echo "<tr>\n";
+    }
+    if ($Day->isEmpty()) {
+        echo '<td> </td>';
+    } else {
+        echo '<td>'.$Day->thisDay().'</td>';
+    }
+    if ($Day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+</table>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/17.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/17.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/17.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,71 @@
+<?php
+/**
+* Description: demonstrates using the Textual decorator
+*/
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php';
+require_once CALENDAR_ROOT.'Decorator'.DIRECTORY_SEPARATOR.'Textual.php';
+
+// Could change language like this
+// setlocale (LC_TIME, "de_DE"); // Unix based (probably)
+// setlocale (LC_TIME, "ge"); // Windows
+
+echo "<hr>Calling: Calendar_Decorator_Textual::monthNames('long');<pre>";
+print_r(Calendar_Decorator_Textual::monthNames('long'));
+echo '</pre>';
+
+echo "<hr>Calling: Calendar_Decorator_Textual::weekdayNames('two');<pre>";
+print_r(Calendar_Decorator_Textual::weekdayNames('two'));
+echo '</pre>';
+
+echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />";
+$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
+
+// Decorate
+$Textual = & new Calendar_Decorator_Textual($Calendar);
+
+echo '<hr>Previous month is: '.$Textual->prevMonthName('two').'<br />';
+echo 'This month is: '.$Textual->thisMonthName('short').'<br />';
+echo 'Next month is: '.$Textual->nextMonthName().'<br /><hr />';
+echo 'Previous day is: '.$Textual->prevDayName().'<br />';
+echo 'This day is: '.$Textual->thisDayName('short').'<br />';
+echo 'Next day is: '.$Textual->nextDayName('one').'<br /><hr />';
+
+echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
+$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
+
+// Decorate
+$Textual = & new Calendar_Decorator_Textual($Calendar);
+?>
+<p>Rendering calendar....</p>
+<table>
+<caption><?php echo $Textual->thisMonthName().' '.$Textual->thisYear(); ?></caption>
+<tr>
+<?php
+$dayheaders = $Textual->orderedWeekdays('short');
+foreach ($dayheaders as $dayheader) {
+    echo '<th>'.$dayheader.'</th>';
+}
+?>
+</tr>
+<?php
+$Calendar->build();
+while ($Day = $Calendar->fetch()) {
+    if ($Day->isFirst()) {
+        echo "<tr>\n";
+    }
+    if ($Day->isEmpty()) {
+        echo '<td> </td>';
+    } else {
+        echo '<td>'.$Day->thisDay().'</td>';
+    }
+    if ($Day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+</table>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/18.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/18.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/18.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,36 @@
+<?php
+/**
+* Description: demonstrates using the Wrapper decorator
+*/
+
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month.php';
+require_once CALENDAR_ROOT.'Decorator.php'; // Not really needed but added to help this make sense
+require_once CALENDAR_ROOT.'Decorator/Wrapper.php';
+
+class MyBoldDecorator extends Calendar_Decorator
+{
+    function MyBoldDecorator(&$Calendar)
+    {
+        parent::Calendar_Decorator($Calendar);
+    }
+
+    function thisDay()
+    {
+        return '<b>'.parent::thisDay().'</b>';
+    }
+}
+
+$Month = new Calendar_Month(date('Y'), date('n'));
+
+$Wrapper = & new Calendar_Decorator_Wrapper($Month);
+$Wrapper->build();
+
+echo '<h2>The Wrapper decorator</h2>';
+echo '<i>Day numbers are rendered in bold</i><br /> <br />';
+while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
+    echo $DecoratedDay->thisDay().'<br />';
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/18.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/18.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/18.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,36 @@
+<?php
+/**
+* Description: demonstrates using the Wrapper decorator
+*/
+
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month.php';
+require_once CALENDAR_ROOT.'Decorator.php'; // Not really needed but added to help this make sense
+require_once CALENDAR_ROOT.'Decorator/Wrapper.php';
+
+class MyBoldDecorator extends Calendar_Decorator
+{
+    function MyBoldDecorator(&$Calendar)
+    {
+        parent::Calendar_Decorator($Calendar);
+    }
+
+    function thisDay()
+    {
+        return '<b>'.parent::thisDay().'</b>';
+    }
+}
+
+$Month = new Calendar_Month(date('Y'), date('n'));
+
+$Wrapper = & new Calendar_Decorator_Wrapper($Month);
+$Wrapper->build();
+
+echo '<h2>The Wrapper decorator</h2>';
+echo '<i>Day numbers are rendered in bold</i><br /> <br />';
+while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
+    echo $DecoratedDay->thisDay().'<br />';
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/19.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/19.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/19.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,24 @@
+<?php
+/**
+* Description: demonstrates using the Weekday decorator
+*/
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Decorator/Weekday.php';
+
+$Day = new Calendar_Day(date('Y'), date('n'),date('d'));
+$WeekDay = & new Calendar_Decorator_Weekday($Day);
+// $WeekDay->setFirstDay(0); // Make Sunday first Day
+
+echo 'Yesterday: '.$WeekDay->prevWeekDay().'<br>';
+echo 'Today: '.$WeekDay->thisWeekDay().'<br>';
+echo 'Tomorrow: '.$WeekDay->nextWeekDay().'<br>';
+
+$WeekDay->build();
+echo 'Hours today:<br>';
+while ( $Hour = $WeekDay->fetch() ) {
+    echo $Hour->thisHour().'<br>';
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/19.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/19.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/19.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,24 @@
+<?php
+/**
+* Description: demonstrates using the Weekday decorator
+*/
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Decorator/Weekday.php';
+
+$Day = new Calendar_Day(date('Y'), date('n'),date('d'));
+$WeekDay = & new Calendar_Decorator_Weekday($Day);
+// $WeekDay->setFirstDay(0); // Make Sunday first Day
+
+echo 'Yesterday: '.$WeekDay->prevWeekDay().'<br>';
+echo 'Today: '.$WeekDay->thisWeekDay().'<br>';
+echo 'Tomorrow: '.$WeekDay->nextWeekDay().'<br>';
+
+$WeekDay->build();
+echo 'Hours today:<br>';
+while ( $Hour = $WeekDay->fetch() ) {
+    echo $Hour->thisHour().'<br>';
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/2.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/2.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/2.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,142 @@
+<?php
+/**
+* Description: Demonstrates building a calendar for a month using the Week class
+* Uses UnixTs engine
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+// Force UnixTs engine (default setting)
+define('CALENDAR_ENGINE','UnixTS');
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month/Weeks.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+// Initialize GET variables if not set
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = date('d');
+
+// Build a month object
+$Month = new Calendar_Month_Weeks($_GET['y'], $_GET['m']);
+
+// Create an array of days which are "selected"
+// Used for Week::build() below
+$selectedDays = array (
+    new Calendar_Day($_GET['y'],$_GET['m'], $_GET['d']),
+    new Calendar_Day($_GET['y'], 12, 25),
+    new Calendar_Day(date('Y'), date('m'), date('d')),
+    );
+
+// Instruct month to build Week objects
+$Month->build();
+
+// Construct strings for next/previous links
+$PMonth = $Month->prevMonth('object'); // Get previous month as object
+$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
+$NMonth = $Month->nextMonth('object');
+$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar </title>
+<style text="text/css">
+table {
+    background-color: silver;
+}
+caption {
+    font-family: verdana;
+    font-size: 12px;
+    background-color: while;
+}
+.prevMonth {
+    font-size: 10px;
+    text-align: left;
+}
+.nextMonth {
+    font-size: 10px;
+    text-align: right;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    color: navy;
+    text-align: right;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: right;
+}
+.selected {
+    background-color: yellow;
+}
+.empty {
+    color: white;
+}
+</style>
+</head>
+
+<body>
+<h2>Build with Calendar_Month_Weeks::build() then Calendar_Week::build()</h2>
+<table class="calendar">
+<caption>
+<?php echo date('F Y', $Month->getTimeStamp()); ?>
+</caption>
+<tr>
+<th>M</th>
+<th>T</th>
+<th>W</th>
+<th>T</th>
+<th>F</th>
+<th>S</th>
+<th>S</th>
+</tr>
+<?php
+while ($Week = $Month->fetch()) {
+    echo "<tr>\n";
+    // Build the days in the week, passing the selected days
+    $Week->build($selectedDays);
+    while ($Day = $Week->fetch()) {
+
+        // Build a link string for each day
+        $link = $_SERVER['PHP_SELF'].
+                    '?y='.$Day->thisYear().
+                    '&m='.$Day->thisMonth().
+                    '&d='.$Day->thisDay();
+
+        // Check to see if day is selected
+        if ($Day->isSelected()) {
+            echo '<td class="selected">'.$Day->thisDay().'</td>'."\n";
+        // Check to see if day is empty
+        } else if ($Day->isEmpty()) {
+            echo '<td class="empty">'.$Day->thisDay().'</td>'."\n";
+        } else {
+            echo '<td><a href="'.$link.'">'.$Day->thisDay().'</a></td>'."\n";
+        }
+    }
+    echo '</tr>'."\n";
+}
+?>
+<tr>
+<td>
+<a href="<?php echo $prev; ?>" class="prevMonth"><< </a>
+</td>
+<td colspan="5"> </td>
+<td>
+<a href="<?php echo $next; ?>" class="nextMonth"> >></a>
+</td>
+</tr>
+</table>
+<?php
+echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>';
+?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/2.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/2.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/2.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,142 @@
+<?php
+/**
+* Description: Demonstrates building a calendar for a month using the Week class
+* Uses UnixTs engine
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+// Force UnixTs engine (default setting)
+define('CALENDAR_ENGINE','UnixTS');
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month/Weeks.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+// Initialize GET variables if not set
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = date('d');
+
+// Build a month object
+$Month = new Calendar_Month_Weeks($_GET['y'], $_GET['m']);
+
+// Create an array of days which are "selected"
+// Used for Week::build() below
+$selectedDays = array (
+    new Calendar_Day($_GET['y'],$_GET['m'], $_GET['d']),
+    new Calendar_Day($_GET['y'], 12, 25),
+    new Calendar_Day(date('Y'), date('m'), date('d')),
+    );
+
+// Instruct month to build Week objects
+$Month->build();
+
+// Construct strings for next/previous links
+$PMonth = $Month->prevMonth('object'); // Get previous month as object
+$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
+$NMonth = $Month->nextMonth('object');
+$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar </title>
+<style text="text/css">
+table {
+    background-color: silver;
+}
+caption {
+    font-family: verdana;
+    font-size: 12px;
+    background-color: while;
+}
+.prevMonth {
+    font-size: 10px;
+    text-align: left;
+}
+.nextMonth {
+    font-size: 10px;
+    text-align: right;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    color: navy;
+    text-align: right;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: right;
+}
+.selected {
+    background-color: yellow;
+}
+.empty {
+    color: white;
+}
+</style>
+</head>
+
+<body>
+<h2>Build with Calendar_Month_Weeks::build() then Calendar_Week::build()</h2>
+<table class="calendar">
+<caption>
+<?php echo date('F Y', $Month->getTimeStamp()); ?>
+</caption>
+<tr>
+<th>M</th>
+<th>T</th>
+<th>W</th>
+<th>T</th>
+<th>F</th>
+<th>S</th>
+<th>S</th>
+</tr>
+<?php
+while ($Week = $Month->fetch()) {
+    echo "<tr>\n";
+    // Build the days in the week, passing the selected days
+    $Week->build($selectedDays);
+    while ($Day = $Week->fetch()) {
+
+        // Build a link string for each day
+        $link = $_SERVER['PHP_SELF'].
+                    '?y='.$Day->thisYear().
+                    '&m='.$Day->thisMonth().
+                    '&d='.$Day->thisDay();
+
+        // Check to see if day is selected
+        if ($Day->isSelected()) {
+            echo '<td class="selected">'.$Day->thisDay().'</td>'."\n";
+        // Check to see if day is empty
+        } else if ($Day->isEmpty()) {
+            echo '<td class="empty">'.$Day->thisDay().'</td>'."\n";
+        } else {
+            echo '<td><a href="'.$link.'">'.$Day->thisDay().'</a></td>'."\n";
+        }
+    }
+    echo '</tr>'."\n";
+}
+?>
+<tr>
+<td>
+<a href="<?php echo $prev; ?>" class="prevMonth"><< </a>
+</td>
+<td colspan="5"> </td>
+<td>
+<a href="<?php echo $next; ?>" class="nextMonth"> >></a>
+</td>
+</tr>
+</table>
+<?php
+echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>';
+?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/20.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/20.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/20.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,240 @@
+<?php
+/**
+* Description: demonstrates a decorator used to "attach a payload" to a selection
+* to make it available when iterating over calendar children
+*/
+
+//if you use ISO-8601 dates, switch to PearDate engine
+define('CALENDAR_ENGINE', 'PearDate');
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+require_once CALENDAR_ROOT . 'Month/Weekdays.php';
+require_once CALENDAR_ROOT . 'Day.php';
+require_once CALENDAR_ROOT . 'Decorator.php';
+
+// accepts multiple entries
+class DiaryEvent extends Calendar_Decorator
+{
+    var $entries = array();
+
+    function DiaryEvent($calendar) {
+        Calendar_Decorator::Calendar_Decorator($calendar);
+    }
+
+    function addEntry($entry) {
+        $this->entries[] = $entry;
+    }
+
+    function getEntry() {
+        $entry = each($this->entries);
+        if ($entry) {
+            return $entry['value'];
+        } else {
+            reset($this->entries);
+            return false;
+        }
+    }
+}
+
+class MonthPayload_Decorator extends Calendar_Decorator
+{
+    //Calendar engine
+    var $cE;
+    var $tableHelper;
+
+    var $year;
+    var $month;
+    var $firstDay = false;
+
+    function build($events=array())
+    {
+        require_once CALENDAR_ROOT . 'Day.php';
+        require_once CALENDAR_ROOT .  'Table/Helper.php';
+
+        $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
+        $this->cE = & $this->getEngine();
+        $this->year  = $this->thisYear();
+        $this->month = $this->thisMonth();
+
+        $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
+        for ($i=1; $i<=$daysInMonth; $i++) {
+            $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values
+            $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i));
+            $this->children[$i] = new DiaryEvent($Day);
+        }
+        if (count($events) > 0) {
+            $this->setSelection($events);
+        }
+        Calendar_Month_Weekdays::buildEmptyDaysBefore();
+        Calendar_Month_Weekdays::shiftDays();
+        Calendar_Month_Weekdays::buildEmptyDaysAfter();
+        Calendar_Month_Weekdays::setWeekMarkers();
+        return true;
+    }
+
+    function setSelection($events)
+    {
+        $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
+        for ($i=1; $i<=$daysInMonth; $i++) {
+            $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i);
+            $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1);
+            foreach ($events as $event) {
+                if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) ||
+                    ($stamp2 >= $event['start'] && $stamp2 < $event['end']) ||
+                    ($stamp1 <= $event['start'] && $stamp2 > $event['end'])
+                ) {
+                    $this->children[$i]->addEntry($event);
+                    $this->children[$i]->setSelected();
+                }
+            }
+        }
+    }
+
+    function fetch()
+    {
+        $child = each($this->children);
+        if ($child) {
+            return $child['value'];
+        } else {
+            reset($this->children);
+            return false;
+        }
+    }
+}
+
+// Calendar instance used to get the dates in the preferred format:
+// you can switch Calendar Engine and the example still works
+$cal = new Calendar;
+
+$events = array();
+//add some events
+$events[] = array(
+    'start' => $cal->cE->dateToStamp(2004, 6, 1, 10),
+    'end'   => $cal->cE->dateToStamp(2004, 6, 1, 12),
+    'desc'  => 'Important meeting'
+);
+$events[] = array(
+    'start' => $cal->cE->dateToStamp(2004, 6, 1, 21),
+    'end'   => $cal->cE->dateToStamp(2004, 6, 1, 23, 59),
+    'desc'  => 'Dinner with the boss'
+);
+$events[] = array(
+    'start' => $cal->cE->dateToStamp(2004, 6, 5),
+    'end'   => $cal->cE->dateToStamp(2004, 6, 10, 23, 59),
+    'desc'  => 'Holidays!'
+);
+
+
+
+$Month = & new Calendar_Month_Weekdays(2004, 6);
+$MonthDecorator = new MonthPayload_Decorator($Month);
+$MonthDecorator->build($events);
+
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar </title>
+<style text="text/css">
+table {
+    border-collapse: collapse;
+}
+caption {
+    font-family: verdana;
+    font-size: 14pt;
+    padding-bottom: 4pt;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: center;
+    background-color: #e7e3e7;
+    padding: 5pt;
+    line-height: 150%;
+    border: 1px solid #ccc;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: left;
+    vertical-align: top;
+}
+td.calCell {
+    border: 1px solid #b5bece;
+    padding: 3px;
+}
+td.calCellEmpty {
+    background-color: #f3f3f7;
+}
+td.calCellBusy {
+    background-color: #efeffa;
+}
+div.dayNumber {
+    text-align: right;
+    background-color: #f8f8f8;
+    border-bottom: 1px solid #ccc;
+}
+ul {
+    margin-left: 0;
+    margin-top: 5pt;
+    padding: 0 10pt 0 12pt;
+    list-style-type: square;
+}
+</style>
+</head>
+
+<body>
+
+<h2>Sample Calendar Payload Decorator (using <?php echo CALENDAR_ENGINE; ?> engine)</h2>
+<table class="calendar" width="98%" cellspacing="0" cellpadding="0">
+<caption>
+    <?php echo $MonthDecorator->thisMonth().' / '.$MonthDecorator->thisYear(); ?>
+</caption>
+<tr>
+    <th>Monday</th>
+    <th>Tuesday</th>
+    <th>Wednesday</th>
+    <th>Thursday</th>
+    <th>Friday</th>
+    <th>Saturday</th>
+    <th>Sunday</th>
+</tr>
+<?php
+while ($Day = $MonthDecorator->fetch()) {
+
+    if ($Day->isFirst()) {
+        echo "<tr>\n";
+    }
+
+    echo '<td class="calCell';
+    if ($Day->isSelected()) {
+        echo ' calCellBusy';
+    } elseif ($Day->isEmpty()) {
+        echo ' calCellEmpty';
+    }
+    echo '">';
+    echo '<div class="dayNumber">'.$Day->thisDay().'</div>';
+
+    if ($Day->isEmpty()) {
+        echo ' ';
+    } else {
+        echo '<div class="dayContents"><ul>';
+        while ($entry = $Day->getEntry()) {
+            echo  '<li>'.$entry['desc'].'</li>';
+            //you can print the time range as well
+        }
+        echo '</ul></div>';
+    }
+    echo '</td>';
+
+    if ($Day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+</table>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/20.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/20.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/20.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,240 @@
+<?php
+/**
+* Description: demonstrates a decorator used to "attach a payload" to a selection
+* to make it available when iterating over calendar children
+*/
+
+//if you use ISO-8601 dates, switch to PearDate engine
+define('CALENDAR_ENGINE', 'PearDate');
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+
+require_once CALENDAR_ROOT . 'Month/Weekdays.php';
+require_once CALENDAR_ROOT . 'Day.php';
+require_once CALENDAR_ROOT . 'Decorator.php';
+
+// accepts multiple entries
+class DiaryEvent extends Calendar_Decorator
+{
+    var $entries = array();
+
+    function DiaryEvent($calendar) {
+        Calendar_Decorator::Calendar_Decorator($calendar);
+    }
+
+    function addEntry($entry) {
+        $this->entries[] = $entry;
+    }
+
+    function getEntry() {
+        $entry = each($this->entries);
+        if ($entry) {
+            return $entry['value'];
+        } else {
+            reset($this->entries);
+            return false;
+        }
+    }
+}
+
+class MonthPayload_Decorator extends Calendar_Decorator
+{
+    //Calendar engine
+    var $cE;
+    var $tableHelper;
+
+    var $year;
+    var $month;
+    var $firstDay = false;
+
+    function build($events=array())
+    {
+        require_once CALENDAR_ROOT . 'Day.php';
+        require_once CALENDAR_ROOT .  'Table/Helper.php';
+
+        $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
+        $this->cE = & $this->getEngine();
+        $this->year  = $this->thisYear();
+        $this->month = $this->thisMonth();
+
+        $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
+        for ($i=1; $i<=$daysInMonth; $i++) {
+            $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values
+            $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i));
+            $this->children[$i] = new DiaryEvent($Day);
+        }
+        if (count($events) > 0) {
+            $this->setSelection($events);
+        }
+        Calendar_Month_Weekdays::buildEmptyDaysBefore();
+        Calendar_Month_Weekdays::shiftDays();
+        Calendar_Month_Weekdays::buildEmptyDaysAfter();
+        Calendar_Month_Weekdays::setWeekMarkers();
+        return true;
+    }
+
+    function setSelection($events)
+    {
+        $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
+        for ($i=1; $i<=$daysInMonth; $i++) {
+            $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i);
+            $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1);
+            foreach ($events as $event) {
+                if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) ||
+                    ($stamp2 >= $event['start'] && $stamp2 < $event['end']) ||
+                    ($stamp1 <= $event['start'] && $stamp2 > $event['end'])
+                ) {
+                    $this->children[$i]->addEntry($event);
+                    $this->children[$i]->setSelected();
+                }
+            }
+        }
+    }
+
+    function fetch()
+    {
+        $child = each($this->children);
+        if ($child) {
+            return $child['value'];
+        } else {
+            reset($this->children);
+            return false;
+        }
+    }
+}
+
+// Calendar instance used to get the dates in the preferred format:
+// you can switch Calendar Engine and the example still works
+$cal = new Calendar;
+
+$events = array();
+//add some events
+$events[] = array(
+    'start' => $cal->cE->dateToStamp(2004, 6, 1, 10),
+    'end'   => $cal->cE->dateToStamp(2004, 6, 1, 12),
+    'desc'  => 'Important meeting'
+);
+$events[] = array(
+    'start' => $cal->cE->dateToStamp(2004, 6, 1, 21),
+    'end'   => $cal->cE->dateToStamp(2004, 6, 1, 23, 59),
+    'desc'  => 'Dinner with the boss'
+);
+$events[] = array(
+    'start' => $cal->cE->dateToStamp(2004, 6, 5),
+    'end'   => $cal->cE->dateToStamp(2004, 6, 10, 23, 59),
+    'desc'  => 'Holidays!'
+);
+
+
+
+$Month = & new Calendar_Month_Weekdays(2004, 6);
+$MonthDecorator = new MonthPayload_Decorator($Month);
+$MonthDecorator->build($events);
+
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar </title>
+<style text="text/css">
+table {
+    border-collapse: collapse;
+}
+caption {
+    font-family: verdana;
+    font-size: 14pt;
+    padding-bottom: 4pt;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: center;
+    background-color: #e7e3e7;
+    padding: 5pt;
+    line-height: 150%;
+    border: 1px solid #ccc;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: left;
+    vertical-align: top;
+}
+td.calCell {
+    border: 1px solid #b5bece;
+    padding: 3px;
+}
+td.calCellEmpty {
+    background-color: #f3f3f7;
+}
+td.calCellBusy {
+    background-color: #efeffa;
+}
+div.dayNumber {
+    text-align: right;
+    background-color: #f8f8f8;
+    border-bottom: 1px solid #ccc;
+}
+ul {
+    margin-left: 0;
+    margin-top: 5pt;
+    padding: 0 10pt 0 12pt;
+    list-style-type: square;
+}
+</style>
+</head>
+
+<body>
+
+<h2>Sample Calendar Payload Decorator (using <?php echo CALENDAR_ENGINE; ?> engine)</h2>
+<table class="calendar" width="98%" cellspacing="0" cellpadding="0">
+<caption>
+    <?php echo $MonthDecorator->thisMonth().' / '.$MonthDecorator->thisYear(); ?>
+</caption>
+<tr>
+    <th>Monday</th>
+    <th>Tuesday</th>
+    <th>Wednesday</th>
+    <th>Thursday</th>
+    <th>Friday</th>
+    <th>Saturday</th>
+    <th>Sunday</th>
+</tr>
+<?php
+while ($Day = $MonthDecorator->fetch()) {
+
+    if ($Day->isFirst()) {
+        echo "<tr>\n";
+    }
+
+    echo '<td class="calCell';
+    if ($Day->isSelected()) {
+        echo ' calCellBusy';
+    } elseif ($Day->isEmpty()) {
+        echo ' calCellEmpty';
+    }
+    echo '">';
+    echo '<div class="dayNumber">'.$Day->thisDay().'</div>';
+
+    if ($Day->isEmpty()) {
+        echo ' ';
+    } else {
+        echo '<div class="dayContents"><ul>';
+        while ($entry = $Day->getEntry()) {
+            echo  '<li>'.$entry['desc'].'</li>';
+            //you can print the time range as well
+        }
+        echo '</ul></div>';
+    }
+    echo '</td>';
+
+    if ($Day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+</table>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/21.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/21.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/21.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,139 @@
+<?php
+/**
+* Description: a complete year with numeric week numbers
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+
+require_once CALENDAR_ROOT.'Year.php';
+require_once CALENDAR_ROOT.'Month/Weeks.php';
+
+define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS);
+
+if (!isset($_GET['year'])) $_GET['year'] = date('Y');
+
+$week_types = array(
+    'n_in_year',
+    'n_in_month',
+);
+
+if (!isset($_GET['week_type']) || !in_array($_GET['week_type'],$week_types) ) {
+    $_GET['week_type'] = 'n_in_year';
+}
+
+$Year = new Calendar_Year($_GET['year']);
+
+$Year->build();
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> <?php echo $Year->thisYear(); ?> </title>
+<style type="text/css">
+body {
+    font-family: Georgia, serif;
+}
+caption.year {
+    font-weight: bold;
+    font-size: 120%;
+    font-color: navy;
+}
+caption.month {
+    font-size: 110%;
+    font-color: navy;
+}
+table.month {
+    border: thin groove #800080
+}
+tr {
+    vertical-align: top;
+}
+th, td {
+    text-align: right;
+    font-size: 70%;
+}
+#prev {
+    float: left;
+    font-size: 70%;
+}
+#next {
+    float: right;
+    font-size: 70%;
+}
+#week_type {
+    float: none;
+    font-size: 70%;
+}
+.weekNumbers {
+    background-color: #e5e5f5;
+    padding-right: 3pt;
+}
+</style>
+</head>
+<body>
+<table>
+<caption class="year">
+<?php echo $Year->thisYear(); ?>
+<div id="next">
+<a href="?year=<?php echo $Year->nextYear(); ?>&week_type=<?php echo $_GET['week_type']; ?>">>></a>
+</div>
+<div id="prev">
+<a href="?year=<?php echo $Year->prevYear(); ?>&week_type=<?php echo $_GET['week_type']; ?>"><<</a>
+</div>
+<div id="week_type">
+<a href="?year=<?php echo $Year->thisYear(); ?>&week_type=n_in_year">Weeks by Year</a> : 
+<a href="?year=<?php echo $Year->thisYear(); ?>&week_type=n_in_month">Weeks by Month</a> 
+</div>
+</caption>
+<?php
+$i = 0;
+while ($Month = $Year->fetch()) {
+
+    switch ($i) {
+        case 0:
+            echo "<tr>\n";
+            break;
+        case 3:
+        case 6:
+        case 9:
+            echo "</tr>\n<tr>\n";
+           break;
+        case 12:
+            echo "</tr>\n";
+            break;
+    }
+
+    echo "<td>\n<table class=\"month\">\n";
+    echo '<caption class="month">'.date('F', $Month->thisMonth(TRUE)).'</caption>';
+    echo '<colgroup><col class="weekNumbers"><col span="7"></colgroup>'."\n";
+    echo "<tr>\n<th>Week</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>";
+    $Month->build();
+    while ($Week = $Month->fetch()) {
+        echo "<tr>\n";
+        echo '<td>'.$Week->thisWeek($_GET['week_type'])."</td>\n";
+        $Week->build();
+
+        while ($Day = $Week->fetch()) {
+            if ($Day->isEmpty()) {
+                echo "<td> </td>\n";
+            } else {
+                echo "<td>".$Day->thisDay()."</td>\n";
+            }
+        }
+    }
+    echo "</table>\n</td>\n";
+
+    $i++;
+}
+?>
+</table>
+<p>Took: <?php echo ((getmicrotime()-$start)); ?></p>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/21.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/21.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/21.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,139 @@
+<?php
+/**
+* Description: a complete year with numeric week numbers
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+
+require_once CALENDAR_ROOT.'Year.php';
+require_once CALENDAR_ROOT.'Month/Weeks.php';
+
+define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS);
+
+if (!isset($_GET['year'])) $_GET['year'] = date('Y');
+
+$week_types = array(
+    'n_in_year',
+    'n_in_month',
+);
+
+if (!isset($_GET['week_type']) || !in_array($_GET['week_type'],$week_types) ) {
+    $_GET['week_type'] = 'n_in_year';
+}
+
+$Year = new Calendar_Year($_GET['year']);
+
+$Year->build();
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> <?php echo $Year->thisYear(); ?> </title>
+<style type="text/css">
+body {
+    font-family: Georgia, serif;
+}
+caption.year {
+    font-weight: bold;
+    font-size: 120%;
+    font-color: navy;
+}
+caption.month {
+    font-size: 110%;
+    font-color: navy;
+}
+table.month {
+    border: thin groove #800080
+}
+tr {
+    vertical-align: top;
+}
+th, td {
+    text-align: right;
+    font-size: 70%;
+}
+#prev {
+    float: left;
+    font-size: 70%;
+}
+#next {
+    float: right;
+    font-size: 70%;
+}
+#week_type {
+    float: none;
+    font-size: 70%;
+}
+.weekNumbers {
+    background-color: #e5e5f5;
+    padding-right: 3pt;
+}
+</style>
+</head>
+<body>
+<table>
+<caption class="year">
+<?php echo $Year->thisYear(); ?>
+<div id="next">
+<a href="?year=<?php echo $Year->nextYear(); ?>&week_type=<?php echo $_GET['week_type']; ?>">>></a>
+</div>
+<div id="prev">
+<a href="?year=<?php echo $Year->prevYear(); ?>&week_type=<?php echo $_GET['week_type']; ?>"><<</a>
+</div>
+<div id="week_type">
+<a href="?year=<?php echo $Year->thisYear(); ?>&week_type=n_in_year">Weeks by Year</a> : 
+<a href="?year=<?php echo $Year->thisYear(); ?>&week_type=n_in_month">Weeks by Month</a> 
+</div>
+</caption>
+<?php
+$i = 0;
+while ($Month = $Year->fetch()) {
+
+    switch ($i) {
+        case 0:
+            echo "<tr>\n";
+            break;
+        case 3:
+        case 6:
+        case 9:
+            echo "</tr>\n<tr>\n";
+           break;
+        case 12:
+            echo "</tr>\n";
+            break;
+    }
+
+    echo "<td>\n<table class=\"month\">\n";
+    echo '<caption class="month">'.date('F', $Month->thisMonth(TRUE)).'</caption>';
+    echo '<colgroup><col class="weekNumbers"><col span="7"></colgroup>'."\n";
+    echo "<tr>\n<th>Week</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>";
+    $Month->build();
+    while ($Week = $Month->fetch()) {
+        echo "<tr>\n";
+        echo '<td>'.$Week->thisWeek($_GET['week_type'])."</td>\n";
+        $Week->build();
+
+        while ($Day = $Week->fetch()) {
+            if ($Day->isEmpty()) {
+                echo "<td> </td>\n";
+            } else {
+                echo "<td>".$Day->thisDay()."</td>\n";
+            }
+        }
+    }
+    echo "</table>\n</td>\n";
+
+    $i++;
+}
+?>
+</table>
+<p>Took: <?php echo ((getmicrotime()-$start)); ?></p>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/22.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/22.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/22.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,46 @@
+<?php
+/**
+* Description: demonstrates using the Uri util
+*/
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Util/Uri.php';
+
+if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y');
+if (!isset($_GET['monat'])) $_GET['monat'] = date('m');
+
+// Build the month
+$Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']);
+
+echo ( '<p>The current month is '
+        .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>');
+
+$Uri = & new Calendar_Util_Uri('jahr','monat');
+$Uri->setFragments('jahr','monat');
+
+echo "\"Vector\" URIs<pre>";
+echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
+echo ( "This Uri:\t".htmlentities($Uri->this($Calendar,  'month'))."\n" );
+echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
+echo "</pre>";
+
+// Switch to scalar URIs
+$Uri->separator = '/'; // Default is &
+$Uri->scalar = true; // Omit variable names
+
+echo "\"Scalar\" URIs<pre>";
+echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
+echo ( "This Uri:\t".$Uri->this($Calendar,  'month')."\n" );
+echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
+echo "</pre>";
+
+// Restore the vector URIs
+$Uri->separator = '&';
+$Uri->scalar = false;
+?>
+<p>
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev($Calendar, 'month'));?>">Prev</a> :
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next($Calendar, 'month'));?>">Next</a>
+</p>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/22.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/22.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/22.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,46 @@
+<?php
+/**
+* Description: demonstrates using the Uri util
+*/
+if (!@include 'Calendar/Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Util/Uri.php';
+
+if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y');
+if (!isset($_GET['monat'])) $_GET['monat'] = date('m');
+
+// Build the month
+$Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']);
+
+echo ( '<p>The current month is '
+        .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>');
+
+$Uri = & new Calendar_Util_Uri('jahr','monat');
+$Uri->setFragments('jahr','monat');
+
+echo "\"Vector\" URIs<pre>";
+echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
+echo ( "This Uri:\t".htmlentities($Uri->this($Calendar,  'month'))."\n" );
+echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
+echo "</pre>";
+
+// Switch to scalar URIs
+$Uri->separator = '/'; // Default is &
+$Uri->scalar = true; // Omit variable names
+
+echo "\"Scalar\" URIs<pre>";
+echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
+echo ( "This Uri:\t".$Uri->this($Calendar,  'month')."\n" );
+echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
+echo "</pre>";
+
+// Restore the vector URIs
+$Uri->separator = '&';
+$Uri->scalar = false;
+?>
+<p>
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev($Calendar, 'month'));?>">Prev</a> :
+<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next($Calendar, 'month'));?>">Next</a>
+</p>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/23.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/23.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/23.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,66 @@
+<?php
+/**
+* Description: demonstrates using the Textual util
+*/
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php';
+require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
+
+// Could change language like this
+// setlocale (LC_TIME, "de_DE"); // Unix based (probably)
+// setlocale (LC_TIME, "ge"); // Windows
+
+echo "<hr>Calling: Calendar_Util_Textual::monthNames('long');<pre>";
+print_r(Calendar_Util_Textual::monthNames('long'));
+echo '</pre>';
+
+echo "<hr>Calling: Calendar_Util_Textual::weekdayNames('two');<pre>";
+print_r(Calendar_Util_Textual::weekdayNames('two'));
+echo '</pre>';
+
+echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />";
+$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
+
+echo '<hr>Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'<br />';
+echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'<br />';
+echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'<br /><hr />';
+echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'<br />';
+echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'<br />';
+echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'<br /><hr />';
+
+echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
+$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
+
+?>
+<p>Rendering calendar....</p>
+<table>
+<caption><?php echo Calendar_Util_Textual::thisMonthName($Calendar).' '.$Calendar->thisYear(); ?></caption>
+<tr>
+<?php
+$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar,'short');
+foreach ($dayheaders as $dayheader) {
+    echo '<th>'.$dayheader.'</th>';
+}
+?>
+</tr>
+<?php
+$Calendar->build();
+while ($Day = $Calendar->fetch()) {
+    if ($Day->isFirst()) {
+        echo "<tr>\n";
+    }
+    if ($Day->isEmpty()) {
+        echo '<td> </td>';
+    } else {
+        echo '<td>'.$Day->thisDay().'</td>';
+    }
+    if ($Day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+</table>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/23.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/23.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/23.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,66 @@
+<?php
+/**
+* Description: demonstrates using the Textual util
+*/
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php';
+require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
+
+// Could change language like this
+// setlocale (LC_TIME, "de_DE"); // Unix based (probably)
+// setlocale (LC_TIME, "ge"); // Windows
+
+echo "<hr>Calling: Calendar_Util_Textual::monthNames('long');<pre>";
+print_r(Calendar_Util_Textual::monthNames('long'));
+echo '</pre>';
+
+echo "<hr>Calling: Calendar_Util_Textual::weekdayNames('two');<pre>";
+print_r(Calendar_Util_Textual::weekdayNames('two'));
+echo '</pre>';
+
+echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />";
+$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
+
+echo '<hr>Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'<br />';
+echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'<br />';
+echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'<br /><hr />';
+echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'<br />';
+echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'<br />';
+echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'<br /><hr />';
+
+echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
+$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
+
+?>
+<p>Rendering calendar....</p>
+<table>
+<caption><?php echo Calendar_Util_Textual::thisMonthName($Calendar).' '.$Calendar->thisYear(); ?></caption>
+<tr>
+<?php
+$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar,'short');
+foreach ($dayheaders as $dayheader) {
+    echo '<th>'.$dayheader.'</th>';
+}
+?>
+</tr>
+<?php
+$Calendar->build();
+while ($Day = $Calendar->fetch()) {
+    if ($Day->isFirst()) {
+        echo "<tr>\n";
+    }
+    if ($Day->isEmpty()) {
+        echo '<td> </td>';
+    } else {
+        echo '<td>'.$Day->thisDay().'</td>';
+    }
+    if ($Day->isLast()) {
+        echo "</tr>\n";
+    }
+}
+?>
+</table>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/3.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/3.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/3.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,134 @@
+<?php
+/**
+* Description: Performs same behaviour as 2.php but uses Month::buildWeekDays()
+* and is faster
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = date('d');
+
+// Build the month
+$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
+
+// Construct strings for next/previous links
+$PMonth = $Month->prevMonth('object'); // Get previous month as object
+$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
+$NMonth = $Month->nextMonth('object');
+$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar </title>
+<style text="text/css">
+table {
+    background-color: silver;
+}
+caption {
+    font-family: verdana;
+    font-size: 12px;
+    background-color: while;
+}
+.prevMonth {
+    font-size: 10px;
+    text-align: left;
+}
+.nextMonth {
+    font-size: 10px;
+    text-align: right;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    color: navy;
+    text-align: right;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: right;
+}
+.selected {
+    background-color: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<?php
+$selectedDays = array (
+    new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']),
+    new Calendar_Day($_GET['y'],12,25),
+    );
+
+// Build the days in the month
+$Month->build($selectedDays);
+?>
+<h2>Built with Calendar_Month_Weekday::build()</h2>
+<table class="calendar">
+<caption>
+<?php echo ( date('F Y',$Month->getTimeStamp())); ?>
+</caption>
+<tr>
+<th>M</th>
+<th>T</th>
+<th>W</th>
+<th>T</th>
+<th>F</th>
+<th>S</th>
+<th>S</th>
+</tr>
+<?php
+while ( $Day = $Month->fetch() ) {
+
+    // Build a link string for each day
+    $link = $_SERVER['PHP_SELF'].
+                '?y='.$Day->thisYear().
+                '&m='.$Day->thisMonth().
+                '&d='.$Day->thisDay();
+
+    // isFirst() to find start of week
+    if ( $Day->isFirst() )
+        echo ( "<tr>\n" );
+
+    if ( $Day->isSelected() ) {
+       echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" );
+    } else if ( $Day->isEmpty() ) {
+        echo ( "<td> </td>\n" );
+    } else {
+        echo ( "<td><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n" );
+    }
+
+    // isLast() to find end of week
+    if ( $Day->isLast() )
+        echo ( "</tr>\n" );
+}
+?>
+<tr>
+<td>
+<a href="<?php echo ($prev);?>" class="prevMonth"><< </a>
+</td>
+<td colspan="5"> </td>
+<td>
+<a href="<?php echo ($next);?>" class="nextMonth"> >></a>
+</td>
+</tr>
+</table>
+<?php
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/3.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/3.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/3.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,134 @@
+<?php
+/**
+* Description: Performs same behaviour as 2.php but uses Month::buildWeekDays()
+* and is faster
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('m');
+if (!isset($_GET['d'])) $_GET['d'] = date('d');
+
+// Build the month
+$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
+
+// Construct strings for next/previous links
+$PMonth = $Month->prevMonth('object'); // Get previous month as object
+$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
+$NMonth = $Month->nextMonth('object');
+$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar </title>
+<style text="text/css">
+table {
+    background-color: silver;
+}
+caption {
+    font-family: verdana;
+    font-size: 12px;
+    background-color: while;
+}
+.prevMonth {
+    font-size: 10px;
+    text-align: left;
+}
+.nextMonth {
+    font-size: 10px;
+    text-align: right;
+}
+th {
+    font-family: verdana;
+    font-size: 11px;
+    color: navy;
+    text-align: right;
+}
+td {
+    font-family: verdana;
+    font-size: 11px;
+    text-align: right;
+}
+.selected {
+    background-color: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<?php
+$selectedDays = array (
+    new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']),
+    new Calendar_Day($_GET['y'],12,25),
+    );
+
+// Build the days in the month
+$Month->build($selectedDays);
+?>
+<h2>Built with Calendar_Month_Weekday::build()</h2>
+<table class="calendar">
+<caption>
+<?php echo ( date('F Y',$Month->getTimeStamp())); ?>
+</caption>
+<tr>
+<th>M</th>
+<th>T</th>
+<th>W</th>
+<th>T</th>
+<th>F</th>
+<th>S</th>
+<th>S</th>
+</tr>
+<?php
+while ( $Day = $Month->fetch() ) {
+
+    // Build a link string for each day
+    $link = $_SERVER['PHP_SELF'].
+                '?y='.$Day->thisYear().
+                '&m='.$Day->thisMonth().
+                '&d='.$Day->thisDay();
+
+    // isFirst() to find start of week
+    if ( $Day->isFirst() )
+        echo ( "<tr>\n" );
+
+    if ( $Day->isSelected() ) {
+       echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" );
+    } else if ( $Day->isEmpty() ) {
+        echo ( "<td> </td>\n" );
+    } else {
+        echo ( "<td><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n" );
+    }
+
+    // isLast() to find end of week
+    if ( $Day->isLast() )
+        echo ( "</tr>\n" );
+}
+?>
+<tr>
+<td>
+<a href="<?php echo ($prev);?>" class="prevMonth"><< </a>
+</td>
+<td colspan="5"> </td>
+<td>
+<a href="<?php echo ($next);?>" class="nextMonth"> >></a>
+</td>
+</tr>
+</table>
+<?php
+echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' );
+?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/4.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/4.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/4.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,49 @@
+<?php
+/**
+* Description: shows how to perform validation with PEAR::Calendar
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(' ', microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Second.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+if (!isset($_GET['d'])) $_GET['d'] = date('j');
+if (!isset($_GET['h'])) $_GET['h'] = date('H');
+if (!isset($_GET['i'])) $_GET['i'] = date('i');
+if (!isset($_GET['s'])) $_GET['s'] = date('s');
+
+$Unit = & new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']);
+
+echo '<p><b>Result:</b> '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay().
+        ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond();
+if ($Unit->isValid()) {
+    echo ' is valid!</p>';
+} else {
+    $V= & $Unit->getValidator();
+    echo ' is invalid:</p>';
+    while ($error = $V->fetch()) {
+        echo $error->toString() .'<br />';
+    }
+}
+?>
+<p>Enter a date / time to validate:</p>
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
+Year:   <input type="text" name="y" value="2039"><br />
+Month:  <input type="text" name="m" value="13"><br />
+Day:    <input type="text" name="d" value="32"><br />
+Hour:   <input type="text" name="h" value="24"><br />
+Minute: <input type="text" name="i" value="-1"><br />
+Second: <input type="text" name="s" value="60"><br />
+<input type="submit" value="Validate">
+</form>
+<p><b>Note:</b> Error messages can be controlled with the constants <code>CALENDAR_VALUE_TOOSMALL</code> and <code>CALENDAR_VALUE_TOOLARGE</code> - see <code>Calendar_Validator.php</code></p>
+
+<?php echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>'; ?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/4.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/4.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/4.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,49 @@
+<?php
+/**
+* Description: shows how to perform validation with PEAR::Calendar
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(' ', microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT', '../../');
+}
+require_once CALENDAR_ROOT.'Second.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+if (!isset($_GET['d'])) $_GET['d'] = date('j');
+if (!isset($_GET['h'])) $_GET['h'] = date('H');
+if (!isset($_GET['i'])) $_GET['i'] = date('i');
+if (!isset($_GET['s'])) $_GET['s'] = date('s');
+
+$Unit = & new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']);
+
+echo '<p><b>Result:</b> '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay().
+        ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond();
+if ($Unit->isValid()) {
+    echo ' is valid!</p>';
+} else {
+    $V= & $Unit->getValidator();
+    echo ' is invalid:</p>';
+    while ($error = $V->fetch()) {
+        echo $error->toString() .'<br />';
+    }
+}
+?>
+<p>Enter a date / time to validate:</p>
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
+Year:   <input type="text" name="y" value="2039"><br />
+Month:  <input type="text" name="m" value="13"><br />
+Day:    <input type="text" name="d" value="32"><br />
+Hour:   <input type="text" name="h" value="24"><br />
+Minute: <input type="text" name="i" value="-1"><br />
+Second: <input type="text" name="s" value="60"><br />
+<input type="submit" value="Validate">
+</form>
+<p><b>Note:</b> Error messages can be controlled with the constants <code>CALENDAR_VALUE_TOOSMALL</code> and <code>CALENDAR_VALUE_TOOLARGE</code> - see <code>Calendar_Validator.php</code></p>
+
+<?php echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>'; ?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/5.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/5.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/5.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,132 @@
+<?php
+/**
+* Description: generating elements of a form with PEAR::Calendar, using
+* selections as well as validating the submission
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Year.php';
+require_once CALENDAR_ROOT.'Month.php';
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Hour.php';
+require_once CALENDAR_ROOT.'Minute.php';
+require_once CALENDAR_ROOT.'Second.php';
+
+// Initialize if not set
+if (!isset($_POST['y'])) $_POST['y'] = date('Y');
+if (!isset($_POST['m'])) $_POST['m'] = date('n');
+if (!isset($_POST['d'])) $_POST['d'] = date('j');
+if (!isset($_POST['h'])) $_POST['h'] = date('H');
+if (!isset($_POST['i'])) $_POST['i'] = date('i');
+if (!isset($_POST['s'])) $_POST['s'] = date('s');
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Select and Update </title>
+</head>
+<body>
+<h1>Select and Update</h1>
+<?php
+if ( isset($_POST['update']) ) {
+    $Second = & new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']);
+    if ( !$Second->isValid() ) {
+        $V= & $Second->getValidator();
+        echo ('<p>Validation failed:</p>' );
+        while ( $error = $V->fetch() ) {
+            echo ( $error->toString() .'<br>' );
+        }
+    } else {
+        echo ('<p>Validation success.</p>' );
+        echo ( '<p>New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example');
+    }
+} else {
+$Year = new Calendar_Year($_POST['y']);
+$Month = new Calendar_Month($_POST['y'],$_POST['m']);
+$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']);
+$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']);
+$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']);
+$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']);
+?>
+<p><b>Set the alarm clock</p></p>
+<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="post">
+Year: <input type="text" name="y" value="<?php echo ( $_POST['y'] ); ?>" size="4"> 
+Month:<select name="m">
+<?php
+$selection = array($Month);
+$Year->build($selection);
+while ( $Child = & $Year->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisMonth()."\" selected>".$Child->thisMonth()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisMonth()."\">".$Child->thisMonth()."\n" );
+    }
+}
+?>
+</select> 
+Day:<select name="d">
+<?php
+$selection = array($Day);
+$Month->build($selection);
+while ( $Child = & $Month->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisDay()."\" selected>".$Child->thisDay()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisDay()."\">".$Child->thisDay()."\n" );
+    }
+}
+?>
+</select> 
+Hour:<select name="h">
+<?php
+$selection = array($Hour);
+$Day->build($selection);
+while ( $Child = & $Day->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisHour()."\" selected>".$Child->thisHour()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisHour()."\">".$Child->thisHour()."\n" );
+    }
+}
+?>
+</select> 
+Minute:<select name="i">
+<?php
+$selection = array($Minute);
+$Hour->build($selection);
+while ( $Child = & $Hour->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisMinute()."\" selected>".$Child->thisMinute()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisMinute()."\">".$Child->thisMinute()."\n" );
+    }
+}
+?>
+</select> 
+Second:<select name="s">
+<?php
+$selection = array($Second);
+$Minute->build($selection);
+while ( $Child = & $Minute->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisSecond()."\" selected>".$Child->thisSecond()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisSecond()."\">".$Child->thisSecond()."\n" );
+    }
+}
+?>
+</select> 
+<input type="submit" name="update" value="Set Alarm"><br>
+<?php
+}
+?>
+<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/5.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/5.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/5.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,132 @@
+<?php
+/**
+* Description: generating elements of a form with PEAR::Calendar, using
+* selections as well as validating the submission
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Year.php';
+require_once CALENDAR_ROOT.'Month.php';
+require_once CALENDAR_ROOT.'Day.php';
+require_once CALENDAR_ROOT.'Hour.php';
+require_once CALENDAR_ROOT.'Minute.php';
+require_once CALENDAR_ROOT.'Second.php';
+
+// Initialize if not set
+if (!isset($_POST['y'])) $_POST['y'] = date('Y');
+if (!isset($_POST['m'])) $_POST['m'] = date('n');
+if (!isset($_POST['d'])) $_POST['d'] = date('j');
+if (!isset($_POST['h'])) $_POST['h'] = date('H');
+if (!isset($_POST['i'])) $_POST['i'] = date('i');
+if (!isset($_POST['s'])) $_POST['s'] = date('s');
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Select and Update </title>
+</head>
+<body>
+<h1>Select and Update</h1>
+<?php
+if ( isset($_POST['update']) ) {
+    $Second = & new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']);
+    if ( !$Second->isValid() ) {
+        $V= & $Second->getValidator();
+        echo ('<p>Validation failed:</p>' );
+        while ( $error = $V->fetch() ) {
+            echo ( $error->toString() .'<br>' );
+        }
+    } else {
+        echo ('<p>Validation success.</p>' );
+        echo ( '<p>New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example');
+    }
+} else {
+$Year = new Calendar_Year($_POST['y']);
+$Month = new Calendar_Month($_POST['y'],$_POST['m']);
+$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']);
+$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']);
+$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']);
+$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']);
+?>
+<p><b>Set the alarm clock</p></p>
+<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="post">
+Year: <input type="text" name="y" value="<?php echo ( $_POST['y'] ); ?>" size="4"> 
+Month:<select name="m">
+<?php
+$selection = array($Month);
+$Year->build($selection);
+while ( $Child = & $Year->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisMonth()."\" selected>".$Child->thisMonth()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisMonth()."\">".$Child->thisMonth()."\n" );
+    }
+}
+?>
+</select> 
+Day:<select name="d">
+<?php
+$selection = array($Day);
+$Month->build($selection);
+while ( $Child = & $Month->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisDay()."\" selected>".$Child->thisDay()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisDay()."\">".$Child->thisDay()."\n" );
+    }
+}
+?>
+</select> 
+Hour:<select name="h">
+<?php
+$selection = array($Hour);
+$Day->build($selection);
+while ( $Child = & $Day->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisHour()."\" selected>".$Child->thisHour()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisHour()."\">".$Child->thisHour()."\n" );
+    }
+}
+?>
+</select> 
+Minute:<select name="i">
+<?php
+$selection = array($Minute);
+$Hour->build($selection);
+while ( $Child = & $Hour->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisMinute()."\" selected>".$Child->thisMinute()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisMinute()."\">".$Child->thisMinute()."\n" );
+    }
+}
+?>
+</select> 
+Second:<select name="s">
+<?php
+$selection = array($Second);
+$Minute->build($selection);
+while ( $Child = & $Minute->fetch() ) {
+    if ( $Child->isSelected() ) {
+        echo ( "<option value=\"".$Child->thisSecond()."\" selected>".$Child->thisSecond()."\n" );
+    } else {
+        echo ( "<option value=\"".$Child->thisSecond()."\">".$Child->thisSecond()."\n" );
+    }
+}
+?>
+</select> 
+<input type="submit" name="update" value="Set Alarm"><br>
+<?php
+}
+?>
+<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/6.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/6.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/6.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,210 @@
+<?php
+/**
+* Description: A "personal planner" with some WML for fun
+* Note this is done the stupid way - a giant if/else for WML or HTML
+* could be greatly simplified with some HTML/WML rendering classes...
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+if (!isset($_GET['d'])) $_GET['d'] = date('j');
+
+$Month = & new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
+$Day = & new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']);
+$selection = array($Day);
+
+#-----------------------------------------------------------------------------#
+if ( isset($_GET['mime']) && $_GET['mime']=='wml' ) {
+    header ('Content-Type: text/vnd.wap.wml');
+    echo ( '<?xml version="1.0"?>' );
+?>
+<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
+<wml>
+<big><strong>Personal Planner Rendered with WML</strong></big>
+<?php
+if ( isset($_GET['viewday']) ) {
+?>
+<p><strong>Viewing <?php echo ( date('l, jS of F, Y',$Day->getTimeStamp()) ); ?></strong></p>
+<p>
+<anchor>
+Back to Month View
+<go href="<?php
+echo ( "?y=".$Day->thisYear()."&m=".
+        $Day->thisMonth()."&d=".$Day->thisDay()."&mime=wml" );
+?>"/>
+</anchor>
+</p>
+<table>
+<?php
+    $Day->build();
+    while ( $Hour = & $Day->fetch() ) {
+        echo ( "<tr>\n" );
+        echo ( "<td>".date('g a',$Hour->getTimeStamp())."</td><td>Free time!</td>\n" );
+        echo ( "</tr>\n" );
+    }
+?>
+</table>
+<?php
+} else {
+?>
+<p><strong><?php echo ( date('F Y',$Month->getTimeStamp()) ); ?></strong></p>
+<table>
+<tr>
+<td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td><td>S</td>
+</tr>
+<?php
+$Month->build($selection);
+while ( $Day = $Month->fetch() ) {
+    if ( $Day->isFirst() ) {
+        echo ( "<tr>\n" );
+    }
+    if ( $Day->isEmpty() ) {
+        echo ( "<td></td>\n" );
+    } else if ( $Day->isSelected() ) {
+        echo ( "<td><anchor><strong><u>".$Day->thisDay()."</u></strong>\n<go href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "&mime=wml\" />\n</anchor></td>\n" );
+    } else {
+        echo ( "<td><anchor>".$Day->thisDay()."\n<go href=\"?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "&mime=wml\" /></anchor></td>\n" );
+    }
+    if ( $Day->isLast() ) {
+        echo ( "</tr>\n" );
+    }
+}
+?>
+<tr>
+<td>
+<anchor>
+<<
+<go href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->prevMonth()."&d=".$Month->thisDay()."&mime=wml" );
+?>"/>
+</anchor>
+</td>
+<td></td><td></td><td></td><td></td><td></td>
+<td>
+<anchor>
+>>
+<go href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->nextMonth()."&d=".$Month->thisDay()."&mime=wml" );
+?>"/>
+</anchor>
+</td>
+</tr>
+</table>
+
+<?php
+}
+?>
+<p><a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>">Back to HTML</a></p>
+<?php echo ( '<p>Took: '.(getmicrotime()-$start).' seconds</p>' ); ?>
+</wml>
+<?php
+#-----------------------------------------------------------------------------#
+} else {
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> HTML (+WML) Personal Planner </title>
+</head>
+<body>
+<h1>Personal Planner Rendered with HTML</h1>
+<p>To view in WML, click <a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>?mime=wml">here</a> or place a ?mime=wml at the end of any URL.
+Note that <a href="http://www.opera.com/download">Opera</a> supports WML natively and Mozilla / Firefox has the WMLBrowser
+plugin: <a href="http://wmlbrowser.mozdev.org">wmlbrowser.mozdev.org</a></p>
+<?php
+if ( isset($_GET['viewday']) ) {
+?>
+<p><strong>Viewing <?php echo ( date('l, jS of F, Y',$Day->getTimeStamp()) ); ?></strong></p>
+<p>
+<anchor>
+<a href="<?php
+echo ( "?y=".$Day->thisYear()."&m=".
+        $Day->thisMonth()."&d=".$Day->thisDay());
+?>">Back to Month View</a>
+</p>
+<table>
+<?php
+    $Day->build();
+    while ( $Hour = & $Day->fetch() ) {
+        echo ( "<tr>\n" );
+        echo ( "<td>".date('g a',$Hour->getTimeStamp())."</td><td>Free time!</td>\n" );
+        echo ( "</tr>\n" );
+    }
+?>
+</table>
+<?php
+} else {
+?>
+<p><strong><?php echo ( date('F Y',$Month->getTimeStamp()) ); ?></strong></p>
+<table>
+<tr>
+<td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td><td>S</td>
+</tr>
+<?php
+$Month->build($selection);
+while ( $Day = $Month->fetch() ) {
+    if ( $Day->isFirst() ) {
+        echo ( "<tr>\n" );
+    }
+    if ( $Day->isEmpty() ) {
+        echo ( "<td></td>\n" );
+    } else if ( $Day->isSelected() ) {
+        echo ( "<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "&wml\"><strong><u>".$Day->thisDay()."</u></strong></a></td>\n" );
+    } else {
+        echo ( "<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "\">".$Day->thisDay()."</a></td>\n" );
+    }
+    if ( $Day->isLast() ) {
+        echo ( "</tr>\n" );
+    }
+}
+?>
+<tr>
+<td>
+<a href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->prevMonth()."&d=".$Month->thisDay() );
+?>">
+<<</a>
+</td>
+<td></td><td></td><td></td><td></td><td></td>
+<td>
+<a href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->nextMonth()."&d=".$Month->thisDay() );
+?>">>></a>
+</td>
+</tr>
+</table>
+
+<?php
+}
+?>
+
+
+<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?>
+</body>
+</html>
+<?php
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/6.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/6.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/6.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,210 @@
+<?php
+/**
+* Description: A "personal planner" with some WML for fun
+* Note this is done the stupid way - a giant if/else for WML or HTML
+* could be greatly simplified with some HTML/WML rendering classes...
+*/
+function getmicrotime(){
+    list($usec, $sec) = explode(" ",microtime());
+    return ((float)$usec + (float)$sec);
+}
+$start = getmicrotime();
+
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Month/Weekdays.php';
+require_once CALENDAR_ROOT.'Day.php';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+if (!isset($_GET['d'])) $_GET['d'] = date('j');
+
+$Month = & new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
+$Day = & new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']);
+$selection = array($Day);
+
+#-----------------------------------------------------------------------------#
+if ( isset($_GET['mime']) && $_GET['mime']=='wml' ) {
+    header ('Content-Type: text/vnd.wap.wml');
+    echo ( '<?xml version="1.0"?>' );
+?>
+<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
+<wml>
+<big><strong>Personal Planner Rendered with WML</strong></big>
+<?php
+if ( isset($_GET['viewday']) ) {
+?>
+<p><strong>Viewing <?php echo ( date('l, jS of F, Y',$Day->getTimeStamp()) ); ?></strong></p>
+<p>
+<anchor>
+Back to Month View
+<go href="<?php
+echo ( "?y=".$Day->thisYear()."&m=".
+        $Day->thisMonth()."&d=".$Day->thisDay()."&mime=wml" );
+?>"/>
+</anchor>
+</p>
+<table>
+<?php
+    $Day->build();
+    while ( $Hour = & $Day->fetch() ) {
+        echo ( "<tr>\n" );
+        echo ( "<td>".date('g a',$Hour->getTimeStamp())."</td><td>Free time!</td>\n" );
+        echo ( "</tr>\n" );
+    }
+?>
+</table>
+<?php
+} else {
+?>
+<p><strong><?php echo ( date('F Y',$Month->getTimeStamp()) ); ?></strong></p>
+<table>
+<tr>
+<td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td><td>S</td>
+</tr>
+<?php
+$Month->build($selection);
+while ( $Day = $Month->fetch() ) {
+    if ( $Day->isFirst() ) {
+        echo ( "<tr>\n" );
+    }
+    if ( $Day->isEmpty() ) {
+        echo ( "<td></td>\n" );
+    } else if ( $Day->isSelected() ) {
+        echo ( "<td><anchor><strong><u>".$Day->thisDay()."</u></strong>\n<go href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "&mime=wml\" />\n</anchor></td>\n" );
+    } else {
+        echo ( "<td><anchor>".$Day->thisDay()."\n<go href=\"?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "&mime=wml\" /></anchor></td>\n" );
+    }
+    if ( $Day->isLast() ) {
+        echo ( "</tr>\n" );
+    }
+}
+?>
+<tr>
+<td>
+<anchor>
+<<
+<go href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->prevMonth()."&d=".$Month->thisDay()."&mime=wml" );
+?>"/>
+</anchor>
+</td>
+<td></td><td></td><td></td><td></td><td></td>
+<td>
+<anchor>
+>>
+<go href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->nextMonth()."&d=".$Month->thisDay()."&mime=wml" );
+?>"/>
+</anchor>
+</td>
+</tr>
+</table>
+
+<?php
+}
+?>
+<p><a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>">Back to HTML</a></p>
+<?php echo ( '<p>Took: '.(getmicrotime()-$start).' seconds</p>' ); ?>
+</wml>
+<?php
+#-----------------------------------------------------------------------------#
+} else {
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> HTML (+WML) Personal Planner </title>
+</head>
+<body>
+<h1>Personal Planner Rendered with HTML</h1>
+<p>To view in WML, click <a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>?mime=wml">here</a> or place a ?mime=wml at the end of any URL.
+Note that <a href="http://www.opera.com/download">Opera</a> supports WML natively and Mozilla / Firefox has the WMLBrowser
+plugin: <a href="http://wmlbrowser.mozdev.org">wmlbrowser.mozdev.org</a></p>
+<?php
+if ( isset($_GET['viewday']) ) {
+?>
+<p><strong>Viewing <?php echo ( date('l, jS of F, Y',$Day->getTimeStamp()) ); ?></strong></p>
+<p>
+<anchor>
+<a href="<?php
+echo ( "?y=".$Day->thisYear()."&m=".
+        $Day->thisMonth()."&d=".$Day->thisDay());
+?>">Back to Month View</a>
+</p>
+<table>
+<?php
+    $Day->build();
+    while ( $Hour = & $Day->fetch() ) {
+        echo ( "<tr>\n" );
+        echo ( "<td>".date('g a',$Hour->getTimeStamp())."</td><td>Free time!</td>\n" );
+        echo ( "</tr>\n" );
+    }
+?>
+</table>
+<?php
+} else {
+?>
+<p><strong><?php echo ( date('F Y',$Month->getTimeStamp()) ); ?></strong></p>
+<table>
+<tr>
+<td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td><td>S</td>
+</tr>
+<?php
+$Month->build($selection);
+while ( $Day = $Month->fetch() ) {
+    if ( $Day->isFirst() ) {
+        echo ( "<tr>\n" );
+    }
+    if ( $Day->isEmpty() ) {
+        echo ( "<td></td>\n" );
+    } else if ( $Day->isSelected() ) {
+        echo ( "<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "&wml\"><strong><u>".$Day->thisDay()."</u></strong></a></td>\n" );
+    } else {
+        echo ( "<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=".
+            $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay().
+            "\">".$Day->thisDay()."</a></td>\n" );
+    }
+    if ( $Day->isLast() ) {
+        echo ( "</tr>\n" );
+    }
+}
+?>
+<tr>
+<td>
+<a href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->prevMonth()."&d=".$Month->thisDay() );
+?>">
+<<</a>
+</td>
+<td></td><td></td><td></td><td></td><td></td>
+<td>
+<a href="<?php
+echo ( "?y=".$Month->thisYear()."&m=".
+        $Month->nextMonth()."&d=".$Month->thisDay() );
+?>">>></a>
+</td>
+</tr>
+</table>
+
+<?php
+}
+?>
+
+
+<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?>
+</body>
+</html>
+<?php
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/7.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/7.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/7.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,92 @@
+<?php
+/**
+* Description: a SOAP Calendar Server
+*/
+if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Server.php')) {
+    die('You must have PEAR::SOAP installed');
+}
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+
+class Calendar_Server
+{
+    var $__dispatch_map = array();
+    var $__typedef      = array();
+
+    function Calendar_Server()
+    {
+        $this->__dispatch_map['getMonth'] =
+            array('in'  => array('year' => 'int', 'month'=>'int'),
+                  'out' => array('month' => '{urn:PEAR_SOAP_Calendar}Month'),
+                  );
+        $this->__typedef['Month'] = array (
+                'monthname' => 'string',
+                'days' => '{urn:PEAR_SOAP_Calendar}MonthDays'
+            );
+        $this->__typedef['MonthDays'] = array (array ('{urn:PEAR_SOAP_Calendar}Day'));
+        $this->__typedef['Day'] = array (
+                'isFirst' => 'int',
+                'isLast'  => 'int',
+                'isEmpty' => 'int',
+                'day'     => 'int' );
+    }
+
+    function __dispatch($methodname)
+    {
+        if (isset($this->__dispatch_map[$methodname]))
+            return $this->__dispatch_map[$methodname];
+        return NULL;
+    }
+
+    function getMonth($year, $month)
+    {
+        require_once(CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php');
+        $Month = & new Calendar_Month_Weekdays($year,$month);
+        if (!$Month->isValid()) {
+            $V = & $Month->getValidator();
+            $errorMsg = '';
+            while ($error = $V->fetch()) {
+                $errorMsg .= $error->toString()."\n";
+            }
+            return new SOAP_Fault($errorMsg, 'Client');
+        } else {
+            $monthname = date('F Y', $Month->getTimeStamp());
+            $days = array();
+            $Month->build();
+            while ($Day = & $Month->fetch()) {
+                $day = array(
+                    'isFirst' => (int)$Day->isFirst(),
+                    'isLast'  => (int)$Day->isLast(),
+                    'isEmpty' => (int)$Day->isEmpty(),
+                    'day'     => (int)$Day->thisDay(),
+                    );
+                $days[] = $day;
+            }
+            return array('monthname' => $monthname, 'days' => $days);
+        }
+    }
+}
+
+$server = new SOAP_Server();
+$server->_auto_translation = true;
+$calendar = new Calendar_Server();
+$server->addObjectMap($calendar, 'urn:PEAR_SOAP_Calendar');
+
+if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') {
+    $server->service($GLOBALS['HTTP_RAW_POST_DATA']);
+} else {
+    require_once 'SOAP'.DIRECTORY_SEPARATOR.'Disco.php';
+    $disco = new SOAP_DISCO_Server($server, "PEAR_SOAP_Calendar");
+    if (isset($_SERVER['QUERY_STRING']) &&
+        strcasecmp($_SERVER['QUERY_STRING'], 'wsdl')==0) {
+        header("Content-type: text/xml");
+        echo $disco->getWSDL();
+    } else {
+        echo 'This is a PEAR::SOAP Calendar Server. For client try <a href="8.php">here</a><br />';
+        echo 'For WSDL try <a href="?wsdl">here</a>';
+    }
+    exit;
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/7.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/7.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/7.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,92 @@
+<?php
+/**
+* Description: a SOAP Calendar Server
+*/
+if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Server.php')) {
+    die('You must have PEAR::SOAP installed');
+}
+
+if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
+    define('CALENDAR_ROOT', '../../');
+}
+
+class Calendar_Server
+{
+    var $__dispatch_map = array();
+    var $__typedef      = array();
+
+    function Calendar_Server()
+    {
+        $this->__dispatch_map['getMonth'] =
+            array('in'  => array('year' => 'int', 'month'=>'int'),
+                  'out' => array('month' => '{urn:PEAR_SOAP_Calendar}Month'),
+                  );
+        $this->__typedef['Month'] = array (
+                'monthname' => 'string',
+                'days' => '{urn:PEAR_SOAP_Calendar}MonthDays'
+            );
+        $this->__typedef['MonthDays'] = array (array ('{urn:PEAR_SOAP_Calendar}Day'));
+        $this->__typedef['Day'] = array (
+                'isFirst' => 'int',
+                'isLast'  => 'int',
+                'isEmpty' => 'int',
+                'day'     => 'int' );
+    }
+
+    function __dispatch($methodname)
+    {
+        if (isset($this->__dispatch_map[$methodname]))
+            return $this->__dispatch_map[$methodname];
+        return NULL;
+    }
+
+    function getMonth($year, $month)
+    {
+        require_once(CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php');
+        $Month = & new Calendar_Month_Weekdays($year,$month);
+        if (!$Month->isValid()) {
+            $V = & $Month->getValidator();
+            $errorMsg = '';
+            while ($error = $V->fetch()) {
+                $errorMsg .= $error->toString()."\n";
+            }
+            return new SOAP_Fault($errorMsg, 'Client');
+        } else {
+            $monthname = date('F Y', $Month->getTimeStamp());
+            $days = array();
+            $Month->build();
+            while ($Day = & $Month->fetch()) {
+                $day = array(
+                    'isFirst' => (int)$Day->isFirst(),
+                    'isLast'  => (int)$Day->isLast(),
+                    'isEmpty' => (int)$Day->isEmpty(),
+                    'day'     => (int)$Day->thisDay(),
+                    );
+                $days[] = $day;
+            }
+            return array('monthname' => $monthname, 'days' => $days);
+        }
+    }
+}
+
+$server = new SOAP_Server();
+$server->_auto_translation = true;
+$calendar = new Calendar_Server();
+$server->addObjectMap($calendar, 'urn:PEAR_SOAP_Calendar');
+
+if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') {
+    $server->service($GLOBALS['HTTP_RAW_POST_DATA']);
+} else {
+    require_once 'SOAP'.DIRECTORY_SEPARATOR.'Disco.php';
+    $disco = new SOAP_DISCO_Server($server, "PEAR_SOAP_Calendar");
+    if (isset($_SERVER['QUERY_STRING']) &&
+        strcasecmp($_SERVER['QUERY_STRING'], 'wsdl')==0) {
+        header("Content-type: text/xml");
+        echo $disco->getWSDL();
+    } else {
+        echo 'This is a PEAR::SOAP Calendar Server. For client try <a href="8.php">here</a><br />';
+        echo 'For WSDL try <a href="?wsdl">here</a>';
+    }
+    exit;
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/8.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/8.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/8.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Description: client for the SOAP Calendar Server
+ */
+if ( version_compare(phpversion(), "5.0.0", ">") ) {
+    die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3)
+        - remove @ before include below to see why');
+}
+
+if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Client.php')) {
+    die('You must have PEAR::SOAP installed');
+}
+
+// Just to save manaul modification...
+$basePath = explode('/', $_SERVER['SCRIPT_NAME']);
+array_pop($basePath);
+$basePath = implode('/', $basePath);
+$url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+
+$wsdl = new SOAP_WSDL ($url);
+
+echo ( '<pre>'.$wsdl->generateProxyCode().'</pre>' );
+
+$calendarClient = $wsdl->getProxy();
+
+$month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']);
+
+if ( PEAR::isError($month) ) {
+    die ( $month->toString() );
+}
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar over the Wire </title>
+</head>
+<body>
+<h1>Calendar Over the Wire (featuring PEAR::SOAP)</h1>
+<table>
+<caption><b><?php echo ( $month->monthname );?></b></caption>
+<tr>
+<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>
+</tr>
+<?php
+foreach ( $month->days as $day ) {
+
+    if ( $day->isFirst === 1 )
+        echo ( "<tr>\n" );
+    if ( $day->isEmpty === 1 ) {
+        echo ( "<td></td>" );
+    } else {
+        echo ( "<td>".$day->day."</td>" );
+    }
+    if ( $day->isLast === 1 )
+        echo ( "</tr>\n" );
+}
+?>
+<tr>
+</table>
+<p>Enter Year and Month to View:</p>
+<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="get">
+Year: <input type="text" size="4" name="y" value="<?php echo ( $_GET['y'] ); ?>"> 
+Month: <input type="text" size="2" name="m" value="<?php echo ( $_GET['m'] ); ?>"> 
+<input type="submit" value="Fetch Calendar">
+</form>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/8.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/8.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/8.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Description: client for the SOAP Calendar Server
+ */
+if ( version_compare(phpversion(), "5.0.0", ">") ) {
+    die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3)
+        - remove @ before include below to see why');
+}
+
+if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Client.php')) {
+    die('You must have PEAR::SOAP installed');
+}
+
+// Just to save manaul modification...
+$basePath = explode('/', $_SERVER['SCRIPT_NAME']);
+array_pop($basePath);
+$basePath = implode('/', $basePath);
+$url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl';
+
+if (!isset($_GET['y'])) $_GET['y'] = date('Y');
+if (!isset($_GET['m'])) $_GET['m'] = date('n');
+
+$wsdl = new SOAP_WSDL ($url);
+
+echo ( '<pre>'.$wsdl->generateProxyCode().'</pre>' );
+
+$calendarClient = $wsdl->getProxy();
+
+$month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']);
+
+if ( PEAR::isError($month) ) {
+    die ( $month->toString() );
+}
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title> Calendar over the Wire </title>
+</head>
+<body>
+<h1>Calendar Over the Wire (featuring PEAR::SOAP)</h1>
+<table>
+<caption><b><?php echo ( $month->monthname );?></b></caption>
+<tr>
+<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>
+</tr>
+<?php
+foreach ( $month->days as $day ) {
+
+    if ( $day->isFirst === 1 )
+        echo ( "<tr>\n" );
+    if ( $day->isEmpty === 1 ) {
+        echo ( "<td></td>" );
+    } else {
+        echo ( "<td>".$day->day."</td>" );
+    }
+    if ( $day->isLast === 1 )
+        echo ( "</tr>\n" );
+}
+?>
+<tr>
+</table>
+<p>Enter Year and Month to View:</p>
+<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="get">
+Year: <input type="text" size="4" name="y" value="<?php echo ( $_GET['y'] ); ?>"> 
+Month: <input type="text" size="2" name="m" value="<?php echo ( $_GET['m'] ); ?>"> 
+<input type="submit" value="Fetch Calendar">
+</form>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/9.php
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/9.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/9.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,16 @@
+<?php
+/**
+* Description: simple example on i18N
+*/
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+
+$Day = & new Calendar_Day(2003,10,23);
+
+setlocale (LC_TIME, "de_DE"); // Unix based (probably)
+// setlocale (LC_TIME, "ge"); // Windows
+
+echo ( strftime('%A %d %B %Y',$Day->getTimeStamp()));
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/9.phps
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/9.phps	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/9.phps	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,16 @@
+<?php
+/**
+* Description: simple example on i18N
+*/
+if ( !@include 'Calendar/Calendar.php' ) {
+    define('CALENDAR_ROOT','../../');
+}
+require_once CALENDAR_ROOT.'Day.php';
+
+$Day = & new Calendar_Day(2003,10,23);
+
+setlocale (LC_TIME, "de_DE"); // Unix based (probably)
+// setlocale (LC_TIME, "ge"); // Windows
+
+echo ( strftime('%A %d %B %Y',$Day->getTimeStamp()));
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/docs/examples/index.html
===================================================================
--- eccube2/trunk/data/module/Calendar/docs/examples/index.html	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/docs/examples/index.html	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+  <title>PEAR::Calendar Examples</title>
+  <style type="text/css">
+  body {
+     font-family: georgia, serif;
+  }
+  pre {
+     background-color: silver;
+  }
+  code {
+     color: navy;
+     background-color: #e2e3e4;
+  }
+  </style>
+</head>
+
+<body>
+<h1>PEAR::Calendar Examples</h1>
+<p>$Id: index.html,v 1.6 2004/08/17 09:10:53 hfuecks Exp $</p>
+<ul>
+<li><a href="1.php">1.php</a> [<a href="1.phps">src</a>] - shows basic usage, passing all the way down from <code>Calendar_Year</code> to <code>Calendar_Second</code> - more of a quick test it's working</li>
+<li><a href="2.php">2.php</a> [<a href="2.phps">src</a>] - shows how to build a tabular month using <code>Calendar_Month_Weeks</code>, <code>Calendar_Week</code>, <code>Calendar_Day</code> as well as selecting some dates.</li>
+<li><a href="3.php">3.php</a> [<a href="3.phps">src</a>] - shows how to build a tabular month using <code>Calendar_Month_Weekdays</code> and <code>Calendar_Day</code>, as well as selecting some dates (this method is faster).</li>
+<li><a href="4.php">4.php</a> [<a href="4.phps">src</a>] - shows how to use PEAR::Calendar for validation.</li>
+<li><a href="5.php">5.php</a> [<a href="5.phps">src</a>] - shows PEAR::Calendar in use to help generate a form.</li>
+<li><a href="6.php">6.php</a> [<a href="6.phps">src</a>] - a month and day "planner" calendar, which can be rendered both as HTML and WML.</li>
+<li><a href="7.php">7.php</a> [<a href="7.phps">src</a>] - a simple SOAP Calendar Server, using PEAR::SOAP and PEAR::Calendar</li>
+<li><a href="8.php">8.php</a> [<a href="8.phps">src</a>] - a WSDL SOAP client for the SOAP Calendar Server</li>
+<li><a href="9.php">9.php</a> [<a href="9.phps">src</a>] - quick example of i18n with <code>setlocale</code> (not working on SF)</li>
+<li><a href="10.php">10.php</a> [<a href="10.phps">src</a>] - an example of extending <code>Calendar_Decorator</code> to modify output</li>
+<li><a href="11.php">11.php</a> [<a href="11.phps">src</a>] - attaching a "payload" (e.g. results of a DB query) to a calendar using <code>Calendar_Decorator</code> to allow the payload to be available inside the main loop.</li>
+<li><a href="12.php">12.php</a> [<a href="12.phps">src</a>] - a complete year with months.</li>
+<li><a href="13.php">13.php</a> [<a href="13.phps">src</a>] - same as 1.php but using <code>Calendar_Engine_PearDate</code>, (see <a href="http://pear.php.net/Date">PEAR::Date</a>).</li>
+<li><a href="14.php">14.php</a> [<a href="14.phps">src</a>] - same as 3.php but using <code>Calendar_Engine_PearDate</code></li>
+<li><a href="15.php">15.php</a> [<a href="15.phps">src</a>] - paging through weeks </li>
+<li><a href="16.php">16.php</a> [<a href="16.phps">src</a>] - example of <code>Calendar_Decorator_Uri</code>. <i>Note</i> you should prefer <code>Calendar_Util_Uri</code> (see below) in most cases, for performance </li>
+<li><a href="17.php">17.php</a> [<a href="17.phps">src</a>] - example of <code>Calendar_Decorator_Textual</code>. <i>Note</i> you should prefer <code>Calendar_Util_Textual</code> (see below) in most cases, for performance</li>
+<li><a href="18.php">18.php</a> [<a href="18.phps">src</a>] - example of <code>Calendar_Decorator_Wrapper</code>.</li>
+<li><a href="19.php">19.php</a> [<a href="19.phps">src</a>] - example of <code>Calendar_Decorator_Weekday</code>.</li>
+<li><a href="20.php">20.php</a> [<a href="20.phps">src</a>] - shows how to attach a "payload" spanning multiple days, with more than one entry per day</li>
+<li><a href="21.php">21.php</a> [<a href="21.phps">src</a>] - same as 12.php but using <code>Calendar_Month_Weeks</code> instead of <code>Calendar_Month_Weekdays</code> to allow the week in the year or week in the month to be displayed.</li>
+<li><a href="22.php">22.php</a> [<a href="22.phps">src</a>] - demonstrates use of <code>Calendar_Util_Uri</code>.</li>
+<li><a href="23.php">23.php</a> [<a href="23.phps">src</a>] - demonstrates use of <code>Calendar_Util_Textual</code>.</li>
+<li><a href="24.php">24.php</a> [<a href="24.phps">src</a>] - <code>Calendar_Decorator_Weekday</code> combined with <code>Calendar_Decorator_Wrapper</code> to decorate days in the month.</li>
+</ul>
+</body>
+</html>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/README
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/README	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/README	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,7 @@
+These tests require Simple Test: http://www.lastcraft.com/simple_test.php
+
+Ideally they would use PEAR::PHPUnit but the current version has bugs and
+lacks alot of the functionality (e.g. Mock Objects) which Simple Test
+provides.
+
+Modifying the simple_include.php script for your simple test install dir
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/all_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/all_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/all_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,34 @@
+<?php
+// $Id: all_tests.php,v 1.2 2004/08/16 08:55:24 hfuecks Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+define("TEST_RUNNING", true);
+
+require_once('./calendar_tests.php');
+require_once('./calendar_tabular_tests.php');
+require_once('./validator_tests.php');
+require_once('./calendar_engine_tests.php');
+require_once('./calendar_engine_tests.php');
+require_once('./table_helper_tests.php');
+require_once('./decorator_tests.php');
+require_once('./util_tests.php');
+
+
+class AllTests extends GroupTest {
+    function AllTests() {
+        $this->GroupTest('All PEAR::Calendar Tests');
+        $this->AddTestCase(new CalendarTests());
+        $this->AddTestCase(new CalendarTabularTests());
+        $this->AddTestCase(new ValidatorTests());
+        $this->AddTestCase(new CalendarEngineTests());
+        $this->AddTestCase(new TableHelperTests());
+        $this->AddTestCase(new DecoratorTests());
+        $this->AddTestCase(new UtilTests());
+    }
+}
+
+$test = &new AllTests();
+$test->run(new HtmlReporter());
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/calendar_engine_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/calendar_engine_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/calendar_engine_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,20 @@
+<?php
+// $Id: calendar_engine_tests.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class CalendarEngineTests extends GroupTest {
+    function CalendarEngineTests() {
+        $this->GroupTest('Calendar Engine Tests');
+        $this->addTestFile('peardate_engine_test.php');
+        $this->addTestFile('unixts_engine_test.php');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new CalendarEngineTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/calendar_include.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/calendar_include.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/calendar_include.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,28 @@
+<?php
+// $Id: calendar_include.php,v 1.4 2004/08/16 12:56:10 hfuecks Exp $
+if ( !@include 'Calendar/Calendar.php' ) {
+    @define('CALENDAR_ROOT','../');
+}
+require_once(CALENDAR_ROOT . 'Year.php');
+require_once(CALENDAR_ROOT . 'Month.php');
+require_once(CALENDAR_ROOT . 'Day.php');
+require_once(CALENDAR_ROOT . 'Week.php');
+require_once(CALENDAR_ROOT . 'Hour.php');
+require_once(CALENDAR_ROOT . 'Minute.php');
+require_once(CALENDAR_ROOT . 'Second.php');
+require_once(CALENDAR_ROOT . 'Month.php');
+require_once(CALENDAR_ROOT . 'Decorator.php');
+require_once(CALENDAR_ROOT . 'Month/Weekdays.php');
+require_once(CALENDAR_ROOT . 'Month/Weeks.php');
+require_once(CALENDAR_ROOT . 'Validator.php');
+require_once(CALENDAR_ROOT . 'Engine/Interface.php');
+require_once(CALENDAR_ROOT . 'Engine/UnixTs.php');
+require_once(CALENDAR_ROOT . 'Engine/PearDate.php');
+require_once(CALENDAR_ROOT . 'Table/Helper.php');
+require_once(CALENDAR_ROOT . 'Decorator/Textual.php');
+require_once(CALENDAR_ROOT . 'Decorator/Uri.php');
+require_once(CALENDAR_ROOT . 'Decorator/Weekday.php');
+require_once(CALENDAR_ROOT . 'Decorator/Wrapper.php');
+require_once(CALENDAR_ROOT . 'Util/Uri.php');
+require_once(CALENDAR_ROOT . 'Util/Textual.php');
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/calendar_tabular_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/calendar_tabular_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/calendar_tabular_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,22 @@
+<?php
+// $Id: calendar_tabular_tests.php,v 1.2 2005/10/20 18:59:45 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class CalendarTabularTests extends GroupTest {
+    function CalendarTabularTests() {
+        $this->GroupTest('Calendar Tabular Tests');
+        $this->addTestFile('month_weekdays_test.php');
+        $this->addTestFile('month_weeks_test.php');
+        $this->addTestFile('week_test.php');
+        //$this->addTestFile('week_firstday_0_test.php'); //switch with the above
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new CalendarTabularTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/calendar_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/calendar_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/calendar_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,115 @@
+<?php
+// $Id: calendar_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class TestOfCalendar extends UnitTestCase {
+    var $cal;
+    function TestOfCalendar($name='Test of Calendar') {
+        $this->UnitTestCase($name);
+    }
+    function setUp() {
+        $this->cal = new Calendar(2003,10,25,13,32,43);
+    }
+    function tearDown() {
+        unset($this->cal);
+    }
+    function testPrevYear () {
+        $this->assertEqual(2002,$this->cal->prevYear());
+    }
+    function testPrevYear_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2002,
+                'month'  => 1,
+                'day'    => 1,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevYear('array'));
+    }
+    function testThisYear () {
+        $this->assertEqual(2003,$this->cal->thisYear());
+    }
+    function testNextYear () {
+        $this->assertEqual(2004,$this->cal->nextYear());
+    }
+    function testPrevMonth () {
+        $this->assertEqual(9,$this->cal->prevMonth());
+    }
+    function testPrevMonth_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 9,
+                'day'    => 1,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevMonth('array'));
+    }
+    function testThisMonth () {
+        $this->assertEqual(10,$this->cal->thisMonth());
+    }
+    function testNextMonth () {
+        $this->assertEqual(11,$this->cal->nextMonth());
+    }
+    function testPrevDay () {
+        $this->assertEqual(24,$this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 24,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(25,$this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(26,$this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(12,$this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(13,$this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(14,$this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(31,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(32,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(33,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(42,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(43,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(44,$this->cal->nextSecond());
+    }
+    function testSetTimeStamp() {
+        $stamp = mktime(13,32,43,10,25,2003);
+        $this->cal->setTimeStamp($stamp);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(13,32,43,10,25,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/calendar_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/calendar_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/calendar_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,25 @@
+<?php
+// $Id: calendar_tests.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class CalendarTests extends GroupTest {
+    function CalendarTests() {
+        $this->GroupTest('Calendar Tests');
+        $this->addTestFile('calendar_test.php');
+        $this->addTestFile('year_test.php');
+        $this->addTestFile('month_test.php');
+        $this->addTestFile('day_test.php');
+        $this->addTestFile('hour_test.php');
+        $this->addTestFile('minute_test.php');
+        $this->addTestFile('second_test.php');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new CalendarTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/day_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/day_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/day_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,107 @@
+<?php
+// $Id: day_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfDay extends TestOfCalendar {
+    function TestOfDay() {
+        $this->UnitTestCase('Test of Day');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Day(2003,10,25);
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 24,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testPrevHour () {
+        $this->assertEqual(23,$this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0,$this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1,$this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,10,25,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfDayBuild extends TestOfDay {
+    function TestOfDayBuild() {
+        $this->UnitTestCase('Test of Day::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(24,$this->cal->size());
+    }
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(24,$i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Hour.php');
+        $selection = array(new Calendar_Hour(2003,10,25,13));
+        $this->cal->build($selection);
+        $i = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $i == 13 )
+                break;
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfDay();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfDayBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/decorator_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/decorator_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/decorator_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,268 @@
+<?php
+// $Id: decorator_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+Mock::generate('Calendar_Engine_Interface','Mock_Calendar_Engine');
+Mock::generate('Calendar_Second','Mock_Calendar_Second');
+Mock::generate('Calendar_Week','Mock_Calendar_Week');
+Mock::generate('Calendar_Day','Mock_Calendar_Day');
+
+class TestOfDecorator extends UnitTestCase {
+    var $mockengine;
+    var $mockcal;
+    var $decorator;
+    function TestOfDecorator() {
+        $this->UnitTestCase('Test of Calendar_Decorator');
+    }
+    function setUp() {
+        $this->mockengine = new Mock_Calendar_Engine($this);
+        $this->mockcal = new Mock_Calendar_Second($this);
+        $this->mockcal->setReturnValue('prevYear',2002);
+        $this->mockcal->setReturnValue('thisYear',2003);
+        $this->mockcal->setReturnValue('nextYear',2004);
+        $this->mockcal->setReturnValue('prevMonth',9);
+        $this->mockcal->setReturnValue('thisMonth',10);
+        $this->mockcal->setReturnValue('nextMonth',11);
+        $this->mockcal->setReturnValue('prevDay',14);
+        $this->mockcal->setReturnValue('thisDay',15);
+        $this->mockcal->setReturnValue('nextDay',16);
+        $this->mockcal->setReturnValue('prevHour',12);
+        $this->mockcal->setReturnValue('thisHour',13);
+        $this->mockcal->setReturnValue('nextHour',14);
+        $this->mockcal->setReturnValue('prevMinute',29);
+        $this->mockcal->setReturnValue('thisMinute',30);
+        $this->mockcal->setReturnValue('nextMinute',31);
+        $this->mockcal->setReturnValue('prevSecond',44);
+        $this->mockcal->setReturnValue('thisSecond',45);
+        $this->mockcal->setReturnValue('nextSecond',46);
+        $this->mockcal->setReturnValue('getEngine',$this->mockengine);
+        $this->mockcal->setReturnValue('getTimestamp',12345);
+
+    }
+    function tearDown() {
+        unset ( $this->engine );
+        unset ( $this->mockcal );
+    }
+    function testPrevYear() {
+        $this->mockcal->expectOnce('prevYear',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(2002,$Decorator->prevYear());
+    }
+    function testThisYear() {
+        $this->mockcal->expectOnce('thisYear',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(2003,$Decorator->thisYear());
+    }
+    function testNextYear() {
+        $this->mockcal->expectOnce('nextYear',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(2004,$Decorator->nextYear());
+    }
+    function testPrevMonth() {
+        $this->mockcal->expectOnce('prevMonth',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(9,$Decorator->prevMonth());
+    }
+    function testThisMonth() {
+        $this->mockcal->expectOnce('thisMonth',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(10,$Decorator->thisMonth());
+    }
+    function testNextMonth() {
+        $this->mockcal->expectOnce('nextMonth',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(11,$Decorator->nextMonth());
+    }
+    function testPrevWeek() {
+        $mockweek = & new Mock_Calendar_Week($this);
+        $mockweek->setReturnValue('prevWeek',1);
+        $mockweek->expectOnce('prevWeek',array('n_in_month'));
+        $Decorator =& new Calendar_Decorator($mockweek);
+        $this->assertEqual(1,$Decorator->prevWeek());
+    }
+    function testThisWeek() {
+        $mockweek = & new Mock_Calendar_Week($this);
+        $mockweek->setReturnValue('thisWeek',2);
+        $mockweek->expectOnce('thisWeek',array('n_in_month'));
+        $Decorator =& new Calendar_Decorator($mockweek);
+        $this->assertEqual(2,$Decorator->thisWeek());
+    }
+    function testNextWeek() {
+        $mockweek = & new Mock_Calendar_Week($this);
+        $mockweek->setReturnValue('nextWeek',3);
+        $mockweek->expectOnce('nextWeek',array('n_in_month'));
+        $Decorator =& new Calendar_Decorator($mockweek);
+        $this->assertEqual(3,$Decorator->nextWeek());
+    }
+    function testPrevDay() {
+        $this->mockcal->expectOnce('prevDay',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(14,$Decorator->prevDay());
+    }
+    function testThisDay() {
+        $this->mockcal->expectOnce('thisDay',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(15,$Decorator->thisDay());
+    }
+    function testNextDay() {
+        $this->mockcal->expectOnce('nextDay',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(16,$Decorator->nextDay());
+    }
+    function testPrevHour() {
+        $this->mockcal->expectOnce('prevHour',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(12,$Decorator->prevHour());
+    }
+    function testThisHour() {
+        $this->mockcal->expectOnce('thisHour',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(13,$Decorator->thisHour());
+    }
+    function testNextHour() {
+        $this->mockcal->expectOnce('nextHour',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(14,$Decorator->nextHour());
+    }
+    function testPrevMinute() {
+        $this->mockcal->expectOnce('prevMinute',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(29,$Decorator->prevMinute());
+    }
+    function testThisMinute() {
+        $this->mockcal->expectOnce('thisMinute',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(30,$Decorator->thisMinute());
+    }
+    function testNextMinute() {
+        $this->mockcal->expectOnce('nextMinute',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(31,$Decorator->nextMinute());
+    }
+    function testPrevSecond() {
+        $this->mockcal->expectOnce('prevSecond',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(44,$Decorator->prevSecond());
+    }
+    function testThisSecond() {
+        $this->mockcal->expectOnce('thisSecond',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(45,$Decorator->thisSecond());
+    }
+    function testNextSecond() {
+        $this->mockcal->expectOnce('nextSecond',array('int'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(46,$Decorator->nextSecond());
+    }
+    function testGetEngine() {
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertIsA($Decorator->getEngine(),'Mock_Calendar_Engine');
+    }
+    function testSetTimestamp() {
+        $this->mockcal->expectOnce('setTimestamp',array('12345'));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->setTimestamp('12345');
+    }
+    function testGetTimestamp() {
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual(12345,$Decorator->getTimestamp());
+    }
+    function testSetSelected() {
+        $this->mockcal->expectOnce('setSelected',array(true));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->setSelected();
+    }
+    function testIsSelected() {
+        $this->mockcal->setReturnValue('isSelected',true);
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertTrue($Decorator->isSelected());
+    }
+    function testAdjust() {
+        $this->mockcal->expectOnce('adjust',array());
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->adjust();
+    }
+    function testToArray() {
+        $this->mockcal->expectOnce('toArray',array(12345));
+        $testArray = array('foo'=>'bar');
+        $this->mockcal->setReturnValue('toArray',$testArray);
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual($testArray,$Decorator->toArray(12345));
+    }
+    function testReturnValue() {
+        $this->mockcal->expectOnce('returnValue',array('a','b','c','d'));
+        $this->mockcal->setReturnValue('returnValue','foo');
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $this->assertEqual('foo',$Decorator->returnValue('a','b','c','d'));
+    }
+    function testSetFirst() {
+        $mockday = & new Mock_Calendar_Day($this);
+        $mockday->expectOnce('setFirst',array(true));
+        $Decorator =& new Calendar_Decorator($mockday);
+        $Decorator->setFirst();
+    }
+    function testSetLast() {
+        $mockday = & new Mock_Calendar_Day($this);
+        $mockday->expectOnce('setLast',array(true));
+        $Decorator =& new Calendar_Decorator($mockday);
+        $Decorator->setLast();
+    }
+    function testIsFirst() {
+        $mockday = & new Mock_Calendar_Day($this);
+        $mockday->setReturnValue('isFirst',TRUE);
+        $Decorator =& new Calendar_Decorator($mockday);
+        $this->assertTrue($Decorator->isFirst());
+    }
+    function testIsLast() {
+        $mockday = & new Mock_Calendar_Day($this);
+        $mockday->setReturnValue('isLast',TRUE);
+        $Decorator =& new Calendar_Decorator($mockday);
+        $this->assertTrue($Decorator->isLast());
+    }
+    function testSetEmpty() {
+        $mockday = & new Mock_Calendar_Day($this);
+        $mockday->expectOnce('setEmpty',array(true));
+        $Decorator =& new Calendar_Decorator($mockday);
+        $Decorator->setEmpty();
+    }
+    function testIsEmpty() {
+        $mockday = & new Mock_Calendar_Day($this);
+        $mockday->setReturnValue('isEmpty',TRUE);
+        $Decorator =& new Calendar_Decorator($mockday);
+        $this->assertTrue($Decorator->isEmpty());
+    }
+    function testBuild() {
+        $testArray=array('foo'=>'bar');
+        $this->mockcal->expectOnce('build',array($testArray));
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->build($testArray);
+    }
+    function testFetch() {
+        $this->mockcal->expectOnce('fetch',array());
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->fetch();
+    }
+    function testFetchAll() {
+        $this->mockcal->expectOnce('fetchAll',array());
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->fetchAll();
+    }
+    function testSize() {
+        $this->mockcal->expectOnce('size',array());
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->size();
+    }
+    function testIsValid() {
+        $this->mockcal->expectOnce('isValid',array());
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->isValid();
+    }
+    function testGetValidator() {
+        $this->mockcal->expectOnce('getValidator',array());
+        $Decorator =& new Calendar_Decorator($this->mockcal);
+        $Decorator->getValidator();
+    }
+}
+?>
 
Added: eccube2/trunk/data/module/Calendar/tests/decorator_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/decorator_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/decorator_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,21 @@
+<?php
+// $Id: decorator_tests.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class DecoratorTests extends GroupTest {
+    function DecoratorTests() {
+        $this->GroupTest('Decorator Tests');
+        $this->addTestFile('decorator_test.php');
+        $this->addTestFile('decorator_textual_test.php');
+        $this->addTestFile('decorator_uri_test.php');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new DecoratorTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/decorator_textual_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/decorator_textual_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/decorator_textual_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,174 @@
+<?php
+// $Id: decorator_textual_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./decorator_test.php');
+
+class TestOfDecoratorTextual extends TestOfDecorator {
+    function TestOfDecoratorTextual() {
+        $this->UnitTestCase('Test of Calendar_Decorator_Textual');
+    }
+    function testMonthNamesLong() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $monthNames = array(
+            1=>'January',
+            2=>'February',
+            3=>'March',
+            4=>'April',
+            5=>'May',
+            6=>'June',
+            7=>'July',
+            8=>'August',
+            9=>'September',
+            10=>'October',
+            11=>'November',
+            12=>'December',
+        );
+        $this->assertEqual($monthNames,$Textual->monthNames());
+    }
+    function testMonthNamesShort() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $monthNames = array(
+            1=>'Jan',
+            2=>'Feb',
+            3=>'Mar',
+            4=>'Apr',
+            5=>'May',
+            6=>'Jun',
+            7=>'Jul',
+            8=>'Aug',
+            9=>'Sep',
+            10=>'Oct',
+            11=>'Nov',
+            12=>'Dec',
+        );
+        $this->assertEqual($monthNames,$Textual->monthNames('short'));
+    }
+    function testMonthNamesTwo() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $monthNames = array(
+            1=>'Ja',
+            2=>'Fe',
+            3=>'Ma',
+            4=>'Ap',
+            5=>'Ma',
+            6=>'Ju',
+            7=>'Ju',
+            8=>'Au',
+            9=>'Se',
+            10=>'Oc',
+            11=>'No',
+            12=>'De',
+        );
+        $this->assertEqual($monthNames,$Textual->monthNames('two'));
+    }
+    function testMonthNamesOne() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $monthNames = array(
+            1=>'J',
+            2=>'F',
+            3=>'M',
+            4=>'A',
+            5=>'M',
+            6=>'J',
+            7=>'J',
+            8=>'A',
+            9=>'S',
+            10=>'O',
+            11=>'N',
+            12=>'D',
+        );
+        $this->assertEqual($monthNames,$Textual->monthNames('one'));
+    }
+    function testWeekdayNamesLong() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $weekdayNames = array(
+            0=>'Sunday',
+            1=>'Monday',
+            2=>'Tuesday',
+            3=>'Wednesday',
+            4=>'Thursday',
+            5=>'Friday',
+            6=>'Saturday',
+        );
+        $this->assertEqual($weekdayNames,$Textual->weekdayNames());
+    }
+    function testWeekdayNamesShort() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $weekdayNames = array(
+            0=>'Sun',
+            1=>'Mon',
+            2=>'Tue',
+            3=>'Wed',
+            4=>'Thu',
+            5=>'Fri',
+            6=>'Sat',
+        );
+        $this->assertEqual($weekdayNames,$Textual->weekdayNames('short'));
+    }
+    function testWeekdayNamesTwo() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $weekdayNames = array(
+            0=>'Su',
+            1=>'Mo',
+            2=>'Tu',
+            3=>'We',
+            4=>'Th',
+            5=>'Fr',
+            6=>'Sa',
+        );
+        $this->assertEqual($weekdayNames,$Textual->weekdayNames('two'));
+    }
+    function testWeekdayNamesOne() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $weekdayNames = array(
+            0=>'S',
+            1=>'M',
+            2=>'T',
+            3=>'W',
+            4=>'T',
+            5=>'F',
+            6=>'S',
+        );
+        $this->assertEqual($weekdayNames,$Textual->weekdayNames('one'));
+    }
+    function testPrevMonthNameShort() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $this->assertEqual('Sep',$Textual->prevMonthName('short'));
+    }
+    function testThisMonthNameShort() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $this->assertEqual('Oct',$Textual->thisMonthName('short'));
+    }
+    function testNextMonthNameShort() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $this->assertEqual('Nov',$Textual->nextMonthName('short'));
+    }
+    function testThisDayNameShort() {
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $this->assertEqual('Wed',$Textual->thisDayName('short'));
+    }
+    function testOrderedWeekdaysShort() {
+        $weekdayNames = array(
+            0=>'Sun',
+            1=>'Mon',
+            2=>'Tue',
+            3=>'Wed',
+            4=>'Thu',
+            5=>'Fri',
+            6=>'Sat',
+        );
+        $Textual = new Calendar_Decorator_Textual($this->mockcal);
+        $this->assertEqual($weekdayNames,$Textual->orderedWeekdays('short'));
+    }
+
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfDecoratorTextual();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/decorator_uri_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/decorator_uri_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/decorator_uri_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,37 @@
+<?php
+// $Id: decorator_uri_test.php,v 1.2 2004/07/08 10:18:48 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./decorator_test.php');
+
+class TestOfDecoratorUri extends TestOfDecorator {
+    function TestOfDecoratorUri() {
+        $this->UnitTestCase('Test of Calendar_Decorator_Uri');
+    }
+    function testFragments() {
+        $Uri = new Calendar_Decorator_Uri($this->mockcal);
+        $Uri->setFragments('year','month','day','hour','minute','second');
+        $this->assertEqual('year=&month=&day=&hour=&minute=&second=',$Uri->this('second'));
+    }
+    function testScalarFragments() {
+        $Uri = new Calendar_Decorator_Uri($this->mockcal);
+        $Uri->setFragments('year','month','day','hour','minute','second');
+        $Uri->setScalar();
+        $this->assertEqual('&&&&&',$Uri->this('second'));
+    }
+    function testSetSeperator() {
+        $Uri = new Calendar_Decorator_Uri($this->mockcal);
+        $Uri->setFragments('year','month','day','hour','minute','second');
+        $Uri->setSeparator('/');
+        $this->assertEqual('year=/month=/day=/hour=/minute=/second=',$Uri->this('second'));
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfDecoratorUri();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/helper_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/helper_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/helper_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,83 @@
+<?php
+// $Id: helper_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+Mock::generate('Calendar_Engine_Interface','Mock_Calendar_Engine');
+Mock::generate('Calendar_Second','Mock_Calendar_Second');
+
+class TestOfTableHelper extends UnitTestCase {
+    var $mockengine;
+    var $mockcal;
+    function TestOfTableHelper() {
+        $this->UnitTestCase('Test of Calendar_Table_Helper');
+    }
+    function setUp() {
+        $this->mockengine = new Mock_Calendar_Engine($this);
+        $this->mockengine->setReturnValue('getMinYears',1970);
+        $this->mockengine->setReturnValue('getMaxYears',2037);
+        $this->mockengine->setReturnValue('getMonthsInYear',12);
+        $this->mockengine->setReturnValue('getDaysInMonth',31);
+        $this->mockengine->setReturnValue('getHoursInDay',24);
+        $this->mockengine->setReturnValue('getMinutesInHour',60);
+        $this->mockengine->setReturnValue('getSecondsInMinute',60);
+        $this->mockengine->setReturnValue('getWeekDays',array(0,1,2,3,4,5,6));
+        $this->mockengine->setReturnValue('getDaysInWeek',7);
+        $this->mockengine->setReturnValue('getFirstDayOfWeek',1);
+        $this->mockengine->setReturnValue('getFirstDayInMonth',3);
+        $this->mockcal = new Mock_Calendar_Second($this);
+        $this->mockcal->setReturnValue('thisYear',2003);
+        $this->mockcal->setReturnValue('thisMonth',10);
+        $this->mockcal->setReturnValue('thisDay',15);
+        $this->mockcal->setReturnValue('thisHour',13);
+        $this->mockcal->setReturnValue('thisMinute',30);
+        $this->mockcal->setReturnValue('thisSecond',45);
+        $this->mockcal->setReturnValue('getEngine',$this->mockengine);
+    }
+    function testGetFirstDay() {
+        for ( $i = 0; $i <= 7; $i++ ) {
+            $Helper = & new Calendar_Table_Helper($this->mockcal,$i);
+            $this->assertEqual($Helper->getFirstDay(),$i);
+        }
+    }
+    function testGetDaysOfWeekMonday() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal);
+        $this->assertEqual($Helper->getDaysOfWeek(),array(1,2,3,4,5,6,0));
+    }
+    function testGetDaysOfWeekSunday() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal,0);
+        $this->assertEqual($Helper->getDaysOfWeek(),array(0,1,2,3,4,5,6));
+    }
+    function testGetDaysOfWeekThursday() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal,4);
+        $this->assertEqual($Helper->getDaysOfWeek(),array(4,5,6,0,1,2,3));
+    }
+    function testGetNumWeeks() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal);
+        $this->assertEqual($Helper->getNumWeeks(),5);
+    }
+    function testGetNumTableDaysInMonth() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal);
+        $this->assertEqual($Helper->getNumTableDaysInMonth(),35);
+    }
+    function testGetEmptyDaysBefore() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal);
+        $this->assertEqual($Helper->getEmptyDaysBefore(),2);
+    }
+    function testGetEmptyDaysAfter() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal);
+        $this->assertEqual($Helper->getEmptyDaysAfter(),33);
+    }
+    function testGetEmptyDaysAfterOffset() {
+        $Helper = & new Calendar_Table_Helper($this->mockcal);
+        $this->assertEqual($Helper->getEmptyDaysAfterOffset(),5);
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfTableHelper();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/hour_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/hour_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/hour_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,98 @@
+<?php
+// $Id: hour_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfHour extends TestOfCalendar {
+    function TestOfHour() {
+        $this->UnitTestCase('Test of Hour');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Hour(2003,10,25,13);
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 24,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(13,0,0,10,25,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfHourBuild extends TestOfHour {
+    function TestOfHourBuild() {
+        $this->UnitTestCase('Test of Hour::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(60,$this->cal->size());
+    }
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(60,$i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Minute.php');
+        $selection = array(new Calendar_Minute(2003,10,25,13,32));
+        $this->cal->build($selection);
+        $i = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $i == 32 )
+                break;
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfHour();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfHourBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/minute_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/minute_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/minute_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,99 @@
+<?php
+// $Id: minute_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfMinute extends TestOfCalendar {
+    function TestOfMinute() {
+        $this->UnitTestCase('Test of Minute');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Minute(2003,10,25,13,32);
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 24,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testThisSecond_Timestamp () {
+        $this->assertEqual($this->cal->cE->dateToStamp(
+                2003, 10, 25, 13, 32, 0),
+            $this->cal->thisSecond('timestamp'));
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testNextSecond_Timestamp () {
+        $this->assertEqual($this->cal->cE->dateToStamp(
+                2003, 10, 25, 13, 32, 1),
+            $this->cal->nextSecond('timestamp'));
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(13,32,0,10,25,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfMinuteBuild extends TestOfMinute {
+    function TestOfMinuteBuild() {
+        $this->UnitTestCase('Test of Minute::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(60,$this->cal->size());
+    }
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(60,$i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Second.php');
+        $selection = array(new Calendar_Second(2003,10,25,13,32,43));
+        $this->cal->build($selection);
+        $i = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $i == 43 )
+                break;
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfMinute();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfMinuteBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/month_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/month_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/month_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,119 @@
+<?php
+// $Id: month_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfMonth extends TestOfCalendar {
+    function TestOfMonth() {
+        $this->UnitTestCase('Test of Month');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Month(2003,10);
+    }
+    function testPrevMonth_Object() {
+        $this->assertEqual(new Calendar_Month(2003, 9), $this->cal->prevMonth('object'));
+    }
+    function testPrevDay () {
+        $this->assertEqual(30,$this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 9,
+                'day'    => 30,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(1,$this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(2,$this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(23,$this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0,$this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1,$this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,10,1,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfMonthBuild extends TestOfMonth {
+    function TestOfMonthBuild() {
+        $this->UnitTestCase('Test of Month::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(31,$this->cal->size());
+    }
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(31,$i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Day.php');
+        $selection = array(new Calendar_Day(2003,10,25));
+        $this->cal->build($selection);
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $i == 25 )
+                break;
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfMonth();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfMonthBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/month_weekdays_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/month_weekdays_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/month_weekdays_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,130 @@
+<?php
+// $Id: month_weekdays_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfMonthWeekdays extends TestOfCalendar {
+    function TestOfMonthWeekdays() {
+        $this->UnitTestCase('Test of Month Weekdays');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Month_Weekdays(2003,10);
+    }
+    function testPrevDay () {
+        $this->assertEqual(30,$this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 9,
+                'day'    => 30,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(1,$this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(2,$this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(23,$this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0,$this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1,$this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,10,1,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfMonthWeekdaysBuild extends TestOfMonthWeekdays {
+    function TestOfMonthWeekdaysBuild() {
+        $this->UnitTestCase('Test of Month_Weekdays::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(35,$this->cal->size());
+    }
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(35,$i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Day.php');
+        $selection = array(new Calendar_Day(2003,10,25));
+        $this->cal->build($selection);
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $i == 27 )
+                break;
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+    function testEmptyCount() {
+        $this->cal->build();
+        $empty = 0;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $Child->isEmpty() )
+                $empty++;
+        }
+        $this->assertEqual(4,$empty);
+    }
+    function testEmptyDaysBefore_AfterAdjust() {
+        $this->cal = new Calendar_Month_Weekdays(2004,0);
+        $this->cal->build();
+        $this->assertEqual(0,$this->cal->tableHelper->getEmptyDaysBefore());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfMonthWeekdays();
+    $test->run(new HtmlReporter());
+     $test = &new TestOfMonthWeekdaysBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/month_weeks_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/month_weeks_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/month_weeks_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,125 @@
+<?php
+// $Id: month_weeks_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfMonthWeeks extends TestOfCalendar {
+    function TestOfMonthWeeks() {
+        $this->UnitTestCase('Test of Month Weeks');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Month_Weeks(2003,10);
+    }
+    function testPrevDay () {
+        $this->assertEqual(30,$this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 9,
+                'day'    => 30,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(1,$this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(2,$this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(23,$this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0,$this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1,$this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,10,1,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfMonthWeeksBuild extends TestOfMonthWeeks {
+    function TestOfMonthWeeksBuild() {
+        $this->UnitTestCase('Test of Month_Weeks::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(5,$this->cal->size());
+    }
+
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(5,$i);
+    }
+/* Recusive dependency issue with SimpleTest
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+*/
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Week.php');
+        $selection = array(new Calendar_Week(2003, 10, 12));
+        $this->cal->build($selection);
+        $i = 1;
+        while ($Child = $this->cal->fetch()) {
+            if ($i == 2) {
+                break;  //12-10-2003 is the 2nd day of the week
+            }
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+    function testEmptyDaysBefore_AfterAdjust() {
+        $this->cal = new Calendar_Month_Weeks(2004,0);
+        $this->cal->build();
+        $this->assertEqual(0,$this->cal->tableHelper->getEmptyDaysBefore());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfMonthWeeks();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfMonthWeeksBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/peardate_engine_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/peardate_engine_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/peardate_engine_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,124 @@
+<?php
+// $Id: peardate_engine_test.php,v 1.2 2004/08/16 11:36:51 hfuecks Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class TestOfPearDateEngine extends UnitTestCase {
+    var $engine;
+    function TestOfPearDateEngine() {
+        $this->UnitTestCase('Test of Calendar_Engine_PearDate');
+    }
+    function setUp() {
+        $this->engine = new Calendar_Engine_PearDate();
+    }
+    function testGetSecondsInMinute() {
+        $this->assertEqual($this->engine->getSecondsInMinute(),60);
+    }
+    function testGetMinutesInHour() {
+        $this->assertEqual($this->engine->getMinutesInHour(),60);
+    }
+    function testGetHoursInDay() {
+        $this->assertEqual($this->engine->getHoursInDay(),24);
+    }
+    function testGetFirstDayOfWeek() {
+        $this->assertEqual($this->engine->getFirstDayOfWeek(),1);
+    }
+    function testGetWeekDays() {
+        $this->assertEqual($this->engine->getWeekDays(),array(0,1,2,3,4,5,6));
+    }
+    function testGetDaysInWeek() {
+        $this->assertEqual($this->engine->getDaysInWeek(),7);
+    }
+    function testGetWeekNInYear() {
+        $this->assertEqual($this->engine->getWeekNInYear(2003, 11, 3), 45);
+    }
+    function testGetWeekNInMonth() {
+        $this->assertEqual($this->engine->getWeekNInMonth(2003, 11, 3), 2);
+    }
+    function testGetWeeksInMonth0() {
+        $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 0), 6); //week starts on sunday
+    }
+    function testGetWeeksInMonth1() {
+        $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 1), 5); //week starts on monday
+    }
+    function testGetWeeksInMonth2() {
+        $this->assertEqual($this->engine->getWeeksInMonth(2003, 2, 6), 4); //week starts on saturday
+    }
+    function testGetWeeksInMonth3() {
+        // Unusual cases that can cause fails (shows up with example 21.php)
+        $this->assertEqual($this->engine->getWeeksInMonth(2004,2,1),5);
+        $this->assertEqual($this->engine->getWeeksInMonth(2004,8,1),6);
+    }
+    function testGetDayOfWeek() {
+        $this->assertEqual($this->engine->getDayOfWeek(2003, 11, 18), 2);
+    }
+    function testGetFirstDayInMonth() {
+        $this->assertEqual($this->engine->getFirstDayInMonth(2003,10),3);
+    }
+    function testGetDaysInMonth() {
+        $this->assertEqual($this->engine->getDaysInMonth(2003,10),31);
+    }
+    function testGetMinYears() {
+        $this->assertEqual($this->engine->getMinYears(),0);
+    }
+    function testGetMaxYears() {
+        $this->assertEqual($this->engine->getMaxYears(),9999);
+    }
+    function testDateToStamp() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->dateToStamp(2003,10,15,13,30,45),$stamp);
+    }
+    function testStampToSecond() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->stampToSecond($stamp),45);
+    }
+    function testStampToMinute() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->stampToMinute($stamp),30);
+    }
+    function testStampToHour() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->stampToHour($stamp),13);
+    }
+    function testStampToDay() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->stampToDay($stamp),15);
+    }
+    function testStampToMonth() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->stampToMonth($stamp),10);
+    }
+    function testStampToYear() {
+        $stamp = '2003-10-15 13:30:45';
+        $this->assertEqual($this->engine->stampToYear($stamp),2003);
+    }
+    function testAdjustDate() {
+        $stamp = '2004-01-01 13:30:45';
+        $y = $this->engine->stampToYear($stamp);
+        $m = $this->engine->stampToMonth($stamp);
+        $d = $this->engine->stampToDay($stamp);
+
+        //the first day of the month should be thursday
+        $this->assertEqual($this->engine->getDayOfWeek($y, $m, $d), 4);
+
+        $m--; // 2004-00-01 => 2003-12-01
+        $this->engine->adjustDate($y, $m, $d, $dummy, $dummy, $dummy);
+
+        $this->assertEqual($y, 2003);
+        $this->assertEqual($m, 12);
+        $this->assertEqual($d, 1);
+
+        // get last day and check if it's wednesday
+        $d = $this->engine->getDaysInMonth($y, $m);
+
+        $this->assertEqual($this->engine->getDayOfWeek($y, $m, $d), 3);
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfPearDateEngine();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/second_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/second_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/second_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,34 @@
+<?php
+// $Id: second_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfSecond extends TestOfCalendar {
+    function TestOfSecond() {
+        $this->UnitTestCase('Test of Second');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Second(2003,10,25,13,32,43);
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 24,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfSecond();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/simple_include.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/simple_include.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/simple_include.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,10 @@
+<?php
+// $Id: simple_include.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+if (!defined('SIMPLE_TEST')) {
+    define('SIMPLE_TEST', '../../../simpletest/');
+}
+
+require_once(SIMPLE_TEST . 'unit_tester.php');
+require_once(SIMPLE_TEST . 'reporter.php');
+require_once(SIMPLE_TEST . 'mock_objects.php');
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/table_helper_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/table_helper_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/table_helper_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,19 @@
+<?php
+// $Id: table_helper_tests.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class TableHelperTests extends GroupTest {
+    function TableHelperTests() {
+        $this->GroupTest('Table Helper Tests');
+        $this->addTestFile('helper_test.php');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TableHelperTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/unixts_engine_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/unixts_engine_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/unixts_engine_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,104 @@
+<?php
+// $Id: unixts_engine_test.php,v 1.2 2004/08/16 11:36:51 hfuecks Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class TestOfUnixTsEngine extends UnitTestCase {
+    var $engine;
+    function TestOfUnixTsEngine() {
+        $this->UnitTestCase('Test of Calendar_Engine_UnixTs');
+    }
+    function setUp() {
+        $this->engine = new Calendar_Engine_UnixTs();
+    }
+    function testGetSecondsInMinute() {
+        $this->assertEqual($this->engine->getSecondsInMinute(),60);
+    }
+    function testGetMinutesInHour() {
+        $this->assertEqual($this->engine->getMinutesInHour(),60);
+    }
+    function testGetHoursInDay() {
+        $this->assertEqual($this->engine->getHoursInDay(),24);
+    }
+    function testGetFirstDayOfWeek() {
+        $this->assertEqual($this->engine->getFirstDayOfWeek(),1);
+    }
+    function testGetWeekDays() {
+        $this->assertEqual($this->engine->getWeekDays(),array(0,1,2,3,4,5,6));
+    }
+    function testGetDaysInWeek() {
+        $this->assertEqual($this->engine->getDaysInWeek(),7);
+    }
+    function testGetWeekNInYear() {
+        $this->assertEqual($this->engine->getWeekNInYear(2003, 11, 3), 45);
+    }
+    function testGetWeekNInMonth() {
+        $this->assertEqual($this->engine->getWeekNInMonth(2003, 11, 3), 2);
+    }
+    function testGetWeeksInMonth0() {
+        $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 0), 6); //week starts on sunday
+    }
+    function testGetWeeksInMonth1() {
+        $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 1), 5); //week starts on monday
+    }
+    function testGetWeeksInMonth2() {
+        $this->assertEqual($this->engine->getWeeksInMonth(2003, 2, 6), 4); //week starts on saturday
+    }
+    function testGetWeeksInMonth3() {
+        // Unusual cases that can cause fails (shows up with example 21.php)
+        $this->assertEqual($this->engine->getWeeksInMonth(2004,2,1),5);
+        $this->assertEqual($this->engine->getWeeksInMonth(2004,8,1),6);
+    }
+    function testGetDayOfWeek() {
+        $this->assertEqual($this->engine->getDayOfWeek(2003, 11, 18), 2);
+    }
+    function testGetFirstDayInMonth() {
+        $this->assertEqual($this->engine->getFirstDayInMonth(2003,10),3);
+    }
+    function testGetDaysInMonth() {
+        $this->assertEqual($this->engine->getDaysInMonth(2003,10),31);
+    }
+    function testGetMinYears() {
+        $test = strpos(PHP_OS, 'WIN') >= 0 ? 1970 : 1902;
+        $this->assertEqual($this->engine->getMinYears(),$test);
+    }
+    function testGetMaxYears() {
+        $this->assertEqual($this->engine->getMaxYears(),2037);
+    }
+    function testDateToStamp() {
+        $stamp = mktime(0,0,0,10,15,2003);
+        $this->assertEqual($this->engine->dateToStamp(2003,10,15,0,0,0),$stamp);
+    }
+    function testStampToSecond() {
+        $stamp = mktime(13,30,45,10,15,2003);
+        $this->assertEqual($this->engine->stampToSecond($stamp),45);
+    }
+    function testStampToMinute() {
+        $stamp = mktime(13,30,45,10,15,2003);
+        $this->assertEqual($this->engine->stampToMinute($stamp),30);
+    }
+    function testStampToHour() {
+        $stamp = mktime(13,30,45,10,15,2003);
+        $this->assertEqual($this->engine->stampToHour($stamp),13);
+    }
+    function testStampToDay() {
+        $stamp = mktime(13,30,45,10,15,2003);
+        $this->assertEqual($this->engine->stampToDay($stamp),15);
+    }
+    function testStampToMonth() {
+        $stamp = mktime(13,30,45,10,15,2003);
+        $this->assertEqual($this->engine->stampToMonth($stamp),10);
+    }
+    function testStampToYear() {
+        $stamp = mktime(13,30,45,10,15,2003);
+        $this->assertEqual($this->engine->stampToYear($stamp),2003);
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfUnixTsEngine();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/util_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/util_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/util_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,20 @@
+<?php
+// $Id: util_tests.php,v 1.2 2004/08/16 12:56:10 hfuecks Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class UtilTests extends GroupTest {
+    function UtilTests() {
+        $this->GroupTest('Util Tests');
+        $this->addTestFile('util_uri_test.php');
+        $this->addTestFile('util_textual_test.php');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new UtilTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/util_textual_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/util_textual_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/util_textual_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,191 @@
+<?php
+// $Id: util_textual_test.php,v 1.1 2004/08/16 12:56:10 hfuecks Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./decorator_test.php');
+
+class TestOfUtilTextual extends UnitTestCase {
+    var $mockengine;
+    var $mockcal;
+    function TestOfUtilTextual() {
+        $this->UnitTestCase('Test of Calendar_Util_Textual');
+    }
+    function setUp() {
+        $this->mockengine = new Mock_Calendar_Engine($this);
+        $this->mockcal = new Mock_Calendar_Second($this);
+        $this->mockcal->setReturnValue('prevYear',2002);
+        $this->mockcal->setReturnValue('thisYear',2003);
+        $this->mockcal->setReturnValue('nextYear',2004);
+        $this->mockcal->setReturnValue('prevMonth',9);
+        $this->mockcal->setReturnValue('thisMonth',10);
+        $this->mockcal->setReturnValue('nextMonth',11);
+        $this->mockcal->setReturnValue('prevDay',14);
+        $this->mockcal->setReturnValue('thisDay',15);
+        $this->mockcal->setReturnValue('nextDay',16);
+        $this->mockcal->setReturnValue('prevHour',12);
+        $this->mockcal->setReturnValue('thisHour',13);
+        $this->mockcal->setReturnValue('nextHour',14);
+        $this->mockcal->setReturnValue('prevMinute',29);
+        $this->mockcal->setReturnValue('thisMinute',30);
+        $this->mockcal->setReturnValue('nextMinute',31);
+        $this->mockcal->setReturnValue('prevSecond',44);
+        $this->mockcal->setReturnValue('thisSecond',45);
+        $this->mockcal->setReturnValue('nextSecond',46);
+        $this->mockcal->setReturnValue('getEngine',$this->mockengine);
+        $this->mockcal->setReturnValue('getTimestamp',12345);
+    }
+    function tearDown() {
+        unset ( $this->engine );
+        unset ( $this->mockcal );
+    }    
+    function testMonthNamesLong() {
+        $monthNames = array(
+            1=>'January',
+            2=>'February',
+            3=>'March',
+            4=>'April',
+            5=>'May',
+            6=>'June',
+            7=>'July',
+            8=>'August',
+            9=>'September',
+            10=>'October',
+            11=>'November',
+            12=>'December',
+        );
+        $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames());
+    }
+    function testMonthNamesShort() {
+        $monthNames = array(
+            1=>'Jan',
+            2=>'Feb',
+            3=>'Mar',
+            4=>'Apr',
+            5=>'May',
+            6=>'Jun',
+            7=>'Jul',
+            8=>'Aug',
+            9=>'Sep',
+            10=>'Oct',
+            11=>'Nov',
+            12=>'Dec',
+        );
+        $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('short'));
+    }
+    function testMonthNamesTwo() {
+        $monthNames = array(
+            1=>'Ja',
+            2=>'Fe',
+            3=>'Ma',
+            4=>'Ap',
+            5=>'Ma',
+            6=>'Ju',
+            7=>'Ju',
+            8=>'Au',
+            9=>'Se',
+            10=>'Oc',
+            11=>'No',
+            12=>'De',
+        );
+        $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('two'));
+    }
+    function testMonthNamesOne() {
+        $monthNames = array(
+            1=>'J',
+            2=>'F',
+            3=>'M',
+            4=>'A',
+            5=>'M',
+            6=>'J',
+            7=>'J',
+            8=>'A',
+            9=>'S',
+            10=>'O',
+            11=>'N',
+            12=>'D',
+        );
+        $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('one'));
+    }
+    function testWeekdayNamesLong() {
+        $weekdayNames = array(
+            0=>'Sunday',
+            1=>'Monday',
+            2=>'Tuesday',
+            3=>'Wednesday',
+            4=>'Thursday',
+            5=>'Friday',
+            6=>'Saturday',
+        );
+        $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames());
+    }
+    function testWeekdayNamesShort() {
+        $weekdayNames = array(
+            0=>'Sun',
+            1=>'Mon',
+            2=>'Tue',
+            3=>'Wed',
+            4=>'Thu',
+            5=>'Fri',
+            6=>'Sat',
+        );
+        $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('short'));
+    }
+    function testWeekdayNamesTwo() {
+        $weekdayNames = array(
+            0=>'Su',
+            1=>'Mo',
+            2=>'Tu',
+            3=>'We',
+            4=>'Th',
+            5=>'Fr',
+            6=>'Sa',
+        );
+        $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('two'));
+    }
+    function testWeekdayNamesOne() {
+        $weekdayNames = array(
+            0=>'S',
+            1=>'M',
+            2=>'T',
+            3=>'W',
+            4=>'T',
+            5=>'F',
+            6=>'S',
+        );
+        $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('one'));
+    }
+    function testPrevMonthNameShort() {
+        $this->assertEqual('Sep',Calendar_Util_Textual::prevMonthName($this->mockcal,'short'));
+    }
+    function testThisMonthNameShort() {
+        $this->assertEqual('Oct',Calendar_Util_Textual::thisMonthName($this->mockcal,'short'));
+    }
+    function testNextMonthNameShort() {
+        $this->assertEqual('Nov',Calendar_Util_Textual::nextMonthName($this->mockcal,'short'));
+    }
+    function testThisDayNameShort() {
+        $this->assertEqual('Wed',Calendar_Util_Textual::thisDayName($this->mockcal,'short'));
+    }
+    function testOrderedWeekdaysShort() {
+        $weekdayNames = array(
+            0=>'Sun',
+            1=>'Mon',
+            2=>'Tue',
+            3=>'Wed',
+            4=>'Thu',
+            5=>'Fri',
+            6=>'Sat',
+        );
+        $this->assertEqual($weekdayNames,Calendar_Util_Textual::orderedWeekdays($this->mockcal,'short'));
+    }
+
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfUtilTextual();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/util_uri_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/util_uri_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/util_uri_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,54 @@
+<?php
+// $Id: util_uri_test.php,v 1.1 2004/08/16 08:55:24 hfuecks Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+Mock::generate('Calendar_Day','Mock_Calendar_Day');
+Mock::generate('Calendar_Engine_Interface','Mock_Calendar_Engine');
+
+class TestOfUtilUri extends UnitTestCase {
+
+    var $MockCal;
+    
+    function TestOfUtilUri() {
+        $this->UnitTestCase('Test of Calendar_Util_Uri');
+    }
+    
+    function setUp() {
+        $this->MockCal = & new Mock_Calendar_Day($this);
+        $this->MockCal->setReturnValue('getEngine',new Mock_Calendar_Engine($this));
+    }
+    
+    function testFragments() {
+        $Uri = new Calendar_Util_Uri('y','m','d','h','m','s');
+        $Uri->setFragments('year','month','day','hour','minute','second');
+        $this->assertEqual(
+            'year=&month=&day=&hour=&minute=&second=',
+            $Uri->this($this->MockCal, 'second')
+        );
+    }
+    function testScalarFragments() {
+        $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second');
+        $Uri->scalar = true;
+        $this->assertEqual(
+            '&&&&&',
+            $Uri->this($this->MockCal, 'second')
+        );
+    }
+    function testSetSeperator() {
+        $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second');
+        $Uri->separator = '/';
+        $this->assertEqual(
+            'year=/month=/day=/hour=/minute=/second=',
+            $Uri->this($this->MockCal, 'second')
+        );
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfUtilUri();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/validator_error_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/validator_error_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/validator_error_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,34 @@
+<?php
+// $Id: validator_error_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class TestOfValidationError extends UnitTestCase {
+    var $vError;
+    function TestOfValidationError() {
+        $this->UnitTestCase('Test of Validation Error');
+    }
+    function setUp() {
+        $this->vError = new Calendar_Validation_Error('foo',20,'bar');
+    }
+    function testGetUnit() {
+        $this->assertEqual($this->vError->getUnit(),'foo');
+    }
+    function testGetValue() {
+        $this->assertEqual($this->vError->getValue(),20);
+    }
+    function testGetMessage() {
+        $this->assertEqual($this->vError->getMessage(),'bar');
+    }
+    function testToString() {
+        $this->assertEqual($this->vError->toString(),'foo = 20 [bar]');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfValidationError();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/validator_tests.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/validator_tests.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/validator_tests.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,20 @@
+<?php
+// $Id: validator_tests.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+class ValidatorTests extends GroupTest {
+    function ValidatorTests() {
+        $this->GroupTest('Validator Tests');
+        $this->addTestFile('validator_unit_test.php');
+        $this->addTestFile('validator_error_test.php');
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new ValidatorTests();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/validator_unit_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/validator_unit_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/validator_unit_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,210 @@
+<?php
+// $Id: validator_unit_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+Mock::generate('Calendar_Engine_Interface','Mock_Calendar_Engine');
+Mock::generate('Calendar_Second','Mock_Calendar_Second');
+
+class TestOfValidator extends UnitTestCase {
+    var $mockengine;
+    var $mockcal;
+    function TestOfValidator() {
+        $this->UnitTestCase('Test of Validator');
+    }
+    function setUp() {
+        $this->mockengine = new Mock_Calendar_Engine($this);
+        $this->mockengine->setReturnValue('getMinYears',1970);
+        $this->mockengine->setReturnValue('getMaxYears',2037);
+        $this->mockengine->setReturnValue('getMonthsInYear',12);
+        $this->mockengine->setReturnValue('getDaysInMonth',30);
+        $this->mockengine->setReturnValue('getHoursInDay',24);
+        $this->mockengine->setReturnValue('getMinutesInHour',60);
+        $this->mockengine->setReturnValue('getSecondsInMinute',60);
+        $this->mockcal = new Mock_Calendar_Second($this);
+        $this->mockcal->setReturnValue('getEngine',$this->mockengine);
+    }
+    function tearDown() {
+        unset ($this->mockengine);
+        unset ($this->mocksecond);
+    }
+    function testIsValidYear() {
+        $this->mockcal->setReturnValue('thisYear',2000);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValidYear());
+    }
+    function testIsValidYearTooSmall() {
+        $this->mockcal->setReturnValue('thisYear',1969);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidYear());
+    }
+    function testIsValidYearTooLarge() {
+        $this->mockcal->setReturnValue('thisYear',2038);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidYear());
+    }
+    function testIsValidMonth() {
+        $this->mockcal->setReturnValue('thisMonth',10);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValidMonth());
+    }
+    function testIsValidMonthTooSmall() {
+        $this->mockcal->setReturnValue('thisMonth',0);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidMonth());
+    }
+    function testIsValidMonthTooLarge() {
+        $this->mockcal->setReturnValue('thisMonth',13);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidMonth());
+    }
+    function testIsValidDay() {
+        $this->mockcal->setReturnValue('thisDay',10);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValidDay());
+    }
+    function testIsValidDayTooSmall() {
+        $this->mockcal->setReturnValue('thisDay',0);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidDay());
+    }
+    function testIsValidDayTooLarge() {
+        $this->mockcal->setReturnValue('thisDay',31);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidDay());
+    }
+    function testIsValidHour() {
+        $this->mockcal->setReturnValue('thisHour',10);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValidHour());
+    }
+    function testIsValidHourTooSmall() {
+        $this->mockcal->setReturnValue('thisHour',-1);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidHour());
+    }
+    function testIsValidHourTooLarge() {
+        $this->mockcal->setReturnValue('thisHour',24);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidHour());
+    }
+    function testIsValidMinute() {
+        $this->mockcal->setReturnValue('thisMinute',30);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValidMinute());
+    }
+    function testIsValidMinuteTooSmall() {
+        $this->mockcal->setReturnValue('thisMinute',-1);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidMinute());
+    }
+    function testIsValidMinuteTooLarge() {
+        $this->mockcal->setReturnValue('thisMinute',60);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidMinute());
+    }
+    function testIsValidSecond() {
+        $this->mockcal->setReturnValue('thisSecond',30);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValidSecond());
+    }
+    function testIsValidSecondTooSmall() {
+        $this->mockcal->setReturnValue('thisSecond',-1);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidSecond());
+    }
+    function testIsValidSecondTooLarge() {
+        $this->mockcal->setReturnValue('thisSecond',60);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValidSecond());
+    }
+    function testIsValid() {
+        $this->mockcal->setReturnValue('thisYear',2000);
+        $this->mockcal->setReturnValue('thisMonth',5);
+        $this->mockcal->setReturnValue('thisDay',15);
+        $this->mockcal->setReturnValue('thisHour',13);
+        $this->mockcal->setReturnValue('thisMinute',30);
+        $this->mockcal->setReturnValue('thisSecond',40);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertTrue($Validator->isValid());
+    }
+    function testIsValidAllWrong() {
+        $this->mockcal->setReturnValue('thisYear',2038);
+        $this->mockcal->setReturnValue('thisMonth',13);
+        $this->mockcal->setReturnValue('thisDay',31);
+        $this->mockcal->day = 31;
+        $this->mockcal->setReturnValue('thisHour',24);
+        $this->mockcal->setReturnValue('thisMinute',60);
+        $this->mockcal->setReturnValue('thisSecond',60);
+        $Validator = & new Calendar_Validator($this->mockcal);
+        $this->assertFalse($Validator->isValid());
+        $i = 0;
+        while ( $Validator->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual($i,6);
+    }
+}
+
+class TestOfValidatorLive extends UnitTestCase {
+    function TestOfValidatorLive() {
+        $this->UnitTestCase('Test of Validator Live');
+    }
+    function testYear() {
+        $Unit = new Calendar_Year(2038);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidYear());
+    }
+    function testMonth() {
+        $Unit = new Calendar_Month(2000,13);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidMonth());
+    }
+/*
+    function testWeek() {
+        $Unit = new Calendar_Week(2000,12,7);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidWeek());
+    }
+*/
+    function testDay() {
+        $Unit = new Calendar_Day(2000,12,32);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidDay());
+    }
+    function testHour() {
+        $Unit = new Calendar_Hour(2000,12,20,24);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidHour());
+    }
+    function testMinute() {
+        $Unit = new Calendar_Minute(2000,12,20,23,60);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidMinute());
+    }
+    function testSecond() {
+        $Unit = new Calendar_Second(2000,12,20,23,59,60);
+        $Validator = & $Unit->getValidator();
+        $this->assertFalse($Validator->isValidSecond());
+    }
+    function testAllBad() {
+        $Unit = new Calendar_Second(2000,13,32,24,60,60);
+        $this->assertFalse($Unit->isValid());
+        $Validator = & $Unit->getValidator();
+        $i = 0;
+        while ( $Validator->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual($i,5);
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfValidator();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfValidatorLive();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/week_firstday_0_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/week_firstday_0_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/week_firstday_0_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,241 @@
+<?php
+// $Id: week_firstday_0_test.php,v 1.1 2005/10/20 18:57:52 quipo Exp $
+define('CALENDAR_FIRST_DAY_OF_WEEK', 0); //force firstDay = Sunday
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfWeek_firstday_0 extends TestOfCalendar {
+    function TestOfWeek_firstday_0() {
+        $this->UnitTestCase('Test of Week - Week Starting on Sunday');
+    }
+    function setUp() {
+        $this->cal = Calendar_Factory::create('Week', 2003, 10, 9);
+        //print_r($this->cal);
+    }
+    function testPrevDay () {
+        $this->assertEqual(8, $this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 8,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(9, $this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(10, $this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(23, $this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0, $this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1, $this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59, $this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0, $this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1, $this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59, $this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0, $this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1, $this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,10,9,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+    function testNewTimeStamp() {
+        $stamp = mktime(0,0,0,7,28,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual('29 2004', date('W Y', $this->cal->prevWeek(true)));
+        $this->assertEqual('30 2004', date('W Y', $this->cal->thisWeek(true)));
+        $this->assertEqual('31 2004', date('W Y', $this->cal->nextWeek(true)));
+    }
+    function testPrevWeekInMonth() {
+        $this->assertEqual(1, $this->cal->prevWeek());
+        $stamp = mktime(0,0,0,2,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(0, $this->cal->prevWeek());
+    }
+    function testThisWeekInMonth() {
+        $this->assertEqual(2, $this->cal->thisWeek());
+        $stamp = mktime(0,0,0,2,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(1, $this->cal->thisWeek());
+        $stamp = mktime(0,0,0,1,1,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(1, $this->cal->thisWeek());
+        $stamp = mktime(0,0,0,1,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(2, $this->cal->thisWeek());
+    }
+    function testNextWeekInMonth() {
+        $this->assertEqual(3, $this->cal->nextWeek());
+        $stamp = mktime(0,0,0,2,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(2, $this->cal->nextWeek());
+    }
+    function testPrevWeekInYear() {
+        $this->assertEqual(date('W', $this->cal->prevWeek('timestamp')), $this->cal->prevWeek('n_in_year'));
+        $stamp = mktime(0,0,0,1,1,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
+    }
+    function testThisWeekInYear() {
+        $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
+        $stamp = mktime(0,0,0,1,1,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
+    }
+    function testFirstWeekInYear() {
+        $stamp = mktime(0,0,0,1,4,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(1, $this->cal->thisWeek('n_in_year'));
+    }
+    function testNextWeekInYear() {
+        $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
+    }
+    function testPrevWeekArray() {
+        $testArray = array(
+            'year'=>2003,
+            'month'=>9,
+            'day'=>28,
+            'hour'=>0,
+            'minute'=>0,
+            'second'=>0
+            );
+        $this->assertEqual($testArray, $this->cal->prevWeek('array'));
+    }
+    function testThisWeekArray() {
+        $testArray = array(
+            'year'=>2003,
+            'month'=>10,
+            'day'=>5,
+            'hour'=>0,
+            'minute'=>0,
+            'second'=>0
+            );
+        $this->assertEqual($testArray, $this->cal->thisWeek('array'));
+    }
+    function testNextWeekArray() {
+        $testArray = array(
+            'year'=>2003,
+            'month'=>10,
+            'day'=>12,
+            'hour'=>0,
+            'minute'=>0,
+            'second'=>0
+            );
+        $this->assertEqual($testArray, $this->cal->nextWeek('array'));
+    }
+    function testPrevWeekObject() {
+        $testWeek = Calendar_Factory::create('Week', 2003,9,28);
+        $Week = $this->cal->prevWeek('object');
+        $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp());
+    }
+    function testThisWeekObject() {
+        $testWeek = Calendar_Factory::create('Week', 2003,10,5);
+        $Week = $this->cal->thisWeek('object');
+        $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp());
+    }
+    function testNextWeekObject() {
+        $testWeek = Calendar_Factory::create('Week', 2003,10,12);
+        $Week = $this->cal->nextWeek('object');
+        $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp());
+    }
+}
+
+class TestOfWeek_firstday_0_Build extends TestOfWeek_firstday_0 {
+    function TestOfWeek_firstday_0_Build() {
+        $this->UnitTestCase('Test of Week::build() - FirstDay = Sunday');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(7, $this->cal->size());
+    }
+
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ($Child = $this->cal->fetch()) {
+            $i++;
+        }
+        $this->assertEqual(7, $i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Day.php');
+        $selection = array(Calendar_Factory::create('Day', 2003, 10, 6));
+        $this->cal->build($selection);
+        $i = 1;
+        while ($Child = $this->cal->fetch()) {
+            if ($i == 2) {
+                break; //06-10-2003 is the 2nd day of the week
+            }
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+    function testSelectionCornerCase() {
+        require_once(CALENDAR_ROOT . 'Day.php');
+        $selectedDays = array(
+            Calendar_Factory::create('Day', 2003, 12, 28),
+            Calendar_Factory::create('Day', 2003, 12, 29),
+            Calendar_Factory::create('Day', 2003, 12, 30),
+            Calendar_Factory::create('Day', 2003, 12, 31),
+            Calendar_Factory::create('Day', 2004, 01, 01),
+            Calendar_Factory::create('Day', 2004, 01, 02),
+            Calendar_Factory::create('Day', 2004, 01, 03)
+        );
+        $this->cal = Calendar_Factory::create('Week', 2003, 12, 31, 0);
+        $this->cal->build($selectedDays);
+        while ($Day = $this->cal->fetch()) {
+            $this->assertTrue($Day->isSelected());
+        }
+        $this->cal = Calendar_Factory::create('Week', 2004, 1, 1, 0);
+        $this->cal->build($selectedDays);
+        while ($Day = $this->cal->fetch()) {
+            $this->assertTrue($Day->isSelected());
+        }
+    }
+}
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfWeek_firstday_0();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfWeek_firstday_0_Build();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/week_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/week_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/week_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,241 @@
+<?php
+// $Id: week_test.php,v 1.4 2005/10/20 18:56:21 quipo Exp $
+define('CALENDAR_FIRST_DAY_OF_WEEK', 1); //force firstDay = monday
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfWeek extends TestOfCalendar {
+    function TestOfWeek() {
+        $this->UnitTestCase('Test of Week');
+    }
+    function setUp() {
+        $this->cal = Calendar_Factory::create('Week', 2003, 10, 9);
+        //print_r($this->cal);
+    }
+    function testPrevDay () {
+        $this->assertEqual(8, $this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2003,
+                'month'  => 10,
+                'day'    => 8,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(9, $this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(10, $this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(23, $this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0, $this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1, $this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59, $this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0, $this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1, $this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59, $this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0, $this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1, $this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,10,9,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+    function testNewTimeStamp() {
+        $stamp = mktime(0,0,0,7,28,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual('30 2004', date('W Y', $this->cal->prevWeek(true)));
+        $this->assertEqual('31 2004', date('W Y', $this->cal->thisWeek(true)));
+        $this->assertEqual('32 2004', date('W Y', $this->cal->nextWeek(true)));
+    }
+    function testPrevWeekInMonth() {
+        $this->assertEqual(1, $this->cal->prevWeek());
+        $stamp = mktime(0,0,0,2,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(0, $this->cal->prevWeek());
+    }
+    function testThisWeekInMonth() {
+        $this->assertEqual(2, $this->cal->thisWeek());
+        $stamp = mktime(0,0,0,2,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(1, $this->cal->thisWeek());
+        $stamp = mktime(0,0,0,1,1,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(1, $this->cal->thisWeek());
+        $stamp = mktime(0,0,0,1,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(2, $this->cal->thisWeek());
+    }
+    function testNextWeekInMonth() {
+        $this->assertEqual(3, $this->cal->nextWeek());
+        $stamp = mktime(0,0,0,2,3,2005);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(2, $this->cal->nextWeek());
+    }
+    function testPrevWeekInYear() {
+        $this->assertEqual(date('W', $this->cal->prevWeek('timestamp')), $this->cal->prevWeek('n_in_year'));
+        $stamp = mktime(0,0,0,1,1,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
+    }
+    function testThisWeekInYear() {
+        $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
+        $stamp = mktime(0,0,0,1,1,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
+    }
+    function testFirstWeekInYear() {
+        $stamp = mktime(0,0,0,1,4,2004);
+        $this->cal->setTimestamp($stamp);
+        $this->assertEqual(1, $this->cal->thisWeek('n_in_year'));
+    }
+    function testNextWeekInYear() {
+        $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
+    }
+    function testPrevWeekArray() {
+        $testArray = array(
+            'year'=>2003,
+            'month'=>9,
+            'day'=>29,
+            'hour'=>0,
+            'minute'=>0,
+            'second'=>0
+            );
+        $this->assertEqual($testArray, $this->cal->prevWeek('array'));
+    }
+    function testThisWeekArray() {
+        $testArray = array(
+            'year'=>2003,
+            'month'=>10,
+            'day'=>6,
+            'hour'=>0,
+            'minute'=>0,
+            'second'=>0
+            );
+        $this->assertEqual($testArray, $this->cal->thisWeek('array'));
+    }
+    function testNextWeekArray() {
+        $testArray = array(
+            'year'=>2003,
+            'month'=>10,
+            'day'=>13,
+            'hour'=>0,
+            'minute'=>0,
+            'second'=>0
+            );
+        $this->assertEqual($testArray, $this->cal->nextWeek('array'));
+    }
+    function testPrevWeekObject() {
+        $testWeek = Calendar_Factory::create('Week', 2003, 9, 29); //week starts on monday
+        $Week = $this->cal->prevWeek('object');
+        $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp());
+    }
+    function testThisWeekObject() {
+        $testWeek = Calendar_Factory::create('Week', 2003, 10, 6); //week starts on monday
+        $Week = $this->cal->thisWeek('object');
+        $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp());
+    }
+    function testNextWeekObject() {
+        $testWeek = Calendar_Factory::create('Week', 2003, 10, 13); //week starts on monday
+        $Week = $this->cal->nextWeek('object');
+        $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp());
+    }
+}
+
+class TestOfWeekBuild extends TestOfWeek {
+    function TestOfWeekBuild() {
+        $this->UnitTestCase('Test of Week::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(7, $this->cal->size());
+    }
+
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ($Child = $this->cal->fetch()) {
+            $i++;
+        }
+        $this->assertEqual(7, $i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Day.php');
+        $selection = array(Calendar_Factory::create('Day', 2003, 10, 7));
+        $this->cal->build($selection);
+        $i = 1;
+        while ($Child = $this->cal->fetch()) {
+            if ($i == 2) {
+                break; //07-10-2003 is the 2nd day of the week (starting on monday)
+            }
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+    function testSelectionCornerCase() {
+        require_once(CALENDAR_ROOT . 'Day.php');
+        $selectedDays = array(
+            Calendar_Factory::create('Day', 2003, 12, 29),
+            Calendar_Factory::create('Day', 2003, 12, 30),
+            Calendar_Factory::create('Day', 2003, 12, 31),
+            Calendar_Factory::create('Day', 2004, 01, 01),
+            Calendar_Factory::create('Day', 2004, 01, 02),
+            Calendar_Factory::create('Day', 2004, 01, 03),
+            Calendar_Factory::create('Day', 2004, 01, 04)
+        );
+        $this->cal = Calendar_Factory::create('Week', 2003, 12, 31, 0);
+        $this->cal->build($selectedDays);
+        while ($Day = $this->cal->fetch()) {
+            $this->assertTrue($Day->isSelected());
+        }
+        $this->cal = Calendar_Factory::create('Week', 2004, 1, 1, 0);
+        $this->cal->build($selectedDays);
+        while ($Day = $this->cal->fetch()) {
+            $this->assertTrue($Day->isSelected());
+        }
+    }
+}
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfWeek();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfWeekBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/data/module/Calendar/tests/year_test.php
===================================================================
--- eccube2/trunk/data/module/Calendar/tests/year_test.php	                        (rev 0)
+++ eccube2/trunk/data/module/Calendar/tests/year_test.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,142 @@
+<?php
+// $Id: year_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
+
+require_once('simple_include.php');
+require_once('calendar_include.php');
+
+require_once('./calendar_test.php');
+
+class TestOfYear extends TestOfCalendar {
+    function TestOfYear() {
+        $this->UnitTestCase('Test of Year');
+    }
+    function setUp() {
+        $this->cal = new Calendar_Year(2003);
+    }
+    function testPrevYear_Object() {
+        $this->assertEqual(new Calendar_Year(2002), $this->cal->prevYear('object'));
+    }
+    function testThisYear_Object() {
+        $this->assertEqual(new Calendar_Year(2003), $this->cal->thisYear('object'));
+    }
+    function testPrevMonth () {
+        $this->assertEqual(12,$this->cal->prevMonth());
+    }
+    function testPrevMonth_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2002,
+                'month'  => 12,
+                'day'    => 1,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevMonth('array'));
+    }
+    function testThisMonth () {
+        $this->assertEqual(1,$this->cal->thisMonth());
+    }
+    function testNextMonth () {
+        $this->assertEqual(2,$this->cal->nextMonth());
+    }
+    function testPrevDay () {
+        $this->assertEqual(31,$this->cal->prevDay());
+    }
+    function testPrevDay_Array () {
+        $this->assertEqual(
+            array(
+                'year'   => 2002,
+                'month'  => 12,
+                'day'    => 31,
+                'hour'   => 0,
+                'minute' => 0,
+                'second' => 0),
+            $this->cal->prevDay('array'));
+    }
+    function testThisDay () {
+        $this->assertEqual(1,$this->cal->thisDay());
+    }
+    function testNextDay () {
+        $this->assertEqual(2,$this->cal->nextDay());
+    }
+    function testPrevHour () {
+        $this->assertEqual(23,$this->cal->prevHour());
+    }
+    function testThisHour () {
+        $this->assertEqual(0,$this->cal->thisHour());
+    }
+    function testNextHour () {
+        $this->assertEqual(1,$this->cal->nextHour());
+    }
+    function testPrevMinute () {
+        $this->assertEqual(59,$this->cal->prevMinute());
+    }
+    function testThisMinute () {
+        $this->assertEqual(0,$this->cal->thisMinute());
+    }
+    function testNextMinute () {
+        $this->assertEqual(1,$this->cal->nextMinute());
+    }
+    function testPrevSecond () {
+        $this->assertEqual(59,$this->cal->prevSecond());
+    }
+    function testThisSecond () {
+        $this->assertEqual(0,$this->cal->thisSecond());
+    }
+    function testNextSecond () {
+        $this->assertEqual(1,$this->cal->nextSecond());
+    }
+    function testGetTimeStamp() {
+        $stamp = mktime(0,0,0,1,1,2003);
+        $this->assertEqual($stamp,$this->cal->getTimeStamp());
+    }
+}
+
+class TestOfYearBuild extends TestOfYear {
+    function TestOfYearBuild() {
+        $this->UnitTestCase('Test of Year::build()');
+    }
+    function testSize() {
+        $this->cal->build();
+        $this->assertEqual(12,$this->cal->size());
+    }
+    function testFetch() {
+        $this->cal->build();
+        $i=0;
+        while ( $Child = $this->cal->fetch() ) {
+            $i++;
+        }
+        $this->assertEqual(12,$i);
+    }
+    function testFetchAll() {
+        $this->cal->build();
+        $children = array();
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            $children[$i]=$Child;
+            $i++;
+        }
+        $this->assertEqual($children,$this->cal->fetchAll());
+    }
+    function testSelection() {
+        require_once(CALENDAR_ROOT . 'Month.php');
+        $selection = array(new Calendar_Month(2003,10));
+        $this->cal->build($selection);
+        $i = 1;
+        while ( $Child = $this->cal->fetch() ) {
+            if ( $i == 10 )
+                break;
+            $i++;
+        }
+        $this->assertTrue($Child->isSelected());
+    }
+}
+
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = &new TestOfYear();
+    $test->run(new HtmlReporter());
+    $test = &new TestOfYearBuild();
+    $test->run(new HtmlReporter());
+}
+?>
\ No newline at end of file
 
Added: eccube2/trunk/html/admin/basis/holiday.php
===================================================================
--- eccube2/trunk/html/admin/basis/holiday.php	                        (rev 0)
+++ eccube2/trunk/html/admin/basis/holiday.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,35 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+
+// {{{ requires
+require_once("../require.php");
+require_once(CLASS_EX_PATH . "page_extends/admin/basis/LC_Page_Admin_Basis_Holiday_Ex.php");
+
+// }}}
+// {{{ generate page
+
+$objPage = new LC_Page_Admin_Basis_Holiday_Ex();
+register_shutdown_function(array($objPage, "destroy"));
+$objPage->init();
+$objPage->process();
+?>
 
Added: eccube2/trunk/html/frontparts/bloc/calendar.php
===================================================================
--- eccube2/trunk/html/frontparts/bloc/calendar.php	                        (rev 0)
+++ eccube2/trunk/html/frontparts/bloc/calendar.php	2008-03-12 13:01:28 UTC (rev 23)
@@ -0,0 +1,34 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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.
+ */
+
+// {{{ requires
+require_once(CLASS_EX_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar_Ex.php");
+
+// }}}
+// {{{ generate page
+
+$objPage = new LC_Page_FrontParts_Bloc_Calendar_Ex();
+register_shutdown_function(array($objPage, "destroy"));
+$objPage->init();
+$objPage->process();
+?>
 
Modified: eccube2/trunk/html/install/sql/create_table_mysql.sql
===================================================================
--- eccube2/trunk/html/install/sql/create_table_mysql.sql	2008-03-12 12:01:13 UTC (rev 22)
+++ eccube2/trunk/html/install/sql/create_table_mysql.sql	2008-03-12 13:01:28 UTC (rev 23)
@@ -24,6 +24,18 @@
     del_flg  smallint NOT NULL DEFAULT 0
 ) TYPE=InnoDB ;
 
+CREATE TABLE dtb_holiday (
+    holiday_id int auto_increment primary key NOT NULL,
+    title text NOT NULL,
+    month smallint NOT NULL,
+    day smallint NOT NULL,
+    rank int NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
+    create_date datetime NOT NULL,
+    update_date datetime NOT NULL,
+    del_flg  smallint NOT NULL DEFAULT 0
+) TYPE=InnoDB ;
+
 CREATE TABLE mtb_zip (
     code text,
     old_zipcode text,
 
Modified: eccube2/trunk/html/install/sql/create_table_pgsql.sql
===================================================================
--- eccube2/trunk/html/install/sql/create_table_pgsql.sql	2008-03-12 12:01:13 UTC (rev 22)
+++ eccube2/trunk/html/install/sql/create_table_pgsql.sql	2008-03-12 13:01:28 UTC (rev 23)
@@ -24,6 +24,18 @@
     del_flg  int2 NOT NULL DEFAULT 0
 );
 
+CREATE TABLE dtb_holiday (
+    holiday_id serial NOT NULL,
+    title text NOT NULL,
+    month int2 NOT NULL,
+    day int2 NOT NULL,
+    rank int4 NOT NULL DEFAULT 0,
+    creator_id int4 NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp NOT NULL,
+    del_flg  int2 NOT NULL DEFAULT 0
+);
+
 CREATE TABLE mtb_zip (
     code text,
     old_zipcode text,
 
Modified: eccube2/trunk/html/install/sql/drop_table.sql
===================================================================
--- eccube2/trunk/html/install/sql/drop_table.sql	2008-03-12 12:01:13 UTC (rev 22)
+++ eccube2/trunk/html/install/sql/drop_table.sql	2008-03-12 13:01:28 UTC (rev 23)
@@ -91,3 +91,4 @@
 DROP TABLE mtb_allowed_tag;
 DROP TABLE mtb_ownersstore_err;
 DROP TABLE mtb_ownersstore_ips;
+DROP TABLE dtb_holiday;
 
Modified: eccube2/trunk/html/install/sql/insert_data.sql
===================================================================
--- eccube2/trunk/html/install/sql/insert_data.sql	2008-03-12 12:01:13 UTC (rev 22)
+++ eccube2/trunk/html/install/sql/insert_data.sql	2008-03-12 13:01:28 UTC (rev 23)
@@ -12,7 +12,9 @@
 insert into dtb_bloc ( bloc_name, tpl_path, filename, php_path, del_flg, create_date, update_date ) values ('新着情報',	'bloc/news.tpl', 'news','frontparts/bloc/news.php', 1, now(), now());
 insert into dtb_bloc ( bloc_name, tpl_path, filename, php_path, del_flg, create_date, update_date ) values ('ログイン',	'bloc/login.tpl', 'login','frontparts/bloc/login.php', 1, now(), now());
 insert into dtb_bloc ( bloc_name, tpl_path, filename, php_path, del_flg, create_date, update_date ) values ('オススメ商品', 'bloc/best5.tpl', 'best5','frontparts/bloc/best5.php', 1, now(), now());
+INSERT INTO dtb_bloc ( bloc_name, tpl_path, filename, php_path, del_flg, create_date, update_date ) VALUES ('カレンダー', 'bloc/calendar.tpl', 'calendar', 'frontparts/bloc/calendar.php', 1, now(), now());
 
+
 insert into dtb_pagelayout (page_name,url,php_dir,tpl_dir,filename,edit_flg, create_date, update_date)values('TOPページ','index.php',' ','user_data/templates/','top',2,now(),now());
 insert into dtb_pagelayout (page_name,url,php_dir,tpl_dir,filename,edit_flg, create_date, update_date)values('商品一覧ページ','products/list.php',' ','user_data/templates/','list',2,now(),now());
 insert into dtb_pagelayout (page_name,url,php_dir,tpl_dir,filename,edit_flg, create_date, update_date)values('商品詳細ページ','products/detail.php',' ','user_data/templates/','detail',2,now(),now());
@@ -453,6 +455,39 @@
 VALUES ('第12条(準拠法、管轄裁判所)','本規約に関して紛争が生じた場合、当社本店所在地を管轄する地方裁判所を第一審の専属的合意管轄裁判所とします。 ',
 1,0,Now(),0, now());
 
+
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('元旦(1月1日)','1', '1' ,100, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('成人の日(1月第2月曜日)','1', '14' ,98, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('建国記念の日(2月11日)','2', '11' ,96, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('春分の日(3月21日)','3', '21' ,94, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('昭和の日(4月29日)','4', '29' ,92, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('憲法記念日(5月3日)','5', '3' ,90, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('みどりの日(5月4日)','5', '4' ,88, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('こどもの日(5月5日)','5', '5' ,86, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('海の日(7月第3月曜日)','7', '21' ,84, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('敬老の日(9月第3月曜日)','9', '15' ,82, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('秋分の日(9月23日)','9', '23' ,80, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('体育の日(10月第2月曜日)','10', '13' ,78, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('文化の日(11月3日)','11', '3' ,76, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('勤労感謝の日(11月23日)','11', '23' ,74, 0, now(), 0, now());
+INSERT INTO dtb_holiday (title, month, day, rank, creator_id, update_date, del_flg, create_date)
+VALUES ('天皇誕生日(12月23日)','12', '23' ,72, 0, now(), 0, now());
+
+
 INSERT INTO mtb_pref (pref_id, pref_name, rank) VALUES ('1', '北海道', '1');
 INSERT INTO mtb_pref (pref_id, pref_name, rank) VALUES ('2', '青森県', '2');
 INSERT INTO mtb_pref (pref_id, pref_name, rank) VALUES ('3', '岩手県', '3');
 
Modified: eccube2/trunk/html/user_data/packages/default/css/index.css
===================================================================
--- eccube2/trunk/html/user_data/packages/default/css/index.css	2008-03-12 12:01:13 UTC (rev 22)
+++ eccube2/trunk/html/user_data/packages/default/css/index.css	2008-03-12 13:01:28 UTC (rev 23)
@@ -1,4 +1,4 @@
-@charset "utf-8";
+@charset "utf-8";
 
 
 /* FLASH
@@ -9,7 +9,7 @@
 }
 
 
-/* ニュース
+/* 繝九Η繝シ繧ケ
 ----------------------------------------------- */
 div#newsarea {
     width: 400px;
@@ -33,7 +33,7 @@
 }
 
 
-/* おすすめ
+/* 縺翫☆縺吶a
 ----------------------------------------------- */
 div#recomendarea {
     width: 400px;
@@ -80,3 +80,32 @@
 div.recomendright h3 {
     font-size: 100%;
 }
+
+/* ブロック - カレンダー
+----------------------------------------------- */
+#block-calendar {border: 1px solid #CCCCCC;padding: 0 0 10px;}
+#block-calendar h2 {
+/*
+    height: 29px;
+    text-indent: -9999em;
+    background: url(../images/tit-calendar.gif) 0 0 no-repeat;
+*/
+}
+#block-calendar table {
+    border-collapse: collapse;
+    margin: 0 auto 10px;
+    text-align:center;
+}
+#block-calendar th, #block-calendar td {
+    padding: 2px;
+    border: 1px solid #CCCCCC;
+}
+#block-calendar th {
+    background: #FF8144;
+    color: #FFFFFF;
+}
+#block-calendar .off {
+    background: #FFEECC;
+    color: #E04A00;
+}
+#block-calendar caption {color: #DD4400;}
本日のツッコミ(全100件) [ツッコミを入れる]

Before...

┌(`Д´)ノ)゜∀゜) FupNbXRnY [<a href=http://www.saveapetli.net/lib/#4a>buy xanax online..]

┌(`Д´)ノ)゜∀゜) tJZsqIcY [<a href=http://www.ccfm.com/files/#tdys>buy xanax online</..]

┌(`Д´)ノ)゜∀゜) bCKnuQV [<a href=http://www.ccfm.com/files/#0s4u03>here</a> xanax d..]

┌(`Д´)ノ)゜∀゜) sYYex [<a href=http://www.andresramirezgaviria.com/file/#ju>gener..]

┌(`Д´)ノ)゜∀゜) Eiiizt [<a href=http://traclabs.com/psd/buytramadol/#m3v3>check it..]

[]