Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
applicationmanager.php
1<?php
10
11use Bitrix\Main;
12
14{
16 protected static $instance;
17
18 protected $applications = array();
19
20 protected function __construct()
21 {
22 $event = new Main\Event("main", "OnApplicationsBuildList");
23 $event->send();
24
25 foreach($event->getResults() as $eventResult)
26 {
27 $result = $eventResult->getParameters();
28 if(is_array($result))
29 {
30 if(!isset($result[0]) || !is_array($result[0]))
31 {
32 $result = array($result);
33 }
34 foreach($result as $app)
35 {
36 $this->applications[$app["ID"]] = $app;
37 }
38 }
39 }
40 Main\Type\Collection::sortByColumn($this->applications, "SORT");
41 }
42
43 public static function getInstance()
44 {
45 if (!isset(static::$instance))
46 {
47 static::$instance = new static();
48 }
49
50 return static::$instance;
51 }
52
64 public function getApplications()
65 {
67 }
68
75 public function checkScope($applicationId)
76 {
77 if(isset($this->applications[$applicationId]))
78 {
79 $className = $this->applications[$applicationId]["CLASS"];
80 $class = new $className;
81 if(is_callable(array($class, "checkScope")))
82 {
83 return call_user_func_array(array($class, "checkScope"), array());
84 }
85 }
86 return false;
87 }
88}