ssi_showPoll
Description
Displays a poll from the specified topic or returns an array of information about that poll, depending on output_method.
Syntax
array ssi_showPoll ([int $topic[, string $output_method]])
Parameter $topic
Expected type: Integer
Description: The ID of the topic containing the poll you wish to show. If not specified, the topic must be set in the 'ssi_topic' request variable.
Parameter $output_method
Expected type: String
Description: Standard SSI.php output_method variable. If 'echo', the specified poll will be displayed. Otherwise an array containing the poll info will be returned.
Return value
Expected type: Array
Description: If output_method is 'echo', displays the specified poll. Otherwise returns all the info in an array.
Array Elements | |||
Key | Optional | Expected type | Description |
allow_vote | no | Boolean | Whether or not you can vote in this poll (true if it's not locked, it hasn't expired, you're not a guest and you have permission to vote in polls) |
allow_warning | no | String | If you can vote for mutiple options, this is the "You may only select up to x options" text. Otherwise it's an empty string |
id | no | Integer | The poll ID |
image | no | String | "poll" (used to display the poll icon) |
is_locked | no | Boolean | Whether or not voting is locked for this poll |
options | no | Array | An array of information about the poll options - id ("options-{option_number}"), percent (percentage of votes that have been cast for this option), bar (the graphical bar that's displayed next to an option), vote_button (either a checkbox or a radio button for voting for this option, depending on poll settings) |
question | no | String | The poll question |
topic | no | Integer | The ID of the topic this poll is associated with |
total_votes | no | Integer | The total number of votes cast in this poll |
Notes
- Topic can be specified either in the parameters or via $_REQUEST['ssi_topic']
- User can vote in the poll if they're allowed (see ssi_pollVote)
- Returns an empty array if you're not allowed to view polls or if no polls are visible to you...