From 232aa1924c8c0f10d87b210b46c9f061af5c844c Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 17 Oct 2010 13:29:57 +0000 Subject: added files --- h-source/Library/Form/Checkbox.php | 41 +++++++++++++ h-source/Library/Form/Entry.php | 45 ++++++++++++++ h-source/Library/Form/Form.php | 116 ++++++++++++++++++++++++++++++++++++ h-source/Library/Form/Hidden.php | 23 +++++++ h-source/Library/Form/Html.php | 23 +++++++ h-source/Library/Form/InputText.php | 30 ++++++++++ h-source/Library/Form/Password.php | 30 ++++++++++ h-source/Library/Form/Radio.php | 30 ++++++++++ h-source/Library/Form/Select.php | 30 ++++++++++ h-source/Library/Form/Textarea.php | 30 ++++++++++ h-source/Library/Form/index.html | 1 + 11 files changed, 399 insertions(+) create mode 100755 h-source/Library/Form/Checkbox.php create mode 100755 h-source/Library/Form/Entry.php create mode 100755 h-source/Library/Form/Form.php create mode 100755 h-source/Library/Form/Hidden.php create mode 100644 h-source/Library/Form/Html.php create mode 100755 h-source/Library/Form/InputText.php create mode 100644 h-source/Library/Form/Password.php create mode 100755 h-source/Library/Form/Radio.php create mode 100755 h-source/Library/Form/Select.php create mode 100755 h-source/Library/Form/Textarea.php create mode 100644 h-source/Library/Form/index.html (limited to 'h-source/Library/Form') diff --git a/h-source/Library/Form/Checkbox.php b/h-source/Library/Form/Checkbox.php new file mode 100755 index 0000000..5df1917 --- /dev/null +++ b/h-source/Library/Form/Checkbox.php @@ -0,0 +1,41 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::checkbox($this->entryName, $value, $this->options, $this->className,$this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/Entry.php b/h-source/Library/Form/Entry.php new file mode 100755 index 0000000..725235a --- /dev/null +++ b/h-source/Library/Form/Entry.php @@ -0,0 +1,45 @@ + entry or a radio button). Associative array or comma-divided list. + public $defaultValue = ''; + public $wrap = array(); + 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) ? "\n\t" : null; + } + + //get the class of the entry + public function getEntryClass() + { + return isset($this->entryClass) ? $this->entryClass : 'formEntry'; + } + + public function getWrapElements() + { + $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; + return $wrap; + } + + abstract public function render($value = null); + +} diff --git a/h-source/Library/Form/Form.php b/h-source/Library/Form/Form.php new file mode 100755 index 0000000..00e27d4 --- /dev/null +++ b/h-source/Library/Form/Form.php @@ -0,0 +1,116 @@ +'value') + public $method = 'POST'; //the transmission method: POST/GET + + public function __construct($action,$submit = array('generalAction'=>'save'),$method = 'POST') + { + $this->action = $action; //action of the form: controller/action + $this->submit = $submit; + $this->method = $method; + } + + //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 \n\n"; + } + $htmlForm .= "\n"; + return $htmlForm; + } + +} diff --git a/h-source/Library/Form/Hidden.php b/h-source/Library/Form/Hidden.php new file mode 100755 index 0000000..fb81b30 --- /dev/null +++ b/h-source/Library/Form/Hidden.php @@ -0,0 +1,23 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $returnString = Html_Form::hidden($this->entryName, $value); + return $returnString; + } + +} diff --git a/h-source/Library/Form/Html.php b/h-source/Library/Form/Html.php new file mode 100644 index 0000000..dce91c6 --- /dev/null +++ b/h-source/Library/Form/Html.php @@ -0,0 +1,23 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $returnString = "
\n\t$value\n
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/InputText.php b/h-source/Library/Form/InputText.php new file mode 100755 index 0000000..fb98336 --- /dev/null +++ b/h-source/Library/Form/InputText.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::input($this->entryName, $value, $this->className, $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/Password.php b/h-source/Library/Form/Password.php new file mode 100644 index 0000000..76bc735 --- /dev/null +++ b/h-source/Library/Form/Password.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::password($this->entryName, null, $this->className); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/Radio.php b/h-source/Library/Form/Radio.php new file mode 100755 index 0000000..fb20677 --- /dev/null +++ b/h-source/Library/Form/Radio.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::radio($this->entryName,$value,$this->options,$this->className, 'after', $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/Select.php b/h-source/Library/Form/Select.php new file mode 100755 index 0000000..558fd57 --- /dev/null +++ b/h-source/Library/Form/Select.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::select($this->entryName,$value,$this->options,$this->className, $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/Textarea.php b/h-source/Library/Form/Textarea.php new file mode 100755 index 0000000..d81cc84 --- /dev/null +++ b/h-source/Library/Form/Textarea.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::textarea($this->entryName, $value, $this->className, $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/h-source/Library/Form/index.html b/h-source/Library/Form/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/h-source/Library/Form/index.html @@ -0,0 +1 @@ + -- cgit v1.2.3