Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
answer.php
1<?php
8namespace Bitrix\Vote;
9use \Bitrix\Main\Entity;
10use \Bitrix\Main\Localization\Loc;
19
20Loc::loadMessages(__FILE__);
21
51class AnswerTable extends Entity\DataManager
52{
58 public static function getTableName()
59 {
60 return 'b_vote_answer';
61 }
62
68 public static function getMap()
69 {
70 return [
71 (new IntegerField('ID'))
72 ->configurePrimary(true)
73 ->configureAutocomplete(true),
74 (new BooleanField('ACTIVE'))
75 ->configureValues('N', 'Y')
76 ->configureDefaultValue('Y'),
77 (new DatetimeField('TIMESTAMP_X')),
78 (new IntegerField('QUESTION_ID')),
79 (new IntegerField('C_SORT')),
80 (new IntegerField('IMAGE_ID')),
81 (new Reference('IMAGE',
82 \Bitrix\Main\FileTable::class,
83 Join::on('this.IMAGE_ID', 'ref.ID')
84 )),
85 (new TextField('MESSAGE')),
86 (new EnumField('MESSAGE_TYPE', ['values' => ['text', 'html']]))
87 ->configureDefaultValue('text'),
88 (new IntegerField('COUNTER')),
89 (new IntegerField('FIELD_TYPE')),
90 (new IntegerField('FIELD_WIDTH')),
91 (new IntegerField('FIELD_HEIGHT')),
92 (new StringField('FIELD_PARAM'))
93 ->configureSize(255),
94 (new StringField('COLOR'))
95 ->configureSize(6)
96 ];
97 }
103 public static function setCounter(array $id, $increment = true)
104 {
105 $id = implode(", ", array_map('intval', $id));
106 if (empty($id))
107 return;
108 $connection = \Bitrix\Main\Application::getInstance()->getConnection();
109
110 $sql = intval($increment);
111 if ($increment === true)
112 $sql = "COUNTER+1";
113 else if ($increment === false)
114 $sql = "COUNTER-1";
115 $connection->queryExecute("UPDATE ".self::getTableName()." SET COUNTER=".$sql." WHERE ID IN (".$id.")");
116 }
117}
118
120{
121 public static $storage = array();
122}
static loadMessages($file)
Definition loc.php:64
static setCounter(array $id, $increment=true)
Definition answer.php:103