Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
anonymity.php
1<?php
9use \Bitrix\Main\Localization\Loc;
10
11Loc::loadMessages(__FILE__);
12
14{
15 const UNDEFINED = 0;
16 const PUBLICLY = 1;
17 const ANONYMOUSLY = 2;
18
23 public static function getList()
24 {
25 return (new \ReflectionClass(__CLASS__))->getConstants();
26 }
31 public static function getTitledList()
32 {
33 $res = (new \ReflectionClass(__CLASS__))->getConstants();
34 $result = array();
35 foreach ($res as $code => $id)
36 {
37 $result[$id] = Loc::getMessage("VOTE_ANONYMITY_TYPE_".$code);
38 }
39 return $result;
40 }
41
45 public static function getValues()
46 {
47 return array_values(self::getList());
48 }
55 public static function isUserVoteVisible(bool $userValue, int $voteValue)
56 {
57 if ($voteValue === self::ANONYMOUSLY)
58 return false;
59 else if ($voteValue === self::PUBLICLY)
60 return true;
61 return $userValue !== false;
62 }
63 public static function getTitle()
64 {
65 return Loc::getMessage("VOTE_ANONYMITY_TITLE");
66 }
67 public static function validate($value)
68 {
69
70 }
71}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static validate($value)
Definition anonymity.php:67
static isUserVoteVisible(bool $userValue, int $voteValue)
Definition anonymity.php:55