Beispiel #1
0
        }
        $arResult["BP"] = $arRecord;
    } else {
        $arResult["FatalErrorMessage"] .= GetMessage("BPWC_WLC_WRONG_BP") . ". ";
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
    if ("user_" . $GLOBALS["USER"]->GetID() == $arResult["BP"]["CREATED_BY"]) {
        $arCurrentUserGroups[] = "author";
    }
    $documentId = array("bizproc", "CBPVirtualDocument", $arResult["BP"]["ID"]);
    $arDocumentStates = CBPDocument::GetDocumentStates($documentType, $documentId);
    foreach ($arDocumentStates as $arDocumentState) {
        $arResult["BP"]["DOCUMENT_STATE"] = $arDocumentState;
        $ar = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentState);
        foreach ($ar as $ar1) {
            $ar1["URL"] = $APPLICATION->GetCurPageParam("bizproc_id=" . $arDocumentState["ID"] . "&process_state_event=Y&bizproc_event=" . htmlspecialcharsbx($ar1["NAME"]) . "&" . bitrix_sessid_get(), array("sessid", "stop_bizproc_id", "process_state_event", "bizproc_event", "bizproc_id"));
            $arResult["BP"]["DOCUMENT_STATE_EVENTS"][] = $ar1;
        }
        if (count($arResult["BP"]["DOCUMENT_STATE_EVENTS"]) > 0) {
            $arResult["ShowStateEvents"] = true;
        }
        $arResult["BP"]["DOCUMENT_STATE_TASKS"] = array();
        $ar = CBPDocument::GetUserTasksForWorkflow($GLOBALS["USER"]->GetID(), $arDocumentState["ID"]);
        foreach ($ar as $ar1) {
            $ar1["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASK"], array("task_id" => $ar1["ID"], "block_id" => $arParams["BLOCK_ID"]));
            $arResult["BP"]["DOCUMENT_STATE_TASKS"][] = $ar1;
        }
        if (count($arResult["BP"]["DOCUMENT_STATE_TASKS"]) > 0) {
            $arResult["ShowTasks"] = true;
Beispiel #2
0
                        }
                    }
                    if (!empty($replace)) {
                        $arPattern[] = "{=user:"******"}";
                        $arPattern[] = "{=user:user_" . $user . "}";
                        $arReplacement[] = $replace;
                        $arReplacement[] = $replace;
                    }
                }
                $strMessageTemplate = str_replace($arPattern, $arReplacement, $strMessageTemplate);
            }
            $arDumpWorkflow[] = $strMessageTemplate;
            $track = next($arDmpWorkflow);
        } while ($tmp["LEVEL"] == $track["LEVEL"]);
    }
    $arEvents = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arParams["USER_GROUPS"], $arDocumentState);
    $bEmpty = false;
    $iCount++;
    $iCountRow = 0;
    ?>
	<li class="bizproc-list-item bizproc-document-process <?php 
    echo strlen($arDocumentState["WORKFLOW_STATUS"]) > 0 ? "bizproc-document-inprogress" : "bizproc-document-finished";
    ?>
 <?php 
    echo empty($arTasks) ? "" : "bizproc-document-hastasks";
    ?>
 <?php 
    echo $iCount == 1 ? "bizproc-list-item-first" : "";
    ?>
 <?php 
    echo $iCount % 2 == 1 ? "bizproc-list-item-odd " : "bizproc-list-item-even ";
