PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/components/bitrix/bizproc.workflow.start/templates/modern/template.php

https://gitlab.com/alexprowars/bitrix
PHP | 125 lines | 120 code | 4 blank | 1 comment | 14 complexity | 775c14bf26e2307d6ceae378f80068b2 MD5 | raw file
  1. <?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
  2. CModule::IncludeModule('socialnetwork');
  3. CUtil::InitJSCore(array('socnetlogdest'));
  4. \Bitrix\Main\Localization\Loc::loadMessages(__DIR__.DIRECTORY_SEPARATOR.'script.js.php');
  5. ?>
  6. <div class="bizproc-page-workflow-start">
  7. <?
  8. if (!empty($arResult["ERROR_MESSAGE"])):
  9. ShowError($arResult["ERROR_MESSAGE"]);
  10. endif;
  11. if ($arResult["SHOW_MODE"] == "StartWorkflowSuccess")
  12. {
  13. ShowNote(str_replace("#TEMPLATE#", $arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["NAME"], GetMessage("BPABS_MESSAGE_SUCCESS")));
  14. }
  15. elseif ($arResult["SHOW_MODE"] == "StartWorkflowError")
  16. {
  17. ShowNote(str_replace("#TEMPLATE#", $arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["NAME"], GetMessage("BPABS_MESSAGE_ERROR")));
  18. }
  19. elseif ($arResult["SHOW_MODE"] == "WorkflowParameters")
  20. {
  21. /** @var CBPDocumentService $documentService */
  22. $documentService = $arResult["DocumentService"];
  23. ?>
  24. <form method="post" name="start_workflow_form1" action="<?=POST_FORM_ACTION_URI?>" enctype="multipart/form-data" data-role="bizproc-start-form">
  25. <input type="hidden" name="workflow_template_id" value="<?=intval($arParams["TEMPLATE_ID"]) ?>" />
  26. <input type="hidden" name="document_type" value="<?= htmlspecialcharsbx($arParams["DOCUMENT_TYPE"][2]) ?>" />
  27. <input type="hidden" name="document_id" value="<?= htmlspecialcharsbx($arParams["DOCUMENT_ID"][2]) ?>" />
  28. <input type="hidden" name="back_url" value="<?= htmlspecialcharsbx($arResult["back_url"]) ?>" />
  29. <?= bitrix_sessid_post() ?>
  30. <fieldset class="bizproc-item bizproc-workflow-template">
  31. <legend class="bizproc-item-legend bizproc-workflow-template-title">
  32. <?=$arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["NAME"]?>
  33. </legend>
  34. <?if($arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["DESCRIPTION"]!=''):?>
  35. <div class="bizproc-item-description bizproc-workflow-template-description">
  36. <?= $arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["DESCRIPTION"] ?>
  37. </div>
  38. <?endif;
  39. if (!empty($arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["PARAMETERS"]))
  40. {
  41. foreach ($arResult["TEMPLATES"][$arParams["TEMPLATE_ID"]]["PARAMETERS"] as $parameterKey => $arParameter)
  42. {
  43. if ($parameterKey == "TargetUser")
  44. {
  45. continue;
  46. }
  47. ?>
  48. <div class="bizproc-modern-type-control-container">
  49. <span class="bizproc-modern-type-control-container-title bizproc-modern-type-control-container-title-top"
  50. <? if ($arParameter["Description"]):?> title="<?=htmlspecialcharsbx($arParameter["Description"])?>"<?endif;?>>
  51. <?=htmlspecialcharsbx($arParameter['Name'])?><?=($arParameter["Required"] ? "<span class=\"required\">*</span> " : "")?>:
  52. </span>
  53. <div class="bizproc-modern-type-control-wrapper">
  54. <?
  55. echo $documentService->GetFieldInputControl(
  56. $arParams["DOCUMENT_TYPE"],
  57. $arParameter,
  58. array(
  59. "Form" => "start_workflow_form1",
  60. "Field" => $parameterKey,
  61. ),
  62. $arResult["PARAMETERS_VALUES"][$parameterKey],
  63. false,
  64. true
  65. );
  66. ?>
  67. </div>
  68. </div>
  69. <?
  70. }
  71. }
  72. ?>
  73. <div class="bizproc-item-buttons bizproc-workflow-start-buttons" data-role="bizproc-form-buttons">
  74. <input type="submit" name="DoStartParamWorkflow" value="<?= GetMessage("BPABS_DO_START") ?>" />
  75. <input type="submit" name="CancelStartParamWorkflow" value="<?= GetMessage("BPABS_DO_CANCEL") ?>" />
  76. </div>
  77. </fieldset>
  78. </form>
  79. <script>
  80. BX.ready(function()
  81. {
  82. BX.message({
  83. BP_WS_DESTINATION_CHOOSE: '<?=GetMessageJS('BP_WS_DESTINATION_CHOOSE')?>',
  84. BP_WS_DESTINATION_EDIT: '<?=GetMessageJS('BP_WS_DESTINATION_EDIT')?>',
  85. BP_WS_FILE_CHOOSE: '<?=GetMessageJS('BP_WS_FILE_CHOOSE')?>',
  86. BP_WS_CONTROL_CLONE: '<?=GetMessageJS('BP_WS_CONTROL_CLONE')?>'
  87. });
  88. });
  89. </script>
  90. <?
  91. }
  92. elseif ($arResult["SHOW_MODE"] == "SelectWorkflow" && count($arResult["TEMPLATES"]) > 0)
  93. {
  94. foreach($_GET as $key => $val):
  95. if (in_array(mb_strtolower($key), array("sessid", "workflow_template_id")))
  96. continue;
  97. endforeach;
  98. $bFirst = true;
  99. ?>
  100. <ul class="bizproc-list bizproc-workflow-templates">
  101. <?foreach ($arResult["TEMPLATES"] as $workflowTemplateId => $arWorkflowTemplate):?>
  102. <li class="bizproc-list-item bizproc-workflow-template">
  103. <div class="bizproc-item-title">
  104. <a href="<?=$arResult["TEMPLATES"][$arWorkflowTemplate["ID"]]["URL"]?>"><?=$arWorkflowTemplate["NAME"]?></a>
  105. </div>
  106. <?if ($arWorkflowTemplate["DESCRIPTION"] <> ''):?>
  107. <div class="bizproc-item-description">
  108. <?= $arWorkflowTemplate["DESCRIPTION"] ?>
  109. </div>
  110. <?endif;?>
  111. </li>
  112. <?endforeach;?>
  113. </ul>
  114. <?
  115. }
  116. elseif ($arResult["SHOW_MODE"] == "SelectWorkflow")
  117. {
  118. ShowNote(GetMessage("BPABS_NO_TEMPLATES"));
  119. }
  120. ?>
  121. </div>