Bitrix API

Vote extends BaseObject implements ArrayAccess

Table of Contents

Interfaces

ArrayAccess

Properties

$statStorage  : mixed
$storage  : mixed

Methods

__construct()  : mixed
canEdit()  : bool
Checks rights to update current attached object.
canParticipate()  : mixed
canRead()  : bool
Checks rights to read current attached object.
canReadResult()  : mixed
canRevote()  : mixed
canVote()  : Result
checkData()  : bool
clearCache()  : void
Clears cache
delete()  : bool
Deletes Vote by its id.
exportExcel()  : void
Exports data of voting into excel file
fillStatistic()  : void
Complete vote array by data from DB.
get()  : mixed
getApplication()  : CMain
getChannel()  : array<string|int, mixed>|null
getData()  : array<string|int, mixed>|null
getErrorByCode()  : Error|null
getErrors()  : array<string|int, Error>
getId()  : int
getQuestion()  : array<string|int, mixed>|null
Returns question array.
getQuestions()  : array<string|int, mixed>
getStatistic()  : mixed
getUser()  : CUser
init()  : void
exists only for child class
isVotedFor()  : bool|int
Checks if current user voted for this vote.
loadFromId()  : BaseObject
loadUserGroups()  : array<string|int, mixed>
offsetExists()  : bool
offsetGet()  : array<string|int, mixed>|mixed|null
offsetSet()  : void
Is not supported.
offsetUnset()  : void
Is not supported.
recall()  : Result
registerEvent()  : mixed
resume()  : void
Prolongs the time of voting for a year
saveData()  : int
sendVotingMessage()  : bool
Sends notifications to users.
shutdown()  : mixed
Debug function
stop()  : void
Sets the finish time for voting by current moment
voteFor()  : bool
Voting for vote from current user $USER.

Properties

$statStorage

public static mixed $statStorage = array()

$storage

public static mixed $storage = array()

Methods

__construct()

public __construct(mixed $id) : mixed
Parameters
$id : mixed

canEdit()

Checks rights to update current attached object.

public canEdit(int $userId) : bool
Parameters
$userId : int

Id of user.

Return values
bool

canParticipate()

public canParticipate(mixed $userId) : mixed
Parameters
$userId : mixed

canRead()

Checks rights to read current attached object.

public canRead(int $userId) : bool
Parameters
$userId : int

Id of user.

Return values
bool

canReadResult()

public canReadResult(mixed $user) : mixed
Parameters
$user : mixed

canRevote()

public canRevote(mixed $user) : mixed
Parameters
$user : mixed

canVote()

public canVote(User|int $user) : Result
Parameters
$user : User|int
Tags
throws
ArgumentException
throws
ObjectException
throws
ObjectPropertyException
throws
SystemException
Return values
Result

checkData()

public static checkData(array<string|int, mixed> &$data[, int $voteId = 0 ]) : bool
Parameters
$data : array<string|int, mixed>

