Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/b24connector/lib/ |
Upload File : |
<?php namespace Bitrix\B24connector; use Bitrix\Main\ORM\Data\DataManager; use Bitrix\Main\ORM\Fields\IntegerField; use Bitrix\Main\ORM\Fields\StringField; /** * ORM class describes the limitation of displaying B24-widgets on specific sites. * * DO NOT WRITE ANYTHING BELOW THIS * * <<< ORMENTITYANNOTATION * @method static EO_ButtonSite_Query query() * @method static EO_ButtonSite_Result getByPrimary($primary, array $parameters = array()) * @method static EO_ButtonSite_Result getById($id) * @method static EO_ButtonSite_Result getList(array $parameters = array()) * @method static EO_ButtonSite_Entity getEntity() * @method static \Bitrix\B24connector\EO_ButtonSite createObject($setDefaultValues = true) * @method static \Bitrix\B24connector\EO_ButtonSite_Collection createCollection() * @method static \Bitrix\B24connector\EO_ButtonSite wakeUpObject($row) * @method static \Bitrix\B24connector\EO_ButtonSite_Collection wakeUpCollection($rows) */ class ButtonSiteTable extends DataManager { /** * Returns table name * @return string */ public static function getTableName() { return 'b_b24connector_button_site'; } /** * Returns table structure * * @return array */ public static function getMap() { return [ new IntegerField('ID', [ 'primary' => true, 'autocomplete' => true, ]), new IntegerField('BUTTON_ID', [ 'required' => true, ]), new StringField('SITE_ID', [ 'required' => true, ]), ]; } /** * Returns list of allowed sites for every button. * @return array<int, string[]> */ public static function getAllRestrictions() { $result = []; $rows = static::getList(); while ($row = $rows->fetch()) { $buttonId = $row['BUTTON_ID']; $siteId = $row['SITE_ID']; if (!isset($result[$buttonId])) { $result[$buttonId] = []; } $result[$buttonId][] = $siteId; } return $result; } public static function deleteByButtonId($buttonId) { $buttonId = (int)$buttonId; if ($buttonId <= 0) { return; } $rows = static::getList([ 'select' => ['ID'], 'filter' => ['=BUTTON_ID' => $buttonId] ]); while ($row = $rows->fetch()) { static::delete($row['ID']); } } }