cvs: pear /HTML_OOH_Form/container form_container_enum.php

From: Date: Tue, 20 Nov 2001 01:06:39 +0000
Subject: cvs: pear /HTML_OOH_Form/container form_container_enum.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1371@lists.php.net to get a copy of this message
uw Mon Nov 19 20:06:39 2001 EDT Added files: /pear/HTML_OOH_Form/container form_container_enum.php Log: enumerations, e.g. for select boxes Index: pear/HTML_OOH_Form/container/form_container_enum.php +++ pear/HTML_OOH_Form/container/form_container_enum.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_enum.php,v 1.1 2001/11/20 01:06:39 uw Exp $ require_once('HTML_OOH_Form/container/form_container_string.php'); /** * Plain string input field without encoding/decoding * * @package HTML_OOH_Form * @version $Id: form_container_enum.php,v 1.1 2001/11/20 01:06:39 uw Exp $ */ class form_container_enum extends form_container_string { var $allowed_slots = array( 'value' => 'mixed', 'minlength' => 'string', 'maxlength' => 'string', 'length_e' => 'string', 'valid_regex' => 'string', 'valid_icase' => 'boolean', 'valid_e' => 'string', 'intro' => 'mixed', 'intro_e' => 'string' ); function validate() { return $this->validateLength() . $this->validateRegExp() . $this->validateIntro(); } // end func validate /** * Checks whether an intro option was selected. * * @return string $message If not empty, an introption was selected. */ function validateIntro() { $message = ''; if ($this->doValidation('intro')) { if (is_array($this->intro)) { reset($this->intro); list($intro_value, $label) = each($this->intro); } else $intro_value = $this->intro; if (!is_array($this->value)) { if ($this->value == $intro_value) $message .= $this->intro_e; } else { foreach ($this->value as $value => $label) if ($value == $intro_value) { $message .= $this->intro_e; break; } } } return $message; } // end func validateIntro } // end class form_container_enum ?>

« previous php.pear.cvs (#1371) next »