Functions

Add a new poll to the database, then return the ID of the new entry.

add_poll(\SHORT_TEXT $question, \SHORT_TEXT $a1, \SHORT_TEXT $a2, \SHORT_TEXT $a3 = '', \SHORT_TEXT $a4 = '', \SHORT_TEXT $a5 = '', \SHORT_TEXT $a6 = '', \SHORT_TEXT $a7 = '', \SHORT_TEXT $a8 = '', \SHORT_TEXT $a9 = '', \SHORT_TEXT $a10 = '', \?integer $num_options = null, \BINARY $current = 0, \BINARY $allow_rating = 1, \SHORT_INTEGER $allow_comments = 1, \BINARY $allow_trackbacks = 1, \LONG_TEXT $notes = '', \?TIME $time = null, \?MEMBER $submitter = null, \?TIME $use_time = null, integer $v1 = 0, integer $v2 = 0, integer $v3 = 0, integer $v4 = 0, integer $v5 = 0, integer $v6 = 0, integer $v7 = 0, integer $v8 = 0, integer $v9 = 0, integer $v10 = 0, integer $views = 0, \?TIME $edit_date = null) : \AUTO_LINK
package polls
range 1 max
range 1 max
range 2 5
range 0 max
range 0 max
range 0 max
range 0 max
range 0 max
range 0 max
range 0 max
range 0 max
range 0 max
range 0 max

Parameters

$question

\SHORT_TEXT

The question

$a1

\SHORT_TEXT

The first choice

$a2

\SHORT_TEXT

The second choice

$a3

\SHORT_TEXT

The third choice (blank means not a choice)

$a4

\SHORT_TEXT

The fourth choice (blank means not a choice)

$a5

\SHORT_TEXT

The fifth choice (blank means not a choice)

$a6

\SHORT_TEXT

The sixth choice (blank means not a choice)

$a7

\SHORT_TEXT

The seventh choice (blank means not a choice)

$a8

\SHORT_TEXT

The eighth choice (blank means not a choice)

$a9

\SHORT_TEXT

The ninth choice (blank means not a choice)

$a10

\SHORT_TEXT

The tenth choice (blank means not a choice)

$num_options

\?integer

The number of choices (null: calculate)

$current

\BINARY

Whether the poll is the current poll

$allow_rating

\BINARY

Whether to allow rating of this poll

$allow_comments

\SHORT_INTEGER

Whether comments are allowed (0=no, 1=yes, 2=review style)

$allow_trackbacks

\BINARY

Whether to allow trackbacking on this poll

$notes

\LONG_TEXT

Notes about this poll

$time

\?TIME

The time the poll was submitted (null: now)

$submitter

\?MEMBER

The member who submitted (null: the current member)

$use_time

\?TIME

The time the poll was put to use (null: not put to use yet)

$v1

integer

How many have voted for option 1

$v2

integer

How many have voted for option 2

$v3

integer

How many have voted for option 3

$v4

integer

How many have voted for option 4

$v5

integer

How many have voted for option 5

$v6

integer

How many have voted for option 6

$v7

integer

How many have voted for option 7

$v8

integer

How many have voted for option 8

$v9

integer

How many have voted for option 9

$v10

integer

How many have voted for option 10

$views

integer

The number of views had

$edit_date

\?TIME

The edit date (null: never)

Returns

\AUTO_LINKThe poll ID of our new poll

Get a list of polls.

create_selection_list_polls(\?AUTO_LINK $it = null, \?MEMBER $only_owned = null) : \Tempcode
package polls

Parameters

$it

\?AUTO_LINK

The ID of the poll to select by default (null: first)

$only_owned

\?MEMBER

Only show polls owned by this member (null: no such restriction)

Returns

\TempcodeThe list

Delete a poll.

delete_poll(\AUTO_LINK $id) 
package polls

Parameters

$id

\AUTO_LINK

The ID of the poll to delete

