HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Polls

» Return to Contents



sources/polls.php

Global_functions_polls.php

Function summary

?object poll_script (boolean ret, ?AUTO_LINK param)
boolean may_vote_in_poll (array myrow)
tempcode show_poll (boolean results, array myrow, ID_TEXT zone)
AUTO_LINK 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)
void 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)
void delete_poll (AUTO_LINK id)
void set_poll (AUTO_LINK id)
tempcode nice_get_polls (?AUTO_LINK it, ?MEMBER only_owned)

?object poll_script(boolean ret, ?AUTO_LINK param)

Show poll block.

Parameters…

Name ret
Description Whether to get the output instead of outputting it directly
Default value boolean-false
Type boolean

Name param
Description Poll ID (NULL: read from environment)
Default value
Type ?AUTO_LINK

Returns…

Description Output (NULL: outputted it already)
Type ?object

Return to the function index for this class Expand: View the source code to this function

boolean may_vote_in_poll(array myrow)

Find whether the current member may vote.

Parameters…

Name myrow
Description The poll row
Type array

Returns…

Description Whether the current member may vote
Type boolean

Return to the function index for this class Expand: View the source code to this function

tempcode show_poll(boolean results, array myrow, ID_TEXT zone)

Show an actual poll block.

Parameters…

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

Name myrow
Description The poll row
Type array

Name zone
Description The zone our poll module is in
Type ID_TEXT

Returns…

Description The block
Type tempcode

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK 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)

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

Parameters…

Name question
Description The question
Type SHORT_TEXT

Name a1
Description The first choice
Type SHORT_TEXT
Value range 1 max

Name a2
Description The second choice
Type SHORT_TEXT
Value range 1 max

Name a3
Description The third choice (blank means not a choice)
Type SHORT_TEXT

Name a4
Description The fourth choice (blank means not a choice)
Type SHORT_TEXT

Name a5
Description The fifth choice (blank means not a choice)
Type SHORT_TEXT

Name a6
Description The sixth choice (blank means not a choice)
Type SHORT_TEXT

Name a7
Description The seventh choice (blank means not a choice)
Type SHORT_TEXT

Name a8
Description The eighth choice (blank means not a choice)
Type SHORT_TEXT

Name a9
Description The ninth choice (blank means not a choice)
Type SHORT_TEXT

Name a10
Description The tenth choice (blank means not a choice)
Type SHORT_TEXT

Name num_options
Description The number of choices
Type integer
Value range 2 5

Name current
Description Whether the poll is the current poll
Type BINARY

Name allow_rating
Description Whether to allow rating of this poll
Type BINARY

Name allow_comments
Description Whether comments are allowed (0=no, 1=yes, 2=review style)
Type SHORT_INTEGER

Name allow_trackbacks
Description Whether to allow trackbacking on this poll
Type BINARY

Name notes
Description Notes about this poll
Type LONG_TEXT

Name time
Description The time the poll was submitted (NULL: now)
Default value
Type ?TIME

Name submitter
Description The member who submitted (NULL: the current member)
Default value
Type ?MEMBER

Name use_time
Description The time the poll was put to use (NULL: not put to use yet)
Default value
Type ?TIME

Name v1
Description How many have voted for option 1
Default value 0
Type integer
Value range 0 max

Name v2
Description How many have voted for option 2
Default value 0
Type integer
Value range 0 max

Name v3
Description How many have voted for option 3
Default value 0
Type integer
Value range 0 max

Name v4
Description How many have voted for option 4
Default value 0
Type integer
Value range 0 max

Name v5
Description How many have voted for option 5
Default value 0
Type integer
Value range 0 max

Name v6
Description How many have voted for option 6
Default value 0
Type integer
Value range 0 max

Name v7
Description How many have voted for option 7
Default value 0
Type integer
Value range 0 max

Name v8
Description How many have voted for option 8
Default value 0
Type integer
Value range 0 max

Name v9
Description How many have voted for option 9
Default value 0
Type integer
Value range 0 max

Name v10
Description How many have voted for option 10
Default value 0
Type integer
Value range 0 max

Name views
Description The number of views had
Default value 0
Type integer

Name edit_date
Description The edit date (NULL: never)
Default value
Type ?TIME

Returns…

Description The poll ID of our new poll
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void 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)

Edit a poll.

Parameters…

Name id
Description The ID of the poll to edit
Type AUTO_LINK

Name question
Description The question
Type SHORT_TEXT

Name a1
Description The first choice
Type SHORT_TEXT
Value range 1 max

Name a2
Description The second choice
Type SHORT_TEXT
Value range 1 max

Name a3
Description The third choice (blank means not a choice)
Type SHORT_TEXT

Name a4
Description The fourth choice (blank means not a choice)
Type SHORT_TEXT

Name a5
Description The fifth choice (blank means not a choice)
Type SHORT_TEXT

Name a6
Description The sixth choice (blank means not a choice)
Type SHORT_TEXT

Name a7
Description The seventh choice (blank means not a choice)
Type SHORT_TEXT

Name a8
Description The eighth choice (blank means not a choice)
Type SHORT_TEXT

Name a9
Description The ninth choice (blank means not a choice)
Type SHORT_TEXT

Name a10
Description The tenth choice (blank means not a choice)
Type SHORT_TEXT

Name num_options
Description The number of choices
Type integer

Name allow_rating
Description Whether to allow rating of this poll
Type BINARY

Name allow_comments
Description Whether comments are allowed (0=no, 1=yes, 2=review style)
Type SHORT_INTEGER

Name allow_trackbacks
Description Whether to allow trackbacking on this poll
Type BINARY

Name notes
Description Notes about this poll
Type LONG_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_poll(AUTO_LINK id)

Delete a poll.

Parameters…

Name id
Description The ID of the poll to delete
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

void set_poll(AUTO_LINK id)

Set the poll.

Parameters…

Name id
Description The poll ID to set
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

tempcode nice_get_polls(?AUTO_LINK it, ?MEMBER only_owned)

Get a list of polls.

Parameters…

Name it
Description The ID of the poll to select by default (NULL: first)
Default value
Type ?AUTO_LINK

Name only_owned
Description Only show polls owned by this member (NULL: no such restriction)
Default value
Type ?MEMBER

Returns…

Description The list
Type tempcode

Return to the function index for this class Expand: View the source code to this function