1 <?php
2 /**
3 * XAO_InputControl.php
4 *
5 * This script provides the class definition for InputControl. This
6 * class facilitates caollections of input field specifications. See class doc
7 * comment for details.
8 */
9
10 /**
11 * Import the basic DomDoc class for inheritance.
12 *
13 * This class is based on DomDoc and hence supports all of it's functionality,
14 * including it's ability to be consumed by another DomDoc based object.
15 *
16 * @import DomDoc
17 */
18 include_once "XAO_DomDoc.php";
19
20 /**
21 * Import the InputField class for association.
22 *
23 * This class is instantiated when cirtain calls such as ndAddField() are called
24 * in the InputControls class.
25 *
26 * @import InputField
27 */
28 include_once "XAO_InputField.php";
29
30 /**
31 * Collection for grouping InputFields and other InputControls.
32 *
33 * WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
34 * DO NOT ATTEMPT TO USE THIS CLASS. IT IS A WORK IN PROGRESS. IT IS VAPOURWARE.
35 * IT PROBABLY HAS NOT EVEN BEEN THROUGH THE INTERPRETER/PARSER YET. IT WILL NOT
36 * WORK. THE DESIGN WILL CHANGE. THERE'S STILL MUCH WORK TO BE DONE. LEAVE IT.
37 * This class provides a standard API for specifying GUI controls for user-input.
38 * Naturally the XSLT templates will be responsible for implementing them but
39 * the server (this class) is responsible for the input requirements (the spec).
40 * Input controls should be able to "consume" other input controls.
41 * The leaves of this tree are the InputFields themselves. InputControls will be
42 * categoriesed into "types" according to their meaning/context. For
43 * instnace, the most common type will be a "form". This type will be
44 * obligated to include information such as uriProc, strMethod, strContentType,
45 * strEncoding. Each type will have an initialisation method. Developers wishing
46 * to add new types of controls simply inherit this class and add new
47 * initialisation methods (or override existing ones to modify them).
48 * As with individual InputFields, an InputControl may specify it's own
49 * requirements that are subject to validation. For instance, a control may say
50 * that if Field1 is not filled in, then Field2 is compulsory.
51 *
52 * @author Terence Kearns
53 * @version 0.2
54 * @copyright Terence Kearns 2003
55 * @license LGPL
56 * @package XAO
57 * @link http://xao-php.sourceforge.net
58 */
59 class InputControl extends DomDoc {
60
61 var $ndFields;
62
63 function InputControl($strName, $strType, $arrParams) {
64 $strRoot = "inputControl";
65 $this->DomDoc($strRoot);
66 $this->ndRoot->set_namespace(
67 $this->idXaoNamespace,$this->
68 strXaoNamespacePrefix );
69 $this->ndFields = $this->ndAppendToRoot("inputFields");
70
71 }
72
73 function ndAddField($arrParams) {
74 $objField = new InputField($arrParams);
75 return $this->ndConsumeDoc($objField,$this->ndFields);
76 }
77 }
78
79 ?>