Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
answertypes.php
1<?php
8namespace Bitrix\Vote;
9use \Bitrix\Main\Localization\Loc;
10
11Loc::loadMessages(__FILE__);
12
14{
15 const RADIO = 0;
16 const CHECKBOX = 1;
17 const DROPDOWN = 2;
18 const MULTISELECT = 3;
19 const TEXT = 4;
20 const TEXTAREA = 5;
21
26 public static function getFullList()
27 {
28 $res = (new \ReflectionClass(__CLASS__))->getConstants();
29 $result = array();
30 foreach ($res as $code => $id)
31 {
32 $result[] = array("ID" => $id, "CODE" => $code, "TITLE" => Loc::getMessage("VOTE_ANSWER_TYPE_".$code));
33 }
34 return $result;
35 }
36
41 public static function getTitledList()
42 {
43 $res = (new \ReflectionClass(__CLASS__))->getConstants();
44 $result = array();
45 foreach ($res as $code => $id)
46 {
47 $result[$id] = Loc::getMessage("VOTE_ANSWER_TYPE_".$code);
48 }
49 return $result;
50 }
51
57 public static function getTitleById($id)
58 {
59 $res = array_flip((new \ReflectionClass(__CLASS__))->getConstants());
60 $val = $id;
61 if (array_key_exists($id, $res))
62 {
63 $val = Loc::getMessage("VOTE_ANSWER_TYPE_".$res[$id]);
64 }
65 return $val;
66 }
67}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29