Sitellite Application Framework
Class Tree         Index         All Elements

Class: MF_Widget_virtual

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

Class Overview

MF_Widget
   |
   --MF_Widget_virtual

Pseudo-Widget that displays information from a database query or user-defined function.


Author(s)

Version

  • 1.0, 2002-08-31, $Id: Virtual.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

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 54]
Pseudo-Widget that displays information from a database query or user-defined function.


1 <?php
2
3 $widget = new MF_Widget_virtual ('virtual_test');
4
5 $widget->setValue (
6 'query',
7 'select round(((clicks / views) * 100), 2) as clicks from banner where id = ??'
8 );
9 $widget->bindValues = array ('pkey value from banner table');
10
11 $obj = $widget->getValue ();
12 echo $obj->clicks;
13
14 ?>




Tags:

access:  public
version:  1.0, 2002-08-31, $Id: Virtual.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

$bindValues = array ()

[line 78]

A list of bind values to pass to the database query.



Tags:

access:  public

Type:   mixed


[ Top ]

$column =

[line 89]

A column that will be returned from the database query. If this column is specified, then instead of returning an object or array, the getValue() method will return the value of this column from the first result returned from the database.



Tags:

access:  public

Type:   mixed


[ Top ]

$error =

[line 97]

If the database query fails, this will contain the error message.



Tags:

access:  public

Type:   mixed


[ Top ]

$function =

[line 62]

A function to call to get the value of this widget. This function must act on a $cgi object.



Tags:

access:  public

Type:   mixed


[ Top ]

$query =

[line 70]

A database query to execute to get the value of this widget.



Tags:

access:  public

Type:   mixed


[ Top ]

$type =  'virtual'

[line 106]

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_virtual [line 115]

MF_Widget_virtual MF_Widget_virtual( string $name)

Constructor Method.



Tags:

access:  public


Parameters:

string   $name  

[ Top ]

method display [line 204]

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::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 170]

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

Fetches the actual value for this widget. Returns whatever the function or database query returns. If $column is specified, returns the value of the $column field from the first record of the database results.



Tags:

access:  public


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

Parameters:

object   $cgi  

[ Top ]

method setValue [line 147]

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

Sets either the $function or $query property. If the property name is specified as $key, then $value is what it is set to, otherwise it checks to see if the $key is an existing function and if so sets $function to $key, otherwise sets $query to $key.



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   $key  
string   $value  

[ Top ]

method validate [line 132]

boolean validate( string $value, object $form, object $cgi)

Validates the widget against its set of $rules. Returns false on failure to pass any rule.



Tags:

access:  public


Overrides MF_Widget::validate() (Validates the widget against its set of $rules. Returns false on failure to pass any rule.)

Parameters:

string   $value  
object   $form  
object   $cgi  

[ Top ]


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