Skip to main content Help Control Panel

Login   A+   A-

Server software «  

Documentation: overlays/poll.php

class Poll extends Overlay - Describe one poll

Normally, a poll appears at the front page only to let people vote.

However, you can select to also display raw results by adding the keyword 'poll_with_results' in the field for options of the containing article.

This script is a reference file of this system.

License: GNU Lesser General Public License

Authors:

  • Bernard Paques
  • GnapZ

Testers:

  • Timster

On the to-do list:

  • allow for multiple choices (Myriam)
  • export data as csv

get_fields() - Build the list of fields for one overlay

function get_fields($host)

  • $host - the hosting attributes
  • returns a list of ($label, $input, $hint)



See also:

get_label() - Get an overlaid label

function get_label($label, $action='view')

  • $label - string the target label
  • $action='view' - string the on-going action
  • returns the label to use

Accepted action codes:
  • 'edit' modification of an existing object
  • 'delete' deletion form
  • 'new' creation of a new object
  • 'view' rendering of the object


See also:

get_list_text() - Display the content of one poll

function &get_list_text($host=NULL)

  • $host=NULL - attributes of the hosting page
  • returns some HTML to be inserted into the resulting page



See also:

get_view_text() - Display the content of one poll

function &get_view_text($host=NULL)

  • $host=NULL - attributes of the hosting page
  • returns some HTML to be inserted into the resulting page



See also:

get_text_to_list() - Show voting form and raw results

function get_text_to_list($host=NULL, $enable_votes=TRUE)

  • $host=NULL - array attributes of the containing page
  • $enable_votes=TRUE - boolean TRUE if votes are enabled, FALSE otherwise
  • returns some HTML to be inserted into the resulting page

get_text_to_view() - Fully describe a poll in its main page

function get_text_to_view($host=NULL, $enable_votes=TRUE)

  • $host=NULL - array attributes of the containing page
  • $enable_votes=TRUE - boolean TRUE if votes are enabled, FALSE otherwise
  • returns some HTML to be inserted into the resulting page

This also features a voting form, to let people vote from permalinks.

See also:

get_text_to_vote() - Get the text to make people vote

function get_text_to_vote($host=NULL, $enable_votes=TRUE)

  • $host=NULL - array attributes of the containing page
  • $enable_votes=TRUE - boolean TRUE if votes are enabled, FALSE otherwise
  • returns some HTML to be inserted into the resulting page

parse_fields() - Retrieve the content of one modified overlay

function parse_fields($fields)

  • $fields - the fields as filled by the end user
  • returns array of updated attributes



See also: