Location: PHPKode > projects > PHP Toolbox > apidoc/CControl.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
   <TITLE>class CControl</TITLE>
   <META NAME="GENERATOR" CONTENT="DOC++ 3.4.8">
   <LINK REL="stylesheet" TYPE="text/css" HREF="docxx.css">
</HEAD>
 <body>
<h1>PHP/Toolbox#2</h1>
<a name=top>&nbsp;</a>
<div class="navbar">
=[<a href="index.html">Contents</a>]=[<a href="HIER.html">Class Tree</a>]=[<a href="#bottom">Bottom</a>]=
</div>
<br>
In file ccontrol.phps:<H2>class <A HREF="#DOC.DOCU">CControl</A></H2></H2><BLOCKQUOTE>Basic form control class.</BLOCKQUOTE>
<HR>
<H2>Documentation</H2>
<BLOCKQUOTE>Basic form control class.
Use it to render an input tag somehow like
<xmp>
| 	new CControl(array(
| 		"type"	=> "text", "img", etc.
| 		…
| 	))
</xmp>
@package	PHP/Toolbox::Form</BLOCKQUOTE>

<A NAME="DOC.DOCU"></A>
<HR>

<H2>Inheritance:</H2>
<H3>CControl
- <A HREF="CMarkup.html">CMarkup</A>
- <A HREF="CSnippet.html">CSnippet</A>
</H3>
<HR>

<DL>
<P><DL>
<DT><H3>Public Fields</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.5.3">maxROLength</A></B>
<DD><I>Max length of readonly value</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.5.2">nodata</A></B>
<DD><I>Specifies that it's not a data control.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.5.1">type</A></B>
</DL></P>

<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.4">CControl</A></B>($<!1><A HREF="CMarkup.html#DOC.20.1">attrs</A> = NULL)
<DD><I>Constructor</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.5">code</A></B>()
<DD><I> Snippet ordinal code handler.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.6">codeReadonly</A></B>()
<DD><I>Readonly code handler.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.7">getValue</A></B>()
<DD><I>Returns control's value.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.10">htmlValue</A></B>()
<DD><I>Control's value to display.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.9">inValue</A></B>($value)
<DD><I>Control's value to input to form.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.8">outValue</A></B>()
<DD><I>Control's value to output from the form.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>function <B><A HREF="#DOC.5.11">validateValue</A></B>()
<DD><I>Verifies the control's data.</I>
</DL></P>

</DL>
<HR><H3>Inherited from <A HREF="CMarkup.html">CMarkup</A>:</H3>
<DL>
<P><DL>
<DT><H3>Public Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif> <B>attrs</B>
</DL></P>

</DL>
<HR><H3>Inherited from <A HREF="CSnippet.html">CSnippet</A>:</H3>
<DL>
<P><DL>
<DT><H3>Public Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif> <B>buffer</B>
<DT>
<IMG ALT="o" SRC=icon2.gif> <B>class</B>
<DT>
<IMG ALT="o" SRC=icon2.gif> <B>id</B>
</DL></P>

<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>function <B>append</B>($fields)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>buffer</B>($str)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>flush</B>()
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>getExternal</B>($varName, $default = , $globalArrayName=)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>getGlobal</B>($varName, $default = )
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>getVar</B>($varName)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>qualify</B>($varName)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>reset_buffer</B>($str=)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>reset_class_vars</B>()
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>setExternal</B>($varName, $value, $globalArrayName=)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>setGlobal</B>($varName, $value)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>write</B>($str)
<DT>
<IMG ALT="o" SRC=icon2.gif>function <B>writeCode</B>($<!1><A HREF="CTextarea.html#DOC.53.3">code</A>, $eval=FALSE)
</DL></P>

</DL>
<DL>

<A NAME="type"></A>
<A NAME="DOC.5.1"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> type</B></TT>
<DL><DT><DD></DL><P>
<A NAME="nodata"></A>
<A NAME="DOC.5.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> nodata</B></TT>
<DD>Specifies that it's not a data control.
I.e., there is no direct correspondence to
some database field.
<DL><DT><DD></DL><P>
<A NAME="maxROLength"></A>
<A NAME="DOC.5.3"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> maxROLength</B></TT>
<DD>Max length of readonly value
<DL><DT><DD></DL><P>
<A NAME="CControl"></A>
<A NAME="DOC.5.4"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function CControl($<!1><A HREF="CMarkup.html#DOC.20.1">attrs</A> = NULL)</B></TT>
<DD>Constructor
<DL><DT><DD></DL><P>
<A NAME="code"></A>
<A NAME="DOC.5.5"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function code()</B></TT>
<DD>
Snippet ordinal code handler.
It never has to be used directly, use it via the parent form method
instead.

