Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
param.php
1<?php
2
4
7
8class Param
9{
10 public static function fillUrls(array &$params = []): void
11 {
12 if (!isset($params['PATH_TO_USER']) || (string)$params['PATH_TO_USER'] === '')
13 {
14 $params['PATH_TO_USER'] = Helper\Path::get('user_profile');
15 }
16
17 if (!isset($params['PATH_TO_GROUP']) || (string)$params['PATH_TO_GROUP'] === '')
18 {
19 $params['PATH_TO_GROUP'] = Helper\Path::get('group_path_template');
20 }
21
22 if (!isset($params['PATH_TO_GROUP_CREATE']) || (string)$params['PATH_TO_GROUP_CREATE'] === '')
23 {
24 $params['PATH_TO_GROUP_CREATE'] = Helper\Path::get('user_create_group_path_template');
25 }
26
27 if (!isset($params['PATH_TO_GROUP_EDIT']) || (string)$params['PATH_TO_GROUP_EDIT'] === '')
28 {
29 $params['PATH_TO_GROUP_EDIT'] = Helper\Path::get('group_edit_path_template');
30 }
31
32 if (!isset($params['PATH_TO_GROUP_DELETE']) || (string)$params['PATH_TO_GROUP_DELETE'] === '')
33 {
34 $params['PATH_TO_GROUP_DELETE'] = Helper\Path::get('group_delete_path_template');
35 }
36
37 if (!isset($params['PATH_TO_JOIN_GROUP']) || (string)$params['PATH_TO_JOIN_GROUP'] === '')
38 {
39 $params['PATH_TO_JOIN_GROUP'] = Helper\Path::get('user_request_group_path_template');
40 }
41
42 if (!isset($params['PATH_TO_LEAVE_GROUP']) || (string)$params['PATH_TO_LEAVE_GROUP'] === '')
43 {
44 $params['PATH_TO_LEAVE_GROUP'] = Helper\Path::get('user_leave_group_path_template');
45 }
46
47 self::fillTasksUrls($params);
48 }
49
50 public static function fillTasksUrls(array &$params = []): void
51 {
52 if (ModuleManager::isModuleInstalled('tasks'))
53 {
54 return;
55 }
56
57 if (!isset($params['PATH_TO_GROUP_TASKS']) || (string)$params['PATH_TO_GROUP_TASKS'] === '')
58 {
59 $params['PATH_TO_GROUP_TASKS'] = Helper\Path::get('group_tasks_path_template');
60 }
61
62 if (!isset($params['PATH_TO_GROUP_TASKS_VIEW']) || (string)$params['PATH_TO_GROUP_TASKS_VIEW'] === '')
63 {
64 $params['PATH_TO_GROUP_TASKS_VIEW'] = Helper\Path::get('group_tasks_view_path_template');
65 }
66
67 if (!isset($params['PATH_TO_GROUP_TASKS_REPORT']) || (string)$params['PATH_TO_GROUP_TASKS_REPORT'] === '')
68 {
69 $params['PATH_TO_GROUP_TASKS_REPORT'] = Helper\Path::get('group_tasks_report_path_template');
70 }
71
72 if (!isset($params['PATH_TO_GROUP_TASKS_TASK']) || (string)$params['PATH_TO_GROUP_TASKS_TASK'] === '')
73 {
74 $params['PATH_TO_GROUP_TASKS_TASK'] = Helper\Path::get('group_tasks_task_path_template');
75 }
76
77 if (!isset($params['PATH_TO_USER_TASKS']) || (string)$params['PATH_TO_USER_TASKS'] === '')
78 {
79 $params['PATH_TO_USER_TASKS'] = str_replace(
80 [ '#user_id#', '#id#', '#ID#' ],
81 $params['USER_ID'],
82 Helper\Path::get('user_tasks_path_template')
83 );
84 }
85
86 if (!isset($params['PATH_TO_USER_TASKS_VIEW']) || (string)$params['PATH_TO_USER_TASKS_VIEW'] === '')
87 {
88 $params['PATH_TO_USER_TASKS_VIEW'] = str_replace(
89 [ '#user_id#', '#id#', '#ID#' ],
90 $params['USER_ID'],
91 Helper\Path::get('user_tasks_view_path_template')
92 );
93 }
94
95 if (!isset($params['PATH_TO_USER_TASKS_REPORT']) || (string)$params['PATH_TO_USER_TASKS_REPORT'] === '')
96 {
97 $params['PATH_TO_USER_TASKS_REPORT'] = str_replace(
98 [ '#user_id#', '#id#', '#ID#' ],
99 $params['USER_ID'],
100 Helper\Path::get('user_tasks_report_path_template')
101 );
102 }
103
104 if (!isset($params['PATH_TO_USER_TASKS_TEMPLATES']) || (string)$params['PATH_TO_USER_TASKS_TEMPLATES'] === '')
105 {
106 $params['PATH_TO_USER_TASKS_TEMPLATES'] = str_replace(
107 [ '#user_id#', '#id#', '#ID#' ],
108 $params['USER_ID'],
109 Helper\Path::get('user_tasks_templates_path_template')
110 );
111 }
112 }
113}