Sitellite Application Framework
Class Tree         Index         All Elements

Class: MF_Widget_mref

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

Class Overview

MF_Widget
   |
   --MF_Widget_multiple
      |
      --MF_Widget_mref

Mref widget. Displays a select box with a list of options from another table to choose from. Optionally configurable to be self-referencial and organizes the options intuitively into a hierarchy.


Author(s)

Version

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

Copyright

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

Variables

Methods


Inherited Variables

Inherited Methods

Class: MF_Widget_multiple

MF_Widget_multiple::MF_Widget_multiple()
Constructor Method. Also sets the $passover_isset property to false.
MF_Widget_multiple::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_multiple::getValue()
Fetches the actual value for this widget.
MF_Widget_multiple::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.

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 68]
Mref widget. Displays a select box with a list of options from another table to choose from. Optionally configurable to be self-referencial and organizes the options intuitively into a hierarchy.

Note: This widget requires a global $db database object to be available.

New in 1.2:

  • Added a $self_ref property, to determine whether or not this widget is self- referencial.
New in 1.4:
  • Added the $popup and $popup_limit properties, which give some control over the popup behaviour of this widget.
New in 1.6:
  • Added an $addblank property.

1 <?php
2
3 $widget = new MF_Widget_mref ('name');
4 $widget->validation ('is "foo"');
5 $widget->error_message = 'Oops! This widget is being unruly!';
6 $widget->table = 'tablename';
7 $widget->primary_key = 'id';
8 $widget->display_column = 'title';
9 $widget->ref_column = 'refcolumn';
10 echo $widget->display ();
11
12 ?>




Tags:

access:  public
version:  1.6, 2002-08-05, $Id: Mref.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

$addblank =

[line 127]

Whether or not to add a blank line to the list. $addblank is

useful in the Sitellite CMS because saf.App.Versioning returns the column value as NULL if $nullable is set to true, and getData() is called automatically by display(), so there's no chance to add a blank array element at the bottom of the list.




Tags:

access:  public

Type:   mixed


[ Top ]

$display_column =

[line 99]

The column in the other table that should be shown in the select box.



Tags:

access:  public

Type:   mixed


[ Top ]

$nullable =

[line 115]

Can this field contain a null value.



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$popup =

[line 138]

If true, this will prompt a popup to occur at $popup_limit number of options in the Ref, so that they all aren't loaded at once into the select box. This is true by default. It is good for references to large tables. This feature is Sitellite Content Manager specific.



Tags:

access:  public

Type:   mixed


[ Top ]

$popup_limit =

[line 147]

This determines the limit at which a popup occurs instead of a select box, if $popup is set to true.



Tags:

access:  public

Type:   mixed


[ Top ]

$primary_key =

[line 91]

The column in the other table that is the primary key.



Tags:

access:  public

Type:   mixed


[ Top ]

$ref_column =

[line 107]

The column in the current table that refers to the other table.



Tags:

access:  public

Type:   mixed


[ Top ]

$self_ref =

[line 83]

Whether or not this widget is self-referencial.



Tags:

access:  public

Type:   mixed


[ Top ]

$table =

[line 75]

Contains the table to read from.



Tags:

access:  public

Type:   mixed


[ Top ]

$type =  'mref'

[line 156]

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 ]



Class Methods


constructor MF_Widget_mref [line 165]

MF_Widget_mref MF_Widget_mref( string $name)

Constructor Method.



Tags:

access:  public


Parameters:

string   $name  

[ Top ]

method display [line 236]

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


Overrides MF_Widget_multiple::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 getData [line 203]

associative getData( [string $val = ''], [string $dashes = ''])

Returns an associative array of values from the database. This method is recursive, and used to generate hierarchical views.



Tags:

return:  array
access:  public


Parameters:

string   $val  
string   $dashes  

[ Top ]

method getNumRows [line 180]

integer getNumRows( )

Returns the number of rows in the table being referenced.



Tags:

access:  public


[ Top ]


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