Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
question.php
1
<?php
8
namespace
Bitrix\Vote
;
9
use \Bitrix\Main\Entity;
10
use \Bitrix\Main\Localization\Loc;
11
Loc::loadMessages
(__FILE__);
12
44
class
QuestionTable
extends
Entity\DataManager
45
{
51
public
static
function
getTableName
()
52
{
53
return
'b_vote_question'
;
54
}
55
61
public
static
function
getMap
()
62
{
63
return
array(
64
'ID'
=> array(
65
'data_type'
=>
'integer'
,
66
'primary'
=>
true
,
67
'autocomplete'
=>
true
,
68
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_ID'
),
69
),
70
'ACTIVE'
=> array(
71
'data_type'
=>
'boolean'
,
72
'values'
=> array(
'N'
,
'Y'
),
73
'default_value'
=>
'Y'
,
74
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_ACTIVE'
)
75
),
76
'TIMESTAMP_X'
=> array(
77
'data_type'
=>
'datetime'
,
78
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_TIMESTAMP_X'
),
79
),
80
'VOTE_ID'
=> array(
81
'data_type'
=>
'integer'
,
82
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_VOTE_ID'
),
83
),
84
'C_SORT'
=> array(
85
'data_type'
=>
'integer'
,
86
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_C_SORT'
),
87
),
88
'COUNTER'
=> array(
89
'data_type'
=>
'integer'
,
90
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_COUNTER'
),
91
),
92
'QUESTION'
=> array(
93
'data_type'
=>
'text'
,
94
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_QUESTION'
)
95
),
96
'QUESTION_TYPE'
=> array(
97
'data_type'
=>
'enum'
,
98
'values'
=> array(
"text"
,
"html"
),
99
'default_value'
=>
"text"
,
100
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_QUESTION_TYPE'
),
101
),
102
'IMAGE_ID'
=> array(
103
'data_type'
=>
'integer'
,
104
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_IMAGE_ID'
),
105
),
106
'IMAGE'
=> array(
107
'data_type'
=>
'\Bitrix\Main\FileTable'
,
108
'reference'
=> array(
109
'=this.IMAGE_ID'
=>
'ref.ID'
,
110
),
111
'join_type'
=>
'LEFT'
,
112
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_IMAGE'
),
113
),
114
'DIAGRAM'
=> array(
115
'data_type'
=>
'boolean'
,
116
'values'
=> array(
'N'
,
'Y'
),
117
'default_value'
=>
'Y'
,
118
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_DIAGRAM'
)
119
),
120
'DIAGRAM_TYPE'
=> array(
121
'data_type'
=>
'enum'
,
122
'values'
=> array(
"histogram"
,
"circle"
),
123
'default_value'
=>
"histogram"
,
124
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_DIAGRAM_TYPE'
),
125
),
126
'REQUIRED'
=> array(
127
'data_type'
=>
'boolean'
,
128
'values'
=> array(
'N'
,
'Y'
),
129
'default_value'
=>
'N'
,
130
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_REQUIRED'
)
131
),
132
'FIELD_TYPE'
=> array(
133
'data_type'
=>
'enum'
,
134
'values'
=> \
Bitrix
\
Vote
\
QuestionTypes::getValues
(),
135
'default_value'
=>
'0'
,
136
'title'
=>
Loc::getMessage
(
'V_TABLE_FIELD_FIELD_TYPE'
)
137
),
138
'VOTE'
=> array(
139
'data_type'
=>
'\Bitrix\Vote\VoteTable'
,
140
'reference'
=> array(
141
'=this.VOTE_ID'
=>
'ref.ID'
,
142
),
143
'join_type'
=>
'RIGHT'
,
144
),
145
'ANSWER'
=> array(
146
'data_type'
=>
'\Bitrix\Vote\AnswerTable'
,
147
'reference'
=> array(
148
'=this.ID'
=>
'ref.QUESTION_ID'
,
149
),
150
'join_type'
=>
'LEFT'
,
151
)
152
);
153
}
159
public
static
function
setCounter
(array $id, $increment =
true
)
160
{
161
$id = implode(
", "
, $id);
162
if
(empty($id))
163
return
;
164
$connection = \Bitrix\Main\Application::getInstance()->getConnection();
165
$sql = intval($increment);
166
if
($increment ===
true
)
167
$sql =
"COUNTER+1"
;
168
else
if
($increment ===
false
)
169
$sql =
"COUNTER-1"
;
170
$connection->queryExecute(
"UPDATE "
.self::getTableName().
" SET COUNTER="
.$sql.
" WHERE ID IN ("
.$id.
")"
);
171
}
172
}
173
174
class
Question
175
{
176
public
static
$storage
= array();
177
}
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Vote\Question
Definition
question.php:175
Bitrix\Vote\Question\$storage
static $storage
Definition
question.php:176
Bitrix\Vote\QuestionTable
Definition
question.php:45
Bitrix\Vote\QuestionTable\getMap
static getMap()
Definition
question.php:61
Bitrix\Vote\QuestionTable\setCounter
static setCounter(array $id, $increment=true)
Definition
question.php:159
Bitrix\Vote\QuestionTable\getTableName
static getTableName()
Definition
question.php:51
Bitrix\Vote\QuestionTypes\getValues
static getValues()
Definition
questiontypes.php:25
Bitrix\Vote\Vote
Definition
vote.php:454
Bitrix\Vote
Definition
answer.php:8
Bitrix
modules
vote
lib
question.php
Создано системой
1.10.0