9use \Bitrix\Main\Entity;
10use \Bitrix\Main\Localization\Loc;
11use \Bitrix\Vote\Base\BaseObject;
12Loc::loadMessages(__FILE__);
38 return 'b_vote_channel';
50 'data_type' =>
'integer',
52 'autocomplete' =>
true,
53 'title' => Loc::getMessage(
'V_TABLE_FIELD_ID'),
55 'SYMBOLIC_NAME' =>
array(
56 'data_type' =>
'string',
58 'title' => Loc::getMessage(
'V_TABLE_FIELD_SYMBOLIC_NAME'),
61 'data_type' =>
'string',
63 'title' => Loc::getMessage(
'V_TABLE_FIELD_TITLE'),
66 'data_type' =>
'integer',
67 'title' => Loc::getMessage(
'V_TABLE_FIELD_C_SORT'),
70 'data_type' =>
'boolean',
71 'values' =>
array(
'N',
'Y'),
72 'default_value' =>
'Y',
73 'title' => Loc::getMessage(
'V_TABLE_FIELD_ACTIVE')
76 'data_type' =>
'boolean',
77 'values' =>
array(
'N',
'Y'),
78 'default_value' =>
'N',
79 'title' => Loc::getMessage(
'V_TABLE_FIELD_HIDDEN')
81 'TIMESTAMP_X' =>
array(
82 'data_type' =>
'datetime',
83 'title' => Loc::getMessage(
'V_TABLE_FIELD_TIMESTAMP_X'),
85 'VOTE_SINGLE' =>
array(
86 'data_type' =>
'boolean',
87 'values' =>
array(
'N',
'Y'),
88 'default_value' =>
'Y',
89 'title' => Loc::getMessage(
'V_TABLE_FIELD_ACTIVE')
91 'USE_CAPTCHA' =>
array(
92 'data_type' =>
'boolean',
93 'values' =>
array(
'N',
'Y'),
94 'default_value' =>
'N',
95 'title' => Loc::getMessage(
'V_TABLE_FIELD_HIDDEN')
97 'PERMISSION' =>
array(
98 'data_type' =>
'\Bitrix\Vote\ChannelGroupTable',
100 '=this.ID' =>
'ref.CHANNEL_ID',
102 'join_type' =>
'INNER',
105 'data_type' =>
'\Bitrix\Vote\ChannelSiteTable',
106 'reference' =>
array(
107 '=this.ID' =>
'ref.CHANNEL_ID',
109 'join_type' =>
'LEFT',
134 return 'b_vote_channel_2_group';
146 'data_type' =>
'integer',
148 'autocomplete' =>
true,
149 'title' => Loc::getMessage(
'V_TABLE_FIELD_ID'),
151 'CHANNEL_ID' =>
array(
152 'data_type' =>
'integer',
153 'title' => Loc::getMessage(
'V_TABLE_CHANNEL_ID'),
156 'data_type' =>
'integer',
157 'title' => Loc::getMessage(
'V_TABLE_GROUP_ID'),
159 'PERMISSION' =>
array(
160 'data_type' =>
'enum',
161 'values' =>
array(1, 2, 3, 4),
162 'default_value' => 4,
163 'title' => Loc::getMessage(
'V_TABLE_PERMISSION')
198 return 'b_vote_channel_2_site';
209 'CHANNEL_ID' =>
array(
210 'data_type' =>
'integer',
212 'title' => Loc::getMessage(
'V_TABLE_FIELD_CHANNEL_ID'),
215 'data_type' =>
'string',
218 'title' => Loc::getMessage(
'V_TABLE_FIELD_SITE_ID'),
227 private $data =
array();
237 throw new \Bitrix\Main\ArgumentNullException(
"id");
238 parent::__construct(
$id);
245 if (($data = self::getById($this->
id)->fetch()) && !empty($data))
248 throw new \Bitrix\Main\ObjectNotFoundException(
GetMessage(
"V_CHANNEL_IS_NOT_FOUND",
"channel is not found"));
258 $md5 = md5(serialize($parameters));
259 if (!array_key_exists(
$md5, self::$channels))
262 if (defined(
"VOTE_CACHE_TIME") &&
$CACHE_MANAGER->read(VOTE_CACHE_TIME,
"b_vote_channel_".$md5,
"b_vote_channel"))
266 $db = ChannelTable::getList($parameters);
267 while ($r = $db->fetch())
268 $data[$r[
"ID"]] = $r;
269 if (defined(
"VOTE_CACHE_TIME"))
272 self::$channels[
$md5] = $data;
275 $db = new \CDBResult();
276 $db->initFromArray(self::$channels[
$md5]);
287 'select' =>
array(
"*"),
302 'select' =>
array(
"*"),
306 ">=PERMISSION.PERMISSION" => 1,
307 "PERMISSION.GROUP_ID" =>
$groups
312 'group' =>
array(
"ID")
316 if (
$res[
"ID"] == $this->
id)
330 return parent::canEdit(
$userId);
342 'select' =>
array(
"*"),
346 ">=PERMISSION.PERMISSION" => 4,
347 "PERMISSION.GROUP_ID" =>
$groups
352 'group' =>
array(
"ID")
356 if (
$res[
"ID"] == $this->
id)
369 return array_key_exists(
$key, $this->data) ? $this->data[
$key] :
null;
378 return array_key_exists($offset, $this->data);
386 return $this->data[$offset];
395 public function offsetSet(mixed $offset, mixed $value): void
397 throw new \Bitrix\Main\NotSupportedException(
'Model provide ArrayAccess only for reading');
405 throw new \Bitrix\Main\NotSupportedException(
'Model provide ArrayAccess only for reading');
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
offsetUnset(mixed $offset)
offsetExists(mixed $offset)
static getList(array $parameters)
offsetSet(mixed $offset, mixed $value)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
GetMessage($name, $aReplace=null)
if(empty($signedUserToken)) $key