Beispiel #3
0
        if (!empty($arDocumentState['STATE_MODIFIED'])) {
            $arResult['FIELDS']['tab_1'][] = array('id' => 'BP_STATE_MODIFIED_' . $bizProcIndex, 'name' => GetMessage('CRM_FIELD_BP_STATE_MODIFIED'), 'type' => 'label', 'value' => $arDocumentState['STATE_MODIFIED']);
        }
        if (!empty($arDocumentState['STATE_NAME'])) {
            $arResult['FIELDS']['tab_1'][] = array('id' => 'BP_STATE_NAME_' . $bizProcIndex, 'name' => GetMessage('CRM_FIELD_BP_STATE_NAME'), 'type' => 'label', 'value' => strlen($arDocumentState['STATE_TITLE']) > 0 ? $arDocumentState['STATE_TITLE'] : $arDocumentState['STATE_NAME']);
        }
        if (strlen($arDocumentState['ID']) <= 0) {
            ob_start();
            CBPDocument::StartWorkflowParametersShow($arDocumentState['TEMPLATE_ID'], $arDocumentState['TEMPLATE_PARAMETERS'], 'form_' . $arResult['FORM_ID'], $varsFromForm);
            $sVal = ob_get_contents();
            ob_end_clean();
            if ($sVal !== '') {
                $arResult['FIELDS']['tab_1'][] = array('id' => 'BP_PARAMETERS', 'name' => GetMessage('CRM_FIELD_BP_PARAMETERS'), 'colspan' => true, 'type' => 'custom', 'value' => "<table>{$sVal}</table>");
            }
        }
        $_arEvents = CBPDocument::GetAllowableEvents($USER->GetID(), $CCrmBizProc->arCurrentUserGroups, $arDocumentState);
        if (count($_arEvents) > 0) {
            $arEvent = array('' => GetMessage('CRM_FIELD_BP_EMPTY_EVENT'));
            foreach ($_arEvents as $_arEvent) {
                $arEvent[$_arEvent['NAME']] = $_arEvent['TITLE'];
            }
            $arResult['FIELDS']['tab_1'][] = array('id' => 'BP_EVENTS', 'name' => GetMessage('CRM_FIELD_BP_EVENTS'), 'params' => array(), 'items' => $arEvent, 'type' => 'list', 'value' => isset($_REQUEST['bizproc_event_' . $bizProcIndex]) ? $_REQUEST['bizproc_event_' . $bizProcIndex] : '');
            $arResult['FORM_CUSTOM_HTML'] = '
					<input type="hidden" name="bizproc_id_' . $bizProcIndex . '" value="' . $arDocumentState["ID"] . '">
					<input type="hidden" name="bizproc_template_id_' . $bizProcIndex . '" value="' . $arDocumentState["TEMPLATE_ID"] . '">
			';
        }
    }
    if ($bizProcIndex > 0) {
        $arResult['BIZPROC'] = true;
    }
                    ?>
</a><?php 
                }
                ?>
