Umfragen
widget Class Reference

the widget base class, all widgets should extend it More...

Inheritance diagram for widget:
checkBox container labelTiny line longtext matrixOption matrixQuestion radioButton scheduleDate scheduleName scheduleOption text

Public Member Functions

 serialize_config ()
 makes a string (php serializer) of the widget config and stores it in widget::config
 unserialize_config ()
 takes widget::config in string form (php serializer) and makes an array
 init_config ()
 initialise config. unserialize when necessary
 set_config ($name, $val)
 sets a config variable
 get_config ($name)
 gets an config variable or it's default value
 set_data ($name, $val)
 sets a data variable. Data is meant for non persistend data storage such as count
 get_data ($name)
 gets a data variable or it's default value
 check_vital_vars ()
 checks if widget::typ widget::name widget::index and widget::pollID are set
 check_required ()
 checks if widget's name is in $_POST (question answered) if the widget is a required question
 check_max ()
 checks if a maximum limit of different answers to a question has been exceeded
 set_dispName ($dispName)
 sets widget's display name by escaping html characters ant checking for a maximum length of 256 chars
 set_name ($name)
 sets widget's name. Max 25 chars. Sets the widget's ID if input is empty
 display_edit_begin ()
 prints edit toolbar and widget container div for a widget. Used as link to widget's edit page
 display_name_edit ()
 prints edit widget name
 handle_name_edit ()
 handles widget name edit and sets widget::name
 display_dispName_edit ()
 prints display name edit
 handle_dispName_edit ()
 handles widget display name edit and sets widget:: dispName
 display_required_edit ()
 prints widget is_required checkbox edit
 handle_required_edit ()
 handles widget is_required checkbox edit and sets widget::is_required
 display_chartType_edit_generic ($allowed, $allowed_names)
 prints widget chart type select edit
 handle_chartType_edit_generic ($allowed)
 handles widget chart type select edit and sets config value
 save_config ($db)
 saves the widget config array to database
 save_dispName ($db)
 saves the widget's display name widget::dispName
 save_required ($db)
 saves the widget's is required widget::is_required
 save_name ($db, $new_name)
 sets the widget's name in the result table and the widget table

Data Fields

 $pollID
 ID of the poll the widget belongs to.
 $name
 The name of the widget, used for columname in the result table. Using the widget's ID in simple poll mode.
 $value
 Place to store data. For output_widget it's the shown data, for input_widget it's the result data.
 $config
 Config array, can be serialized as string.
 $is_required = false
 Is the widget a required question?
 $dispName
 User friendly name for the widget. Used to ask the question.
 $index
 Index in the widget_list.
 $ID
 widget's ID
 $is_child = false
 is the widget a child of another widget or a child of a poll?
 $parent = -1
 the parent's ID if the widget is a child
 $long_result = false
 $direct_result = true
 widget has a row in the result table

Private Attributes

 $data = array()

Detailed Description

the widget base class, all widgets should extend it

Definition at line 13 of file widgetBaseClass.class.php.

Member Function Documentation

check_max ( )

checks if a maximum limit of different answers to a question has been exceeded

Returns
bool true if ok, else error string

Reimplemented in checkBoxSingle.

Definition at line 363 of file widgetBaseClass.class.php.

check_required ( )

checks if widget's name is in $_POST (question answered) if the widget is a required question

Returns
bool true if widget not required or question han been answered, string with error message if test failed

Reimplemented in container, radioButtonList, and checkBoxList.

Definition at line 335 of file widgetBaseClass.class.php.

check_vital_vars ( )

checks if widget::typ widget::name widget::index and widget::pollID are set

Exceptions
varException"widget cars not set"
Returns
bool true

Definition at line 321 of file widgetBaseClass.class.php.

display_chartType_edit_generic (   $allowed,
  $allowed_names 
)

prints widget chart type select edit

See Also
widget::handle_chartType_edit_generic()
Parameters
array$allowedlist of allowed chartypes for this widget
array$allowed_nameslist of allowed chartypes for this widget pretty print names

Definition at line 561 of file widgetBaseClass.class.php.

display_dispName_edit ( )

prints display name edit

See Also
widget::handle_dispName_edit()

Reimplemented in textExt, and matrix.

Definition at line 505 of file widgetBaseClass.class.php.

display_edit_begin ( )

prints edit toolbar and widget container div for a widget. Used as link to widget's edit page

Definition at line 443 of file widgetBaseClass.class.php.

display_name_edit ( )

prints edit widget name

See Also
widget::handle_name_edit()

Definition at line 477 of file widgetBaseClass.class.php.

display_required_edit ( )

prints widget is_required checkbox edit

See Also
widget::handle_required_edit()

Definition at line 533 of file widgetBaseClass.class.php.

get_config (   $name)

gets an config variable or it's default value

