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: OCF polls

» Return to Contents



sources/ocf_polls.php

Global_functions_ocf_polls.php

Function summary

boolean ocf_may_edit_poll_by (AUTO_LINK forum_id, MEMBER poll_owner, ?MEMBER member_id)
boolean ocf_may_attach_poll (AUTO_LINK topic_id, ?MEMBER topic_owner, ?boolean has_poll_already, ?MEMBER forum_id, ?MEMBER member_id)
boolean ocf_may_delete_poll_by (AUTO_LINK forum_id, MEMBER poll_owner, ?MEMBER member_id)
array ocf_poll_get_results (AUTO_LINK poll_id, boolean request_results)

boolean ocf_may_edit_poll_by(AUTO_LINK forum_id, MEMBER poll_owner, ?MEMBER member_id)

Find whether a member can alter a poll owned by a certain member in a certain forum.

Parameters…

Name forum_id
Description The forum.
Type AUTO_LINK

Name poll_owner
Description The poll owner.
Type MEMBER

Name member_id
Description The member we are checking for (NULL: current member).
Default value
Type ?MEMBER

Returns…

Description The answer.
Type boolean

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

boolean ocf_may_attach_poll(AUTO_LINK topic_id, ?MEMBER topic_owner, ?boolean has_poll_already, ?MEMBER forum_id, ?MEMBER member_id)

Find whether a member may attach a poll to a detailed topic.

Parameters…

Name topic_id
Description The topic.
Type AUTO_LINK

Name topic_owner
Description The topic owner (NULL: ask the DB for it).
Default value
Type ?MEMBER

Name has_poll_already
Description Whether the topic already has a poll (NULL: ask the DB for it).
Default value
Type ?boolean

Name forum_id
Description The forum the topic is in (NULL: ask the DB for it).
Default value
Type ?MEMBER

Name member_id
Description The member we are checking for (NULL: current member).
Default value
Type ?MEMBER

Returns…

Description The answer.
Type boolean

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

boolean ocf_may_delete_poll_by(AUTO_LINK forum_id, MEMBER poll_owner, ?MEMBER member_id)

Find whether a member can delete a poll owned by a certain member in a certain forum.

Parameters…

Name forum_id
Description The forum.
Type AUTO_LINK

Name poll_owner
Description The poll owner.
Type MEMBER

Name member_id
Description The member we are checking for (NULL: current member).
Default value
Type ?MEMBER

Returns…

Description The answer.
Type boolean

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

array ocf_poll_get_results(AUTO_LINK poll_id, boolean request_results)

Find a map of results relating to a certain poll.

Parameters…

Name poll_id
Description The poll.
Type AUTO_LINK

Name request_results
Description Whether we must record that the current member is requesting the results, blocking future voting for them.
Default value boolean-true
Type boolean

Returns…

Description The map of results.
Type array

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

sources/ocf_polls_action.php

Global_functions_ocf_polls_action.php

Function summary

AUTO_LINK ocf_make_poll (AUTO_LINK topic_id, SHORT_TEXT question, BINARY is_private, BINARY is_open, integer minimum_selections, integer maximum_selections, BINARY requires_reply, array answers, boolean check_permissions)

AUTO_LINK ocf_make_poll(AUTO_LINK topic_id, SHORT_TEXT question, BINARY is_private, BINARY is_open, integer minimum_selections, integer maximum_selections, BINARY requires_reply, array answers, boolean check_permissions)

Add a forum poll.

Parameters…

Name topic_id
Description The ID of the topic to add the poll to.
Type AUTO_LINK

Name question
Description The question.
Type SHORT_TEXT

Name is_private
Description Whether the result tallies are kept private until the poll is made non-private.
Type BINARY

Name is_open
Description Whether the poll is open for voting.
Type BINARY

Name minimum_selections
Description The minimum number of selections that may be made.
Type integer

Name maximum_selections
Description The maximum number of selections that may be made.
Type integer

Name requires_reply
Description Whether members must have a post in the topic before they made vote.
Type BINARY

Name answers
Description A list of pairs of the potential voteable answers and the number of votes.
Type array

Name check_permissions
Description Whether to check there are permissions to make the poll.
Default value boolean-true
Type boolean

Returns…

Description The ID of the newly created forum poll.
Type AUTO_LINK

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