Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
path.php
1<?php
2
10
14
15class Path
16{
17 public static function get(string $key = '', $siteId = SITE_ID): string
18 {
19 $result = '';
20
21 if ($key === '')
22 {
23 return $result;
24 }
25
26 switch ($key)
27 {
28 case 'user_profile':
29 $result = (
31 ? Option::get('intranet', 'search_user_url', self::getDefault($key, $siteId), $siteId)
32 : ''
33 );
34 break;
35 case 'user_calendar_path_template':
36 $result = self::get('user_profile', $siteId) . 'calendar/';
37 break;
38 case 'user_create_group_path_template':
39 $result = self::get('user_profile', $siteId) . 'groups/create/';
40 break;
41 case 'user_tasks_path_template':
42 $result = self::get('user_profile', $siteId) . 'tasks/';
43 break;
44 case 'user_tasks_view_path_template':
45 $result = self::get('user_tasks_path_template', $siteId) . 'view/#action#/#view_id#/';
46 break;
47 case 'user_tasks_report_path_template':
48 $result = self::get('user_tasks_path_template', $siteId) . 'report/';
49 break;
50 case 'user_tasks_templates_path_template':
51 $result = self::get('user_tasks_path_template', $siteId) . 'templates/';
52 break;
53 case 'userblogpost_page':
54 case 'group_path_template':
55 case 'workgroups_page':
56 $result = Option::get('socialnetwork', $key, self::getDefault($key, $siteId), $siteId);
57 break;
58 case 'group_edit_path_template':
59 $result = self::get('group_path_template', $siteId) . 'edit/';
60 break;
61 case 'group_delete_path_template':
62 $result = self::get('group_path_template', $siteId) . 'delete/';
63 break;
64 case 'group_invite_path_template':
65 $result = self::get('group_path_template', $siteId) . 'invite/';
66 break;
67 case 'group_livefeed_path_template':
68 $result = self::get('group_path_template', $siteId) . (
70 && SITE_TEMPLATE_ID === 'bitrix24'
71 ? 'general/'
72 : ''
73 );
74 break;
75 case 'group_tasks_path_template':
76 $result = self::get('group_path_template', $siteId) . 'tasks/';
77 break;
78 case 'group_tasks_task_path_template':
79 $result = self::get('group_tasks_path_template', $siteId) . 'task/#action#/#task_id#/';
80 break;
81 case 'group_tasks_view_path_template':
82 $result = self::get('group_tasks_path_template', $siteId) . 'view/#action#/#view_id#/';
83 break;
84 case 'group_tasks_report_path_template':
85 $result = self::get('group_tasks_path_template', $siteId) . 'report/';
86 break;
87 case 'group_calendar_path_template':
88 $result = self::get('group_path_template', $siteId) . 'calendar/';
89 break;
90 case 'group_users_path_template':
91 $result = self::get('group_path_template', $siteId) . 'users/';
92 break;
93 case 'group_requests_path_template':
94 $result = self::get('group_path_template', $siteId) . 'requests/';
95 break;
96 case 'group_requests_out_path_template':
97 $result = self::get('group_path_template', $siteId) . 'requests_out/';
98 break;
99 case 'user_request_group_path_template':
100 $result = self::get('group_path_template', $siteId) . 'user_request/';
101 break;
102 case 'user_leave_group_path_template':
103 $result = self::get('group_path_template', $siteId) . 'user_leave/';
104 break;
105 case 'department_path_template':
106 $result = Option::get('main', 'TOOLTIP_PATH_TO_CONPANY_DEPARTMENT', self::getDefault('TOOLTIP_PATH_TO_CONPANY_DEPARTMENT', $siteId), $siteId);
107 break;
108 default:
109 }
110
111 return $result;
112 }
113
114 private static function getDefault(string $key = '', $siteId = SITE_ID): string
115 {
116 $result = '';
117 if ($key === '')
118 {
119 return $result;
120 }
121
122 $siteDir = SITE_DIR;
123 if ($siteDir === '')
124 {
125 $siteDir = '/';
126 }
127
128 switch ($key)
129 {
130 case 'user_profile':
131 $result = $siteDir . self::getUserFolder($siteId) . '#user_id#/';
132 break;
133 case 'userblogpost_page':
134 $result = $siteDir . self::getUserFolder($siteId) . '#user_id#/blog/#post_id#/';
135 break;
136 case 'group_path_template':
137 $result = self::getDefault('workgroups_page', $siteId) . 'group/#group_id#/';
138 break;
139 case 'department_path_template':
140 $result = $siteDir . 'company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#';
141 break;
142 case 'workgroups_page':
143 $result = $siteDir . 'workgroups/';
144 break;
145 default:
146 }
147
148 return $result;
149 }
150
151 private static function getUserFolder($siteId = SITE_ID): string
152 {
153 static $extranetSiteId = null;
154
155 if ($extranetSiteId === null)
156 {
157 $extranetSiteId = (Loader::includeModule('extranet') ? \CExtranet::getExtranetSiteID() : '');
158 }
159
160 return ($siteId === $extranetSiteId ? 'contacts' : 'company') . '/personal/user/';
161 }
162}
static includeModule($moduleName)
Definition loader.php:69
static isModuleInstalled($moduleName)