• Модуль: workflow
  • Путь к файлу: ~/bitrix/modules/workflow/classes/general/workflow.php
  • Класс: CAllWorkflow
  • Вызов: CAllWorkflow::OnPanelCreate
static function OnPanelCreate()
{
	global $APPLICATION, $USER;
	$cur_page_param = $APPLICATION->GetCurPageParam();
	$cur_page = $APPLICATION->GetCurPage(true);
	$cur_dir = $APPLICATION->GetCurDir();

	// New page
	$flow_link_new = CWorkFlow::GetEditLink(array(SITE_ID, rtrim(GetDirPath($cur_page), "/")."/untitled.php"), $status_id, $status_title, "standart.php", LANGUAGE_ID, $cur_page_param);
	$create_permission = $flow_link_new <> '' && $USER->CanDoFileOperation('fm_edit_in_workflow', array(SITE_ID, $cur_dir));
	// Document history
	$flow_link_hist = "/bitrix/admin/workflow_history_list.php?lang=".LANGUAGE_ID. "&find_filename=".urlencode($cur_page)."&find_filename_exact_match=Y&set_filter=Y";
	$history_permission = $USER->CanDoFileOperation('fm_edit_in_workflow', array(SITE_ID, $cur_page));
	// Current page
	$flow_link_edit = CWorkFlow::GetEditLink(array(SITE_ID, $cur_page), $status_id, $status_title, "", LANGUAGE_ID, $cur_page_param);
	$edit_permission = $flow_link_edit <> '' && $history_permission;

	//Big button
	if($edit_permission)
	{
		$public_edit = $APPLICATION->GetPopupLink(array(
			"URL" => $flow_link_edit."&bxpublic=Y&from_module=workflow",
			"PARAMS" => Array(
				"min_width"=>700,
				"min_height" => 400,
				'height' => 700,
				'width' => 400,
			)
		));

		$APPLICATION->AddPanelButton(array(
			"HREF" => "javascript:".$public_edit,
			"TYPE" => "BIG",
			"ID" => "edit",
			"ICON" => "bx-panel-edit-page-icon",
			"ALT" => GetMessage("top_panel_edit_title"),
			"TEXT" => GetMessage("top_panel_edit_new"),
			"MAIN_SORT" => "200",
			"SORT" => 10,
			"MENU" => array(),
			"HK_ID" => "top_panel_edit_new",
			"RESORT_MENU" => true,
			"HINT" => array(
				"TITLE" => GetMessage("top_panel_edit_new_tooltip_title"),
				"TEXT" => GetMessage("top_panel_edit_new_tooltip")
			),
		));
	}

	// New page
	if($create_permission)
	{
		$APPLICATION->AddPanelButtonMenu("create", array("SEPARATOR"=>true, "SORT"=>49));
		$APPLICATION->AddPanelButtonMenu("create", array(
			"SRC" => "/bitrix/images/workflow/new_page.gif",
			"TEXT" => GetMessage("FLOW_PANEL_CREATE_WITH_WF"),
			"TITLE" => GetMessage("FLOW_PANEL_CREATE_ALT"),
			"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($flow_link_new)."')",
			"HK_ID" => "FLOW_PANEL_CREATE_WITH_WF",
			"SORT" => 50
		));
	}

	if($edit_permission || $history_permission)
		$APPLICATION->AddPanelButtonMenu("edit", array("SEPARATOR"=>true, "SORT"=>79));

	// Current page
	if($edit_permission)
	{
		$APPLICATION->AddPanelButtonMenu("edit", array(
			"SRC" => "/bitrix/images/workflow/edit_flow_public.gif",
			"TEXT" => GetMessage("FLOW_PANEL_EDIT_WITH_WF"),
			"TITLE" => (intval($status_id) > 0? GetMessage("FLOW_CURRENT_STATUS")." [$status_id] $status_title": GetMessage("FLOW_PANEL_EDIT_ALT")),
			"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($flow_link_edit)."')",
			"HK_ID" => "FLOW_PANEL_EDIT_WITH_WF",
			"SORT" => 80
		));
	}

	// Document history
	if($history_permission)
	{
		$flow_link_hist = "/bitrix/admin/workflow_history_list.php?lang=".LANGUAGE_ID. "&find_filename=".urlencode($cur_page)."&find_filename_exact_match=Y&set_filter=Y";
		$APPLICATION->AddPanelButtonMenu("edit", array(
			"SRC" => "/bitrix/images/workflow/history.gif",
			"TEXT" => GetMessage("FLOW_PANEL_HISTORY"),
			"TITLE" => GetMessage("FLOW_PANEL_HISTORY_ALT"),
			"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($flow_link_hist)."')",
			"HK_ID" => "FLOW_PANEL_HISTORY",
			"SORT" => 81
		));
	}
}