| 1 | <?php |
|---|
| 2 | // $Id: formtextarea.php,v 1.2 2005/03/18 12:51:55 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------ // |
|---|
| 27 | // Author: Kazumi Ono (AKA onokazu) // |
|---|
| 28 | // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // |
|---|
| 29 | // Project: The XOOPS Project // |
|---|
| 30 | // ------------------------------------------------------------------------- // |
|---|
| 31 | /** |
|---|
| 32 | * |
|---|
| 33 | * |
|---|
| 34 | * @package kernel |
|---|
| 35 | * @subpackage form |
|---|
| 36 | * |
|---|
| 37 | * @author Kazumi Ono <[email protected]> |
|---|
| 38 | * @copyright copyright (c) 2000-2003 XOOPS.org |
|---|
| 39 | */ |
|---|
| 40 | /** |
|---|
| 41 | * A textarea |
|---|
| 42 | * |
|---|
| 43 | * @author Kazumi Ono <[email protected]> |
|---|
| 44 | * @copyright copyright (c) 2000-2003 XOOPS.org |
|---|
| 45 | * |
|---|
| 46 | * @package kernel |
|---|
| 47 | * @subpackage form |
|---|
| 48 | */ |
|---|
| 49 | class XoopsFormTextArea extends XoopsFormElement { |
|---|
| 50 | /** |
|---|
| 51 | * number of columns |
|---|
| 52 | * @var int |
|---|
| 53 | * @access private |
|---|
| 54 | */ |
|---|
| 55 | var $_cols; |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * number of rows |
|---|
| 59 | * @var int |
|---|
| 60 | * @access private |
|---|
| 61 | */ |
|---|
| 62 | var $_rows; |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * initial content |
|---|
| 66 | * @var string |
|---|
| 67 | * @access private |
|---|
| 68 | */ |
|---|
| 69 | var $_value; |
|---|
| 70 | |
|---|
| 71 | /** |
|---|
| 72 | * Constuctor |
|---|
| 73 | * |
|---|
| 74 | * @param string $caption caption |
|---|
| 75 | * @param string $name name |
|---|
| 76 | * @param string $value initial content |
|---|
| 77 | * @param int $rows number of rows |
|---|
| 78 | * @param int $cols number of columns |
|---|
| 79 | */ |
|---|
| 80 | function XoopsFormTextArea($caption, $name, $value="", $rows=5, $cols=50){ |
|---|
| 81 | $this->setCaption($caption); |
|---|
| 82 | $this->setName($name); |
|---|
| 83 | $this->_rows = intval($rows); |
|---|
| 84 | $this->_cols = intval($cols); |
|---|
| 85 | $this->setValue($value); |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | /** |
|---|
| 89 | * get number of rows |
|---|
| 90 | * |
|---|
| 91 | * @return int |
|---|
| 92 | */ |
|---|
| 93 | function getRows(){ |
|---|
| 94 | return $this->_rows; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /** |
|---|
| 98 | * Get number of columns |
|---|
| 99 | * |
|---|
| 100 | * @return int |
|---|
| 101 | */ |
|---|
| 102 | function getCols(){ |
|---|
| 103 | return $this->_cols; |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | * Get initial content |
|---|
| 108 | * |
|---|
| 109 | * @return string |
|---|
| 110 | */ |
|---|
| 111 | function getValue(){ |
|---|
| 112 | return $this->_value; |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | /** |
|---|
| 116 | * Set initial content |
|---|
| 117 | * |
|---|
| 118 | * @param $value string |
|---|
| 119 | */ |
|---|
| 120 | function setValue($value){ |
|---|
| 121 | $this->_value = $value; |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | /** |
|---|
| 125 | * prepare HTML for output |
|---|
| 126 | * |
|---|
| 127 | * @return sting HTML |
|---|
| 128 | */ |
|---|
| 129 | function render(){ |
|---|
| 130 | return "<textarea name='".$this->getName()."' id='".$this->getName()."' rows='".$this->getRows()."' cols='".$this->getCols()."'".$this->getExtra().">".$this->getValue()."</textarea>"; |
|---|
| 131 | } |
|---|
| 132 | } |
|---|
| 133 | ?> |
|---|