Release 0.42
[awl.git] / docs / api / awl / DataEntry / EntryField.html
blobfa1693bf6c1a1c1f8f480f07c3325724a8b1aab5
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <!-- template designed by Marco Von Ballmoos -->
6 <title>Docs For Class EntryField</title>
7 <link rel="stylesheet" href="../../media/stylesheet.css" />
8 <script src="../../media/lib/classTree.js"></script>
9 <script language="javascript" type="text/javascript">
10 var imgPlus = new Image();
11 var imgMinus = new Image();
12 imgPlus.src = "../../media/images/plus.png";
13 imgMinus.src = "../../media/images/minus.png";
15 function showNode(Node){
16 switch(navigator.family){
17 case 'nn4':
18 // Nav 4.x code fork...
19 var oTable = document.layers["span" + Node];
20 var oImg = document.layers["img" + Node];
21 break;
22 case 'ie4':
23 // IE 4/5 code fork...
24 var oTable = document.all["span" + Node];
25 var oImg = document.all["img" + Node];
26 break;
27 case 'gecko':
28 // Standards Compliant code fork...
29 var oTable = document.getElementById("span" + Node);
30 var oImg = document.getElementById("img" + Node);
31 break;
33 oImg.src = imgMinus.src;
34 oTable.style.display = "block";
37 function hideNode(Node){
38 switch(navigator.family){
39 case 'nn4':
40 // Nav 4.x code fork...
41 var oTable = document.layers["span" + Node];
42 var oImg = document.layers["img" + Node];
43 break;
44 case 'ie4':
45 // IE 4/5 code fork...
46 var oTable = document.all["span" + Node];
47 var oImg = document.all["img" + Node];
48 break;
49 case 'gecko':
50 // Standards Compliant code fork...
51 var oTable = document.getElementById("span" + Node);
52 var oImg = document.getElementById("img" + Node);
53 break;
55 oImg.src = imgPlus.src;
56 oTable.style.display = "none";
59 function nodeIsVisible(Node){
60 switch(navigator.family){
61 case 'nn4':
62 // Nav 4.x code fork...
63 var oTable = document.layers["span" + Node];
64 break;
65 case 'ie4':
66 // IE 4/5 code fork...
67 var oTable = document.all["span" + Node];
68 break;
69 case 'gecko':
70 // Standards Compliant code fork...
71 var oTable = document.getElementById("span" + Node);
72 break;
74 return (oTable && oTable.style.display == "block");
77 function toggleNodeVisibility(Node){
78 if (nodeIsVisible(Node)){
79 hideNode(Node);
80 }else{
81 showNode(Node);
84 </script>
85 </head>
86 <body>
87 <div class="page-body">
88 <h2 class="class-name"><img src="../../media/images/Class_logo.png"
89 alt=" Class"
90 title=" Class"
91 style="vertical-align: middle"> EntryField</h2>
93 <a name="sec-description"></a>
94 <div class="info-box">
95 <div class="info-box-title">Description</div>
96 <div class="nav-bar">
97 <span class="disabled">Description</span> |
98 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
99 | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
101 </div>
102 <div class="info-box-body">
103 <!-- ========== Info from phpDoc block ========= -->
104 <p class="short-description">Individual fields used for data entry / viewing.</p>
105 <p class="description"><p>This object is not really intended to be used directly. The more normal interface is to instantiate an <a href="../../awl/DataEntry/EntryForm.html">EntryForm</a> and then issue calls to DataEntryLine() and other <a href="../../awl/DataEntry/EntryForm.html">EntryForm</a> methods.</p><p>Understanding the operation of this class (and possibly auditing the source code, particularly EntryField::Render) will however convey valuable understanding of some of the more esoteric features.</p></p>
106 <ul class="tags">
107 <li><span class="field">todo:</span> <p>This class doesn't really provide a huge amount of utility between construct and render, but there must be good things possible there. Perhaps one EntryField is created and used repeatedly as a template (e.g.). That might be useful to support... Why is this a Class anyway? Maybe we should have just done half a dozen functions (one per major field type) and just used those... Maybe we should build a base class for this and extend it to make EntryField in a better way.</p><p>EntryField is only useful at present if you desperately want to use it's simple field interface, but want to intimately control the layout (or parts of the layout), otherwise you should be using <a href="../../awl/DataEntry/EntryForm.html">EntryForm</a> as the main class.</p></li>
108 </ul>
109 <p class="notes">
110 Located in <a class="field" href="_DataEntry.php.html">/DataEntry.php</a> (line <span class="field">38</span>)
111 </p>
114 <pre></pre>
116 </div>
117 </div>
121 <a name="sec-var-summary"></a>
122 <div class="info-box">
123 <div class="info-box-title">Variable Summary</span></div>
124 <div class="nav-bar">
125 <a href="#sec-description">Description</a> |
126 <span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
128 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
130 </div>
131 <div class="info-box-body">
132 <div class="var-summary">
133 <div class="var-title">
134 <img src="../../media/images/Variable.png" alt=" " />
135 <span class="var-type">string</span>
136 <a href="#$attributes" title="details" class="var-name">$attributes</a>
137 </div>
138 <div class="var-title">
139 <img src="../../media/images/Variable.png" alt=" " />
140 <span class="var-type">string</span>
141 <a href="#$current" title="details" class="var-name">$current</a>
142 </div>
143 <div class="var-title">
144 <img src="../../media/images/Variable.png" alt=" " />
145 <span class="var-type">string</span>
146 <a href="#$rendered" title="details" class="var-name">$rendered</a>
147 </div>
148 </div>
149 </div>
150 </div>
152 <a name="sec-method-summary"></a>
153 <div class="info-box">
154 <div class="info-box-title">Method Summary</span></div>
155 <div class="nav-bar">
156 <a href="#sec-description">Description</a> |
157 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
160 <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
161 </div>
162 <div class="info-box-body">
163 <div class="method-summary">
165 <div class="method-definition">
166 <img src="../../media/images/Constructor.png" alt=" "/>
167 <span class="method-result">EntryField</span>
168 <a href="#EntryField" title="details" class="method-name">EntryField</a>
169 (<span class="var-type">text</span>&nbsp;<span class="var-name">$intype</span>, <span class="var-type">text</span>&nbsp;<span class="var-name">$inname</span>, [<span class="var-type">text</span>&nbsp;<span class="var-name">$attributes</span> = <span class="var-default">&quot;&quot;</span>], [<span class="var-type">text</span>&nbsp;<span class="var-name">$current_value</span> = <span class="var-default">&quot;&quot;</span>])
170 </div>
172 <div class="method-definition">
173 <img src="../../media/images/Method.png" alt=" "/>
174 <span class="method-result">void</span>
175 <a href="#new_lookup" title="details" class="method-name">new_lookup</a>
176 (<span class="var-type">array</span>&nbsp;<span class="var-name">$attributes</span>)
177 </div>
179 <div class="method-definition">
180 <img src="../../media/images/Method.png" alt=" "/>
181 <span class="method-result">text</span>
182 <a href="#Render" title="details" class="method-name">Render</a>
184 </div>
185 </div>
186 </div>
187 </div>
189 <a name="sec-vars"></a>
190 <div class="info-box">
191 <div class="info-box-title">Variables</div>
192 <div class="nav-bar">
193 <a href="#sec-description">Description</a> |
194 <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
198 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
200 </div>
201 <div class="info-box-body">
203 <a name="var$attributes" id="$attributes"><!-- --></A>
204 <div class="oddrow">
206 <div class="var-header">
207 <img src="../../media/images/Variable.png" />
208 <span class="var-title">
209 <span class="var-type">string</span>
210 <span class="var-name">$attributes</span>
211 (line <span class="line-number">69</span>)
212 </span>
213 </div>
215 <!-- ========== Info from phpDoc block ========= -->
216 <p class="short-description">An array of key value pairs</p>
217 <ul class="tags">
218 <li><span class="field">access:</span> public</li>
219 </ul>
225 </div>
226 <a name="var$current" id="$current"><!-- --></A>
227 <div class="evenrow">
229 <div class="var-header">
230 <img src="../../media/images/Variable.png" />
231 <span class="var-title">
232 <span class="var-type">string</span>
233 <span class="var-name">$current</span>
234 (line <span class="line-number">63</span>)
235 </span>
236 </div>
238 <!-- ========== Info from phpDoc block ========= -->
239 <p class="short-description">The current value</p>
240 <ul class="tags">
241 <li><span class="field">access:</span> public</li>
242 </ul>
248 </div>
249 <a name="var$rendered" id="$rendered"><!-- --></A>
250 <div class="oddrow">
252 <div class="var-header">
253 <img src="../../media/images/Variable.png" />
254 <span class="var-title">
255 <span class="var-type">string</span>
256 <span class="var-name">$rendered</span>
257 (line <span class="line-number">75</span>)
258 </span>
259 </div>
261 <!-- ========== Info from phpDoc block ========= -->
262 <p class="short-description">Once it actually is...</p>
263 <ul class="tags">
264 <li><span class="field">access:</span> public</li>
265 </ul>
271 </div>
273 </div>
274 </div>
276 <a name="sec-methods"></a>
277 <div class="info-box">
278 <div class="info-box-title">Methods</div>
279 <div class="nav-bar">
280 <a href="#sec-description">Description</a> |
281 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
282 <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
284 </div>
285 <div class="info-box-body">
286 <A NAME='method_detail'></A>
287 <a name="methodEntryField" id="EntryField"><!-- --></a>
288 <div class="evenrow">
290 <div class="method-header">
291 <img src="../../media/images/Constructor.png" />
292 <span class="method-title">Constructor EntryField</span> (line <span class="line-number">137</span>)
293 </div>
295 <!-- ========== Info from phpDoc block ========= -->
296 <p class="short-description">Initialise an EntryField, used for data entry.</p>
297 <p class="description"><p>The following types of fields are possible: <ul><li>select - Will display a select list of the keys/values in $attributes where the
298 key starts with an underscore. The key will have the '_' removed before being used
299 as the key in the list. All the $attributes with keys not beginning with '_' will
300 be used in the normal manner as HTML attributes within the &amp;lt;select ...&amp;gt; tag.</li><li>lookup - Will display a select list of values from the database.
301 If $attributes defines a '_sql' attibute then that will be used to make
302 the list, otherwise the database values will be from the 'codes' table
303 as in &quot;SELECT code_id, code_value FROM codes WHERE code_type = '_type' ORDER BY code_seq, code_id&quot;
304 using the value of $attributes['_type'] as the code_type.</li><li>date - Will be a text field, expecting a date value which might be
305 javascript validated at some point in the future.</li><li>checkbox - Will display a checkbox for an on-off value.</li><li>textarea - Will display an HTML textarea.</li><li>file - Will display a file browse / enter field.</li><li>button - Will display a button field.</li><li>password - Password entry. This will display entered data as asterisks.</li></ul></p><p>The $attributes array is useful to set specific HTML attributes within the HTML tag used for the entry field however $attribute keys named starting with an underscore ('_') affect the field operation rather than the HTML. For the 'select' field type, these are simply used as the keys / values for the selection (with the '_' removed), but other cases are more complex: <ul><li>_help - While this will be ignored by the EntryField::Render() method the _help
306 should be assigned (or will be assigned the same value as the 'title' attribute) and
307 will (depending on the data-entry line format in force) be displayed as help for the
308 field by the EntryForm::DataEntryLine() method.</li><li>_sql - When used in a 'lookup' field this controls the SQL to return keys/values
309 for the list. The actual SQL should return two columns, the first will be used for
310 the key and the second for the displayed value.</li><li>_type - When used in a 'lookup' field this defines the codes type used.</li><li>_null - When used in a 'lookup' field this will control the description for an
311 option using a '' key value which will precede the list of values from the database.</li><li>_zero - When used in a 'lookup' field this will control the description for an
312 option using a '0' key value which will precede the list of values from the database.</li><li>_label - When used in a 'radio' or 'checkbox' field this will wrap the field
313 with an HTML label tag as &lt;label ...&gt;&lt;input field...&gt;$attributes['_label']&lt;/label&gt;</li><li>-</li></ul></p></p>
315 <div class="method-signature">
316 <span class="method-result">EntryField</span>
317 <span class="method-name">
318 EntryField
319 </span>
320 (<span class="var-type">text</span>&nbsp;<span class="var-name">$intype</span>, <span class="var-type">text</span>&nbsp;<span class="var-name">$inname</span>, [<span class="var-type">text</span>&nbsp;<span class="var-name">$attributes</span> = <span class="var-default">&quot;&quot;</span>], [<span class="var-type">text</span>&nbsp;<span class="var-name">$current_value</span> = <span class="var-default">&quot;&quot;</span>])
321 </div>
323 <ul class="parameters">
324 <li>
325 <span class="var-type">text</span>
326 <span class="var-name">$intype</span><span class="var-description">: The type of field: select | lookup | date | checkbox | textarea | file | button | password (anything else is dealt with as &quot;text&quot;)</span> </li>
327 <li>
328 <span class="var-type">text</span>
329 <span class="var-name">$inname</span><span class="var-description">: The name of the field.</span> </li>
330 <li>
331 <span class="var-type">text</span>
332 <span class="var-name">$attributes</span><span class="var-description">: An associative array of extra attributes to be applied to the field. Optional, but generally important. Some $attribute keys have special meaning, while others are simply added as HTML attributes to the field.</span> </li>
333 <li>
334 <span class="var-type">text</span>
335 <span class="var-name">$current_value</span><span class="var-description">: The current value to use to initialise the field. Optional.</span> </li>
336 </ul>
339 </div>
340 <a name="methodnew_lookup" id="new_lookup"><!-- --></a>
341 <div class="oddrow">
343 <div class="method-header">
344 <img src="../../media/images/Method.png" />
345 <span class="method-title">new_lookup</span> (line <span class="line-number">283</span>)
346 </div>
348 <!-- ========== Info from phpDoc block ========= -->
349 <p class="short-description">Function called indirectly when a new EntryField of type 'lookup' is created.</p>
351 <div class="method-signature">
352 <span class="method-result">void</span>
353 <span class="method-name">
354 new_lookup
355 </span>
356 (<span class="var-type">array</span>&nbsp;<span class="var-name">$attributes</span>)
357 </div>
359 <ul class="parameters">
360 <li>
361 <span class="var-type">array</span>
362 <span class="var-name">$attributes</span><span class="var-description">: The attributes array that was passed in to the new EntryField() constructor.</span> </li>
363 </ul>
366 </div>
367 <a name="methodRender" id="Render"><!-- --></a>
368 <div class="evenrow">
370 <div class="method-header">
371 <img src="../../media/images/Method.png" />
372 <span class="method-title">Render</span> (line <span class="line-number">162</span>)
373 </div>
375 <!-- ========== Info from phpDoc block ========= -->
376 <p class="short-description">Render an EntryField into HTML</p>
377 <ul class="tags">
378 <li><span class="field">return:</span> An HTML fragment for the data-entry field.</li>
379 <li><span class="field">see:</span> <a href="../../awl/DataEntry/EntryField.html#methodEntryField">EntryField::EntryField()</a>, <a href="../../awl/DataEntry/EntryForm.html#methodDataEntryLine">EntryForm::DataEntryLine()</a></li>
380 </ul>
382 <div class="method-signature">
383 <span class="method-result">text</span>
384 <span class="method-name">
385 Render
386 </span>
388 </div>
392 </div>
394 </div>
395 </div>
398 <p class="notes" id="credit">
399 Documentation generated on Mon, 08 Mar 2010 18:19:48 +1300 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.2</a>
400 </p>
401 </div></body>
402 </html>