Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cHTML
  • cHTMLAlignmentTable
  • cHTMLArticle
  • cHTMLAside
  • cHTMLAudio
  • cHTMLButton
  • cHTMLCanvas
  • cHTMLCheckbox
  • cHTMLContentElement
  • cHTMLDiv
  • cHTMLFieldset
  • cHTMLFooter
  • cHTMLForm
  • cHTMLFormElement
  • cHTMLHeader
  • cHTMLHgroup
  • cHTMLHiddenField
  • cHTMLIFrame
  • cHTMLImage
  • cHTMLLabel
  • cHTMLLegend
  • cHTMLLink
  • cHTMLList
  • cHTMLListItem
  • cHTMLNav
  • cHTMLOptgroup
  • cHTMLOptionElement
  • cHTMLParagraph
  • cHTMLPasswordbox
  • cHTMLRadiobutton
  • cHTMLScript
  • cHTMLSection
  • cHTMLSelectElement
  • cHTMLSpan
  • cHTMLTable
  • cHTMLTableBody
  • cHTMLTableData
  • cHTMLTableHead
  • cHTMLTableHeader
  • cHTMLTableRow
  • cHTMLTextarea
  • cHTMLTextbox
  • cHTMLTime
  • cHTMLUpload
  • cHTMLVideo
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * This file contains the cHTMLForm class.
 4:  *
 5:  * @package Core
 6:  * @subpackage GUI_HTML
 7:  * @version SVN Revision $Rev:$
 8:  *
 9:  * @author Simon Sprankel
10:  * @copyright four for business AG <www.4fb.de>
11:  * @license http://www.contenido.org/license/LIZENZ.txt
12:  * @link http://www.4fb.de
13:  * @link http://www.contenido.org
14:  */
15: 
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17: 
18: /**
19:  * cHTMLForm class represents a form.
20:  *
21:  * @package Core
22:  * @subpackage GUI_HTML
23:  */
24: class cHTMLForm extends cHTMLContentElement {
25: 
26:     protected $_name;
27: 
28:     protected $_action;
29: 
30:     protected $_method;
31: 
32:     /**
33:      * Creates an HTML form element.
34:      *
35:      * @param string $name the name of the form
36:      * @param string $action the action which should be performed when this form
37:      *        is submitted
38:      * @param string $method the method to use - post or get
39:      * @param string $class the class of this element
40:      * @return void
41:      */
42:     public function __construct($name = '', $action = 'main.php', $method = 'post', $class = '') {
43:         parent::__construct('', $class);
44:         $this->_tag = 'form';
45:         $this->_name = $name;
46:         $this->_action = $action;
47:         $this->_method = $method;
48:     }
49: 
50:     /**
51:      * Sets the given var.
52:      *
53:      * @param string $var
54:      * @param string $value
55:      * @return cHTMLForm $this
56:      */
57:     public function setVar($var, $value) {
58:         $this->_vars[$var] = $value;
59: 
60:         return $this;
61:     }
62: 
63:     /**
64:      * Renders the form element
65:      *
66:      * @return string Rendered HTML
67:      */
68:     public function toHTML() {
69:         $out = '';
70:         if (is_array($this->_vars)) {
71:             foreach ($this->_vars as $var => $value) {
72:                 $f = new cHTMLHiddenField($var, $value);
73:                 $out .= $f->render();
74:             }
75:         }
76:         if ($this->getAttribute('name') == '') {
77:             $this->setAttribute('name', $this->_name);
78:         }
79:         if ($this->getAttribute('method') == '') {
80:             $this->setAttribute('method', $this->_method);
81:         }
82:         if ($this->getAttribute('action') == '') {
83:             $this->setAttribute('action', $this->_action);
84:         }
85: 
86:         $attributes = $this->getAttributes(true);
87: 
88:         return $this->fillSkeleton($attributes) . $out . $this->_content . $this->fillCloseSkeleton();
89:     }
90: 
91: }
92: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0