Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/bizproc/lib/Calc/Libs/ |
Upload File : |
<?php namespace Bitrix\Bizproc\Calc\Libs; use Bitrix\Main; use Bitrix\Bizproc\Calc\Arguments; use Bitrix\Main\Localization\Loc; class DocumentLib extends BaseLib { public function getFunctions(): array { return [ 'getdocumenturl' => [ 'args' => true, 'func' => 'callGetDocumentUrl', 'description' => Loc::getMessage('BIZPROC_CALC_FUNCTION_GETDOCUMENTURL_DESCRIPTION_MSGVER_1'), ], ]; } public function callGetDocumentUrl(Arguments $args) { $format = $args->getFirst(); $external = $args->getSecond(); $activity = $args->getParser()->getActivity(); $url = $activity->workflow->getRuntime()->getDocumentService()->getDocumentAdminPage( $activity->getDocumentId() ); $name = null; if ($external) { $url = Main\Engine\UrlManager::getInstance()->getHostUrl() . $url; } if ($format === 'bb' || $format === 'html') { $name = $activity->workflow->getService('DocumentService')->getDocumentName( $activity->getDocumentId() ); } if ($format === 'bb') { return sprintf( '[url=%s]%s[/url]', $url, $name ); } if ($format === 'html') { return sprintf( '<a href="%s" target="_blank">%s</a>', $url, htmlspecialcharsbx($name) ); } return $url; } }