Edit a poll.

edit_poll(\AUTO_LINK $id, \SHORT_TEXT $question, \SHORT_TEXT $a1, \SHORT_TEXT $a2, \SHORT_TEXT $a3, \SHORT_TEXT $a4, \SHORT_TEXT $a5, \SHORT_TEXT $a6, \SHORT_TEXT $a7, \SHORT_TEXT $a8, \SHORT_TEXT $a9, \SHORT_TEXT $a10, integer $num_options, \BINARY $allow_rating, \SHORT_INTEGER $allow_comments, \BINARY $allow_trackbacks, \LONG_TEXT $notes, \?TIME $edit_time = null, \?TIME $add_time = null, \?integer $views = null, \?MEMBER $submitter = null, boolean $null_is_literal = false
package polls
range 1 max
range 1 max

Parameters

$id

\AUTO_LINK

The ID of the poll to edit

$question

\SHORT_TEXT

The question

$a1

\SHORT_TEXT

The first choice

$a2

\SHORT_TEXT

The second choice

$a3

\SHORT_TEXT

The third choice (blank means not a choice)

$a4

\SHORT_TEXT

The fourth choice (blank means not a choice)

$a5

\SHORT_TEXT

The fifth choice (blank means not a choice)

$a6

\SHORT_TEXT

The sixth choice (blank means not a choice)

$a7

\SHORT_TEXT

The seventh choice (blank means not a choice)

$a8

\SHORT_TEXT

The eighth choice (blank means not a choice)

$a9

\SHORT_TEXT

The ninth choice (blank means not a choice)

$a10

\SHORT_TEXT

The tenth choice (blank means not a choice)

$num_options

integer

The number of choices

$allow_rating

\BINARY

Whether to allow rating of this poll

$allow_comments

\SHORT_INTEGER

Whether comments are allowed (0=no, 1=yes, 2=review style)

$allow_trackbacks

\BINARY

Whether to allow trackbacking on this poll

$notes

\LONG_TEXT

Notes about this poll

$edit_time

\?TIME

Edit time (null: either means current time, or if $null_is_literal, means reset to to NULL)

$add_time

\?TIME

Add time (null: do not change)

$views

\?integer

Number of views (null: do not change)

$submitter

\?MEMBER

Submitter (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'

Find whether the current member may vote.

may_vote_in_poll(\AUTO_LINK $poll_id, \MEMBER $member_id, \?IP $ip) : boolean
package polls

Parameters

$poll_id

\AUTO_LINK

The poll ID

$member_id

\MEMBER

Who to check for

$ip

\?IP

The IP to check for (null: no IP check)

Returns

booleanWhether the current member may vote

Show an actual poll box.

render_poll_box(boolean $results, array $myrow, \ID_TEXT $zone = '_SEARCH', boolean $include_manage_links = false, boolean $give_context = true, \ID_TEXT $guid = '') : \Tempcode
package polls

Parameters

$results

boolean

Whether to show results (if we've already voted, this'll be overridden)

$myrow

array

The poll row

$zone

\ID_TEXT

The zone our poll module is in

$include_manage_links

boolean

Whether to include extra management links (e.g. editing, choosing, archive, etc)

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe box

Set the poll.

set_poll(\AUTO_LINK $id) 
package polls

Parameters

$id

\AUTO_LINK

The poll ID to set

Vote in a poll.

vote_in_poll(\AUTO_LINK $poll_id, \?integer $cast, \?array $myrow = null, \?MEMBER $member_id = null, \?IP $ip = null) : array
package polls

Parameters

$poll_id

\AUTO_LINK

The poll ID

$cast

\?integer

Vote to cast (null: forfeit vote)

$myrow

\?array

Poll row (null: lookup from DB)

$member_id

\?MEMBER

Who to vote (null: current user)

$ip

\?IP

The IP to vote (null: no IP check)

Returns

arrayAmended poll row