本文整理汇总了PHP中CBPWorkflowTemplateLoader类的典型用法代码示例。如果您正苦于以下问题:PHP CBPWorkflowTemplateLoader类的具体用法?PHP CBPWorkflowTemplateLoader怎么用?PHP CBPWorkflowTemplateLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBPWorkflowTemplateLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processActionDefault
protected function processActionDefault()
{
if ($this->storage->isEnabledBizProc()) {
$documentData = array('DISK' => \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->storage->getId()), 'WEBDAV' => \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->storage->getId()));
if (!empty($this->arParams['FILE_ID'])) {
$autoExecute = CBPDocumentEventType::Edit;
} else {
$autoExecute = CBPDocumentEventType::Create;
}
$this->arParams['BIZPROC_PARAMETERS'] = false;
$this->arParams['BIZPROC_PARAMETERS_REQUIRED'] = array();
$workflowTemplateId = '';
foreach ($documentData as $nameModule => $data) {
$workflowTemplateObject = CBPWorkflowTemplateLoader::getList(array(), array("DOCUMENT_TYPE" => $data, "AUTO_EXECUTE" => $autoExecute, "ACTIVE" => "Y"), false, false, array("ID", "PARAMETERS"));
while ($workflowTemplate = $workflowTemplateObject->getNext()) {
if (!empty($workflowTemplate['PARAMETERS'])) {
foreach ($workflowTemplate['PARAMETERS'] as $parametersId => $parameters) {
if ($parameters['Required']) {
$this->arParams['BIZPROC_PARAMETERS_REQUIRED'][] = 'bizproc' . $workflowTemplate['ID'] . '_' . $parametersId;
}
}
$this->arParams['BIZPROC_PARAMETERS'] = true;
}
$workflowTemplateId = $workflowTemplate['ID'];
}
}
$this->arParams['STATUS_START_BIZPROC'] = !empty($workflowTemplateId);
}
$this->arParams['STORAGE_ID'] = $this->storage->getId();
$this->includeComponentTemplate();
}
示例2: GetLoader
/**
* Static method returns loader object. Singleton pattern.
*
* @return CBPWorkflowTemplateLoader
*/
public static function GetLoader()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例3: UsersArrayToStringInternal
private static function UsersArrayToStringInternal($arUsers, $arWorkflowTemplate, $arAllowableUserGroups)
{
if (is_array($arUsers))
{
$r = array();
$keys = array_keys($arUsers);
foreach ($keys as $key)
$r[$key] = self::UsersArrayToStringInternal($arUsers[$key], $arWorkflowTemplate, $arAllowableUserGroups);
if (count($r) == 2)
{
$keys = array_keys($r);
if ($keys[0] == 0 && $keys[1] == 1 && is_string($r[0]) && is_string($r[1]))
{
if (in_array($r[0], array("Document", "Template", "Variable", "User"))
|| preg_match("#^A\d+_\d+_\d+_\d+$#i", $r[0])
|| is_array($arWorkflowTemplate) && CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $r[0]) != null
)
{
return "{=".$r[0].":".$r[1]."}";
}
}
}
return implode(", ", $r);
}
else
{
if (array_key_exists(strtolower($arUsers), $arAllowableUserGroups))
return $arAllowableUserGroups[strtolower($arUsers)];
$userId = 0;
if (substr($arUsers, 0, strlen("user_")) == "user_")
$userId = intval(substr($arUsers, strlen("user_")));
if ($userId > 0)
{
$db = CUser::GetList(
($by = "LAST_NAME"),
($order = "asc"),
array("ID_EQUAL_EXACT" => $userId),
array(
"NAV_PARAMS" => false,
)
);
if ($ar = $db->Fetch())
{
$str = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $ar, true);
$str = $str." [".$ar["ID"]."]";
return str_replace(",", " ", $str);
}
}
return str_replace(",", " ", $arUsers);
}
}
示例4: __wd_create_default_bp_user_and_groups
function __wd_create_default_bp_user_and_groups($arr)
{
if($handle = opendir($_SERVER['DOCUMENT_ROOT'].'/'.BX_ROOT.'/modules/bizproc/templates'))
{
$documentType = array("webdav", "CIBlockDocumentWebdavSocnet", $arr["document_type"]);
while(false !== ($file = readdir($handle)))
{
if(!is_file($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bizproc/templates/'.$file))
{
continue;
}
$arFields = false;
include($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bizproc/templates/'.$file);
if(is_array($arFields))
{
$arFields["DOCUMENT_TYPE"] = $documentType;
$arFields["SYSTEM_CODE"] = $file;
$arFields["USER_ID"] = $GLOBALS['USER']->GetID();
array_walk_recursive($arFields["TEMPLATE"], "__wd_replace_user_and_groups", $arr);
if ($file == "status.php")
{
$arFields["AUTO_EXECUTE"] = CBPDocumentEventType::Create;
if (!empty($arFields["PARAMETERS"]) && !empty($arFields["PARAMETERS"]["Approvers"]))
{
$name = "";
if ($GLOBALS["USER"]->IsAuthorized() && $arr["owner"] == $GLOBALS["USER"]->GetID())
{
$name = trim($GLOBALS["USER"]->GetFirstName()." ".$GLOBALS["USER"]->GetLastName());
$name = (empty($name) ? $GLOBALS["USER"]->GetLogin() : $name);
}
else
{
$dbUser = CUser::GetByID($arr["owner"]);
$arUser = $dbUser->Fetch();
$name = trim($arUser["NAME"]." ".$arUser["LAST_NAME"]);
$name = (empty($name) ? $arUser["LOGIN"] : $name);
}
$arFields["PARAMETERS"]["Approvers"]["Default"] = $name.' ['.$arr["owner"].']';
}
}
try
{
CBPWorkflowTemplateLoader::Add($arFields);
}
catch (Exception $e)
{
}
}
}
closedir($handle);
}
}
示例5: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array();
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例6: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array("ExecuteCode" => $arCurrentValues["execute_code"]);
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例7: getTemplatesIdList
protected function getTemplatesIdList()
{
if (!Loader::includeModule('bizproc') || empty($this->iblockTypeId) || empty($this->iblockId)) {
return array();
}
$documentType = BizprocDocument::generateDocumentComplexType($this->iblockTypeId, $this->iblockId);
$templates = array_merge(\CBPWorkflowTemplateLoader::SearchTemplatesByDocumentType($documentType, CBPDocumentEventType::Create), \CBPWorkflowTemplateLoader::SearchTemplatesByDocumentType($documentType, CBPDocumentEventType::Edit));
$templateData = array();
foreach ($templates as $template) {
$templateData[$template['ID']]['ID'] = $template['ID'];
$templateData[$template['ID']]['NAME'] = $template['NAME'];
}
return $templateData;
}
示例8: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$state = strlen($arCurrentValues["target_state_name_1"]) > 0 ? $arCurrentValues["target_state_name_1"] : $arCurrentValues["target_state_name"];
$cancelCurrentState = isset($arCurrentValues['cancel_current_state']) && $arCurrentValues['cancel_current_state'] == 'Y' ? 'Y' : 'N';
$arProperties = array('TargetStateName' => $state, 'CancelCurrentState' => $cancelCurrentState);
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例9: HasAutoWorkflows
public static function HasAutoWorkflows($ownerTypeID, $eventType)
{
if (!(IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc'))) {
return false;
}
$ownerTypeID = (int) $ownerTypeID;
$eventType = (int) $eventType;
$docName = self::ResolveDocumentName($ownerTypeID);
if ($docName === '') {
return false;
}
$ownerTypeName = CCrmOwnerType::ResolveName($ownerTypeID);
if ($ownerTypeName === '') {
return false;
}
$ary = CBPWorkflowTemplateLoader::SearchTemplatesByDocumentType(array('crm', $docName, $ownerTypeName), $eventType);
return !empty($ary);
}
示例10: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array("Permission" => array(), "Rewrite" => true);
$documentService = $runtime->GetService("DocumentService");
$arAllowableOperations = $documentService->GetAllowableOperations($documentType);
foreach ($arAllowableOperations as $operationKey => $operationValue) {
$arProperties["Permission"][$operationKey] = CBPHelper::UsersStringToArray($arCurrentValues["permission_" . $operationKey], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
}
$arProperties["Rewrite"] = $arCurrentValues["rewrite"] == "Y" ? "Y" : "N";
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例11: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("review_users" => "Users", "approve_type" => "ApproveType", "review_overdue_date" => "OverdueDate", "review_name" => "Name", "review_description" => "Description", "review_parameters" => "Parameters", "status_message" => "StatusMessage", "set_status_message" => "SetStatusMessage", "task_button_message" => "TaskButtonMessage", "comment_label_message" => "CommentLabelMessage", "show_comment" => "ShowComment", "timeout_duration" => "TimeoutDuration", "timeout_duration_type" => "TimeoutDurationType", "access_control" => "AccessControl");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "review_users") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
$arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["review_users"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例12: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array("Fields" => array());
$documentService = $runtime->GetService("DocumentService");
$arDocumentFields = $documentService->GetDocumentFields($documentType);
foreach ($arDocumentFields as $fieldKey => $fieldValue) {
if (!$fieldValue["Editable"]) {
continue;
}
$arFieldErrors = array();
$r = $documentService->GetFieldInputValue($documentType, $fieldValue, $fieldKey, $arCurrentValues, $arFieldErrors);
if (is_array($arFieldErrors) && !empty($arFieldErrors)) {
$arErrors = array_merge($arErrors, $arFieldErrors);
}
if ($fieldValue["BaseType"] == "user") {
if ($r === "author") {
//HACK: We can't resolve author for new document - setup target user as author.
$r = "{=Template:TargetUser}";
} elseif (is_array($r)) {
$qty = count($r);
if ($qty == 0) {
$r = null;
} elseif ($qty == 1) {
$r = $r[0];
}
}
}
if ($fieldValue["Required"] && $r == null) {
$arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $fieldValue["Name"], GetMessage("BPCDA_FIELD_REQUIED")));
}
if ($r != null) {
$arProperties["Fields"][$fieldKey] = $r;
}
}
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例13: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("sh_name" => "Name", "sh_user_id" => "UserId");
$arProperties = array();
foreach ($arMap as $key => $value) {
$arProperties[$value] = $arCurrentValues[$key];
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例14: header
header("Pragma: public");
echo $datum;
}
die;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_REQUEST['import_template'] == 'Y' && check_bitrix_sessid()) {
$APPLICATION->RestartBuffer();
//CUtil::DecodeUriComponent($_POST);
$r = 0;
$errTmp = "";
if (is_uploaded_file($_FILES['import_template_file']['tmp_name'])) {
$f = fopen($_FILES['import_template_file']['tmp_name'], "rb");
$datum = fread($f, filesize($_FILES['import_template_file']['tmp_name']));
fclose($f);
try {
$r = CBPWorkflowTemplateLoader::ImportTemplate($ID, array(MODULE_ID, ENTITY, $document_type), $_POST["import_template_autostart"], $_POST["import_template_name"], $_POST["import_template_description"], $datum);
} catch (Exception $e) {
$errTmp = $e->getMessage();
}
}
?>
<script>
<?php
if (intval($r) <= 0) {
?>
alert('<?php
echo GetMessage("BIZPROC_WFEDIT_IMPORT_ERROR") . (strlen($errTmp) > 0 ? ": " . $errTmp : "");
?>
');
<?php
} else {
示例15: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("message_user_from" => "MessageUserFrom", "message_user_to" => "MessageUserTo", "message_text" => "MessageText");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "message_user_from" || $key == "message_user_to") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
global $USER;
if ($USER->IsAdmin() || CModule::IncludeModule("bitrix24") && CBitrix24::IsPortalAdmin($USER->GetID())) {
$arProperties["MessageUserFrom"] = CBPHelper::UsersStringToArray($arCurrentValues["message_user_from"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
} else {
$arProperties["MessageUserFrom"] = "user_" . $USER->GetID();
}
//global $USER;
//if (!$USER->IsAdmin())
// $arProperties["MessageUserFrom"] = "user_".$USER->GetID();
$arProperties["MessageUserTo"] = CBPHelper::UsersStringToArray($arCurrentValues["message_user_to"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}