Array( "CHANNEL_ID" => 5, "AUTHOR_ID" => 1, "DATE_START" => ..., "DATE_END" => ..., "TITLE" => "ABC...", "ACTIVE" => "Y", "URL" => "http://", "NOTIFY" => "Y" || "N" || "I", "UNIQUE_TYPE" => security context, "DELAY" => 150, //seconds "QUESTIONS" => array( 1 => array( "ID" => 0, "QUESTION" => "Question text", "QUESTION_TYPE" => "text"||"html", "ANSWERS" => array( array( "ID" => 0, "MESSAGE" => "Answer text", "MESSAGE_TYPE" => "text"||"html", "FIELD_TYPE" => 0||1||2||3||4|| ) ) ) );.

$voteId : int = 0

Vote ID.

Tags
throws
ArgumentException
Return values
bool

clearCache()

Clears cache

public clearCache() : void

delete()

Deletes Vote by its id.

public static delete(int $id) : bool
Parameters
$id : int

Vote ID.

Return values
bool

exportExcel()

Exports data of voting into excel file

public exportExcel([string $type = "html" ]) : void
Parameters
$type : string = "html"

html|xls|csv

fillStatistic()

Complete vote array by data from DB.

public fillStatistic() : void

get()

public get(string $key) : mixed
Parameters
$key : string

The name if characteristic that you want to know.

getChannel()

public getChannel() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getData()

public static getData(int $id) : array<string|int, mixed>|null
Parameters
$id : int

Vote ID.

Return values
array<string|int, mixed>|null

getErrorByCode()

public getErrorByCode(string|int $code) : Error|null
Parameters
$code : string|int

The code of the error.

Tags
inheritdoc

Returns an error with the necessary code.

Return values
Error|null

getQuestion()

Returns question array.

public getQuestion(int $id) : array<string|int, mixed>|null
Parameters
$id : int
Return values
array<string|int, mixed>|null

getQuestions()

public getQuestions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStatistic()

public getStatistic() : mixed

init()

exists only for child class

public init() : void

isVotedFor()

Checks if current user voted for this vote.

public isVotedFor(int|User $userId) : bool|int
Parameters
$userId : int|User

User ID.

Return values
bool|int

loadFromId()

public static loadFromId(int $id[, bool $shouldBeNewIfIdIsNull = false ]) : BaseObject
Parameters
$id : int

Entity ID.

$shouldBeNewIfIdIsNull : bool = false
Return values
BaseObject

loadUserGroups()

public static loadUserGroups(int $userId) : array<string|int, mixed>
Parameters
$userId : int

User ID.

Return values
array<string|int, mixed>

offsetExists()

public offsetExists(string $offset) : bool
Parameters
$offset : string

Key for vote or attach data array.

Return values
bool

offsetGet()

public offsetGet(string $offset) : array<string|int, mixed>|mixed|null
Parameters
$offset : string

Key for vote or attach data array.

Return values
array<string|int, mixed>|mixed|null

offsetSet()

Is not supported.

public offsetSet(string $offset, mixed $value) : void
Parameters
$offset : string

Key for vote or attach data array.

$value : mixed

Value for vote or attach data array.

Tags
throws
NotSupportedException

offsetUnset()

Is not supported.

public offsetUnset(string $offset) : void
Parameters
$offset : string

Key for vote or attach data array.

Tags
throws
NotSupportedException

recall()

public recall(int $userId) : Result
Parameters
$userId : int
Return values
Result

registerEvent()

public registerEvent(array<string|int, mixed> $data, array<string|int, mixed> $params, User $user) : mixed
Parameters
$data : array<string|int, mixed>
$params : array<string|int, mixed>
$user : User

resume()

Prolongs the time of voting for a year

public resume() : void

saveData()

public static saveData(int $voteId, array<string|int, mixed> $data) : int
Parameters
$voteId : int

Vote ID, can be 0.

$data : array<string|int, mixed>

Look at checkData.

Tags
throws
ArgumentException
Return values
int

sendVotingMessage()

Sends notifications to users.

public sendVotingMessage(array<string|int, mixed> $event, array<string|int, mixed> $vote[, string $type = "im" ]) : bool
Parameters
$event : array<string|int, mixed>

Array("ID" => 1, "VOTE_USER_ID" => 45);.

$vote : array<string|int, mixed>

Array(ID => 1, QUESTIONS => array("ID" => 2, ANSWERS => array()));.

$type : string = "im"

Can be "im" || "mail".

Return values
bool

shutdown()

Debug function

public static shutdown() : mixed

stop()

Sets the finish time for voting by current moment

public stop() : void

voteFor()

Voting for vote from current user $USER.

public voteFor(array<string|int, mixed> $request[, array<string|int, mixed> $params = [] ]) : bool
Parameters
$request : array<string|int, mixed>

Old variant Array(" vote_checkbox_".$questionId => array(1,2,3,...), "vote_multiselect_".$questionId => array(1,2,3,...), "vote_dropdown_".$questionId => 12 || "12", "vote_radio_".$questionId => 12 || "12", "vote_field_".$answerId => "12"). New variant is [ EXTRA => [HIDDEN => N], 871 => [345 => (Does not matter || text from field)], QUESTION_ID => [ANSWER_ID => (Y || text from field)], ]

$params : array<string|int, mixed> = []
Tags
throws
AccessDeniedException
Return values
bool

        
On this page

Search results