Aliro Documentation : AliroParameterRender

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

aliroParameterRender


This abstract class provides a static method renderParameters which creates the HTML for a group of parameters that are held in an aliroParameters object. This is the only public method provided by the class.

In addition, there is one subclass of aliroParameterRender for each type of <parm> element that can be contained within a set of <params> in packaging XML. There are a number of protected properties, and three protected methods, one of which is the abstract renderItem that must be implemented by the subclasses. The protected constructor method sets up the properties, which are then available to the renderItem method in each subclass. The subclasses are named with aliroParameterRender followed by the parameter type in lower case except for the first letter in upper case, for example aliroParameterRenderRadio. In addition to a standard set of types, it is possible to extend the system by adding new subclasses of aliroParameterRender to support new types. The only requirement for these is that they should be known to the system, usually achieved by including them in a file that appears within a <classfiles> element in the packaging XML. The attributes available for a parameter are restricted by the DTD for packaging XML, although this can be extended if the need arises.

Methods in more detail are:

string = renderParameters ($parmspec, $pobject, $controlname) which is a static method that returns a set of HTML to render the parameters contained within a single group. The first parameter is an array, equivalent to the packaging XML for the <params> element and everything contained within it. The second parameter is an Aliro parameters object, of the class aliroParameters. The third parameter is the name that is to be used in the HTML for the input fields to receive values for the various parameters. Each individual field is given a subscripted name, using the name of the parameter as the subscript to the value of $controlname.

__construct ($param, $poptions, $pobject, $controlname) is the standard constructor that creates an environment to aid the various subclasses. The first parameter is an associative array that provides the details of an individual <param> attributes, with the attribute name as key to the value. Where they exist, the set of <option> elements within the <param> are passed as an array in the second parameter, with each element of the array itself being an array with two elements. One has the key 'value' and contains the value for the option, while the other has the key 0 and contains the name of the option. The third parameter is the relevant aliroParameters object. The final parameter is the name to be used in the HTML for input fields, subscripted with the individual <param> name. The constructor sets up a number of properties for the convenience of the renderItem method, creates surrounding HTML, and calls renderItem. It is always called by renderParameters, indirectly through the instantiation of an object of a subclass.

string = renderItem ($poptions, $controlname) is an abstract method, and must be implemented in the various subclasses that handle specific parameter types. The parameters are as described for the correspondingly named parameters in the constructor.

string = T_ ($string) will return a translated version of $string if possible, and is provided for convenience.

Properties that are set up by the constructor for use in the renderItem methods of the subclasses are:

type, name, label, default, description, size, rows, cols, class, method, directory - which cover the main attributes available for a <param> element.

value - which is the current value of the parameter

alirohtml - which is an instance of the class aliroHTML provided for convenience and efficiency

param - which is an associative array holding the complete range of attributes of the <param> element.

There are also static properties that are used internally:

html - is an array used to accumulate the lines of HTML for the final result

paramcount - used to keep count of how many parameters have been rendered.

The requirement for building a subclass of aliroParameterRender to support a new type is that the new class must have a name the includes the new type. If, for example, a new type is wanted called sample, then the new class must be called aliroParameterRenderSample. It must have a protected method called renderItem, passed parameters as described above. It can make use of the non-static properties described above. It must return some kind of input HTML to receive a value for a parameter of the new type. This could be a set of radio buttons, a drop down list, or whatever is appropriate. Other methods can be included if required.

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0756 seconds