Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
buttonsitetable.php
1<?php
3
7
25{
30 public static function getTableName()
31 {
32 return 'b_b24connector_button_site';
33 }
34
40 public static function getMap()
41 {
42 return [
43 new IntegerField('ID', [
44 'primary' => true,
45 'autocomplete' => true,
46 ]),
47 new IntegerField('BUTTON_ID', [
48 'required' => true,
49 ]),
50 new StringField('SITE_ID', [
51 'required' => true,
52 ]),
53 ];
54 }
55
60 public static function getAllRestrictions()
61 {
62 $result = [];
63 $rows = static::getList();
64 while ($row = $rows->fetch())
65 {
66 $buttonId = $row['BUTTON_ID'];
67 $siteId = $row['SITE_ID'];
68
69 if (!isset($result[$buttonId]))
70 {
71 $result[$buttonId] = [];
72 }
73
74 $result[$buttonId][] = $siteId;
75 }
76 return $result;
77 }
78
79 public static function deleteByButtonId($buttonId)
80 {
81 $buttonId = (int)$buttonId;
82 if ($buttonId <= 0)
83 {
84 return;
85 }
86
87 $rows = static::getList([
88 'select' => ['ID'],
89 'filter' => ['=BUTTON_ID' => $buttonId]
90 ]);
91 while ($row = $rows->fetch())
92 {
93 static::delete($row['ID']);
94 }
95 }
96}