Parameters
string$namevariable name
Returns
mixed config

Reimplemented in buttonListContainer, text, schedule, checkBox, radioButtonList, checkBoxList, and radioButton.

Definition at line 181 of file widgetBaseClass.class.php.

get_data (   $name)

gets a data variable or it's default value

Parameters
string$namevariable name
Returns
mixed data

Reimplemented in checkBox, radioButton, schedule, checkBoxSingle, and matrixQuestion.

Definition at line 306 of file widgetBaseClass.class.php.

handle_chartType_edit_generic (   $allowed)

handles widget chart type select edit and sets config value

See Also
widget::display_chartType_edit_generic()
Parameters
array$allowedlist of allowed chartypes for this widget
Returns
bool true or error string

Definition at line 582 of file widgetBaseClass.class.php.

handle_dispName_edit ( )

handles widget display name edit and sets widget:: dispName

See Also
widget::display_dispName_edit()
Returns
bool true or error string

Reimplemented in textExt, and matrix.

Definition at line 516 of file widgetBaseClass.class.php.

handle_name_edit ( )

handles widget name edit and sets widget::name

See Also
widget::display_name_edit()
Returns
bool true or error string

Definition at line 488 of file widgetBaseClass.class.php.

handle_required_edit ( )

handles widget is_required checkbox edit and sets widget::is_required

See Also
widget::display_required_edit()
Returns
bool true or error string

Definition at line 546 of file widgetBaseClass.class.php.

init_config ( )

initialise config. unserialize when necessary

Returns
bool true
Exceptions
exceptionwhen serialized config is corrupted

Definition at line 59 of file widgetBaseClass.class.php.

save_config (   $db)

saves the widget config array to database

Parameters
db$dbthe database instance
Returns
bool true on success, else false

Definition at line 599 of file widgetBaseClass.class.php.

save_dispName (   $db)

saves the widget's display name widget::dispName

Parameters
db$dbthe database instance
Returns
bool true on success, else false

Definition at line 611 of file widgetBaseClass.class.php.

save_name (   $db,
  $new_name 
)

sets the widget's name in the result table and the widget table

Parameters
db$dbthe database instance
string$new_namethe name to be set

Definition at line 629 of file widgetBaseClass.class.php.

save_required (   $db)

saves the widget's is required widget::is_required

Parameters
db$dbthe database instance
Returns
bool true on success, else false

Definition at line 620 of file widgetBaseClass.class.php.

serialize_config ( )

makes a string (php serializer) of the widget config and stores it in widget::config

Definition at line 33 of file widgetBaseClass.class.php.

set_config (   $name,
  $val 
)

sets a config variable

Parameters
string$nameconfigvar name to be set
mixed$valvalue to be set
Returns
true if success else error string

Reimplemented in buttonListContainer, schedule, text, checkBox, radioButtonList, radioButton, and checkBoxList.

Definition at line 78 of file widgetBaseClass.class.php.

set_data (   $name,
  $val 
)

sets a data variable. Data is meant for non persistend data storage such as count

Parameters
string$namedata name to be set
mixed$valvalue to be set
Returns
true if success else error string

Reimplemented in checkBox, checkBoxSingle, radioButton, schedule, and matrixQuestion.

Definition at line 293 of file widgetBaseClass.class.php.

set_dispName (   $dispName)

sets widget's display name by escaping html characters ant checking for a maximum length of 256 chars

Parameters
string$dispNamename to be set
Returns
bool true on success or error string on failure

Definition at line 389 of file widgetBaseClass.class.php.

set_name (   $name)

sets widget's name. Max 25 chars. Sets the widget's ID if input is empty

Parameters
string$namename to be set Only 0-9 a-z A-Z and _ are allowed.
Returns
bool true on success or error string on failure

Definition at line 411 of file widgetBaseClass.class.php.

unserialize_config ( )

takes widget::config in string form (php serializer) and makes an array

Definition at line 42 of file widgetBaseClass.class.php.

Field Documentation

Config array, can be serialized as string.

Definition at line 18 of file widgetBaseClass.class.php.

$data = array()
private

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

$direct_result = true

widget has a row in the result table

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

$dispName

User friendly name for the widget. Used to ask the question.

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

$ID

widget's ID

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

$index

Index in the widget_list.

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

$is_child = false

is the widget a child of another widget or a child of a poll?

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

$is_required = false

Is the widget a required question?

Definition at line 19 of file widgetBaseClass.class.php.

$long_result = false

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

$name

The name of the widget, used for columname in the result table. Using the widget's ID in simple poll mode.

Definition at line 16 of file widgetBaseClass.class.php.

$parent = -1

the parent's ID if the widget is a child

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

ID of the poll the widget belongs to.

Definition at line 15 of file widgetBaseClass.class.php.

Place to store data. For output_widget it's the shown data, for input_widget it's the result data.

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


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