Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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: /**
 4:  * This file contains the cHTMLForm class.
 5:  *
 6:  * @package Core
 7:  * @subpackage GUI_HTML
 8:  * @version SVN Revision $Rev:$
 9:  *
10:  * @author Simon Sprankel
11:  * @copyright four for business AG <www.4fb.de>
12:  * @license http://www.contenido.org/license/LIZENZ.txt
13:  * @link http://www.4fb.de
14:  * @link http://www.contenido.org
15:  */
16: 
17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
18: 
19: /**
20:  * cHTMLForm class represents a form.
21:  *
22:  * @package Core
23:  * @subpackage GUI_HTML
24:  */
25: class cHTMLForm extends cHTMLContentElement {
26: 
27:     protected $_name;
28: 
29:     protected $_action;
30: 
31:     protected $_method;
32: 
33:     /**
34:      * Creates an HTML form element.
35:      *
36:      * @param string $name [optional]
37:      *         the name of the form
38:      * @param string $action [optional]
39:      *         the action which should be performed when this form is submitted
40:      * @param string $method [optional]
41:      *         the method to use - post or get
42:      * @param string $class [optional]
43:      *         the class of this element
44:      */
45:     public function __construct($name = '', $action = 'main.php', $method = 'post', $class = '') {
46:         parent::__construct('', $class);
47:         $this->_tag = 'form';
48:         $this->_name = $name;
49:         $this->_action = $action;
50:         $this->_method = $method;
51:     }
52: 
53:     /**
54:      * Sets the given var.
55:      *
56:      * @param string $var
57:      * @param string $value
58:      * @return cHTMLForm
59:      *         $this for chaining
60:      */
61:     public function setVar($var, $value) {
62:         $this->_vars[$var] = $value;
63: 
64:         return $this;
65:     }
66: 
67:     /**
68:      * Renders the form element
69:      *
70:      * @return string
71:      *         Rendered HTML
72:      */
73:     public function toHTML() {
74:         $out = '';
75:         if (is_array($this->_vars)) {
76:             foreach ($this->_vars as $var => $value) {
77:                 $f = new cHTMLHiddenField($var, $value);
78:                 $out .= $f->render();
79:             }
80:         }
81:         if ($this->getAttribute('name') == '') {
82:             $this->setAttribute('name', $this->_name);
83:         }
84:         if ($this->getAttribute('method') == '') {
85:             $this->setAttribute('method', $this->_method);
86:         }
87:         if ($this->getAttribute('action') == '') {
88:             $this->setAttribute('action', $this->_action);
89:         }
90: 
91:         $attributes = $this->getAttributes(true);
92: 
93:         return $this->fillSkeleton($attributes) . $out . $this->_content . $this->fillCloseSkeleton();
94:     }
95: 
96: }
97: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0