</td>
		</tr>
		<?php 
            }
            ?>
		<?php 
            if (strlen($arDocumentState["ID"]) <= 0) {
                CBPDocument::StartWorkflowParametersShow($arDocumentState["TEMPLATE_ID"], $arDocumentState["TEMPLATE_PARAMETERS"], ($bCustomForm ? "tabControl" : "form_element_" . $IBLOCK_ID) . "_form", $bVarsFromForm);
            }
            ?>
		<?php 
            $arEvents = CBPDocument::GetAllowableEvents($USER->GetID(), $arCurrentUserGroups, $arDocumentState, $arIBlock["RIGHTS_MODE"] === "E");
            if (!empty($arEvents)) {
                ?>
			<tr>
				<td width="40%"><?php 
                echo GetMessage("IBEL_BIZPROC_RUN_CMD");
                ?>
</td>
				<td width="60%">
					<input type="hidden" name="bizproc_id_<?php 
                echo $bizProcIndex;
                ?>
" value="<?php 
                echo $arDocumentState["ID"];
                ?>
">
Beispiel #5
0
             if (strlen($arRecord[$key]) > 0) {
                 $arRecord[$key] .= ", ";
             }
             $arRecord[$key] .= $val;
         }
     }
 }
 $arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
 if ("user_" . $GLOBALS["USER"]->GetID() == $arRecord["CREATED_BY"]) {
     $arCurrentUserGroups[] = "author";
 }
 $documentId = array("bizproc", "CBPVirtualDocument", $arRecord["ID"]);
 $arDocumentStates = CBPDocument::GetDocumentStates($documentType, $documentId);
 foreach ($arDocumentStates as $arDocumentState) {
     $arRecord["DOCUMENT_STATE"] = $arDocumentState;
     $arRecord["DOCUMENT_STATE_EVENTS"] = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentState);
     if (count($arRecord["DOCUMENT_STATE_EVENTS"]) > 0) {
         $arResult["ShowStateEvents"] = true;
     }
     $arRecord["DOCUMENT_STATE_TASKS"] = array();
     $ar = CBPDocument::GetUserTasksForWorkflow($GLOBALS["USER"]->GetID(), $arDocumentState["ID"]);
     foreach ($ar as $ar1) {
         $ar1["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASK"], array("task_id" => $ar1["ID"], "block_id" => $arParams["BLOCK_ID"]));
         $arRecord["DOCUMENT_STATE_TASKS"][] = $ar1;
     }
     if (count($arRecord["DOCUMENT_STATE_TASKS"]) > 0) {
         $arResult["ShowTasks"] = true;
     }
     $arRecord["CancelUrl"] = "";
     //$arOperations = CBPDocument::GetAllowableOperations($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentState);
     if ($arResult["AllowAdmin"] && strlen($arDocumentState["ID"]) > 0 && strlen($arDocumentState["WORKFLOW_STATUS"]) > 0) {
function GetTasksList($iblockId, $arOrder = array("SORT" => "ASC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
    global $USER;
    $iblockId = IntVal($iblockId);
    $arFilter["IBLOCK_ID"] = $iblockId;
    $arFilter["SHOW_NEW"] = "Y";
    if (count($arSelectFields) > 0) {
        if (!in_array("IBLOCK_SECTION_ID", $arSelectFields)) {
            $arSelectFields[] = "IBLOCK_SECTION_ID";
        }
        if (!in_array("ID", $arSelectFields)) {
            $arSelectFields[] = "ID";
        }
        if (!in_array("IBLOCK_ID", $arSelectFields)) {
            $arSelectFields[] = "IBLOCK_ID";
        }
        if (!in_array("CREATED_BY", $arSelectFields)) {
            $arSelectFields[] = "CREATED_BY";
        }
    }
    $arResultList = array();
    $arCache = array();
    $isInSecurity = CModule::IncludeModule("security");
    $dbTasksList = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelectFields);
    while ($obTask = $dbTasksList->GetNextElement()) {
        $arResult = array();
        $arFields = $obTask->GetFields();
        foreach ($arFields as $fieldKey => $fieldValue) {
            if (substr($fieldKey, 0, 1) == "~") {
                continue;
            }
            $arResult[$fieldKey] = $fieldValue;
            if (in_array($fieldKey, array("MODIFIED_BY", "CREATED_BY"))) {
                $arResult[$fieldKey . "_PRINTABLE"] = CIntranetTasks::PrepareUserForPrint($fieldValue);
            } elseif ($fieldKey == "DETAIL_TEXT") {
                if ($isInSecurity) {
                    $filter = new CSecurityFilter();
                    $arResult["DETAIL_TEXT_PRINTABLE"] = $filter->TestXSS($arFields["~DETAIL_TEXT"]);
                    $arResult["DETAIL_TEXT"] = $arResult["DETAIL_TEXT_PRINTABLE"];
                } else {
                    $arResult["DETAIL_TEXT_PRINTABLE"] = nl2br($arFields["DETAIL_TEXT"]);
                    $arResult["DETAIL_TEXT"] = $arFields["DETAIL_TEXT"];
                }
            } else {
                $arResult[$fieldKey . "_PRINTABLE"] = $fieldValue;
            }
        }
        $arProperties = $obTask->GetProperties();
        foreach ($arProperties as $propertyKey => $propertyValue) {
            $arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
            if (strtoupper($propertyKey) == "TASKCOMPLETE") {
                $ps = intval($propertyValue["VALUE"]);
                if ($ps > 100) {
                    $ps = 100;
                } elseif ($ps < 0) {
                    $ps = 0;
                }
                $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = '<div class="task-complete-bar-out" title="' . GetMessage("INTASK_L_TASKCOMPLETE", array("#PRC#" => IntVal($propertyValue["VALUE"]))) . '">';
                if ($ps > 0) {
                    $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] .= '<div class="task-complete-bar-in" style="width:' . $ps . '%;"><div class="empty"></div></div>';
                }
                $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] .= '</div>';
            } elseif (strlen($propertyValue["USER_TYPE"]) > 0) {
                if ($propertyValue["USER_TYPE"] == "UserID") {
                    $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = CIntranetTasks::PrepareUserForPrint($propertyValue["VALUE"]);
                } else {
                    $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $propertyValue["VALUE"];
                }
            } elseif ($propertyValue["PROPERTY_TYPE"] == "G") {
                $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = array();
                $vx = CIntranetTasks::PrepareSectionForPrint($propertyValue["VALUE"], $propertyValue["LINK_IBLOCK_ID"]);
                foreach ($vx as $vx1 => $vx2) {
                    $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$vx1] = $vx2["NAME"];
                }
            } elseif ($propertyValue["PROPERTY_TYPE"] == "L") {
                $arResult["PROPERTY_" . $propertyKey] = array();
                $arPropertyValue = $propertyValue["VALUE"];
                $arPropertyKey = $propertyValue["VALUE_ENUM_ID"];
                if (!is_array($arPropertyValue)) {
                    $arPropertyValue = array($arPropertyValue);
                    $arPropertyKey = array($arPropertyKey);
                }
                for ($i = 0, $cnt = count($arPropertyValue); $i < $cnt; $i++) {
                    $arResult["PROPERTY_" . $propertyKey][$arPropertyKey[$i]] = $arPropertyValue[$i];
                }
                $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $arResult["PROPERTY_" . $propertyKey];
            } elseif ($propertyValue["PROPERTY_TYPE"] == "S" && $propertyValue["ROW_COUNT"] > 1) {
                if (is_array($propertyValue["VALUE"])) {
                    $arResult["PROPERTY_" . $propertyKey] = array();
                    $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = array();
                    if ($isInSecurity) {
                        foreach ($propertyValue["~VALUE"] as $k => $v) {
                            $filter = new CSecurityFilter();
                            $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k] = $filter->TestXSS($v);
                            $arResult["PROPERTY_" . $propertyKey][$k] = $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k];
                        }
                    } else {
                        foreach ($propertyValue["VALUE"] as $k => $v) {
                            $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k] = nl2br($v);
                            $arResult["PROPERTY_" . $propertyKey][$k] = $v;
                        }
                    }
                } else {
                    if ($isInSecurity) {
                        $filter = new CSecurityFilter();
                        $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $filter->TestXSS($propertyValue["~VALUE"]);
                        $arResult["PROPERTY_" . $propertyKey] = $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"];
                    } else {
                        $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = nl2br($propertyValue["VALUE"]);
                        $arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
                    }
                }
            }
        }
        $arResult["ROOT_SECTION_ID"] = 0;
        $arResult["IBLOCK_SECTION_ID_PRINTABLE"] = array();
        $v = CIntranetTasks::PrepareSectionForPrint($arResult["IBLOCK_SECTION_ID"], $iblockId);
        if (is_array($v)) {
            foreach ($v as $k1 => $v1) {
                if ($arResult["ROOT_SECTION_ID"] == 0) {
                    $arResult["ROOT_SECTION_ID"] = $k1;
                    $taskType = $v1["XML_ID"] == "users_tasks" ? "user" : "group";
                    $ownerId = $taskType == "user" ? $arResult["PROPERTY_TaskAssignedTo"] : $v1["XML_ID"];
                } else {
                    $arResult["IBLOCK_SECTION_ID_PRINTABLE"][$k1] = $v1["NAME"];
                }
            }
        }
        if (!array_key_exists($taskType . "_" . $ownerId, $arCache)) {
            $arCurrentUserGroups = array();
            if ($taskType == "group") {
                $arCurrentUserGroups[] = SONET_ROLES_ALL;
                if ($GLOBALS["USER"]->IsAuthorized()) {
                    $arCurrentUserGroups[] = SONET_ROLES_AUTHORIZED;
                }
                $r = CSocNetUserToGroup::GetUserRole($USER->GetID(), $ownerId);
                if (strlen($r) > 0) {
                    $arCurrentUserGroups[] = $r;
                }
            } else {
                $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_ALL;
                if ($GLOBALS["USER"]->IsAuthorized()) {
                    $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_AUTHORIZED;
                }
                if (CSocNetUserRelations::IsFriends($USER->GetID(), $ownerId)) {
                    $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
                }
            }
            $arCache[$taskType . "_" . $ownerId] = $arCurrentUserGroups;
        }
        $arCurrentUserGroups = $arCache[$taskType . "_" . $ownerId];
        if ($USER->GetID() == $arResult["CREATED_BY"]) {
            $arCurrentUserGroups[] = "author";
        }
        if ($USER->GetID() == $arResult["PROPERTY_TaskAssignedTo"]) {
            $arCurrentUserGroups[] = "responsible";
        }
        if (is_array($arResult["PROPERTY_TaskTrackers"]) && in_array($USER->GetID(), $arResult["PROPERTY_TaskTrackers"])) {
            $arCurrentUserGroups[] = "trackers";
        }
        $arResult["DocumentState"] = array();
        $arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), array("intranet", "CIntranetTasksDocument", $arResult["ID"]));
        $kk = array_keys($arDocumentStates);
        foreach ($kk as $k) {
            $arResult["DocumentState"] = $arDocumentStates[$k];
            $arResult["DocumentState"]["AllowableEvents"] = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentStates[$k]);
        }
        $arResult["TaskType"] = $taskType;
        $arResult["OwnerId"] = $ownerId;
        $arResult["CurrentUserCanViewTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_READ_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResult["CurrentUserCanCommentTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_COMMENT_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResult["CurrentUserCanDeleteTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_DELETE_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResult["CurrentUserCanWriteTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_WRITE_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResultList[] = $arResult;
    }
    $dbTasksList = new CDBResult();
    $dbTasksList->InitFromArray($arResultList);
    return $dbTasksList;
}
Beispiel #7
0
                echo strlen($arDocumentState["STATE_TITLE"]) > 0 ? $arDocumentState["STATE_TITLE"] : $arDocumentState["STATE_NAME"];
                ?>
					</span>
				</div>
			<?php 
            }
            ?>
			<?php 
            if (strlen($arDocumentState["ID"]) <= 0) {
                ?>
<table class="wd-bp-table-params"><?php 
                CBPDocument::StartWorkflowParametersShow($arDocumentState["TEMPLATE_ID"], $arDocumentState["TEMPLATE_PARAMETERS"], "iu_upload_form_" . $arParams["INDEX_ON_PAGE"], false);
                ?>
</table><?php 
            }
            $arEvents = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arResult["CurrentUserGroups"], $arDocumentState);
            if (count($arEvents) > 0) {
                ?>
				<div class="bizproc-workflow-template-param bizproc-field bizproc-field-events">
					<label for="" class="bizproc-field-name">
						<span class="bizproc-field-title"><?php 
                echo GetMessage("IBEL_BIZPROC_RUN_CMD");
                ?>
</span>
					</label>
					<span class="bizproc-field-value bizproc-field-value-select">
						<input type="hidden" name="bizproc_id_<?php 
                echo $bizProcIndex;
                ?>
" value="<?php 
                echo $arDocumentState["ID"];
        $TEMPLATE_ID = 0;
        $dbWorkflowTemplate = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), "SYSTEM_CODE" => "status.php", "ACTIVE" => "Y"), false, false, array("ID"));
        if ($arWorkflowTemplate = $dbWorkflowTemplate->Fetch()) {
            $TEMPLATE_ID = $arWorkflowTemplate["ID"];
        }
        $arElement = array("IBLOCK_ID" => $IBLOCK_ID, "NAME" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_NAME"), "PREVIEW_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_PREVIEW_TEXT"), "WF_STATUS_ID" => 2, "WF_NEW" => "Y", "PROPERTY_VALUES" => array("KEYWORDS" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_KEYWORDS"), "THEMES" => 4));
        $obElement = new CIBlockElement();
        $element_id = $obElement->Add($arElement);
        if ($element_id && $TEMPLATE_ID > 0) {
            $arErrorsTmp = array();
            $bpId = CBPDocument::StartWorkflow($TEMPLATE_ID, array("iblock", "CIBlockDocument", $element_id), array("Creators" => array("author"), "Approvers" => array(1)), $arErrorsTmp);
            if (count($arErrorsTmp) <= 0) {
                $arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), array("iblock", "CIBlockDocument", $element_id));
                $arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
                $arCurrentUserGroups[] = "Author";
                $arEvents = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, array_pop($arDocumentStates));
                CBPDocument::SendExternalEvent($bpId, $arEvents[0]["NAME"], array("Groups" => $arCurrentUserGroups, "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
            }
        }
    }
    //Include language one more time (after forum creation)
    __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
    //Create directory and copy files
    $search = array("#IBLOCK.ID(XML_ID=content-articles)#", "#IBLOCK.ID(XML_ID=content-news)#", "#MODULE.INSTALLED(ID=forum)#", "#FORUM.ID(NAME=content-articles)#");
    $replace = array($IBLOCK_ID, CIBlockCMLImport::GetIBlockByXML_ID("content-news"), IsModuleInstalled("forum") ? "Y" : "N", $arForum["ID"]);
    DEMO_IBlock_CopyFiles("/public/content/articles/", "/content/articles/", false, $search, $replace);
    CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/content/articles/", $_SERVER["DOCUMENT_ROOT"] . "/content/articles", false, true);
    //Add menu item
    DEMO_IBlock_AddMenuItem("/content/.left.menu.php", array(GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_MENU"), "/content/articles/", array(), array(), ""));
    CUrlRewriter::Add(array("CONDITION" => "#^/content/articles/#", "RULE" => "", "ID" => "bitrix:news", "PATH" => "/content/articles/index.php"));
}
Beispiel #9
0
                         $arResult["Task"][$fieldKey] = htmlspecialcharsbx($arFields[$fieldKey]);
                         $arResult["Task"][$fieldKey . "_PRINTABLE"] = htmlspecialcharsbx($arFields[$fieldKey]);
                     }
                 }
             }
         }
     }
 }
 if (strlen($arResult["FatalError"]) <= 0) {
     if (!$arDocumentStates) {
         $arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), $arParams["TASK_ID"] > 0 ? array("intranet", "CIntranetTasksDocument", $arParams["TASK_ID"]) : null);
     }
     $kk = array_keys($arDocumentStates);
     foreach ($kk as $k) {
         $arResult["DocumentState"] = $arDocumentStates[$k];
         $arResult["DocumentState"]["AllowableEvents"] = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentStates[$k]);
         if ($arParams["ACTION"] == "create") {
             $kk1 = array_keys($arResult["DocumentState"]["AllowableEvents"]);
             foreach ($kk1 as $k1) {
                 if ($arResult["DocumentState"]["AllowableEvents"][$k1]["NAME"] == "HEEA_NotAccepted_SetResponsibleEvent") {
                     unset($arResult["DocumentState"]["AllowableEvents"][$k1]);
                 }
             }
         }
     }
 }
 if (strlen($arResult["FatalError"]) <= 0) {
     $arResult["TaskFieldsOrder"] = array();
     foreach ($arResult["TaskFields"] as $key => $value) {
         $arResult["TaskFieldsOrder"][] = array(0 => $key, 1 => $value["PSORT"]);
     }