GetAnyAccessibleVote
GetAnyAccessibleVote([lid])
The function returns the ID of a poll, vote or survey in which the current user did not take part yet. The function respects the user permissions; the current user must be granted the permission to vote (>=2).
Parameters
Parameter | Description |
---|---|
lid | Site of a vote channel. |
Example
File vote_any.php that can be used in the public section of the site.
<? require_once( $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); // Display a form with the first poll that a user did not take part in yet. // If a user did, redirect to a page with the results of this poll if (CModule::IncludeModule("vote") && $VOTING_OK=="Y") { $VOTE_DIR = COption::GetOptionString("vote", "VOTE_DIR", ""); $z = CLang::GetByID(LANG); $zr = $z->Fetch(); $LANG_DIR = $zr["DIR"]; $LANG_DIR = TrimExAll($LANG_DIR,"/"); $VOTE_DIR = TrimExAll($VOTE_DIR,"/"); LocalRedirect ("/".$LANG_DIR."/".$VOTE_DIR."/vote_result.php?VOTE_ID=". $PUBLIC_VOTE_ID."&VOTING_OK=".$VOTING_OK); } if (strlen($APPLICATION->GetTitle())<=0) $APPLICATION->SetTitle(GetMessage("VOTE_VOTING_TITLE")); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_after.php"); ?><? if (CModule::IncludeModule("vote")) { $VID = GetAnyAccessibleVote(); ShowVote($VID); } require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog.php"); ?>
© «Bitrix24», 2001-2024