cvs: pear /HTML_OOH_Form/container form_container_date.php
| From: | Ulf Wendel | Date: | Tue, 20 Nov 2001 01:06:13 +0000 |
| Subject: | cvs: pear /HTML_OOH_Form/container form_container_date.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1370@lists.php.net to get a copy of this message | ||
uw Mon Nov 19 20:06:13 2001 EDT
Added files:
/pear/HTML_OOH_Form/container form_container_date.php
Log:
Container used to store (english) dates
Index: pear/HTML_OOH_Form/container/form_container_date.php
+++ pear/HTML_OOH_Form/container/form_container_date.php
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 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/2_02.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: Ulf Wendel <ulf.wendel@phpdoc.de> |
// +----------------------------------------------------------------------+
//
// $Id: form_container_date.php,v 1.1 2001/11/20 01:06:13 uw Exp $
require_once('HTML_OOH_Form/container/form_container.php');
/**
* Framework of a container.
*
* @author Ulf Wendel <ulf.wendel@phpdoc.de>
* @package HTML_OOH_Form
* @version $Id: form_container_date.php,v 1.1 2001/11/20 01:06:13 uw Exp $
*/
class form_container_date extends form_container {
/**
* List of (validation rule) slots that can be set by the constructor.
*
* @var array
*/
var $allowed_slots = array(
'value' => 'mixed',
'minlength' => 'int',
'maxlength' => 'int',
'length_e' => 'string',
'valid_regex' => 'string',
'valid_icase' => 'boolean',
'valid_e' => 'string',
);
function encode($value) {
return date('Y-m-d', (int)$value);
} // end func encode
function decode($value) {
$value = strtotime($value);
print $value;
if (-1 == $value)
$value = time();
return $value;
} // end func decode
function validate() {
return $this->validateRegEx() . $this->validateLength();
}
} // end class form_container_date
?>