Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
devops.php
1<?php
2
3namespace Bitrix\Rest\Url;
4
5class DevOps extends Base
6{
7 protected $directory = '/devops/';
8 protected $pages = [
9 'index' => '',
10 'statistic' => 'statistic/',
11 'list' => 'list/',
12 'section' => 'section/#SECTION_CODE#/',
13 'edit' => 'edit/#ELEMENT_CODE#/#ID#/',
14 'iframe' => 'iframe/',
15 'placement' => 'placement/#PLACEMENT_ID#/',
16 ];
17
18 public function getIndexUrl()
19 {
20 return $this->getUrl('index');
21 }
22
23 public function getStatisticUrl()
24 {
25 return $this->getUrl('statistic');
26 }
27
28 public function getListUrl()
29 {
30 return $this->getUrl('list');
31 }
32
33 public function getIframeUrl($query = null)
34 {
35 $params = null;
36 if(!is_null($query))
37 {
38 $params = [
39 'query' => $query
40 ];
41 }
42
43 return $this->getUrl('iframe', null, null, $params);
44 }
45
46 public function getPlacementUrl(?int $placementId = null, ?array $params = null): string
47 {
48 $replace = null;
49 $subject = null;
50 $query = null;
51
52 if ($placementId > 0)
53 {
54 $replace = [
55 '#PLACEMENT_ID#',
56 ];
57 $subject = [
58 $placementId,
59 ];
60 }
61
62 if (is_array($params))
63 {
64 $query = [
65 'params' => $params
66 ];
67 }
68
69 return $this->getUrl(
70 'placement',
71 $replace,
72 $subject,
73 $query
74 );
75 }
76
77 public function getIntegrationSectionUrl($code = null)
78 {
79 $replace = null;
80 $subject = null;
81
82 if(!is_null($code))
83 {
84 $replace = [
85 '#SECTION_CODE#'
86 ];
87 $subject = [
88 $code
89 ];
90 }
91
92 return $this->getUrl(
93 'section',
94 $replace,
95 $subject
96 );
97 }
98
99 public function getIntegrationEditUrl($id = null, $elementCode = null)
100 {
101 $replace = null;
102 $subject = null;
103
104 if(!is_null($id) && !is_null($elementCode))
105 {
106 $replace = [
107 '#ID#',
108 '#ELEMENT_CODE#'
109 ];
110 $subject = [
111 $id,
112 $elementCode
113 ];
114 }
115
116 return $this->getUrl(
117 'edit',
118 $replace,
119 $subject
120 );
121 }
122
123}
getUrl($page, $replace=null, $subject=null, $query=null)
Definition base.php:49
getIntegrationEditUrl($id=null, $elementCode=null)
Definition devops.php:99
getIntegrationSectionUrl($code=null)
Definition devops.php:77
getPlacementUrl(?int $placementId=null, ?array $params=null)
Definition devops.php:46
getIframeUrl($query=null)
Definition devops.php:33