1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
mobile.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing\Connector;
3
4
use \Bitrix\Landing\Manager;
5
use \Bitrix\Main\Localization\Loc;
6
use \Bitrix\Main\Web\Json;
7
use \Bitrix\MobileApp\Janative;
8
use \Bitrix\Mobile\Auth;
9
10
Loc::loadMessages(__FILE__);
11
12
class
Mobile
13
{
18
protected
static
$isMobileHit
=
false
;
19
25
public
static
function
onMobileMenuStructureBuilt
($menu):
array
26
{
27
if
(!isset($menu[0][
'items'
]) || !is_array($menu[0][
'items'
]))
28
{
29
return
$menu;
30
}
31
32
if
(\
Bitrix
\
Landing
\
Site
\Type::isEnabled(
'knowledge'
))
33
{
34
$menu[0][
'items'
][] = self::getKnowledgeMenu();
35
}
36
37
//$menu[0]['items'][] = self::getLandingMenu();
38
39
return
$menu;
40
}
41
46
private
static
function
getKnowledgeMenu():
array
47
{
48
$componentId =
'knowledge.list'
;
49
$componentVersion =
Janative\Manager::getComponentVersion
(
50
$componentId
51
);
52
53
54
55
return
[
56
'sort'
=> 100,
57
'title'
=> Loc::getMessage(
'LANDING_CONNECTOR_MB_MENU_TITLE'
),
58
'imageUrl'
=>
'/bitrix/images/landing/mobile/knowledge.png?4'
,
59
'imageName'
=>
'knowledge_base'
,
60
'color'
=>
'#e597ba'
,
61
'params'
=> [
62
'onclick'
=> <<<JS
63
ComponentHelper.openList({
64
name:
'{$componentId}'
,
65
object:
'list'
,
66
version
:
'{$componentVersion}'
,
67
widgetParams: {titleParams: { text: this.
title
, type:
'section'
} , useSearch:
true
}
68
});
69
JS
70
]
71
];
72
}
73
78
private
static
function
getLandingMenu():
array
79
{
80
$version = time();
81
$title
= Loc::getMessage(
'LANDING_CONNECTOR_MB_LANDINGS_MENU_TITLE'
);
82
$titleTabPage = Loc::getMessage(
'LANDING_CONNECTOR_MB_LANDINGS_TAB_PAGE'
);
83
$titleTabStore = Loc::getMessage(
'LANDING_CONNECTOR_MB_LANDINGS_TAB_STORE'
);
84
85
return
[
86
'sort'
=> 200,
87
'title'
=>
$title
,
88
'imageUrl'
=>
'/bitrix/images/landing/mobile/knowledge.png'
,
89
'color'
=>
'#e597ba'
,
90
'params'
=> [
91
'onclick'
=> <<<JS
92
PageManager.openComponent(
'JSStackComponent'
, {
93
rootWidget: {
94
name:
'tabs'
,
95
settings: {
96
objectName:
'layoutWidget'
,
97
title
:
'{$title}'
,
98
tabs: {
99
items: [
100
{
101
title
:
'{$titleTabPage}'
,
102
component: {
103
name:
'JSStackComponent'
,
104
scriptPath:
'/mobileapp/jn/landing.list/?type=page&version={$version}'
,
105
params: { type:
'page'
},
106
rootWidget: {
107
name:
'layout'
,
108
settings: {
109
objectName:
'layoutWidget'
,
110
title
:
'{$title}'
,
111
},
112
},
113
}
114
},
115
{
116
title
:
'{$titleTabStore}'
,
117
component: {
118
name:
'JSStackComponent'
,
119
scriptPath:
'/mobileapp/jn/landing.list/?type=store&version={$version}'
,
120
params: { type:
'store'
},
121
rootWidget: {
122
name:
'layout'
,
123
settings: {
124
objectName:
'layoutWidget'
,
125
title
:
'{$title}'
,
126
},
127
},
128
}
129
},
130
]
131
}
132
},
133
},
134
},
135
);
136
JS
137
]
138
];
139
}
140
145
public
static
function
forceMobile
()
146
{
147
self::$isMobileHit =
true
;
148
}
149
154
public
static
function
isMobileHit
(): bool
155
{
156
static
$mobileHit =
null
;
157
158
if
(self::$isMobileHit)
159
{
160
return
true
;
161
}
162
163
if
($mobileHit ===
null
)
164
{
165
$mobileHit =
\Bitrix\Main\ModuleManager::isModuleInstalled
(
'intranet'
)
166
&& mb_strpos(
Manager::getCurDir
(),
SITE_DIR
.
'mobile/'
) === 0;
167
}
168
169
return
$mobileHit;
170
}
171
176
public
static
function
prologMobileHit
()
177
{
178
if
(self::isMobileHit())
179
{
180
if
(
181
\
Bitrix
\
Main
\Loader::includeModule(
'mobile'
) &&
182
\
Bitrix
\
Main
\Loader::includeModule(
'mobileapp'
)
183
)
184
{
185
if
(!defined(
'SKIP_MOBILEAPP_INIT'
))
186
{
187
\CMobile::init();
188
if
(!
Manager::getUserId
())
189
{
190
Manager::getApplication
()->restartBuffer();
191
Auth::setNotAuthorizedHeaders();
192
echo Json::encode(Auth::getNotAuthorizedResponse());
193
die
();
194
}
195
}
196
}
197
else
198
{
199
die
();
200
}
201
}
202
}
203
}
version
xml version
Определения
yandex.php:67
Bitrix\Landing\Connector\Mobile
Определения
mobile.php:13
Bitrix\Landing\Connector\Mobile\$isMobileHit
static $isMobileHit
Определения
mobile.php:18
Bitrix\Landing\Connector\Mobile\isMobileHit
static isMobileHit()
Определения
mobile.php:154
Bitrix\Landing\Connector\Mobile\forceMobile
static forceMobile()
Определения
mobile.php:145
Bitrix\Landing\Connector\Mobile\prologMobileHit
static prologMobileHit()
Определения
mobile.php:176
Bitrix\Landing\Connector\Mobile\onMobileMenuStructureBuilt
static onMobileMenuStructureBuilt($menu)
Определения
mobile.php:25
Bitrix\Landing\Manager\getApplication
static getApplication()
Определения
manager.php:71
Bitrix\Landing\Manager\getUserId
static getUserId()
Определения
manager.php:107
Bitrix\Landing\Manager\getCurDir
static getCurDir()
Определения
manager.php:198
Bitrix\Main\ModuleManager\isModuleInstalled
static isModuleInstalled($moduleName)
Определения
modulemanager.php:125
Bitrix\MobileApp\Janative\Manager\getComponentVersion
static getComponentVersion($componentName)
Определения
manager.php:154
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
SITE_DIR
const SITE_DIR(!defined('LANG'))
Определения
include.php:72
Bitrix\Landing\Site
Определения
cookies.php:2
Bitrix\Landing
Определения
agent.php:3
Bitrix\Main
Bitrix
title
<? endif;?> window document title
Определения
prolog_main_admin.php:76
die
die
Определения
quickway.php:367
$title
$title
Определения
pdf.php:123
bitrix
modules
landing
lib
connector
mobile.php
Создано системой
1.14.0