Public Member Functions | Data Fields

widgetFramework Class Reference

An abstract class that every widget must extend. It contains the implementation of some of the common methods like widget creation, deletion, etc. Other methods must be defined by the derived class. widget.lib.php. More...

Inheritance diagram for widgetFramework:
count_down facebook news serverDateTime slider

Public Member Functions

 initWidget ()
 For widget initialization.
 getHTML ()
 For retrieving the widget output.
 getCommonHTML ()
 For retrieving the widget output which is common for all instances of same widget.
 __construct ($widgetId, $widgetInstanceId, $pageId, $defaultconfigs)
 loadWidget ()
 validInstall ()
 installWidget ()
 setConfigs ($configs)
 saveSetting ($key, $value)
 saveData ($key, $value)
 createWidget ($pageId, &$widgetLocation, &$widgetOrder)

Data Fields

 $widgetName
 Name of the widget.
 $widgetDescription
 Description of the widget.
 $widgetVersion
 Version of the widget.
 $widgetAuthor
 Author of the widget.
 $widgetId
 Id of the widget.
 $widgetInstanceId
 Instance Id of the widget.
 $widgetPageId
 Page Id of the page this instance is located on.
 $widgetLocation
 Location of the widget on the page.
 $widgetOrder
 Order of the widget, in case when multiple widgets are on the same location.
 $settings
 Instance-Specific Settings of the widget in key=>value format.
 $data
 A sort of RAM or heap store for the widget in key=>value format.
 $defaultConfigs
 Default configurations of the widget.

Detailed Description

An abstract class that every widget must extend. It contains the implementation of some of the common methods like widget creation, deletion, etc. Other methods must be defined by the derived class. widget.lib.php.

Author:
Abhishek Shrivastava <i.abhi27 [at] gmail.com> .

Definition at line 17 of file widgetFramework.class.php.


Constructor & Destructor Documentation

__construct ( widgetId,
widgetInstanceId,
pageId,
defaultconfigs 
)

Constructor.

Parameters:
$widgetId Widget ID of the widget
$widgetName Widget Name of the widget
Returns:
instance of the class widgetFramework

Definition at line 50 of file widgetFramework.class.php.


Member Function Documentation

createWidget ( pageId,
&$  widgetLocation,
&$  widgetOrder 
) [final]

Creates an instance of the widget on the given page Id by adding the appropriate fields in the database. Default configuration will be used initially.

Parameters:
$pageID Page Id of the page on which to create the widget
$widgetLocation Location ID of the widget on the page
$widgetOrder Order of the widget on a location, when multiple widgets are there
Returns:
true, if succesfully created the widget else false. $configs

Default location for the creation of the widget

Definition at line 262 of file widgetFramework.class.php.

getCommonHTML (  )  [abstract]

For retrieving the widget output which is common for all instances of same widget.

Reimplemented in count_down, facebook, serverDateTime, and slider.

getHTML (  )  [abstract]

For retrieving the widget output.

Reimplemented in count_down, facebook, serverDateTime, and slider.

initWidget (  )  [abstract]

For widget initialization.

Reimplemented in count_down, facebook, serverDateTime, and slider.

installWidget (  ) 

Installs the widget properly by storing its configuration in the configsinfo table and updating the install flag in data.

Returns:
Boolean True if successful, else False.

If some configuration fields are already there in table, we remove them.

Definition at line 165 of file widgetFramework.class.php.

loadWidget (  )  [final]

Loads the widget information, settings and data from the database if the widget already exists.

Parameters:
$widgetInstanceId widget instance id of the existing widget
$pageId page Id of the page in which widget exists
Returns:
Boolean True on success, else false.

Loading widget information

Loading configuration settings (both instance-specific and global)

If configurations doesn't exists, then loading default values.

Only add to database if the current instance type and the configuration type matches i.e. global or instance-specific.

Loading data settigns

Definition at line 67 of file widgetFramework.class.php.

saveData ( key,
value 
) [final]

Saves a particular widget data in the database.

Parameters:
$key The data name which is to be saved.
$value The data value.
Returns:
Boolean True if successful, else False.

Definition at line 235 of file widgetFramework.class.php.

saveSetting ( key,
value 
) [final]

Saves a particular widget configuration in the database.

Parameters:
$key The setting name which is to be saved.
$value The value of the setting.
Returns:
Boolean True if successful, else False.

Definition at line 214 of file widgetFramework.class.php.

setConfigs ( configs  )  [final]

Sets the widget settings by creating the settings in the database. Only needed during installation.

Parameters:
$configs Configuration for the widget.
Returns:
true on success, else false.

Definition at line 187 of file widgetFramework.class.php.

validInstall (  ) 

Checks whether the widget has been installed properly. It checks the install flag in data. If its 0, it assumes the widget needs installation.

Note:
It will only work if widgetInstanceId = -1 (i.e. global) since we need not check installation of every instance.
Returns:
Boolean True if widget is properly installed, else False.

Definition at line 154 of file widgetFramework.class.php.


Field Documentation

$data

A sort of RAM or heap store for the widget in key=>value format.

Definition at line 30 of file widgetFramework.class.php.

$defaultConfigs

Default configurations of the widget.

Definition at line 31 of file widgetFramework.class.php.

$settings

Instance-Specific Settings of the widget in key=>value format.

Definition at line 29 of file widgetFramework.class.php.

$widgetAuthor

Author of the widget.

Definition at line 23 of file widgetFramework.class.php.

$widgetDescription

Description of the widget.

Definition at line 21 of file widgetFramework.class.php.

$widgetId

Id of the widget.

Definition at line 24 of file widgetFramework.class.php.

$widgetInstanceId

Instance Id of the widget.

Definition at line 25 of file widgetFramework.class.php.

$widgetLocation

Location of the widget on the page.

Definition at line 27 of file widgetFramework.class.php.

$widgetName

Name of the widget.

Definition at line 20 of file widgetFramework.class.php.

$widgetOrder

Order of the widget, in case when multiple widgets are on the same location.

Definition at line 28 of file widgetFramework.class.php.

$widgetPageId

Page Id of the page this instance is located on.

Definition at line 26 of file widgetFramework.class.php.

$widgetVersion

Version of the widget.

Definition at line 22 of file widgetFramework.class.php.


The documentation for this class was generated from the following file: