Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
questiontypes.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 COMPATIBILITY = 99999;
20
25 public static function getValues()
26 {
27 $res = (new \ReflectionClass(__CLASS__))->getConstants();
28 return array_values($res);
29 }
34 public static function getList()
35 {
36 $res = (new \ReflectionClass(__CLASS__))->getConstants();
37 $result = array();
38 foreach ($res as $code => $id)
39 {
40 $result[$id] = Loc::getMessage("VOTE_QUESTION_TYPE_".$code);
41 }
42 return $result;
43 }
48 public static function getFullList()
49 {
50 $res = (new \ReflectionClass(__CLASS__))->getConstants();
51 $result = array();
52 foreach ($res as $code => $id)
53 {
54 $result[] = array("ID" => $id, "CODE" => $code, "TITLE" => Loc::getMessage("VOTE_QUESTION_TYPE_".$code));
55 }
56 return $result;
57 }
62 public static function getTitledList()
63 {
64 $res = (new \ReflectionClass(__CLASS__))->getConstants();
65 $result = array();
66 foreach ($res as $code => $id)
67 {
68 $result[$id] = Loc::getMessage("VOTE_QUESTION_TYPE_".$code);
69 }
70 return $result;
71 }
72
78 public static function getTitleById($id)
79 {
80 $res = array_flip((new \ReflectionClass(__CLASS__))->getConstants());
81 $val = $id;
82 if (array_key_exists($id, $res))
83 {
84 $val = Loc::getMessage("VOTE_QUESTION_TYPE_".$res[$id]);
85 }
86 return $val;
87 }
88}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29