<DL><DT><DT><B>Returns:</B><DD>  string	- the snippet HTML code.<BR><DD></DL><P>
<A NAME="codeReadonly"></A>
<A NAME="DOC.5.6"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function codeReadonly()</B></TT>
<DD>Readonly code handler.
It's called by parent form when in Readonly mode.
It produces a plain text and a hidden field.

<DL><DT><DT><B>Returns:</B><DD>  string	- the snippet HTML code.<BR><DD></DL><P>
<A NAME="getValue"></A>
<A NAME="DOC.5.7"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function getValue()</B></TT>
<DD>Returns control's value.
Use this also to override the data handling,
e.g. to process special data formats.
Note, stripslashes allow us to ignore magic_quotes_gpc setting.

<DL><DT><DT><B>Returns:</B><DD>  mixed	- value.<BR><DD></DL><P>
<A NAME="outValue"></A>
<A NAME="DOC.5.8"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function outValue()</B></TT>
<DD>Control's value to output from the form.
Use this to override the data handling,
e.g. to process special data formats.

<DL><DT><DT><B>Returns:</B><DD>  mixed	- out value.<BR><DD></DL><P>
<A NAME="inValue"></A>
<A NAME="DOC.5.9"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function inValue($value)</B></TT>
<DD>Control's value to input to form.
Use this to override the data handling,
e.g. to process special data formats.
<xmp>
|	$rset = do_query ($sql);
|	while (fetch_record($rset, $rec)) {
|		foreach ($rec as $fname => $value) {
|			global $$fname;
|			$$fname = inValue($value);
|		}
|	}
…
|	function inValue ($value) {
|		//	handle the set
|		return split(",", $value);
|	}
</xmp>

<DL><DT><DT><B>Parameters:</B><DD><B>mixed</B> - 	- value.
<BR><DT><B>Returns:</B><DD>  mixed	- in value ($value by default).<BR><DD></DL><P>
<A NAME="htmlValue"></A>
<A NAME="DOC.5.10"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function htmlValue()</B></TT>
<DD>Control's value to display.

<DL><DT><DT><B>Returns:</B><DD>  mixed	- display value (htmlspecialchars()ed by default).<BR><DD></DL><P>
<A NAME="validateValue"></A>
<A NAME="DOC.5.11"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>function validateValue()</B></TT>
<DD>Verifies the control's data.
Use this to override the data verification,
e.g. to process special data formats.
<ul>
<li> <code>ValidateAsNotEmpty</code> = the error message if empty.
<li> <code>ValidateAsInteger</code> = the error message if not an integer.
<li> <code>ValidateAsFloat</code> = the error message if not a float number.
<li> <code>ValidateAsEmail</code> = the error message if not a valid e-mail address.
<li> <code>ValidateAsRegex</code> = the error message if doesn't match to
</code>ValidationRegex</code> = validation regex.
</ul>
Note that error message is eval'ed, so you
can use "\$this->name", "\$value" to insert error data.

<DL><DT><DT><B>Returns:</B><DD>  mixed	- control validation result.<BR><DD></DL><P></DL>
<HR>
<DL><DT><B>Direct child classes:
</B><DD><A HREF="CTextarea.html">CTextarea</A><BR>
<A HREF="CSelect.html">CSelect</A><BR>
<A HREF="CDateTimeControl.html">CDateTimeControl</A><BR>
<A HREF="CCheckBox.html">CCheckBox</A><BR>
<A HREF="CCFile.html">CCFile</A><BR>
</DL>

<DL><DT><DD></DL><P> <a name=bottom>&nbsp;</a>
<div class="navbar">
=[<a href="index.html">Contents</a>]=[<a href="HIER.html">Class Tree</a>]=[<a href="#top">Top</a>]=
</div><HR>
<BR>
This page was generated with the help of <A HREF="http://docpp.sourceforge.net">DOC++</A>.
</BODY>
</HTML>
Return current item: PHP Toolbox