Documentation

GetAllowableEvents

array
public static function CBPDocument::GetAllowableEvents(  int userId,
 array arGroups,
 array arState
);

This method returns an array of events, which can be sent to a workflow with an indicated status by the specified user.

Note: This method receives an array of configuration parameters and generates scripts, required to show file dialog. Static method.

Method parameters

ParameterDescription
userIdUser code
arGroupsArray of user groups
arStateWorkflow status

Returned value

Returns an array of event types

array(
array(
"NAME" => event,
"TITLE" => event_name
),
...
)

Examples

<?
$documentType = array("bizproc", "CBPVirtualDocument", "type_".$blockId);
$documentId = array("bizproc", "CBPVirtualDocument", $id);

$arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
if ($GLOBALS["USER"]->GetID() == $authorId)
$arCurrentUserGroups[] = "Author";

$arDocumentStates = CBPDocument::GetDocumentStates($documentType, $documentId);

foreach ($arDocumentStates as $arDocumentState)
{
$arDocumentStateEvents = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentState);
print_r($arDocumentStateEvents);
}
?>


© «Bitrix24», 2001-2024