Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
connector.php
1<?php
2
4
9
10abstract class Connector
11{
12 protected $entityId;
13
14 public function __construct($entityId)
15 {
16 $this->entityId = $entityId;
17 }
18
25 final public static function buildFromAttachedObject(\Bitrix\Vote\Attach $attachedObject)
26 {
27 if(!Loader::includeModule($attachedObject->getModuleId()))
28 {
29 throw new SystemException("Module {$attachedObject->getModuleId()} is not included.");
30 }
31 $className = str_replace('\\\\', '\\', $attachedObject->getEntityType());
33 if (!is_a($className, Connector::class, true))
34 {
35 throw new ObjectNotFoundException('Connector class should be instance of Bitrix\Vote\Attachment\Connector.');
36 }
37
38 $connector = new $className($attachedObject->getEntityId());
39
40 if($connector instanceof Storable)
41 {
42 $connector->setStorage($attachedObject->getStorage());
43 }
44
45 return $connector;
46 }
47
51 public static function className()
52 {
53 return get_called_class();
54 }
55
60 public function getDataToShow()
61 {
62 return array();
63 }
64
69 public function canRead($userId)
70 {
71 return false;
72 }
73
78 public function canEdit($userId)
79 {
80 return false;
81 }
82
87 public function checkFields(&$data)
88 {
89 return $data;
90 }
91
95 protected function getApplication()
96 {
97 global $APPLICATION;
98 return $APPLICATION;
99 }
100
104 protected function getUser()
105 {
106 global $USER;
107 return $USER;
108 }
109}
static includeModule($moduleName)
Definition loader.php:69