Function Module_topics->get_poll_form_fields

Definitions

forum/pages/modules/topics.php

  • Get Tempcode for a topic poll adding/editing form.
  • Visibility: protected
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: object

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$forum_id ?AUTO_LINK No No Null N/A N/A The ID of the forum to which the poll is being added (null: it is a private topic)
$new_poll boolean No No True N/A N/A Whether we are making a new poll opposed to editing a poll
$topic_validated BINARY No No 1 N/A N/A Whether the topic on which this poll is being created is validated
$question SHORT_TEXT No No Blank (empty string) N/A N/A The poll question
$answers array No No [] N/A N/A A list of current answers for the poll
$is_private BINARY No No 0 N/A N/A Whether it is a private poll (blind poll, where the results aren't visible until made public)
$is_open BINARY No No 1 N/A N/A Whether the poll is open for voting
$requires_reply BINARY No No 0 N/A N/A Whether a reply to the poll topic is required before voting
$minimum_selections integer No No 1 N/A N/A The minimum number of selections for voters
$maximum_selections integer No No 1 N/A N/A The maximum number of selections for voters
$poll_closing_time ?TIME No No Null N/A N/A The time this poll will close voting (null: the poll will not close automatically)
$view_member_votes BINARY No No 0 N/A N/A Whether others should be able to view individual members' votes in the results
$vote_revocation BINARY No No 1 N/A N/A Whether voting revocation should be allowed on this poll
$guests_can_vote BINARY No No 1 N/A N/A Whether guests can vote on the poll without logging in
$point_weighting BINARY No No 0 N/A N/A Whether votes will be weighed according to how many points voters have

Returns

  • The Tempcode for the fields
  • Type: Tempcode
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get Tempcode for a topic poll adding/editing form.
 *
 * @param  ?AUTO_LINK $forum_id The ID of the forum to which the poll is being added (null: it is a private topic)
 * @param  boolean $new_poll Whether we are making a new poll opposed to editing a poll
 * @param  BINARY $topic_validated Whether the topic on which this poll is being created is validated
 * @param  SHORT_TEXT $question The poll question
 * @param  array $answers A list of current answers for the poll
 * @param  BINARY $is_private Whether it is a private poll (blind poll, where the results aren't visible until made public)
 * @param  BINARY $is_open Whether the poll is open for voting
 * @param  BINARY $requires_reply Whether a reply to the poll topic is required before voting
 * @param  integer $minimum_selections The minimum number of selections for voters
 * @param  integer $maximum_selections The maximum number of selections for voters
 * @param  ?TIME $poll_closing_time The time this poll will close voting (null: the poll will not close automatically)
 * @param  BINARY $view_member_votes Whether others should be able to view individual members' votes in the results
 * @param  BINARY $vote_revocation Whether voting revocation should be allowed on this poll
 * @param  BINARY $guests_can_vote Whether guests can vote on the poll without logging in
 * @param  BINARY $point_weighting Whether votes will be weighed according to how many points voters have
 * @return Tempcode The Tempcode for the fields
 */

protected function get_poll_form_fields(?int $forum_id = null, bool $new_poll = true, int $topic_validated = 1, string $question = '', array $answers = [], int $is_private = 0, int $is_open = 1, int $requires_reply = 0, int $minimum_selections = 1, int $maximum_selections = 1, ?int $poll_closing_time = null, int $view_member_votes = 0, int $vote_revocation = 1, int $guests_can_vote = 1, int $point_weighting = 0) : object