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, \BINARY $current, \BINARY $allow_rating, \SHORT_INTEGER $allow_comments, \BINARY $allow_trackbacks, \LONG_TEXT $notes, \?TIME $time, \?MEMBER $submitter, \?TIME $use_time, integer $v1, integer $v2, integer $v3, integer $v4, integer $v5, integer $v6, integer $v7, integer $v8, integer $v9, integer $v10, integer $views, \?TIME $edit_date) : \AUTO_LINK

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

$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

Delete a poll.

delete_poll(\AUTO_LINK $id) 

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) 

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

Find whether the current member may vote.

may_vote_in_poll(array $myrow) : boolean

Parameters

$myrow

array

The poll row

Returns

booleanWhether the current member may vote

Get a list of polls.

nice_get_polls(\?AUTO_LINK $it, \?MEMBER $only_owned) : \tempcode

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

Handle the poll.

poll_script(boolean $ret, \?AUTO_LINK $param) : \?object

Parameters

$ret

boolean

Whether to get the output instead of outputting it directly

$param

\?AUTO_LINK

Poll ID (NULL: read from environment)

Returns

\?objectOutput (NULL: outputted it already)

Show an actual poll box.

render_poll_box(boolean $results, array $myrow, \ID_TEXT $zone) : \tempcode

Parameters

$results

boolean

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

$myrow

array

The poll row

$zone

\ID_TEXT

The zone our poll module is in

Returns

\tempcodeThe box

Set the poll.

set_poll(\AUTO_LINK $id) 

Parameters

$id

\AUTO_LINK

The poll ID to set