Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
DocumentLib.php
1
<?php
2
3
namespace
Bitrix\Bizproc\Calc\Libs
;
4
5
use
Bitrix\Main
;
6
use
Bitrix\Bizproc\Calc\Arguments
;
7
use
Bitrix\Main\Localization\Loc
;
8
9
class
DocumentLib
extends
BaseLib
10
{
11
public
function
getFunctions
(): array
12
{
13
return
[
14
'getdocumenturl'
=> [
15
'args'
=>
true
,
16
'func'
=>
'callGetDocumentUrl'
,
17
'description'
=>
Loc::getMessage
(
'BIZPROC_CALC_FUNCTION_GETDOCUMENTURL_DESCRIPTION'
),
18
],
19
];
20
}
21
22
public
function
callGetDocumentUrl
(
Arguments
$args)
23
{
24
$format = $args->
getFirst
();
25
$external = $args->
getSecond
();
26
$activity = $args->
getParser
()->getActivity();
27
28
$url = $activity->workflow->getRuntime()->getDocumentService()->getDocumentAdminPage(
29
$activity->getDocumentId()
30
);
31
$name =
null
;
32
33
if
($external)
34
{
35
$url = Main\Engine\UrlManager::getInstance()->getHostUrl() . $url;
36
}
37
38
if
($format ===
'bb'
|| $format ===
'html'
)
39
{
40
$name = $activity->workflow->getService(
'DocumentService'
)->getDocumentName(
41
$activity->getDocumentId()
42
);
43
}
44
45
if
($format ===
'bb'
)
46
{
47
return
sprintf(
48
'[url=%s]%s[/url]'
,
49
$url,
50
$name
51
);
52
}
53
54
if
($format ===
'html'
)
55
{
56
return
sprintf(
57
'<a href="%s" target="_blank">%s</a>'
,
58
$url,
59
htmlspecialcharsbx($name)
60
);
61
}
62
63
return
$url;
64
}
65
}
Bitrix\Bizproc\Calc\Arguments
Definition
Arguments.php:6
Bitrix\Bizproc\Calc\Arguments\getParser
getParser()
Definition
Arguments.php:16
Bitrix\Bizproc\Calc\Arguments\getSecond
getSecond()
Definition
Arguments.php:57
Bitrix\Bizproc\Calc\Arguments\getFirst
getFirst()
Definition
Arguments.php:41
Bitrix\Bizproc\Calc\Libs\BaseLib
Definition
BaseLib.php:6
Bitrix\Bizproc\Calc\Libs\DocumentLib
Definition
DocumentLib.php:10
Bitrix\Bizproc\Calc\Libs\DocumentLib\getFunctions
getFunctions()
Definition
DocumentLib.php:11
Bitrix\Bizproc\Calc\Libs\DocumentLib\callGetDocumentUrl
callGetDocumentUrl(Arguments $args)
Definition
DocumentLib.php:22
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Bizproc\Calc\Libs
Definition
ArrayLib.php:3
Bitrix\Main
modules
bizproc
lib
Calc
Libs
DocumentLib.php
Создано системой
1.10.0