The real release 0.46 :-)
[awl.git] / docs / api / awl / DataEntry / EntryField.html
blobb4319649b72107e3acd66419e5ea52eb9c531c79
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/StaticMethod.png" alt=" "/>
167 static <span class="method-result">string</span>
168 <a href="#BuildOptionList" title="details" class="method-name">BuildOptionList</a>
169 (<span class="var-type"></span>&nbsp;<span class="var-name">$qry</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$current</span> = <span class="var-default">''</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$location</span> = <span class="var-default">'options'</span>], [<span class="var-type">array</span>&nbsp;<span class="var-name">$parameters</span> = <span class="var-default">false</span>])
170 </div>
172 <div class="method-definition">
173 <img src="../../media/images/Constructor.png" alt=" "/>
174 <span class="method-result">EntryField</span>
175 <a href="#EntryField" title="details" class="method-name">EntryField</a>
176 (<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>])
177 </div>
179 <div class="method-definition">
180 <img src="../../media/images/Method.png" alt=" "/>
181 <span class="method-result">void</span>
182 <a href="#new_lookup" title="details" class="method-name">new_lookup</a>
183 (<span class="var-type">array</span>&nbsp;<span class="var-name">$attributes</span>)
184 </div>
186 <div class="method-definition">
187 <img src="../../media/images/Method.png" alt=" "/>
188 <span class="method-result">text</span>
189 <a href="#Render" title="details" class="method-name">Render</a>
191 </div>
192 </div>
193 </div>
194 </div>
196 <a name="sec-vars"></a>
197 <div class="info-box">
198 <div class="info-box-title">Variables</div>
199 <div class="nav-bar">
200 <a href="#sec-description">Description</a> |
201 <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
205 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
207 </div>
208 <div class="info-box-body">
210 <a name="var$attributes" id="$attributes"><!-- --></A>
211 <div class="oddrow">
213 <div class="var-header">
214 <img src="../../media/images/Variable.png" />
215 <span class="var-title">
216 <span class="var-type">string</span>
217 <span class="var-name">$attributes</span>
218 (line <span class="line-number">69</span>)
219 </span>
220 </div>
222 <!-- ========== Info from phpDoc block ========= -->
223 <p class="short-description">An array of key value pairs</p>
224 <ul class="tags">
225 <li><span class="field">access:</span> public</li>
226 </ul>
232 </div>
233 <a name="var$current" id="$current"><!-- --></A>
234 <div class="evenrow">
236 <div class="var-header">
237 <img src="../../media/images/Variable.png" />
238 <span class="var-title">
239 <span class="var-type">string</span>
240 <span class="var-name">$current</span>
241 (line <span class="line-number">63</span>)
242 </span>
243 </div>
245 <!-- ========== Info from phpDoc block ========= -->
246 <p class="short-description">The current value</p>
247 <ul class="tags">
248 <li><span class="field">access:</span> public</li>
249 </ul>
255 </div>
256 <a name="var$rendered" id="$rendered"><!-- --></A>
257 <div class="oddrow">
259 <div class="var-header">
260 <img src="../../media/images/Variable.png" />
261 <span class="var-title">
262 <span class="var-type">string</span>
263 <span class="var-name">$rendered</span>
264 (line <span class="line-number">75</span>)
265 </span>
266 </div>
268 <!-- ========== Info from phpDoc block ========= -->
269 <p class="short-description">Once it actually is...</p>
270 <ul class="tags">
271 <li><span class="field">access:</span> public</li>
272 </ul>
278 </div>
280 </div>
281 </div>
283 <a name="sec-methods"></a>
284 <div class="info-box">
285 <div class="info-box-title">Methods</div>
286 <div class="nav-bar">
287 <a href="#sec-description">Description</a> |
288 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
289 <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
291 </div>
292 <div class="info-box-body">
293 <A NAME='method_detail'></A>
294 <a name="methodBuildOptionList" id="BuildOptionList"><!-- --></a>
295 <div class="evenrow">
297 <div class="method-header">
298 <img src="../../media/images/StaticMethod.png" />
299 <span class="method-title">static BuildOptionList</span> (line <span class="line-number">294</span>)
300 </div>
302 <!-- ========== Info from phpDoc block ========= -->
303 <p class="short-description">Build an option list from the query.</p>
304 <ul class="tags">
305 <li><span class="field">return:</span> Select box HTML</li>
306 </ul>
308 <div class="method-signature">
309 static <span class="method-result">string</span>
310 <span class="method-name">
311 BuildOptionList
312 </span>
313 (<span class="var-type"></span>&nbsp;<span class="var-name">$qry</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$current</span> = <span class="var-default">''</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$location</span> = <span class="var-default">'options'</span>], [<span class="var-type">array</span>&nbsp;<span class="var-name">$parameters</span> = <span class="var-default">false</span>])
314 </div>
316 <ul class="parameters">
317 <li>
318 <span class="var-type">string</span>
319 <span class="var-name">$current</span><span class="var-description">: Default selection of drop down box (optional)</span> </li>
320 <li>
321 <span class="var-type">string</span>
322 <span class="var-name">$location</span><span class="var-description">: for debugging purposes</span> </li>
323 <li>
324 <span class="var-type">array</span>
325 <span class="var-name">$parameters</span><span class="var-description">: an array further parameters, including 'maxwidth' =&gt; 20 to set a maximum width</span> </li>
326 <li>
327 <span class="var-type"></span>
328 <span class="var-name">$qry</span> </li>
329 </ul>
332 </div>
333 <a name="methodEntryField" id="EntryField"><!-- --></a>
334 <div class="oddrow">
336 <div class="method-header">
337 <img src="../../media/images/Constructor.png" />
338 <span class="method-title">Constructor EntryField</span> (line <span class="line-number">137</span>)
339 </div>
341 <!-- ========== Info from phpDoc block ========= -->
342 <p class="short-description">Initialise an EntryField, used for data entry.</p>
343 <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
344 key starts with an underscore. The key will have the '_' removed before being used
345 as the key in the list. All the $attributes with keys not beginning with '_' will
346 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.
347 If $attributes defines a '_sql' attibute then that will be used to make
348 the list, otherwise the database values will be from the 'codes' table
349 as in &quot;SELECT code_id, code_value FROM codes WHERE code_type = '_type' ORDER BY code_seq, code_id&quot;
350 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
351 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
352 should be assigned (or will be assigned the same value as the 'title' attribute) and
353 will (depending on the data-entry line format in force) be displayed as help for the
354 field by the EntryForm::DataEntryLine() method.</li><li>_sql - When used in a 'lookup' field this controls the SQL to return keys/values
355 for the list. The actual SQL should return two columns, the first will be used for
356 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
357 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
358 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
359 with an HTML label tag as &lt;label ...&gt;&lt;input field...&gt;$attributes['_label']&lt;/label&gt;</li><li>-</li></ul></p></p>
361 <div class="method-signature">
362 <span class="method-result">EntryField</span>
363 <span class="method-name">
364 EntryField
365 </span>
366 (<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>])
367 </div>
369 <ul class="parameters">
370 <li>
371 <span class="var-type">text</span>
372 <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>
373 <li>
374 <span class="var-type">text</span>
375 <span class="var-name">$inname</span><span class="var-description">: The name of the field.</span> </li>
376 <li>
377 <span class="var-type">text</span>
378 <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>
379 <li>
380 <span class="var-type">text</span>
381 <span class="var-name">$current_value</span><span class="var-description">: The current value to use to initialise the field. Optional.</span> </li>
382 </ul>
385 </div>
386 <a name="methodnew_lookup" id="new_lookup"><!-- --></a>
387 <div class="evenrow">
389 <div class="method-header">
390 <img src="../../media/images/Method.png" />
391 <span class="method-title">new_lookup</span> (line <span class="line-number">283</span>)
392 </div>
394 <!-- ========== Info from phpDoc block ========= -->
395 <p class="short-description">Function called indirectly when a new EntryField of type 'lookup' is created.</p>
397 <div class="method-signature">
398 <span class="method-result">void</span>
399 <span class="method-name">
400 new_lookup
401 </span>
402 (<span class="var-type">array</span>&nbsp;<span class="var-name">$attributes</span>)
403 </div>
405 <ul class="parameters">
406 <li>
407 <span class="var-type">array</span>
408 <span class="var-name">$attributes</span><span class="var-description">: The attributes array that was passed in to the new EntryField() constructor.</span> </li>
409 </ul>
412 </div>
413 <a name="methodRender" id="Render"><!-- --></a>
414 <div class="oddrow">
416 <div class="method-header">
417 <img src="../../media/images/Method.png" />
418 <span class="method-title">Render</span> (line <span class="line-number">162</span>)
419 </div>
421 <!-- ========== Info from phpDoc block ========= -->
422 <p class="short-description">Render an EntryField into HTML</p>
423 <ul class="tags">
424 <li><span class="field">return:</span> An HTML fragment for the data-entry field.</li>
425 <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>
426 </ul>
428 <div class="method-signature">
429 <span class="method-result">text</span>
430 <span class="method-name">
431 Render
432 </span>
434 </div>
438 </div>
440 </div>
441 </div>
444 <p class="notes" id="credit">
445 Documentation generated on Tue, 28 Dec 2010 02:01:35 +1300 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
446 </p>
447 </div></body>
448 </html>