Location: PHPKode > projects > Aukyla Document Management System > doc/html/a00215.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Aukyla PHP Framework</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="StyleSheet" href="auton.css" type="text/css" media="screen">
  </head>

  <body>
    <div id="mainmenu">
      <a href="http://www.auton.nl/" class="home">Home</a>
    </div>
    <div id="submenu">
      <a class="logo" href="http://www.auton.nl/"></a>

      <div class="head">Ads</div>
      <a href="http://sourceforge.net/"><img src="http://sourceforge.net/sflogo.php?group_id=116358&amp;type=1" alt="SourceForge.net Logo" style="padding: 2px 4px; width: 88px; height: 31px; border: 0px"></a>
      <a href="http://getfirefox.com/" title="Get Firefox - The Browser, Reloaded."><img src="http://www.mozilla.org/products/firefox/buttons/getfirefox_small.png" alt="Get Firefox" style="width: 110px; height: 32px; border: 0px"></a>
    </div>
    <div id="main">
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">base</a></div>
<h1>Forms.php</h1><div class="fragment"><pre class="fragment">00001 &lt;?php
00002 <span class="comment">/*</span>
00003 <span class="comment">     Forms.php, provides functions for building forms</span>
00004 <span class="comment">     Copyright (C) 2004 Arend van Beelen, Auton Rijnsburg</span>
00005 <span class="comment"></span>
00006 <span class="comment">     This program is free software; you can redistribute it and/or modify it</span>
00007 <span class="comment">     under the terms of the GNU General Public License as published by the Free</span>
00008 <span class="comment">     Software Foundation; either version 2 of the License, or (at your option)</span>
00009 <span class="comment">     any later version.</span>
00010 <span class="comment"></span>
00011 <span class="comment">     This program is distributed in the hope that it will be useful, but WITHOUT</span>
00012 <span class="comment">     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
00013 <span class="comment">     FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for</span>
00014 <span class="comment">     more details.</span>
00015 <span class="comment"></span>
00016 <span class="comment">     You should have received a copy of the GNU General Public License along</span>
00017 <span class="comment">     with this program; if not, write to the Free Software Foundation, Inc.,</span>
00018 <span class="comment">     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
00019 <span class="comment"></span>
00020 <span class="comment">     For any questions, comments or whatever, you may mail me at: hide@address.com</span>
00021 <span class="comment">*/</span>
00022 
00023 require_once('<a class="code" href="a00092.html">Config</a>.php');
00024 require_once('<a class="code" href="a00115.html">JavaScript</a>.php');
00025 require_once('<a class="code" href="a00119.html">Locale</a>.php');
00026 require_once('<a class="code" href="a00153.html">String</a>.php');
00027 require_once('Tables.php');
00028 require_once('Widgets.php');
00029 
<a name="l00037"></a><a class="code" href="a00106.html">00037</a> <span class="keyword">class </span><a class="code" href="a00106.html">Form</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00038 {
<a name="l00047"></a><a class="code" href="a00106.html#a0">00047</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $actionURL)
00048         {
00049                 parent::__construct($parent);
00050 
00051                 $this-&gt;actionURL = $actionURL;
00052                 $this-&gt;multiPart = <span class="keyword">false</span>;
00053                 $this-&gt;required = array();
00054                 $this-&gt;expressions = array();
00055                 $this-&gt;<a class="code" href="a00106.html#a8">errorMessage</a> = i18n('Please fill in all required fields.');
00056                 $this-&gt;<a class="code" href="a00106.html#a9">useGridLayout</a> = <span class="keyword">false</span>;
00057                 $this-&gt;childrenUseGridLayout = array();
00058                 $this-&gt;<a class="code" href="a00106.html#a12">singleShot</a> = <span class="keyword">false</span>;
00059 
00060                 self::$highlightMethod = <a class="code" href="a00092.html#e0">Config::globals</a>('formLabelHighlight', 'bold');
00061         }
00062 
<a name="l00066"></a><a class="code" href="a00106.html#a1">00066</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a1">show</a>()
00067         {
00068                 $enctypeProperty = ($this-&gt;multiPart ? <span class="stringliteral">" enctype=\"multipart/form-data\""</span> : '');
00069 
00070                 <span class="keywordflow">if</span>($this-&gt;<a class="code" href="a00106.html#a4">hasChecks</a>())
00071                 {
00072                         $expressions = $this-&gt;expressions;
00073                         <span class="keywordflow">if</span>(<span class="keyword">sizeof</span>($this-&gt;required) &gt; 0)
00074                         {
00075                                 $expressions[<a class="code" href="a00115.html#e0">JavaScript::checkVariables</a>($this-&gt;required)] = $this-&gt;errorMessage;
00076                         }
00077                         $javaScript = <span class="keyword">new</span> <a class="code" href="a00115.html">JavaScript</a>($<span class="keyword">this</span>, JavaScript::checkFormFunction($expressions, $this-&gt;id));
00078                 }
00079 
00080                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;form$enctypeProperty action=\"{$this-&gt;actionURL}\""</span>.$this-&gt;parentProperties().<span class="charliteral">'&gt;'</span>);
00081 
00082                 <span class="keywordflow">if</span>($this-&gt;<a class="code" href="a00106.html#a9">useGridLayout</a> == <span class="keyword">true</span>)
00083                 {
00084                         $createNewGridLayout = <span class="keyword">true</span>;
00085                         $gridLayout = NULL;
00086                         foreach($this-&gt;children as $i =&gt; $child)
00087                         {
00088                                 <span class="keywordflow">if</span>($this-&gt;childrenUseGridLayout[$i] == <span class="keyword">true</span>)
00089                                 {
00090                                         <span class="keywordflow">if</span>($createNewGridLayout == <span class="keyword">true</span>)
00091                                         {
00092                                                 $gridLayout = <span class="keyword">new</span> <a class="code" href="a00108.html">GridLayout</a>($<span class="keyword">this</span>, 2);
00093                                                 $createNewGridLayout = <span class="keyword">false</span>;
00094                                         }
00095                                         $child-&gt;show($<a class="code" href="a00106.html#a10">gridLayout</a>);
00096                                 }
00097                                 <span class="keywordflow">else</span>
00098                                 {
00099                                         <span class="keywordflow">if</span>($createNewGridLayout == <span class="keyword">false</span>)
00100                                         {
00101                                                 $gridLayout-&gt;show();
00102                                         }
00103                                         $createNewGridLayout = <span class="keyword">true</span>;
00104                                         $child-&gt;show();
00105                                 }
00106                         }
00107                         <span class="keywordflow">if</span>($createNewGridLayout == <span class="keyword">false</span>)
00108                         {
00109                                 $gridLayout-&gt;show();
00110                         }
00111                 }
00112                 <span class="keywordflow">else</span>
00113                 {
00114                         parent::show();
00115                 }
00116 
00117                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/<a class="code" href="a00106.html#a2">form</a>&gt;');
00118         }
00119 
<a name="l00123"></a><a class="code" href="a00106.html#a2">00123</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a2">form</a>()
00124         {
00125                 <span class="keywordflow">return</span> $this;
00126         }
00127 
<a name="l00139"></a><a class="code" href="a00106.html#a3">00139</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a3">setRequired</a>($<span class="keywordtype">id</span>, $required)
00140         {
00141                 <span class="keywordflow">if</span>($required == <span class="keyword">true</span>)
00142                 {
00143                         $this-&gt;required[$id] = $id;
00144                 }
00145                 <span class="keywordflow">else</span>
00146                 {
00147                         unset($this-&gt;required[$<span class="keywordtype">id</span>]);
00148                 }
00149         }
00150 
<a name="l00155"></a><a class="code" href="a00106.html#a4">00155</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a4">hasChecks</a>()
00156         {
00157                 <span class="keywordflow">return</span> (<span class="keyword">sizeof</span>($this-&gt;required) &gt; 0 ||
00158                         <span class="keyword">sizeof</span>($this-&gt;expressions) &gt; 0);
00159         }
00160 
<a name="l00170"></a><a class="code" href="a00106.html#a5">00170</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a5">addJavaScriptCheck</a>($expression, $error = '')
00171         {
00172                 $this-&gt;expressions[$expression] = $error;
00173         }
00174 
<a name="l00184"></a><a class="code" href="a00106.html#a6">00184</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a6">setMultiPart</a>($multiPart)
00185         {
00186                 $this-&gt;multiPart = $multiPart;
00187         }
00188 
<a name="l00195"></a><a class="code" href="a00106.html#a7">00195</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a7">setErrorMessage</a>($errorMessage)
00196         {
00197                 $this-&gt;<a class="code" href="a00106.html#a8">errorMessage</a> = $errorMessage;
00198         }
00199 
<a name="l00206"></a><a class="code" href="a00106.html#a8">00206</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a8">errorMessage</a>()
00207         {
00208                 <span class="keywordflow">return</span> $this-&gt;errorMessage;
00209         }
00210 
<a name="l00218"></a><a class="code" href="a00106.html#a9">00218</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a9">useGridLayout</a>($useGridLayout)
00219         {
00220                 $this-&gt;<a class="code" href="a00106.html#a9">useGridLayout</a> = $useGridLayout;
00221         }
00222 
<a name="l00228"></a><a class="code" href="a00106.html#a10">00228</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a10">gridLayout</a>()
00229         {
00230                 <span class="keywordflow">return</span> $this-&gt;useGridLayout;
00231         }
00232 
<a name="l00248"></a><a class="code" href="a00106.html#a11">00248</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a11">setSingleShot</a>($singleShot)
00249         {
00250                 $this-&gt;<a class="code" href="a00106.html#a12">singleShot</a> = $singleShot;
00251         }
00252 
<a name="l00258"></a><a class="code" href="a00106.html#a12">00258</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a12">singleShot</a>()
00259         {
00260                 <span class="keywordflow">return</span> $this-&gt;singleShot;
00261         }
00262 
<a name="l00263"></a><a class="code" href="a00106.html#a13">00263</a>         <span class="keyword">public</span> function <a class="code" href="a00106.html#a13">addWidget</a>(<a class="code" href="a00166.html">Widget</a> $widget)
00264         {
00265                 parent::addWidget($widget);
00266 
00267                 $this-&gt;childrenUseGridLayout[] = (is_a($widget, '<a class="code" href="a00114.html">Input</a>') &amp;&amp;
00268                                                   $widget-&gt;supportsGridLayout());
00269         }
00270 
<a name="l00275"></a><a class="code" href="a00106.html#e0">00275</a>         <span class="keyword">public</span> <span class="keyword">static</span> function <a class="code" href="a00106.html#e0">highlightLabel</a>($label, $attribute = <span class="keyword">false</span>)
00276         {
00277                 <span class="keywordflow">switch</span>(self::$highlightMethod)
00278                 {
00279                         <span class="keywordflow">case</span> 'bold':
00280                                 <span class="keywordflow">if</span>($attribute == <span class="keyword">false</span>)
00281                                 {
00282                                         <span class="keywordflow">return</span> <span class="stringliteral">"&lt;label style=\"font-weight: bold\"&gt;$label&lt;/label&gt;"</span>;
00283                                 }
00284                                 <span class="keywordflow">else</span>
00285                                 {
00286                                         <span class="keywordflow">return</span> <span class="stringliteral">"$label\" labelstyle=\"font-weight: bold"</span>;
00287                                 }
00288 
00289                         <span class="keywordflow">case</span> 'star':
00290                                 <span class="keywordflow">if</span>(<a class="code" href="a00153.html#e3">String::endsWith</a>($label, <span class="charliteral">':'</span>))
00291                                 {
00292                                         <span class="keywordflow">return</span> <a class="code" href="a00153.html#e0">String::substringBefore</a>($label, <span class="charliteral">':'</span>).'*:';
00293                                 }
00294                                 <span class="keywordflow">return</span> $label.<span class="charliteral">'*'</span>;
00295                 }
00296         }
00297 
<a name="l00298"></a><a class="code" href="a00106.html#p0">00298</a>         <span class="keyword">protected</span> $children;
<a name="l00299"></a><a class="code" href="a00106.html#p1">00299</a>         <span class="keyword">protected</span> $id;
00300 
00301         <span class="keyword">private</span> $actionURL;
00302         <span class="keyword">private</span> $multiPart;
00303         <span class="keyword">private</span> $required;
00304         <span class="keyword">private</span> $expressions;
00305         <span class="keyword">private</span> $errorMessage;
00306         <span class="keyword">private</span> $useGridLayout;
00307         <span class="keyword">private</span> $childrenUseGridLayout;
00308         <span class="keyword">private</span> $singleShot;
00309 
00310         <span class="keyword">static</span> <span class="keyword">private</span> $highlightMethod;
00311 }
00312 
<a name="l00320"></a><a class="code" href="a00114.html">00320</a> <span class="keyword">abstract</span> <span class="keyword">class </span><a class="code" href="a00114.html">Input</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00321 {
<a name="l00328"></a><a class="code" href="a00114.html#a0">00328</a>         <span class="keyword">public</span> function <a class="code" href="a00114.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00329         {
00330                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00331 
00332                 $this-&gt;name = $id;
00333                 $this-&gt;required = <span class="keyword">false</span>;
00334                 $this-&gt;text = '';
00335                 $this-&gt;value = <span class="keyword">false</span>;
00336                 $this-&gt;enabled = <span class="keyword">true</span>;
00337         }
00338 
<a name="l00344"></a><a class="code" href="a00114.html#a1">00344</a>         <span class="keyword">public</span> function <a class="code" href="a00114.html#a1">setText</a>($text)
00345         {
00346                 $this-&gt;text = $text;
00347         }
00348 
<a name="l00357"></a><a class="code" href="a00114.html#a2">00357</a>         <span class="keyword">public</span> function <a class="code" href="a00114.html#a2">setValue</a>($value)
00358         {
00359                 $this-&gt;value = $value;
00360         }
00361 
<a name="l00368"></a><a class="code" href="a00114.html#a3">00368</a>         <span class="keyword">public</span> function <a class="code" href="a00114.html#a3">setRequired</a>($required)
00369         {
00370                 $this-&gt;required = $required;
00371                 <span class="keywordflow">if</span>(!isset($this-&gt;form))
00372                 {
00373                         die(<span class="stringliteral">"Input widget without form parent. Did you add an input widget outside of a form?"</span>);
00374                 }
00375                 $this-&gt;form-&gt;setRequired($this-&gt;id, $required);
00376         }
00377 
<a name="l00385"></a><a class="code" href="a00114.html#a4">00385</a>         <span class="keyword">public</span> function <a class="code" href="a00114.html#a4">setEnabled</a>($enabled)
00386         {
00387                 $this-&gt;enabled = $enabled;
00388         }
00389 
<a name="l00394"></a><a class="code" href="a00114.html#a5">00394</a>         <span class="keyword">public</span> function <a class="code" href="a00114.html#a5">supportsGridLayout</a>()
00395         {
00396                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00397         }
00398 
<a name="l00399"></a><a class="code" href="a00114.html#b0">00399</a>         <span class="keyword">protected</span> function <a class="code" href="a00114.html#b0">parentProperties</a>()
00400         {
00401                 $parentProperties = parent::parentProperties();
00402                 <span class="keywordflow">if</span>($this-&gt;enabled == <span class="keyword">false</span>)
00403                 {
00404                         $parentProperties .= ' enabled=<span class="stringliteral">"false"</span>';
00405                 }
00406                 <span class="keywordflow">return</span> $parentProperties;
00407         }
00408 
<a name="l00409"></a><a class="code" href="a00114.html#p0">00409</a>         <span class="keyword">protected</span> $form;
<a name="l00410"></a><a class="code" href="a00114.html#p1">00410</a>         <span class="keyword">protected</span> $id;
00411 
<a name="l00416"></a><a class="code" href="a00114.html#p2">00416</a>         <span class="keyword">protected</span> $name;
00417 
<a name="l00422"></a><a class="code" href="a00114.html#p3">00422</a>         <span class="keyword">protected</span> $required;
00423 
<a name="l00428"></a><a class="code" href="a00114.html#p4">00428</a>         <span class="keyword">protected</span> $enabled;
00429 
<a name="l00433"></a><a class="code" href="a00114.html#p5">00433</a>         <span class="keyword">protected</span> $text;
00434 
<a name="l00438"></a><a class="code" href="a00114.html#p6">00438</a>         <span class="keyword">protected</span> $type;
00439 
<a name="l00444"></a><a class="code" href="a00114.html#p7">00444</a>         <span class="keyword">protected</span> $value;
00445 }
00446 
<a name="l00453"></a><a class="code" href="a00161.html">00453</a> <span class="keyword">class </span><a class="code" href="a00161.html">TextInput</a> <span class="keyword">extends</span> <a class="code" href="a00114.html">Input</a>
00454 {
<a name="l00455"></a><a class="code" href="a00161.html#a0">00455</a>         <span class="keyword">public</span> function <a class="code" href="a00161.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00456         {
00457                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00458 
00459                 $this-&gt;size = <span class="keyword">false</span>;
00460                 $this-&gt;type = 'text';
00461         }
00462 
<a name="l00469"></a><a class="code" href="a00161.html#a1">00469</a>         <span class="keyword">public</span> function <a class="code" href="a00161.html#a1">setWidth</a>($width)
00470         {
00471                 $this-&gt;width = $width;
00472         }
00473 
<a name="l00474"></a><a class="code" href="a00161.html#a2">00474</a>         <span class="keyword">public</span> function <a class="code" href="a00161.html#a2">supportsGridLayout</a>()
00475         {
00476                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00477         }
00478 
00479         <span class="keyword">public</span> function <a class="code" href="a00096.html#a2">show</a>($gridLayout = NULL)
00480         {
00481                 $valueProperty = ($this-&gt;value == '' ? '' : <span class="stringliteral">" value=\"{$this-&gt;value}\""</span>);
00482                 $widthProperty = ($this-&gt;width == <span class="keyword">false</span> ? '' : <span class="stringliteral">" size=\"{$this-&gt;width}\""</span>);
00483 
00484                 $labelAttribute = $gridLayout == NULL;
00485                 $label = ($this-&gt;required &amp;&amp; $this-&gt;text != '' ? <a class="code" href="a00106.html#e0">Form::highlightLabel</a>($this-&gt;text, $labelAttribute) : $this-&gt;text);
00486                 $labelProperties = ($labelAttribute &amp;&amp; $label != '' ? <span class="stringliteral">" label=\"$label\" labelposition=\"front\""</span> : '');
00487                 $inputOpen  = <span class="stringliteral">"&lt;input type=\"{$this-&gt;type}\" name=\"{$this-&gt;name}\"$valueProperty$widthProperty$labelProperties"</span>.$this-&gt;parentProperties().<span class="charliteral">'&gt;'</span>;
00488                 $inputClose = '&lt;/input&gt;';
00489 
00490                 <span class="keywordflow">if</span>($gridLayout == NULL)
00491                 {
00492                         <a class="code" href="a00134.html#e5">Output::write</a>($inputOpen);
00493                         parent::show();
00494                         <a class="code" href="a00134.html#e5">Output::write</a>($inputClose);
00495                 }
00496                 <span class="keywordflow">else</span>
00497                 {
00498                         <span class="keyword">new</span> <a class="code" href="a00116.html">Label</a>($gridLayout, <span class="stringliteral">"$label "</span>);
00499                         $textContainer = <span class="keyword">new</span> <a class="code" href="a00141.html">RawContainer</a>($gridLayout, $inputOpen.$inputClose);
00500                         $this-&gt;<a class="code" href="a00096.html#b0">reparentChildrenTo</a>($textContainer);
00501                 }
00502         }
00503 
<a name="l00504"></a><a class="code" href="a00161.html#p0">00504</a>         <span class="keyword">protected</span> $name;
<a name="l00505"></a><a class="code" href="a00161.html#p1">00505</a>         <span class="keyword">protected</span> $required;
<a name="l00506"></a><a class="code" href="a00161.html#p2">00506</a>         <span class="keyword">protected</span> $text;
<a name="l00507"></a><a class="code" href="a00161.html#p3">00507</a>         <span class="keyword">protected</span> $value;
00508 
<a name="l00512"></a><a class="code" href="a00161.html#p4">00512</a>         <span class="keyword">protected</span> $width;
00513 }
00514 
<a name="l00521"></a><a class="code" href="a00138.html">00521</a> <span class="keyword">class </span><a class="code" href="a00138.html">PasswordInput</a> <span class="keyword">extends</span> <a class="code" href="a00161.html">TextInput</a>
00522 {
<a name="l00523"></a><a class="code" href="a00138.html#a0">00523</a>         <span class="keyword">public</span> function <a class="code" href="a00138.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00524         {
00525                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00526 
00527                 $this-&gt;type = 'password';
00528         }
00529 
00530         <span class="keyword">public</span> function <a class="code" href="a00096.html#a2">show</a>($gridLayout = NULL)
00531         {
00532                 $this-&gt;value = '';
00533 
00534                 parent::show($gridLayout);
00535         }
00536 
<a name="l00537"></a><a class="code" href="a00138.html#p0">00537</a>         <span class="keyword">protected</span> $type;
<a name="l00538"></a><a class="code" href="a00138.html#p1">00538</a>         <span class="keyword">protected</span> $value;
00539 }
00540 
<a name="l00549"></a><a class="code" href="a00105.html">00549</a> <span class="keyword">class </span><a class="code" href="a00105.html">FileInput</a> <span class="keyword">extends</span> <a class="code" href="a00161.html">TextInput</a>
00550 {
<a name="l00551"></a><a class="code" href="a00105.html#a0">00551</a>         <span class="keyword">public</span> function <a class="code" href="a00105.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00552         {
00553                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00554 
00555                 $this-&gt;form-&gt;setMultiPart(<span class="keyword">true</span>);
00556                 $this-&gt;type = 'file';
00557         }
00558 
<a name="l00559"></a><a class="code" href="a00105.html#p0">00559</a>         <span class="keyword">protected</span> $form;
<a name="l00560"></a><a class="code" href="a00105.html#p1">00560</a>         <span class="keyword">protected</span> $type;
00561 }
00562 
<a name="l00571"></a><a class="code" href="a00091.html">00571</a> <span class="keyword">class </span><a class="code" href="a00091.html">CheckboxInput</a> <span class="keyword">extends</span> <a class="code" href="a00114.html">Input</a>
00572 {
<a name="l00573"></a><a class="code" href="a00091.html#a0">00573</a>         <span class="keyword">public</span> function <a class="code" href="a00091.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00574         {
00575                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00576 
00577                 $this-&gt;<a class="code" href="a00114.html#a2">setValue</a>('<span class="keyword">true</span>');
00578                 $this-&gt;checked = <span class="keyword">false</span>;
00579                 $this-&gt;name = $id;
00580                 $this-&gt;type = 'checkbox';
00581         }
00582 
<a name="l00589"></a><a class="code" href="a00091.html#a1">00589</a>         <span class="keyword">public</span> function <a class="code" href="a00091.html#a1">setChecked</a>($checked)
00590         {
00591                 $this-&gt;checked = $checked;
00592         }
00593 
<a name="l00594"></a><a class="code" href="a00091.html#a2">00594</a>         <span class="keyword">public</span> function <a class="code" href="a00091.html#a2">show</a>()
00595         {
00596                 $checkedProperty = ($this-&gt;checked ? ' checked=<span class="stringliteral">"true"</span>' : '');
00597 
00598                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;input type=\"{$this-&gt;type}\" name=\"{$this-&gt;name}\" value=\"{$this-&gt;value}\" label=\"{$this-&gt;text}\" labelposition=\"end\"$checkedProperty"</span>.$this-&gt;parentProperties().<span class="charliteral">'&gt;'</span>);
00599                 parent::show();
00600                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/input&gt;');
00601         }
00602 
<a name="l00603"></a><a class="code" href="a00091.html#p0">00603</a>         <span class="keyword">protected</span> $name;
<a name="l00604"></a><a class="code" href="a00091.html#p1">00604</a>         <span class="keyword">protected</span> $text;
<a name="l00605"></a><a class="code" href="a00091.html#p2">00605</a>         <span class="keyword">protected</span> $type;
<a name="l00606"></a><a class="code" href="a00091.html#p3">00606</a>         <span class="keyword">protected</span> $value;
00607 
<a name="l00611"></a><a class="code" href="a00091.html#p4">00611</a>         <span class="keyword">protected</span> $checked;
00612 }
00613 
<a name="l00621"></a><a class="code" href="a00140.html">00621</a> <span class="keyword">class </span><a class="code" href="a00140.html">RadioGroup</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00622 {
<a name="l00623"></a><a class="code" href="a00140.html#a0">00623</a>         <span class="keyword">public</span> function <a class="code" href="a00140.html#a0">show</a>()
00624         {
00625                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;radiogroup&gt;');
00626                 parent::show();
00627                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/radiogroup&gt;');
00628         }
00629 }
00630 
<a name="l00641"></a><a class="code" href="a00139.html">00641</a> <span class="keyword">class </span><a class="code" href="a00139.html">RadioButton</a> <span class="keyword">extends</span> <a class="code" href="a00091.html">CheckboxInput</a>
00642 {
<a name="l00649"></a><a class="code" href="a00139.html#a0">00649</a>         <span class="keyword">public</span> function <a class="code" href="a00139.html#a0">__construct</a>(<a class="code" href="a00140.html">RadioGroup</a> $parent, $<span class="keywordtype">id</span>)
00650         {
00651                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00652 
00653                 $this-&gt;<a class="code" href="a00114.html#a2">setValue</a>($<span class="keywordtype">id</span>);
00654                 $this-&gt;name = $parent-&gt;id();
00655                 $this-&gt;type = 'radio';
00656         }
00657 
<a name="l00658"></a><a class="code" href="a00139.html#p0">00658</a>         <span class="keyword">protected</span> $name;
<a name="l00659"></a><a class="code" href="a00139.html#p1">00659</a>         <span class="keyword">protected</span> $value;
00660 }
00661 
<a name="l00671"></a><a class="code" href="a00151.html">00671</a> <span class="keyword">class </span><a class="code" href="a00151.html">SelectInput</a> <span class="keyword">extends</span> <a class="code" href="a00114.html">Input</a>
00672 {
<a name="l00673"></a><a class="code" href="a00151.html#a0">00673</a>         <span class="keyword">public</span> function <a class="code" href="a00151.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00674         {
00675                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00676 
00677                 $this-&gt;multiple = <span class="keyword">false</span>;
00678                 $this-&gt;options = array();
00679                 $this-&gt;size = 1;
00680         }
00681 
<a name="l00689"></a><a class="code" href="a00151.html#a1">00689</a>         <span class="keyword">public</span> function <a class="code" href="a00151.html#a1">setOptions</a>($options)
00690         {
00691                 $this-&gt;options = $options;
00692         }
00693 
<a name="l00704"></a><a class="code" href="a00151.html#a2">00704</a>         <span class="keyword">public</span> function <a class="code" href="a00151.html#a2">addOption</a>($key, $text, $selected = <span class="keyword">false</span>)
00705         {
00706                 $this-&gt;options[$key] = $text;
00707 
00708                 <span class="keywordflow">if</span>($selected == <span class="keyword">true</span>)
00709                 {
00710                         <span class="keywordflow">if</span>($this-&gt;value == <span class="keyword">false</span>)
00711                         {
00712                                 $this-&gt;value = $key;
00713                         }
00714                         <span class="keywordflow">else</span>
00715                         {
00716                                 $this-&gt;value .= <span class="stringliteral">",$key"</span>;
00717                         }
00718                 }
00719         }
00720 
<a name="l00731"></a><a class="code" href="a00151.html#a3">00731</a>         <span class="keyword">public</span> function <a class="code" href="a00151.html#a3">setMultiple</a>($multiple, $size = 1)
00732         {
00733                 $this-&gt;multiple = $multiple;
00734                 $this-&gt;size = $size;
00735         }
00736 
<a name="l00737"></a><a class="code" href="a00151.html#a4">00737</a>         <span class="keyword">public</span> function <a class="code" href="a00151.html#a4">supportsGridLayout</a>()
00738         {
00739                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00740         }
00741 
00742         <span class="keyword">public</span> function <a class="code" href="a00096.html#a2">show</a>($gridLayout = NULL)
00743         {
00744                 $inputTag = ($this-&gt;multiple == <span class="keyword">true</span> ? 'multiselectinput' : 'selectinput');
00745                 $optionTag = ($this-&gt;multiple == <span class="keyword">true</span> ? 'multiselectoption' : 'selectoption');
00746 
00747                 $labelAttribute = $gridLayout == NULL;
00748                 $label = ($this-&gt;required &amp;&amp; $this-&gt;text != '' ? <a class="code" href="a00106.html#e0">Form::highlightLabel</a>($this-&gt;text, $labelAttribute) : $this-&gt;text);
00749                 $labelProperties = ($labelAttribute &amp;&amp; $label != '' ? <span class="stringliteral">" label=\"$label\" labelposition=\"front\""</span> : '');
00750                 $sizeProperty = ($this-&gt;size != 1 ? <span class="stringliteral">" size=\"{$this-&gt;size}\""</span> : '');
00751 
00752                 $inputOpen = <span class="stringliteral">"&lt;$inputTag name=\"{$this-&gt;name}\" value=\"{$this-&gt;value}\"$labelProperties$sizeProperty"</span>.$this-&gt;parentProperties().<span class="charliteral">'&gt;'</span>;
00753                 $values = explode(<span class="charliteral">','</span>, $this-&gt;value);
00754                 foreach($this-&gt;options as $key =&gt; $optionText)
00755                 {
00756                         $selectedProperty = (in_array($key, $values) ? ' selected=<span class="stringliteral">"true"</span>' : '');
00757                         $inputOpen .= <span class="stringliteral">"&lt;$optionTag value=\"$key\"$selectedProperty&gt;$optionText&lt;/$optionTag&gt;"</span>;
00758                 }
00759                 $inputClose = <span class="stringliteral">"&lt;/$inputTag&gt;"</span>;
00760 
00761                 <span class="keywordflow">if</span>($gridLayout == NULL)
00762                 {
00763                         <a class="code" href="a00134.html#e5">Output::write</a>($inputOpen);
00764                         parent::show();
00765                         <a class="code" href="a00134.html#e5">Output::write</a>($inputClose);
00766                 }
00767                 <span class="keywordflow">else</span>
00768                 {
00769                         <span class="keyword">new</span> <a class="code" href="a00116.html">Label</a>($gridLayout, <span class="stringliteral">"$label "</span>);
00770                         $textContainer = <span class="keyword">new</span> <a class="code" href="a00141.html">RawContainer</a>($gridLayout, $inputOpen.$inputClose);
00771                         $this-&gt;<a class="code" href="a00096.html#b0">reparentChildrenTo</a>($textContainer);
00772                 }
00773         }
00774 
<a name="l00775"></a><a class="code" href="a00151.html#p0">00775</a>         <span class="keyword">protected</span> $name;
<a name="l00776"></a><a class="code" href="a00151.html#p1">00776</a>         <span class="keyword">protected</span> $required;
<a name="l00777"></a><a class="code" href="a00151.html#p2">00777</a>         <span class="keyword">protected</span> $text;
<a name="l00778"></a><a class="code" href="a00151.html#p3">00778</a>         <span class="keyword">protected</span> $value;
00779 
00780         <span class="keyword">private</span> $multiple;
00781         <span class="keyword">private</span> $options;
00782         <span class="keyword">private</span> $size;
00783 }
00784 
<a name="l00790"></a><a class="code" href="a00159.html">00790</a> <span class="keyword">class </span><a class="code" href="a00159.html">TextArea</a> <span class="keyword">extends</span> <a class="code" href="a00114.html">Input</a>
00791 {
<a name="l00792"></a><a class="code" href="a00159.html#a0">00792</a>         <span class="keyword">public</span> function <a class="code" href="a00159.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00793         {
00794                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00795 
00796                 parent::setCssStyle('padding: 5px');
00797         }
00798 
<a name="l00804"></a><a class="code" href="a00159.html#a1">00804</a>         <span class="keyword">public</span> function <a class="code" href="a00159.html#a1">setRows</a>($rows)
00805         {
00806                 $this-&gt;rows = $rows;
00807         }
00808 
<a name="l00815"></a><a class="code" href="a00159.html#a2">00815</a>         <span class="keyword">public</span> function <a class="code" href="a00159.html#a2">setColumns</a>($columns)
00816         {
00817                 $this-&gt;columns = $columns;
00818         }
00819 
<a name="l00820"></a><a class="code" href="a00159.html#a3">00820</a>         <span class="keyword">public</span> function <a class="code" href="a00159.html#a3">show</a>()
00821         {
00822                 $rowsProperty = (!isset($this-&gt;rows) ? '' : <span class="stringliteral">" rows=\"{$this-&gt;rows}\""</span>);
00823                 $colsProperty = (!isset($this-&gt;columns) ? '' : <span class="stringliteral">" columns=\"{$this-&gt;columns}\""</span>);
00824 
00825                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;textarea name=\"{$this-&gt;id}\"$rowsProperty$colsProperty"</span>.$this-&gt;parentProperties().<span class="stringliteral">"&gt;{$this-&gt;value}&lt;/textarea&gt;"</span>);
00826                 parent::show();
00827         }
00828 
<a name="l00829"></a><a class="code" href="a00159.html#p0">00829</a>         <span class="keyword">protected</span> $value;
00830 
00831         <span class="keyword">private</span> $columns;
00832         <span class="keyword">private</span> $rows;
00833 }
00834 
<a name="l00842"></a><a class="code" href="a00111.html">00842</a> <span class="keyword">class </span><a class="code" href="a00111.html">HiddenInput</a> <span class="keyword">extends</span> <a class="code" href="a00161.html">TextInput</a>
00843 {
<a name="l00844"></a><a class="code" href="a00111.html#a0">00844</a>         <span class="keyword">public</span> function <a class="code" href="a00111.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00845         {
00846                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00847 
00848                 $this-&gt;type = 'hidden';
00849         }
00850 
<a name="l00851"></a><a class="code" href="a00111.html#a1">00851</a>         <span class="keyword">public</span> function <a class="code" href="a00111.html#a1">show</a>()
00852         {
00853                 $this-&gt;text = '';
00854 
00855                 parent::show();
00856         }
00857 
<a name="l00858"></a><a class="code" href="a00111.html#p0">00858</a>         <span class="keyword">protected</span> $text;
<a name="l00859"></a><a class="code" href="a00111.html#p1">00859</a>         <span class="keyword">protected</span> $type;
00860 }
00861 
<a name="l00883"></a><a class="code" href="a00089.html">00883</a> <span class="keyword">class </span><a class="code" href="a00089.html">Button</a> <span class="keyword">extends</span> <a class="code" href="a00114.html">Input</a>
00884 {
<a name="l00885"></a><a class="code" href="a00089.html#a0">00885</a>         <span class="keyword">public</span> function <a class="code" href="a00089.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00886         {
00887                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00888 
00889                 $this-&gt;type = 'submit';
00890         }
00891 
<a name="l00900"></a><a class="code" href="a00089.html#a1">00900</a>         <span class="keyword">public</span> function <a class="code" href="a00089.html#a1">setConfirm</a>($confirm)
00901         {
00902                 $this-&gt;confirm = $confirm;
00903         }
00904 
<a name="l00905"></a><a class="code" href="a00089.html#a2">00905</a>         <span class="keyword">public</span> function <a class="code" href="a00089.html#a2">show</a>()
00906         {
00907                 <span class="keywordflow">if</span>($this-&gt;confirm == <span class="keyword">true</span> &amp;&amp; $this-&gt;form-&gt;hasChecks())
00908                 {
00909                         $this-&gt;<a class="code" href="a00166.html#a6">addJavaScript</a>('onclick', <span class="stringliteral">"if(checkForm"</span>.$this-&gt;form-&gt;id().<span class="stringliteral">"() == false) return false"</span>);
00910                 }
00911 
00912                 <span class="keywordflow">if</span>($this-&gt;confirm == <span class="keyword">true</span> &amp;&amp; $this-&gt;form-&gt;singleShot() == <span class="keyword">true</span>)
00913                 {
00914                         $this-&gt;<a class="code" href="a00166.html#a6">addJavaScript</a>('onclick', <span class="stringliteral">"document.getElementById('{$this-&gt;id}').disabled = true"</span>);
00915                 }
00916 
00917                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;button type=\"{$this-&gt;type}\" name=\"{$this-&gt;name}\" value=\"{$this-&gt;value}\""</span>.$this-&gt;parentProperties().<span class="charliteral">'&gt;'</span>);
00918                 <span class="keywordflow">if</span>(<span class="keyword">sizeof</span>($this-&gt;children) == 0)
00919                 {
00920                         <a class="code" href="a00134.html#e5">Output::write</a>($this-&gt;value);
00921                 }
00922                 <span class="keywordflow">else</span>
00923                 {
00924                         <a class="code" href="a00096.html#a2">Container::show</a>();
00925                 }
00926                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/button&gt;');
00927         }
00928 
<a name="l00929"></a><a class="code" href="a00089.html#p0">00929</a>         <span class="keyword">protected</span> $children;
<a name="l00930"></a><a class="code" href="a00089.html#p1">00930</a>         <span class="keyword">protected</span> $form;
<a name="l00931"></a><a class="code" href="a00089.html#p2">00931</a>         <span class="keyword">protected</span> $id;
<a name="l00932"></a><a class="code" href="a00089.html#p3">00932</a>         <span class="keyword">protected</span> $name;
<a name="l00933"></a><a class="code" href="a00089.html#p4">00933</a>         <span class="keyword">protected</span> $type;
<a name="l00934"></a><a class="code" href="a00089.html#p5">00934</a>         <span class="keyword">protected</span> $value;
00935 
00936         <span class="keyword">private</span> $confirm;
00937 }
00938 
<a name="l00946"></a><a class="code" href="a00123.html">00946</a> <span class="keyword">class </span><a class="code" href="a00123.html">LoginForm</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00947 {
<a name="l00955"></a><a class="code" href="a00123.html#a0">00955</a>         <span class="keyword">public</span> function <a class="code" href="a00123.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $viewContainer = 'view', $cancelView = '<span class="keywordflow">default</span>')
00956         {
00957                 parent::__construct($parent);
00958 
00959                 $this-&gt;viewContainer = $viewContainer;
00960                 $this-&gt;cancelView = $cancelView;
00961         }
00962 
<a name="l00963"></a><a class="code" href="a00123.html#a1">00963</a>         <span class="keyword">public</span> function <a class="code" href="a00123.html#a1">show</a>()
00964         {
00965                 <span class="keywordflow">if</span>(class_exists('<a class="code" href="a00135.html">PageIcon</a>'))
00966                 {
00967                         <span class="keyword">new</span> <a class="code" href="a00135.html">PageIcon</a>($<span class="keyword">this</span>, 'base/icons/password');
00968                 }
00969 
00970                 $form = <span class="keyword">new</span> <a class="code" href="a00106.html">Form</a>($<span class="keyword">this</span>, Config::globals('secureBaseURL').<span class="stringliteral">"?action=Login&amp;amp;{$this-&gt;viewContainer}_cancel={$this-&gt;cancelView}"</span>);
00971                 $form-&gt;setErrorMessage(i18n('Please fill in both the username and password fields.'));
00972                 $form-&gt;useGridLayout(<span class="keyword">true</span>);
00973                 $usernameInput = <span class="keyword">new</span> <a class="code" href="a00161.html">TextInput</a>($form, 'username');
00974                 $usernameInput-&gt;setText(i18n('Username:'));
00975                 $usernameInput-&gt;setRequired(<span class="keyword">true</span>);
00976                 $passwordInput = <span class="keyword">new</span> <a class="code" href="a00138.html">PasswordInput</a>($form, 'password');
00977                 $passwordInput-&gt;setText(i18n('Password:'));
00978                 $passwordInput-&gt;setRequired(<span class="keyword">true</span>);
00979                 $box = <span class="keyword">new</span> <a class="code" href="a00088.html">Box</a>($form);
00980                 $loginButton = <span class="keyword">new</span> <a class="code" href="a00089.html">Button</a>($box, 'button');
00981                 $loginButton-&gt;setValue(i18n('<a class="code" href="a00122.html">Login</a>'));
00982                 $loginButton-&gt;setConfirm(<span class="keyword">true</span>);
00983                 $cancelButton = <span class="keyword">new</span> <a class="code" href="a00089.html">Button</a>($box, 'button');
00984                 $cancelButton-&gt;setValue(i18n('Cancel'));
00985 
00986                 parent::show();
00987         }
00988 
00989         <span class="keyword">private</span> $viewContainer;
00990         <span class="keyword">private</span> $cancelView;
00991 }
00992 
00993 ?&gt;
</pre></div>    </div>
  </body>
</html>
Return current item: Aukyla Document Management System