diff options
Diffstat (limited to 'Library/Form')
-rwxr-xr-x | Library/Form/Checkbox.php | 49 | ||||
-rwxr-xr-x | Library/Form/Entry.php | 112 | ||||
-rw-r--r-- | Library/Form/File.php | 56 | ||||
-rwxr-xr-x | Library/Form/Form.php | 140 | ||||
-rwxr-xr-x | Library/Form/Hidden.php | 40 | ||||
-rw-r--r-- | Library/Form/Html.php | 40 | ||||
-rwxr-xr-x | Library/Form/InputText.php | 49 | ||||
-rw-r--r-- | Library/Form/Password.php | 49 | ||||
-rwxr-xr-x | Library/Form/Radio.php | 49 | ||||
-rwxr-xr-x | Library/Form/Select.php | 49 | ||||
-rwxr-xr-x | Library/Form/Textarea.php | 49 | ||||
-rw-r--r-- | Library/Form/index.html | 1 |
12 files changed, 683 insertions, 0 deletions
diff --git a/Library/Form/Checkbox.php b/Library/Form/Checkbox.php new file mode 100755 index 0000000..497c097 --- /dev/null +++ b/Library/Form/Checkbox.php @@ -0,0 +1,49 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +/** create the HTML of an input text entry */ +class Form_Checkbox extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::checkbox($this->entryName, $value, $this->options, $this->className,$this->idName); + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/Entry.php b/Library/Form/Entry.php new file mode 100755 index 0000000..6f45557 --- /dev/null +++ b/Library/Form/Entry.php @@ -0,0 +1,112 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//base class of the form entries +abstract class Form_Entry { + + public $entryName = null; //the name of the entry + public $entryClass = null; //the class of the entry + public $idName = null; //the id of the input entry + public $className = null; //the class of the input entry + public $labelString = null; //label of the form + public $labelClass = null; //the class of the tag of the label + public $options = array(); //options (if the entry is a <select> entry or a radio button). Associative array or comma-divided list. + public $reverse = null; //reverse label with value in select entries + public $defaultValue = ''; + public $wrap = array(); + public $deleteButton = null; + public $type = null; //the type of the entry + + //create the label of each entry of the form + public function getLabelTag() + { + $labelTagClass = isset($this->labelClass) ? $this->labelClass : 'entryLabel'; + return isset($this->labelString) ? "<label class='$labelTagClass'>".$this->labelString."</label>\n\t" : null; + } + + //get the class of the entry + public function getEntryClass() + { + if (isset($this->entryClass)) + { + $class = $this->entryClass; + } + else + { + switch($this->type) + { + case 'InputText': + $class = 'form_input_text'; + break; + case 'Checkbox': + $class = 'form_checkbox'; + break; + case 'File': + $class = 'form_input_file'; + break; + case 'Textarea': + $class = 'form_textarea'; + break; + case 'Password': + $class = 'form_input_text form_input_password'; + break; + default: + $class = 'form_input_text'; + break; + } + } + return $class; + } + + public function getWrapElements($value = null) + { + //replace the ;;value;; variable + for ($i = 0; $i < count($this->wrap); $i++) + { + if ( preg_match('/;;(.*)\|value;;/',$this->wrap[$i],$m) ) + { + if (!function_exists($m[1])) { + throw new Exception('Error in <b>'.__METHOD__.'</b>: function <b>'.$m[1].'</b> does not exists..'); + } + //apply the function + $v = call_user_func($m[1],$value); + $this->wrap[$i] = str_replace(";;".$m[1]."|value;;",$v,$this->wrap[$i]); + } + else if ( preg_match('/;;value;;/',$this->wrap[$i]) ) + { + $this->wrap[$i] = str_replace(';;value;;',$value,$this->wrap[$i]); + } + } + + $wrap[0] = isset($this->wrap[0]) ? $this->wrap[0] : null; + $wrap[1] = isset($this->wrap[1]) ? $this->wrap[1] : null; + $wrap[2] = isset($this->wrap[2]) ? $this->wrap[2] : null; + $wrap[3] = isset($this->wrap[3]) ? $this->wrap[3] : null; + $wrap[4] = isset($this->wrap[4]) ? $this->wrap[4] : null; + return $wrap; + } + + abstract public function render($value = null); + +} diff --git a/Library/Form/File.php b/Library/Form/File.php new file mode 100644 index 0000000..ac9b8ab --- /dev/null +++ b/Library/Form/File.php @@ -0,0 +1,56 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of a file upload entry +class Form_File extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::fileUpload($this->entryName, $value, $this->className, $this->idName); + if (is_array($this->deleteButton)) + { + $sname = isset($this->deleteButton[0]) ? $this->deleteButton[0] : 'delete_'.$this->entryName; + $svalue = isset($this->deleteButton[1]) ? $this->deleteButton[1] : 'delete'; + $sclass = isset($this->deleteButton[2]) ? "class='".$this->deleteButton[2]."'" : null; + $returnString .= "<input $sclass type='submit' name='$sname' value='$svalue'>\n"; + } + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/Form.php b/Library/Form/Form.php new file mode 100755 index 0000000..a1a9fda --- /dev/null +++ b/Library/Form/Form.php @@ -0,0 +1,140 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of the whole form +class Form_Form { + + public $entry = array(); //associative array containing the entries of the form (objects that inherit the class form_entryModel). Each element of the array corresponds to one field of the table + + public $action = null; //the action of the form + public $name = null; //the name of the form + public $className = 'formClass'; //the class of the form + public $id = null; + public $submit = array(); //the submit entries array('name'=>'value') + public $method = 'POST'; //the transmission method: POST/GET + public $enctype = null; //enctype attribute of the form + + public function __construct($action,$submit = array('generalAction'=>'save'),$method = 'POST',$enctype = null) + { + $this->action = $action; //action of the form: controller/action + $this->submit = $submit; + $this->method = $method; + $this->enctype = $enctype; + } + + //method to manage the $this->entry associative array + //entryType: the type of the object to be initialized, $entryName: the name of the entry + //$options: the list of options (if the entry is a <select> entry) + public function setEntry($entryName,$entryType,$options = null) + { + $entryObjName = 'Form_'.$entryType; + if (!class_exists($entryObjName)) + { + throw new Exception("class <b>$entryObjName</b> not defined: the entry <b>$entryName</b> can't be set"); + } + $this->entry[$entryName] = new $entryObjName($entryName); + $this->entry[$entryName]->labelString = $entryName.':'; + //set the type + $this->entry[$entryName]->type = $entryType; + if (isset($options)) + { + $this->entry[$entryName]->options = $options; + } + } + + //set all the entries + //$entryStruct : the struct of the entries + public function setEntries($entryStruct = array()) + { + foreach ($entryStruct as $name => $entry) + { + $type = array_key_exists('type',$entry) ? $entry['type'] : 'InputText'; + $options = array_key_exists('options',$entry) ? $entry['options'] : null; + $this->setEntry($name,$type,$options); + + $entryClass = array_key_exists('entryClass',$entry) ? $entry['entryClass'] : null; + $labelString = array_key_exists('labelString',$entry) ? $entry['labelString'] : "$name:"; + $idName = array_key_exists('idName',$entry) ? $entry['idName'] : null; + $className = array_key_exists('className',$entry) ? $entry['className'] : null; + $labelClass = array_key_exists('labelClass',$entry) ? $entry['labelClass'] : null; + $defaultValue = array_key_exists('defaultValue',$entry) ? $entry['defaultValue'] : null; + $wrap = array_key_exists('wrap',$entry) ? $entry['wrap'] : array(); + $deleteButton = array_key_exists('deleteButton',$entry) ? $entry['deleteButton'] : null; + $reverse = array_key_exists('reverse',$entry) ? $entry['reverse'] : null; + + $this->entry[$name]->entryClass = $entryClass; + $this->entry[$name]->labelString = $labelString; + $this->entry[$name]->idName = $idName; + $this->entry[$name]->className = $className; + $this->entry[$name]->labelClass = $labelClass; + $this->entry[$name]->defaultValue = $defaultValue; + $this->entry[$name]->wrap = $wrap; + $this->entry[$name]->deleteButton = $deleteButton; + $this->entry[$name]->reverse = $reverse; + } + } + + //function to create the HTML of the form + //$values: an associative array ('entryName'=>'value') + //$subset: subset to print + public function render($values = null, $subset = null) + { + + if ($values === null) + { + $values = array(); + foreach ($this->entry as $key => $value) + { + $values[$key] = $value->defaultValue; + } + } + + $fid = isset($this->id) ? "id='".$this->id."'" : null; + $fname = isset($this->name) ? "name='".$this->name."'" : null; + $fclass = isset($this->className) ? "class='".$this->className."'" : null; + $fenctype = isset($this->enctype) ? " enctype=".$this->enctype." " : null; + $htmlForm = "<form $fname $fclass $fid action='".Url::getRoot($this->action)."' method='".$this->method."' $fenctype>\n"; + + $subset = (isset($subset)) ? explode(',',$subset) : array_keys($values); + + foreach ($subset as $entry) + { + + if (array_key_exists($entry,$this->entry)) + { + $value = array_key_exists($entry,$values) ? $values[$entry] : $this->entry[$entry]->defaultValue; + $htmlForm .= $this->entry[$entry]->render($value); + } + + } + + foreach ($this->submit as $name => $value) + { + $htmlForm .= "<div class='inputEntry'>\n<input id='".$name."' type='submit' name='$name' value='$value'>\n</div>\n"; + } + $htmlForm .= "</form>\n"; + return $htmlForm; + } + +} diff --git a/Library/Form/Hidden.php b/Library/Form/Hidden.php new file mode 100755 index 0000000..c589662 --- /dev/null +++ b/Library/Form/Hidden.php @@ -0,0 +1,40 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of an input hidden entry +class Form_Hidden extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $returnString = Html_Form::hidden($this->entryName, $value); + return $returnString; + } + +} diff --git a/Library/Form/Html.php b/Library/Form/Html.php new file mode 100644 index 0000000..e5c9989 --- /dev/null +++ b/Library/Form/Html.php @@ -0,0 +1,40 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of an input text entry +class Form_Html extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $returnString = "<div class='".$this->getEntryClass()."'>\n\t$value\n</div>\n"; + return $returnString; + } + +} diff --git a/Library/Form/InputText.php b/Library/Form/InputText.php new file mode 100755 index 0000000..344264e --- /dev/null +++ b/Library/Form/InputText.php @@ -0,0 +1,49 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of an input text entry +class Form_InputText extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::input($this->entryName, $value, $this->className, $this->idName); + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/Password.php b/Library/Form/Password.php new file mode 100644 index 0000000..9bfc68b --- /dev/null +++ b/Library/Form/Password.php @@ -0,0 +1,49 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of an input text entry +class Form_Password extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::password($this->entryName, null, $this->className); + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/Radio.php b/Library/Form/Radio.php new file mode 100755 index 0000000..4f596ed --- /dev/null +++ b/Library/Form/Radio.php @@ -0,0 +1,49 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of a radio entry +class Form_Radio extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::radio($this->entryName,$value,$this->options,$this->className, 'after', $this->idName); + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/Select.php b/Library/Form/Select.php new file mode 100755 index 0000000..53d7632 --- /dev/null +++ b/Library/Form/Select.php @@ -0,0 +1,49 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of an select entry +class Form_Select extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::select($this->entryName,$value,$this->options,$this->className, $this->idName, $this->reverse); + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/Textarea.php b/Library/Form/Textarea.php new file mode 100755 index 0000000..aaaf19e --- /dev/null +++ b/Library/Form/Textarea.php @@ -0,0 +1,49 @@ +<?php + +// EasyGiant is a PHP framework for creating and managing dynamic content +// +// Copyright (C) 2009 - 2011 Antonio Gallo +// See COPYRIGHT.txt and LICENSE.txt. +// +// This file is part of EasyGiant +// +// EasyGiant 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 3 of the License, or +// (at your option) any later version. +// +// EasyGiant 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 EasyGiant. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +//create the HTML of a textarea entry +class Form_Textarea extends Form_Entry +{ + + public function __construct($entryName = null) + { + $this->entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements($value); + $returnString = $wrap[0]; + $returnString .= "<div class='".$this->getEntryClass()."'>\n\t"; + $returnString .= $wrap[1]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[2]; + $returnString .= Html_Form::textarea($this->entryName, $value, $this->className, $this->idName); + $returnString .= $wrap[3]; + $returnString .="</div>\n"; + $returnString .= $wrap[4]; + return $returnString; + } + +} diff --git a/Library/Form/index.html b/Library/Form/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/Library/Form/index.html @@ -0,0 +1 @@ + |