Sitellite Application Framework
Class Tree         Index         All Elements

Class: MF_Widget_checkbox

Source Location: Program_Root/MailForm/Widget/Checkbox.php

Class Overview

MF_Widget
   |
   --MF_Widget_checkbox

Checkbox widget. Displays a list of HTML <input type="checkbox" /> form fields.


Author(s)

Version

  • 1.2, 2002-05-18, $Id: Checkbox.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Child Classes

MF_Widget_allow
Allow widget. Displays a list of HTML <input type="checkbox" /> form fields.

Inherited Variables

Inherited Methods

Class: MF_Widget

MF_Widget::MF_Widget()
Constructor Method.
MF_Widget::addRule()
Adds a validation rule to the list of $rules.
MF_Widget::attr()
This is the accessor method for setting and getting the value of
MF_Widget::changeType()
MF_Widget::display()
Returns the display HTML for this widget. The optional parameter determines whether or not to automatically display the widget nicely, or whether to simply return the widget (for use in a template).
MF_Widget::getAttrs()
Returns a list of all of the attributes of this object's HTML tag in a string ready to be concatenated into the actual rendered tag output.
MF_Widget::getValue()
Fetches the actual value for this widget.
MF_Widget::invalid()
Returns a ' class="invalid"' string if the widget's $invalid property is set to true, or an empty string otherwise.
MF_Widget::setDefault()
Sets the default value for the widget.
MF_Widget::setValue()
Sets the *ACTUAL* value for this widget. An optional second parameter can be passed, which is unused here, but can be used in complex widget types to assign parts of a value and piece it together from multiple physical form fields.
MF_Widget::setValues()
Sets the *POSSIBLE* values for this widget. If $value is given, sets $this->value as a hash, otherwise, as a string.
MF_Widget::unsetAttr()
Use this method to remove an attribute from the tag
MF_Widget::validate()
Validates the widget against its set of $rules. Returns false on failure to pass any rule.
MF_Widget::validation()
Sets the validation $rule for this widget. Note: This method is deprecated and only wraps around the addRule() method anyway. Please use addRule() instead, since this method will be removed in a near-future release.

Class Details

[line 52]
Checkbox widget. Displays a list of HTML <input type="checkbox" /> form fields.

New in 1.2:

  • Added a constructor method to set the $passover_isset value to true, which is inherited from MF_Widget.

1 <?php
2
3 $widget = new MF_Widget_checkbox ('name');
4 $widget->validation ('is "foo"');
5 $widget->setValue ('foo');
6 $widget->error_message = 'Oops! This widget is being unruly!';
7
8 ? >




Tags:

access:  public
version:  1.2, 2002-05-18, $Id: Checkbox.php,v 1.2 2005/07/06 15:30:56 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$align =  'vertical'

[line 87]

This determines the alignment of the buttons. The default is vertical, which puts each button on its own row. Setting this to horizontal will put the buttons all on the same row.



Tags:

access:  public

Type:   mixed


[ Top ]

$extra =  ''

[line 60]

A way to pass extra parameters to the HTML form tag, for example 'enctype="multipart/formdata"'.



Tags:

access:  public

Type:   mixed


[ Top ]

$fieldset =  true

[line 77]

Set this to false if you don't want the fieldset and legend tags.



Tags:

access:  public

Type:   mixed


[ Top ]

$type =  'checkbox'

[line 69]

This is the short name for this widget. The short name is the class name minus the 'MF_Widget_' prefix.



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$_horizontal_template =  '   <tr>
      <td colspan="3" class="field">
         <table width="100%"><tr><td width="60%" valign="top">
         <span{filter none}{invalid}>{display_value}{end filter}</span> &nbsp;
         </td>

         {loop obj.value}
   <td valign="top" align="center"><input
               type="checkbox"
               {filter none}{attrstr}{end filter}
               value="{loop/_key}"
               id="{name}_{loop/_key}"
               {if in_array (loop._key, obj.values)}checked="checked"{end if}
               {filter none}{extra}{end filter}
            />
            <label for="{name}_{loop/_key}">{loop/_value}</label></td>

         {end loop}
         </tr></table>
      </td>
   </tr>
'

[line 91]


Type:   mixed


[ Top ]

$_vertical_template =  '   <tr>
      <td colspan="2" class="field">
         {if obj.fieldset}
         <fieldset>
            <legend{filter none}{invalid}{end filter}>{display_value}</legend>
         {end if}

         {loop obj.value}
   <input
               type="checkbox"
               {filter none}{attrstr}{end filter}
               value="{loop/_key}"
               id="{name}_{loop/_key}"
               {if in_array (loop._key, obj.values)}checked="checked"{end if}
               {filter none}{extra}{end filter}
            />
            <label for="{name}_{loop/_key}">{loop/_value}</label><br />

         {end loop}
         {if obj.fieldset}
         </fieldset>
         {end if}
      </td>
   </tr>
'

[line 89]


Type:   mixed


[ Top ]



Class Methods


constructor MF_Widget_checkbox [line 101]

MF_Widget_checkbox MF_Widget_checkbox( string $name)

Constructor Method. Also sets the $passover_isset property to false.



Tags:

access:  public


Parameters:

string   $name  

[ Top ]

method display [line 156]

string display( [boolean $generate_html = 0])

Returns the display HTML for this widget. The optional parameter determines whether or not to automatically display the widget nicely, or whether to simply return the widget (for use in a template).



Tags:

access:  public


Overridden in child classes as:

MF_Widget_allow::display()
Returns the display HTML for this widget. The optional parameter determines whether or not to automatically display the widget nicely, or whether to simply return the widget (for use in a template).

Overrides MF_Widget::display() (Returns the display HTML for this widget. The optional parameter determines whether or not to automatically display the widget nicely, or whether to simply return the widget (for use in a template).)

Parameters:

boolean   $generate_html  

[ Top ]

method getValue [line 134]

string getValue( [object $cgi = ''])

Fetches the actual value for this widget.



Tags:

access:  public


Overrides MF_Widget::getValue() (Fetches the actual value for this widget.)

Parameters:

object   $cgi  

[ Top ]

method setValue [line 118]

void setValue( [string $value = ''], [string $inner_component = ''])

Sets the actual value for this widget. An optional second parameter can be passed, which is unused here, but can be used in complex widget types to assign parts of a value and piece it together from multiple physical form fields.



Tags:

access:  public


Overrides MF_Widget::setValue() (Sets the *ACTUAL* value for this widget. An optional second parameter can be passed, which is unused here, but can be used in complex widget types to assign parts of a value and piece it together from multiple physical form fields.)

Parameters:

string   $value  
string   $inner_component  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:05 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2