Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
highloadblockrightstable.php
1<?php
3
5
22class HighloadBlockRightsTable extends Entity\DataManager
23{
28 public static function getTableName()
29 {
30 return 'b_hlblock_entity_rights';
31 }
32
37 public static function getMap()
38 {
39 return array(
40 'ID' => new Entity\IntegerField('ID', array(
41 'primary' => true,
42 'autocomplete' => true,
43 )),
44 'HL_ID' => new Entity\IntegerField('HL_ID', array(
45 'required' => true,
46 )),
47 'TASK_ID' => new Entity\IntegerField('TASK_ID', array(
48 'required' => true,
49 )),
50 'ACCESS_CODE' => new Entity\StringField('ACCESS_CODE', array(
51 'required' => true,
52 'validation' => array(__CLASS__, 'validateAccessCode'),
53 )),
54 'USER_ACCESS' => new Entity\ReferenceField(
55 'USER_ACCESS',
56 '\Bitrix\Main\UserAccessTable',
57 array('=this.ACCESS_CODE' => 'ref.ACCESS_CODE')
58 ),
59 'TASK_OPERATION' => new Entity\ReferenceField(
60 'TASK_OPERATION',
61 '\Bitrix\Main\TaskOperationTable',
62 array('=this.TASK_ID' => 'ref.TASK_ID')
63 ),
64 );
65 }
66
72 public static function validateAccessCode()
73 {
74 return array(
75 new Entity\Validator\Length(null, 50),
76 );
77 }
78
84 public static function getOperationsName($hlId)
85 {
86 $operations = array();
87 $uid = $GLOBALS['USER']->getId();//@fixme
88 $acc = new \CAccess;
89 $acc->UpdateCodes();
90
91 $res = \Bitrix\HighloadBlock\HighloadBlockRightsTable::getList(array(
92 'select' => array(
93 'HL_ID',
94 'OPNAME' => 'TASK_OPERATION.OPERATION.NAME'
95 ),
96 'filter' => array(
97 'HL_ID' => $hlId,
98 'USER_ACCESS.USER_ID' => $uid,
99 '!TASK_OPERATION.OPERATION.NAME' => false
100 )
101 ));
102 while ($row = $res->fetch())
103 {
104 if (!isset($operations[$row['HL_ID']]))
105 {
106 $operations[$row['HL_ID']] = array();
107 }
108 $operations[$row['HL_ID']][] = $row['OPNAME'];
109 }
110
111 return is_array($hlId) ? $operations : $operations[$hlId];
112 }
113}
$GLOBALS['____1444769544']
Definition license.php:1