123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- # ***** BEGIN LICENSE BLOCK *****
- # This file is part of DotClear.
- # Copyright (c) 2004 Olivier Meunier and contributors. All rights
- # reserved.
- #
- # DotClear 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.
- #
- # DotClear 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 DotClear; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- #
- # ***** END LICENSE BLOCK *****
- class form
- {
- function combo($name,$arryData,$default='',$class='',$id='',$tabindex='')
- {
- $res = '<select name="'.$name.'" ';
-
- if($class != '')
- $res .= 'class="'.$class.'" ';
-
- if($tabindex != '')
- $res .= 'tabindex="'.$tabindex.'" ';
-
- if($id != '')
- $res .= 'id="'.$id.'" ';
- else
- $res .= 'id="'.$name.'" ';
-
- $res .= '>'."\n";
-
- foreach($arryData as $k => $v)
- {
- $res .= '<option value="'.$v.'"';
-
- if($v == $default)
- $res .= ' selected="selected"';
-
- $res .= '>'.$k.'</option>'."\n";
- }
-
- $res .= '</select>'."\n";
-
- return $res;
- }
-
- function radio($name, $value, $checked='', $class='', $id='')
- {
- $res = '<input type="radio" name="'.$name.'" value="'.$value.'" ';
-
- if($class != '') {
- $res .= 'class="'.$class.'" ';
- }
-
- if($id != '') {
- $res .= 'id="'.$id.'" ';
- }
-
- if (($checked === 0) or $checked >= 1) {
- $res .= 'checked="checked" ';
- }
-
- $res .= '/>'."\n";
-
- return $res;
- }
- function checkbox($name, $value, $checked='', $class='', $id='')
- {
- $res = '<input type="checkbox" name="'.$name.'" value="'.$value.'"';
-
- if($class != '')
- $res .= 'class="'.$class.'" ';
-
- if($id != '') {
- $res .= 'id="'.$id.'" ';
- }
- if($checked != '') {
- $res.='checked="checked"';
- }
-
- $res .= ' />'."\n";
- return $res;
- }
- function field($id,$size,$max,$default='',$tabindex='',$html='')
- {
- if (is_array($id)) {
- $name = $id[0];
- $id = isset($id[1]) ? $id[1] : '';
- } else {
- $name = $id;
- }
-
- $res = '<input type="text" size="'.$size.'" name="'.$name.'" ';
-
- $res .= ($id != '') ? 'id="'.$id.'" ' : '';
- $res .= ($max != '') ? 'maxlength="'.$max.'" ' : '';
- $res .= ($tabindex != '') ? 'tabindex="'.$tabindex.'" ' : '';
- $res .= ($default != '') ? 'value="'.$default.'" ' : '';
- $res .= $html;
-
- $res .= ' />';
-
- return $res;
- }
-
- function textArea($id,$cols,$rows,$default='',$tabindex='',$html='')
- {
- $res = '<textarea cols="'.$cols.'" rows="'.$rows.'" ';
- $res .= 'name="'.$id.'" id="'.$id.'" ';
- $res .= ($tabindex != '') ? 'tabindex="'.$tabindex.'" ' : '';
- $res .= $html.'>';
- $res .= $default;
- $res .= '</textarea>';
-
- return $res;
- }
-
- function hidden($id,$value)
- {
- return '<input type="hidden" name="'.$id.'" value="'.$value.'" />';
- }
- }
- ?>
|