当前位置: 首页>>代码示例>>PHP>>正文


PHP CBPDocument::GetDocumentStates方法代码示例

本文整理汇总了PHP中CBPDocument::GetDocumentStates方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::GetDocumentStates方法的具体用法?PHP CBPDocument::GetDocumentStates怎么用?PHP CBPDocument::GetDocumentStates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPDocument的用法示例。


在下文中一共展示了CBPDocument::GetDocumentStates方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trim

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/result_modifier.php"));
__IncludeLang($file);
$arArrays = array();
$arElements = array();
$arSections = array();
$CURRENT_USER_ID = $GLOBALS["USER"]->GetID();
$CURRENT_USER_GROUPS = $GLOBALS["USER"]->GetUserGroupArray();
foreach ($arResult["ELEMENTS_ROWS"] as $i => $arRow) {
    if ($arResult["BIZPROC"] == "Y") {
        $arDocumentStates = CBPDocument::GetDocumentStates(BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]), BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arRow["data"]["ID"]));
        $USER_GROUPS = $CURRENT_USER_GROUPS;
        if ($arRow["data"]["~CREATED_BY"] == $CURRENT_USER_ID) {
            $USER_GROUPS[] = "Author";
        }
        $ii = 0;
        $html = "";
        $proccesses = false;
        if ($arResult["PROCESSES"] && $arResult["USE_COMMENTS"]) {
            $proccesses = true;
            $workflows = array();
        }
        foreach ($arDocumentStates as $kk => $vv) {
            if ($vv["ID"] && $proccesses && !empty($arRow["data"]["WORKFLOW_ID"])) {
                $workflows[] = 'WF_' . $vv["ID"];
            }
            $canViewWorkflow = CIBlockDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $CURRENT_USER_ID, $arRow["data"]["ID"], array("IBlockPermission" => $arResult["IBLOCK_PERM"], "AllUserGroups" => $USER_GROUPS, "DocumentStates" => $arDocumentStates, "WorkflowId" => $kk));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:result_modifier.php

示例2: array

							$sHTML .= '<input type="hidden" name="CATALOG_QUANTITY_TO['.$f_ID.']['.$CatGroup["ID"].']" value="'.$arRes["CATALOG_QUANTITY_TO_".$CatGroup["ID"]].'">';

							$row->AddEditField("CATALOG_GROUP_".$CatGroup["ID"], $sHTML);
						}
					}
				}
			}
		}
	}

	if ($bBizproc)
	{
		if ($f_TYPE == "E")
		{
			$arDocumentStates = CBPDocument::GetDocumentStates(
				array(MODULE_ID, ENTITY, DOCUMENT_TYPE),
				array(MODULE_ID, ENTITY, $f_ID)
			);

			$arRes["CURENT_USER_GROUPS"] = $USER->GetUserGroupArray();
			if ($arRes["CREATED_BY"] == $USER->GetID())
				$arRes["CURENT_USER_GROUPS"][] = "Author";

			$arStr = array();
			$arStr1 = array();
			foreach ($arDocumentStates as $kk => $vv)
			{
				$canViewWorkflow = call_user_func(array(ENTITY, "CanUserOperateDocument"),
					CBPCanUserOperateOperation::ViewWorkflow,
					$USER->GetID(),
					$f_ID,
					array("AllUserGroups" => $arRes["CURENT_USER_GROUPS"], "DocumentStates" => $arDocumentStates, "WorkflowId" => $kk)
开发者ID:nycmic,项目名称:bittest,代码行数:32,代码来源:iblock_list_admin.php

示例3: MakeTimeStamp

 if (isset($arContact['~ACTIVITY_TIME'])) {
     $time = MakeTimeStamp($arContact['~ACTIVITY_TIME']);
     $arContact['~ACTIVITY_EXPIRED'] = $time <= $now;
     $arContact['~ACTIVITY_IS_CURRENT_DAY'] = $arContact['~ACTIVITY_EXPIRED'] || CCrmActivity::IsCurrentDay($time);
 }
 if ($arResult['ENABLE_TASK']) {
     $arContact['PATH_TO_TASK_EDIT'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate(COption::GetOptionString('tasks', 'paths_task_user_edit', ''), array('task_id' => 0, 'user_id' => $userID)), array('UF_CRM_TASK' => 'C_' . $arContact['ID'], 'TITLE' => urlencode(GetMessage('CRM_TASK_TITLE_PREFIX')), 'TAGS' => urlencode(GetMessage('CRM_TASK_TAG')), 'back_url' => urlencode($arParams['PATH_TO_CONTACT_LIST'])));
 }
 if (IsModuleInstalled('sale')) {
     $arContact['PATH_TO_QUOTE_ADD'] = CHTTP::urlAddParams(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_QUOTE_EDIT'], array('quote_id' => 0)), array('contact_id' => $arContact['ID']));
     $arContact['PATH_TO_INVOICE_ADD'] = CHTTP::urlAddParams(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_INVOICE_EDIT'], array('invoice_id' => 0)), array('contact' => $arContact['ID']));
 }
 if ($arResult['ENABLE_BIZPROC']) {
     $arContact['BIZPROC_STATUS'] = '';
     $arContact['BIZPROC_STATUS_HINT'] = '';
     $arDocumentStates = CBPDocument::GetDocumentStates(array('crm', 'CCrmDocumentContact', 'CONTACT'), array('crm', 'CCrmDocumentContact', 'CONTACT_' . $arContact['ID']));
     $arContact['PATH_TO_BIZPROC_LIST'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arContact['ID'])), array('CRM_CONTACT_SHOW_V12_active_tab' => 'tab_bizproc'));
     $totalTaskQty = 0;
     $docStatesQty = count($arDocumentStates);
     if ($docStatesQty === 1) {
         $arDocState = $arDocumentStates[array_shift(array_keys($arDocumentStates))];
         $docTemplateID = $arDocState['TEMPLATE_ID'];
         $paramName = "BIZPROC_{$docTemplateID}";
         $docTtl = isset($arDocState['STATE_TITLE']) ? $arDocState['STATE_TITLE'] : '';
         $docName = isset($arDocState['STATE_NAME']) ? $arDocState['STATE_NAME'] : '';
         $docTemplateName = isset($arDocState['TEMPLATE_NAME']) ? $arDocState['TEMPLATE_NAME'] : '';
         if ($isInExportMode) {
             $arContact[$paramName] = $docTtl;
         } else {
             $arContact[$paramName] = '<a href="' . htmlspecialcharsbx($arContact['PATH_TO_BIZPROC_LIST']) . '">' . htmlspecialcharsbx($docTtl) . '</a>';
             $docID = $arDocState['ID'];
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例4: CheckFields

 public function CheckFields($ID = false, $bAutoExec = false, $CreatedBy = 0, $arEntityAttr = array())
 {
     global $USER;
     $this->LAST_ERROR = '';
     if (!CModule::IncludeModule('bizproc')) {
         return true;
     }
     $this->arDocumentStates = CBPDocument::GetDocumentStates(array('crm', $this->sDocument, $this->sEntityType), $ID == false ? null : array('crm', $this->sDocument, $this->sEntityType . '_' . $ID));
     $arCurrentUserGroups = $this->arCurrentUserGroups;
     if (is_object($USER)) {
         if ($ID == false) {
             $arCurrentUserGroups[] = 'Author';
             $bCanWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array('crm', $this->sDocument, $this->sEntityType), array('AllUserGroups' => $arCurrentUserGroups, 'DocumentStates' => $this->arDocumentStates, 'UserIsAdmin' => $USER->IsAdmin()));
         } else {
             if ($USER->GetID() == $CreatedBy) {
                 $arCurrentUserGroups[] = 'Author';
             }
             $bCanWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array('crm', $this->sDocument, $this->sEntityType . '_' . $ID), array('AllUserGroups' => $arCurrentUserGroups, 'DocumentStates' => $this->arDocumentStates, 'CreatedBy' => $CreatedBy != 0 ? $CreatedBy : 0, 'UserIsAdmin' => $USER->IsAdmin(), 'CRMEntityAttr' => $arEntityAttr));
         }
     } else {
         $bCanWrite = true;
     }
     if (!$bCanWrite) {
         $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
         return false;
     }
     $arBizProcParametersValues = array();
     foreach ($this->arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState['ID']) <= 0) {
             if ($bAutoExec) {
                 foreach ($arDocumentState['TEMPLATE_PARAMETERS'] as $parameterKey => $arParam) {
                     if ($arParam['Required'] && !isset($_REQUEST['bizproc' . $arDocumentState['TEMPLATE_ID'] . '_' . $parameterKey]) && strlen($arParam['Default']) > 0) {
                         $_REQUEST['bizproc' . $arDocumentState['TEMPLATE_ID'] . '_' . $parameterKey] = $arParam['Default'];
                     }
                 }
             }
             $arErrorsTmp = array();
             $arBizProcParametersValues[$arDocumentState['TEMPLATE_ID']] = CBPDocument::StartWorkflowParametersValidate($arDocumentState['TEMPLATE_ID'], $arDocumentState['TEMPLATE_PARAMETERS'], array('crm', $this->sDocument, $ID == false ? $this->sEntityType : $this->sEntityType . '_' . $ID), $arErrorsTmp);
             if (count($arErrorsTmp) > 0) {
                 $this->LAST_ERROR = '';
                 foreach ($arErrorsTmp as $e) {
                     $this->LAST_ERROR .= $e['message'] . '<br />';
                 }
                 return false;
             }
         }
     }
     return $arBizProcParametersValues;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:crm_bizproc.php

示例5: FormatDateFromDB

     $data["MODIFIED_BY"] = "[" . $data["MODIFIED_BY"] . "] " . $data["USER_NAME"];
 }
 if (isset($data["ACTIVE_FROM"])) {
     $data['ACTIVE_FROM'] = FormatDateFromDB($data['ACTIVE_FROM']);
 }
 if (isset($data["ACTIVE_TO"])) {
     $data['ACTIVE_TO'] = FormatDateFromDB($data['ACTIVE_TO']);
 }
 if (isset($data["DATE_CREATE"])) {
     $data['DATE_CREATE'] = FormatDateFromDB($data['DATE_CREATE']);
 }
 if (isset($data["TIMESTAMP_X"])) {
     $data['TIMESTAMP_X'] = FormatDateFromDB($data['TIMESTAMP_X']);
 }
 if (CModule::IncludeModule("bizproc")) {
     $documentStates = CBPDocument::GetDocumentStates(BizProcDocument::generateDocumentComplexType($arIBlock["IBLOCK_TYPE_ID"], $arIBlock["ID"]), BizProcDocument::getDocumentComplexId($arIBlock["IBLOCK_TYPE_ID"], $data["ID"]));
     if ($arResult["PROCESSES"] && $arResult["USE_COMMENTS"]) {
         if (!empty($documentStates)) {
             $stateTemporary = current($documentStates);
             $data["WORKFLOW_ID"] = $stateTemporary["ID"];
         } else {
             $data["WORKFLOW_ID"] = '';
         }
     }
 }
 $arUserGroupsForBPTmp = $arUserGroupsForBP;
 if ($USER->GetID() == $data["CREATED_BY"]) {
     $arUserGroupsForBPTmp[] = "Author";
 }
 $arBPStart = array();
 if (CModule::IncludeModule('bizproc')) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例6: GetMessage

?>
</td>
	</tr>
	<?
	$tabControl->EndCustomField("BIZPROC_WF_STATUS", '');

	$tabControl->BeginCustomField("BIZPROC", GetMessage("IBEL_E_TAB_BIZPROC"));

	CBPDocument::AddShowParameterInit(MODULE_ID, "only_users", DOCUMENT_TYPE);

	$bizProcIndex = 0;
	if (!isset($arDocumentStates))
	{
		$arDocumentStates = CBPDocument::GetDocumentStates(
			array(MODULE_ID, ENTITY, DOCUMENT_TYPE),
			($ID > 0) ? array(MODULE_ID, ENTITY, $ID) : null,
			"Y"
		);
	}
	foreach ($arDocumentStates as $arDocumentState)
	{
		$bizProcIndex++;
		if (strlen($arDocumentState["ID"]) > 0)
		{
			$canViewWorkflow = CBPDocument::CanUserOperateDocument(
				CBPCanUserOperateOperation::ViewWorkflow,
				$GLOBALS["USER"]->GetID(),
				array(MODULE_ID, ENTITY, $ID),
				array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"] > 0 ? $arDocumentState["ID"] : $arDocumentState["TEMPLATE_ID"])
			);
		}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:iblock_element_edit.php

示例7: executeComponent

 public function executeComponent()
 {
     if (!empty($this->arParams['ERROR'])) {
         ShowError(array_shift($this->arParams['ERROR']));
         return;
     }
     $this->arResult['USER_ID'] = $this->arParams['USER_ID'];
     $this->arResult['GRID_ID'] = 'lists_processes';
     $selectFields = array('ID', 'IBLOCK_TYPE_ID', 'IBLOCK_ID', 'NAME');
     $gridOptions = new CGridOptions($this->arResult['GRID_ID']);
     $gridColumns = $gridOptions->getVisibleColumns();
     $gridSort = $gridOptions->getSorting(array('sort' => array('ID' => 'desc')));
     $this->arResult['HEADERS'] = array(array("id" => "ID", "name" => "ID", "default" => false, "sort" => "ID"), array('id' => 'DOCUMENT_NAME', 'name' => Loc::getMessage('CC_BLL_DOCUMENT_NAME'), 'default' => true, 'sort' => 'DOCUMENT_NAME'), array('id' => 'COMMENTS', 'name' => Loc::getMessage('CC_BLL_COMMENTS'), 'default' => true, 'sort' => '', 'hideName' => true, 'iconCls' => 'bp-comments-icon'), array('id' => 'WORKFLOW_PROGRESS', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_PROGRESS'), 'default' => true, 'sort' => ''), array('id' => 'WORKFLOW_STATE', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_STATE'), 'default' => false, 'sort' => ''));
     $this->arResult['FILTER'] = array(array("id" => "NAME", "name" => GetMessage("BPATL_NAME"), "type" => "string"), array('id' => 'TIMESTAMP_X', 'name' => Loc::getMessage('CC_BLL_MODIFIED'), 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => Loc::getMessage('CC_BLL_CREATED'), 'type' => 'date', 'default' => true));
     $gridFilter = $gridOptions->getFilter($this->arResult['FILTER']);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (in_array($newKey, array("TIMESTAMP_X", 'DATE_CREATE'))) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
         }
         $filter[$op . $newKey] = $value;
     }
     $this->arResult['SORT'] = $gridSort['sort'];
     $useComments = (bool) CModule::includeModule("forum");
     $workflows = array();
     $this->arResult['DATA'] = array();
     $this->arResult["COMMENTS_COUNT"] = array();
     $filter['CREATED_BY'] = $this->arParams['USER_ID'];
     $iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     $filter['IBLOCK_TYPE'] = $iblockTypeId;
     $filter['CHECK_PERMISSIONS'] = $this->arParams['LIST_PERM'] >= CListPermissions::CAN_READ ? "N" : "Y";
     $elementObject = CIBlockElement::getList($gridSort['sort'], $filter, false, $gridOptions->getNavParams(), $selectFields);
     $documentState = true;
     $path = rtrim(SITE_DIR, '/');
     while ($element = $elementObject->fetch()) {
         $documentState = CBPDocument::GetDocumentStates(BizprocDocument::generateDocumentComplexType($iblockTypeId, $element['IBLOCK_ID']), BizprocDocument::getDocumentComplexId($iblockTypeId, $element['ID']));
         $this->arResult['DATA'][$element['ID']]['ID'] = $element['ID'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_NAME'] = $element['NAME'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_URL'] = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $element["IBLOCK_ID"] . '&element_id=' . $element['ID'];
         if (!empty($documentState)) {
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = true;
             $documentState = current($documentState);
             $this->arResult['DATA'][$element['ID']]['WORKFLOW_ID'] = $documentState['ID'];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_NAME"] = $documentState["TEMPLATE_NAME"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STATE"] = $documentState["STATE_TITLE"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED"] = FormatDateFromDB($documentState["STARTED_FORMATTED"]);
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = "";
             if (intval($documentState["STARTED_BY"]) > 0) {
                 $dbUserTmp = CUser::getByID($documentState["STARTED_BY"]);
                 $arUserTmp = $dbUserTmp->fetch();
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = CUser::FormatName($this->arParams["NAME_TEMPLATE"], $arUserTmp, true);
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] .= " [" . $documentState["STARTED_BY"] . "]";
             }
             $this->arResult['DATA'][$element['ID']]['MODULE_ID'] = $documentState["DOCUMENT_ID"][0];
             $this->arResult['DATA'][$element['ID']]['ENTITY'] = $documentState["DOCUMENT_ID"][1];
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_ID'] = $documentState["DOCUMENT_ID"][2];
         } else {
             $documentState = false;
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = false;
         }
     }
     foreach ($this->arResult['DATA'] as $data) {
         if ($documentState) {
             if ($useComments) {
                 $workflows[] = 'WF_' . $data['WORKFLOW_ID'];
             }
         }
         $actions = array();
         if (strlen($data["DOCUMENT_URL"]) > 0) {
             $actions[] = array('ICONCLASS' => '', 'DEFAULT' => false, 'TEXT' => Loc::getMessage('CC_BLL_C_DOCUMENT'), 'ONCLICK' => 'window.open("' . $data["DOCUMENT_URL"] . '");');
         }
         $this->arResult['RECORDS'][] = array('data' => $data, 'actions' => $actions);
     }
     if ($useComments && $documentState) {
         $workflows = array_unique($workflows);
         if ($workflows) {
             $iterator = CForumTopic::getList(array(), array("@XML_ID" => $workflows));
             while ($row = $iterator->fetch()) {
                 $this->arResult["COMMENTS_COUNT"][$row['XML_ID']] = $row['POSTS'];
             }
         }
     }
     $this->arResult['COUNTERS'] = array('all' => 0);
     $this->arResult["ROWS_COUNT"] = $elementObject->selectedRowsCount();
     $this->arResult["NAV_RESULT"] = $elementObject;
     if ($this->arParams['SET_TITLE'] == 'Y') {
         $this->getApplication()->setTitle(Loc::getMessage('CC_BLL_TITLE'));
     }
     $this->includeComponentTemplate();
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:class.php

示例8: trim

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/result_modifier.php"));
__IncludeLang($file);
$arArrays = array();
$arElements = array();
$arSections = array();
$CURRENT_USER_ID = $GLOBALS["USER"]->GetID();
$CURRENT_USER_GROUPS = $GLOBALS["USER"]->GetUserGroupArray();
foreach ($arResult["ELEMENTS_ROWS"] as $i => $arRow) {
    if ($arResult["BIZPROC"] == "Y") {
        $arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $arResult["IBLOCK_ID"]), array("iblock", "CIBlockDocument", $arRow["data"]["ID"]));
        $USER_GROUPS = $CURRENT_USER_GROUPS;
        if ($arRow["data"]["~CREATED_BY"] == $CURRENT_USER_ID) {
            $USER_GROUPS[] = "Author";
        }
        $ii = 0;
        $html = "";
        foreach ($arDocumentStates as $kk => $vv) {
            $canViewWorkflow = CIBlockDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $CURRENT_USER_ID, $arRow["data"]["ID"], array("IBlockPermission" => $arResult["IBLOCK_PERM"], "AllUserGroups" => $USER_GROUPS, "DocumentStates" => $arDocumentStates, "WorkflowId" => $kk));
            if (!$canViewWorkflow) {
                continue;
            }
            if (strlen($vv["TEMPLATE_NAME"]) > 0) {
                $html .= "<b>" . $vv["TEMPLATE_NAME"] . "</b>:<br />";
            } else {
                $html .= "<b>" . ++$ii . "</b>:<br />";
            }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:result_modifier.php

示例9: GetTasksList


//.........这里部分代码省略.........
                    $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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasks_convert_admin.php

示例10: CheckWebRights

 function CheckWebRights($method = "", $arParams = array(), $simple = true)
 {
     if ($this->withoutAuthorization) {
         return true;
     }
     $strong = $method !== "";
     $path = '';
     if (is_array($arParams['arElement'])) {
         $path = isset($arParams['arElement']['item_id']) ? $arParams['arElement']['item_id'] : '';
     } elseif (is_string($arParams['arElement'])) {
         $path = $arParams['arElement'];
     }
     $result = $this->CheckRights($method, $strong, $path);
     if (!$result || $simple) {
         return $result;
     }
     $arError = array();
     $action = strtolower(is_set($arParams, "action") ? $arParams["action"] : $arParams["ACTION"]);
     $arElement = is_set($arParams, "arElement") ? $arParams["arElement"] : array();
     static $arErrors = array();
     $static_id = md5(serialize(array($action, $arElement["ID"], $GLOBALS["USER"]->GetID())));
     if (array_key_exists($static_id, $arErrors)) {
         $arError = $arErrors[$static_id];
     } else {
         if ($this->e_rights) {
             foreach (array('arElement', 'from', 'to') as $elm) {
                 if (is_set($arParams, $elm)) {
                     if ((!isset($arParams[$elm]['not_found']) || $arParams[$elm]['not_found'] === true) && !in_array($action, array('create', 'copy', 'move', 'mkcol'))) {
                         $arError[] = array("id" => "bad_element", "text" => GetMessage("WD_FILE_ERROR105"));
                     }
                 }
             }
             if (empty($arError)) {
                 if ($action == 'copy') {
                     //from[]
                     //to[]
                     $arTo = isset($arParams['to']) ? $arParams['to'] : array();
                     $arFrom = isset($arParams['from']) ? $arParams['from'] : array();
                     $nCount = min(sizeof($arTo), sizeof($arFrom));
                     for ($i = 0; $i < $nCount; $i++) {
                         $To = $arTo[$i];
                         $From = $arFrom[$i];
                         $type = $To['is_file'] ? 'ELEMENT' : 'SECTION';
                         $id = $To['not_found'] ? $To['parent_id'] : $To['item_id'];
                         $op = $From['is_file'] ? 'section_element_bind' : 'section_section_bind';
                         if (!$this->GetPermission($type, $id, $op)) {
                             $arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
                         }
                     }
                 } elseif ($action == 'create' || $action == 'mkcol') {
                     //arElement
                     //null
                     if (empty($arElement)) {
                         $arParent = $this->GetObject();
                         $bAllowEdit = false;
                         if ($arParent['not_found'] === false) {
                             $bAllowEdit = $this->GetPermission($arParent['is_file'] ? 'ELEMENT' : 'SECTION', $arParent['item_id'], 'element_edit');
                         }
                         return $bAllowEdit;
                     } else {
                         $type = 'SECTION';
                         if (isset($arElement['parent_id']) && $arElement['parent_id'] > 0) {
                             $id = $arElement['parent_id'];
                         } else {
                             $id = $this->IBLOCK_ID;
                             $type = 'IBLOCK';
                         }
                         if ($action == 'mkcol') {
                             return $this->GetPermission($type, $id, 'section_section_bind');
                         }
                         if ($arElement['is_dir']) {
                             if (!$this->GetPermission($type, $id, 'section_section_bind')) {
                                 $arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
                             }
                         } else {
                             if (!empty($arParams['create_element_in_section']) || $this->workflow != "workflow" && $this->workflow != "bizproc") {
                                 if (!$this->GetPermission($type, $id, 'section_element_bind')) {
                                     $arError[] = array("id" => "cannot_create", "text" => GetMessage("WD_ACCESS_DENIED"));
                                 }
                             } elseif ($this->workflow == "workflow") {
                                 $db_res = CWorkflowStatus::GetDropDownList("N", "desc");
                                 if (!($db_res && ($res = $db_res->Fetch()))) {
                                     $arError[] = array("id" => "bad_wf_statuses", "text" => GetMessage("WD_ACCESS_DENIED"));
                                 }
                             } elseif ($this->workflow == 'bizproc') {
                                 $arDocumentStates = CBPDocument::GetDocumentStates($this->wfParams['DOCUMENT_TYPE'], null);
                                 $arUserGroups = $this->USER["GROUPS"];
                                 $arUserGroups[] = "Author";
                                 $canWrite = false;
                                 if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), $this->wfParams['DOCUMENT_TYPE'], array("IBlockPermission" => $this->permission, "AllUserGroups" => $arUserGroups, "DocumentStates" => $arDocumentStates))) {
                                     $arError[] = array("id" => "bad_bizproc_permision", "text" => GetMessage("WD_ACCESS_DENIED"));
                                 }
                             }
                         }
                     }
                 } elseif ($action == 'delete' || $action == 'undelete') {
                     //arElement
                     $type = $arElement['is_dir'] ? 'SECTION' : 'ELEMENT';
                     if ($type == 'ELEMENT') {
                         $res = $this->GetPermission($type, $arElement['item_id'], 'element_delete');
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:iblock.php

示例11: array

                    }
                    $bpId = $arBizProcWorkflowId[$bpTemplateId];
                }
                $needUpdateStatesList = true;
                $arErrorTmp = array();
                CBPDocument::SendExternalEvent($bpId, $bpEvent, array("Groups" => $arParams["USER_GROUPS"], "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
                if (count($arErrorsTmp) > 0) {
                    foreach ($arErrorsTmp as $e) {
                        $strWarning .= $e["message"] . "<br />";
                    }
                    $arError[] = array("id" => "update_workfow", "text" => $strWarning);
                }
            }
        }
        if ($needUpdateStatesList && empty($arError)) {
            $arResult['DOCUMENT_STATES'] = CBPDocument::GetDocumentStates($arParams["DOCUMENT_TYPE"], $arParams["DOCUMENT_ID"]);
        }
    }
    if (!empty($arError)) {
        $e = new CAdminException($arError);
        $arResult["ERROR_MESSAGE"] = $e->GetString();
    } else {
        $url = !empty($arParams["back_url"]) ? $arParams["back_url"] : $APPLICATION->GetCurPageParam("", array("action", "id", "sessid"));
        $url = empty($_POST["apply"]) ? $url : $APPLICATION->GetCurPageParam("", array("action", "id", "sessid"));
        if (isset($_REQUEST['action'])) {
            LocalRedirect($url);
        }
    }
}
/********************************************************************
				/Action
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例12: array

// Contacts selector
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_contacts', 'name' => GetMessage('CRM_SECTION_CONTACTS'), 'type' => 'section');
if (CCrmContact::CheckReadPermission(0, $userPermissions)) {
    ob_start();
    $GLOBALS['APPLICATION']->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'INPUT_VALUE' => isset($arResult['CONTACT_ID']) ? $arResult['CONTACT_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'Y'), false, array('HIDE_ICONS' => 'Y'));
    $sVal = ob_get_contents();
    ob_end_clean();
    $arResult['FIELDS']['tab_1'][] = array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_FIELD_CONTACT_ID'), 'type' => 'custom', 'wrap' => true, 'value' => $sVal);
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_additional', 'name' => GetMessage('CRM_SECTION_ADDITIONAL'), 'type' => 'section');
$CCrmUserType->AddFields($arResult['FIELDS']['tab_1'], $arResult['ELEMENT']['ID'], $arResult['FORM_ID'], $bConvert ? isset($arParams['~VARS_FROM_FORM']) && $arParams['~VARS_FROM_FORM'] === true : $bVarsFromForm, false, false, array('FILE_URL_TEMPLATE' => "/bitrix/components/bitrix/crm.company.show/show_file.php?ownerId=#owner_id#&fieldName=#field_name#&fileId=#file_id#"));
if (IsModuleInstalled('bizproc')) {
    CBPDocument::AddShowParameterInit('crm', 'only_users', 'COMPANY');
    $bizProcIndex = 0;
    if (!isset($arDocumentStates)) {
        $arDocumentStates = CBPDocument::GetDocumentStates(array('crm', 'CCrmDocumentCompany', 'COMPANY'), $bEdit ? array('crm', 'CCrmDocumentCompany', 'COMPANY_' . $arResult['ELEMENT']['ID']) : null);
    }
    foreach ($arDocumentStates as $arDocumentState) {
        $bizProcIndex++;
        $canViewWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $USER->GetID(), array('crm', 'CCrmDocumentCompany', $bEdit ? 'COMPANY_' . $arResult['ELEMENT']['ID'] : 'COMPANY_0'), array('UserGroups' => $CCrmBizProc->arCurrentUserGroups, 'DocumentStates' => $arDocumentStates, 'WorkflowId' => $arDocumentState['ID'] > 0 ? $arDocumentState['ID'] : $arDocumentState['TEMPLATE_ID'], 'CreatedBy' => $arResult['ELEMENT']['ASSIGNED_BY'], 'UserIsAdmin' => $USER->IsAdmin()));
        if (!$canViewWorkflow) {
            continue;
        }
        $arResult['FIELDS']['tab_1'][] = array('id' => 'section_bp_name_' . $bizProcIndex, 'name' => $arDocumentState['TEMPLATE_NAME'], 'type' => 'section');
        if ($arDocumentState['TEMPLATE_DESCRIPTION'] != '') {
            $arResult['FIELDS']['tab_1'][] = array('id' => 'BP_DESC_' . $bizProcIndex, 'name' => GetMessage('CRM_FIELD_BP_TEMPLATE_DESC'), 'type' => 'label', 'colspan' => true, 'value' => $arDocumentState['TEMPLATE_DESCRIPTION']);
        }
        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'])) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例13: getCommentsProcess

 protected function getCommentsProcess($elementId)
 {
     $countComments = 0;
     $this->arResult["ELEMENTS_HEADERS"]["COMMENTS"] = Loc::getMessage("CC_BLL_COMMENTS");
     if (!$this->arResult["BIZPROC"] || !$elementId) {
         return $countComments;
     }
     $documentStates = CBPDocument::GetDocumentStates(BizProcDocument::generateDocumentComplexType($this->arParams["IBLOCK_TYPE_ID"], $this->arResult["IBLOCK_ID"]), BizProcDocument::getDocumentComplexId($this->arParams["IBLOCK_TYPE_ID"], $elementId));
     if (!empty($documentStates)) {
         $state = current($documentStates);
     } else {
         return $countComments;
     }
     $query = CForumTopic::getList(array(), array("@XML_ID" => 'WF_' . $state["ID"]));
     while ($row = $query->fetch()) {
         $countComments = $row["POSTS"];
     }
     return $countComments;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:19,代码来源:class.php

示例14: array

    }
}
$arTabSection = array(array("id" => "IBLOCK_SECTION_ID", "name" => $arResult["IBLOCK"]["SECTIONS_NAME"], "type" => 'list', "items" => $arResult["LIST_SECTIONS"], "params" => array("size" => 15)));
$arTabs = array(array("id" => "tab_el", "name" => $arResult["IBLOCK"]["ELEMENT_NAME"], "icon" => "", "fields" => $arTabElement), array("id" => "tab_se", "name" => $arResult["IBLOCK"]["SECTION_NAME"], "icon" => "", "fields" => $arTabSection));
$custom_html = "";
if (CModule::IncludeModule("bizproc") && $arResult["IBLOCK"]["BIZPROC"] != "N") {
    $arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
    if (!$arResult["ELEMENT_FIELDS"] || $arResult["ELEMENT_FIELDS"]["CREATED_BY"] == $GLOBALS["USER"]->GetID()) {
        $arCurrentUserGroups[] = "Author";
    }
    $DOCUMENT_TYPE = "iblock_" . $arResult["IBLOCK_ID"];
    CBPDocument::AddShowParameterInit("iblock", "only_users", $DOCUMENT_TYPE);
    $arTab2Fields = array();
    $arTab2Fields[] = array("id" => "BIZPROC_WF_STATUS", "name" => GetMessage("CT_BLEE_BIZPROC_PUBLISHED"), "type" => "label", "value" => $arResult["ELEMENT_FIELDS"]["BP_PUBLISHED"] == "Y" ? GetMessage("MAIN_YES") : GetMessage("MAIN_NO"));
    $bizProcIndex = 0;
    $arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), $arResult["ELEMENT_ID"] > 0 ? array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]) : null, "Y");
    $custom_html .= '<input type="hidden" name="stop_bizproc" id="stop_bizproc" value="">';
    $runtime = CBPRuntime::GetRuntime();
    $runtime->StartRuntime();
    $documentService = $runtime->GetService("DocumentService");
    foreach ($arDocumentStates as $arDocumentState) {
        $bizProcIndex++;
        if ($arResult["ELEMENT_ID"] > 0) {
            $canViewWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"] > 0 ? $arDocumentState["ID"] : $arDocumentState["TEMPLATE_ID"]));
        } else {
            $canViewWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), array("iblock", "CIBlockDocument", "iblock_" . $arResult["IBLOCK_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"] > 0 ? $arDocumentState["ID"] : $arDocumentState["TEMPLATE_ID"]));
        }
        if ($canViewWorkflow) {
            $arTab2Fields[] = array("id" => "BIZPROC_TITLE" . $bizProcIndex, "name" => $arDocumentState["TEMPLATE_NAME"], "type" => "section");
            if (strlen($arDocumentState["ID"]) && strlen($arDocumentState["WORKFLOW_STATUS"]) && CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_rights_edit")) {
                $arTab2Fields[] = array("id" => "BIZPROC_STOP" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_STOP_LABEL"), "type" => "label", "value" => '<a href="javascript:jsStopBP(\'' . CUtil::JSEscape('form_' . $arResult["FORM_ID"]) . '\', \'' . CUtil::JSEscape($arDocumentState["ID"]) . '\');">' . GetMessage("CT_BLEE_BIZPROC_STOP") . '</a>');
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:template.php

示例15: UpdateListItems


//.........这里部分代码省略.........
                     $arFields['PROPERTY_TaskPriority'] = $arPrior[0];
                 }
                 if ($assigned_to = $arData['AssignedTo']) {
                     if ($USER_ID = $this->__getUser($assigned_to)) {
                         $arFields['PROPERTY_TaskAssignedTo'] = $USER_ID;
                     } else {
                         $obErrorCode->setData('0x81020054');
                         $bUpdate = false;
                     }
                 }
                 if ($bUpdate) {
                     $bConfirm = false;
                     $bComplete = false;
                     if ($arData['_command'] != 'New') {
                         if (false && $arElement['PROPERTY_VERSION'] > $arData['owshiddenversion']) {
                             $obErrorCode->setData('0x81020015');
                             $bUpdate = false;
                         } else {
                             foreach ($arElement as $fld => $value) {
                                 if (substr($fld, 0, 9) == 'PROPERTY_') {
                                     if (!$arFields[$fld] && $fld != 'PROPERTY_TaskFiles') {
                                         $arFields[$fld] = $arElement[$fld];
                                     }
                                 }
                             }
                             $arFields['PROPERTY_VERSION']++;
                         }
                         $statusOld = $this->__GetTaskStatus($arElement['ID'], $arElement['IBLOCK_ID']);
                     } else {
                         $arFields['PROPERTY_VERSION'] = $arData['owshiddenversion'];
                         $statusOld = -1;
                     }
                     if (!$arFields['PROPERTY_TaskPriority']) {
                         $arFields['PROPERTY_TaskPriority'] = 2;
                     }
                     if (!$arFields['PROPERTY_TaskAssignedTo']) {
                         $arFields['PROPERTY_TaskAssignedTo'] = $USER->GetID();
                     } elseif ($arFields['PROPERTY_TaskAssignedTo'] != $USER->GetID()) {
                         $arData['Status'] = 'NotAccepted';
                     }
                     $statusNew = $arData['Status'] ? $arStatusXML_ID[$arData['Status']] : $statusOld;
                     $ID = 0;
                     if ($bUpdate) {
                         $arError = false;
                         if ($arData['_command'] == 'New') {
                             if ($ID = CIntranetTasks::Add($arFields, $arError)) {
                                 $arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $this->IBLOCK_ID), null);
                                 $arDocumentStates = array_values($arDocumentStates);
                                 $pathTemplate = str_replace(array("#USER_ID#", "#TASK_ID#"), array($USER->GetID(), "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_user_entry", "/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/"));
                                 $arErrors = array();
                                 CBPDocument::StartWorkflow($arDocumentStates[0]["TEMPLATE_ID"], array("intranet", "CIntranetTasksDocument", $ID), array("OwnerId" => $arFields['PROPERTY_TaskAssignedTo'], "TaskType" => 'user', "PathTemplate" => $pathTemplate, "ForumId" => COption::GetOptionInt('intranet', 'task_forum_id', 0), "IBlockId" => $this->IBLOCK_ID), $arErrors);
                                 CIntranetTasks::ChangeStatus($ID, $statusNew);
                                 $arReplicationIDs[$ID] = $arData['MetaInfo_ReplicationID'];
                                 $obErrorCode->setData('0x00000000');
                             }
                         } else {
                             if (CIntranetTasks::Update($arData['ID'], $arFields, $arError)) {
                                 if ($statusOld != $statusNew) {
                                     CIntranetTasks::ChangeStatus($arData['ID'], $statusNew);
                                 }
                                 $ID = $arData['ID'];
                                 $obErrorCode->setData('0x00000000');
                             }
                         }
                         if (is_array($arError) && count($arError) > 0) {
                             $ID = 0;
                             $obErrorCode->setData('0x81020014');
                             $bUpdate = false;
                         } else {
                             $taskType = $arElement ? $arElement['taskType'] : 'user';
                             $ownerId = $arElement ? $arElement['ownerId'] : $USER->GetID();
                             $arParams = $arElement ? $arElement['arParams'] : array('PATH_TO_USER_TASKS_TASK' => str_replace(array('#USER_ID#', '#GROUP_ID#', '#TASK_ID#'), array($USER->GetID(), $arSection['XML_ID'], $ID), $arPaths['user']));
                         }
                     }
                 }
             }
         }
         if ($ID > 0) {
             $arResponseRows[$ID] = $obResponseRow;
         } else {
             $arResponseRowsError[] = $obResponseRow;
         }
     }
     $dbRes = CIntranetTasks::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => $this->IBLOCK_ID, 'ID' => array_keys($arResponseRows)));
     while ($arRes = $dbRes->Fetch()) {
         if ($arResponseRows[$arRes['ID']]) {
             $obRow = $this->__getRow($arRes, $listName, $last_change = 0);
             if ($arReplicationIDs[$arRes['ID']]) {
                 $obRow->setAttribute('ows_MetaInfo_ReplicationID', $arReplicationIDs[$arRes['ID']]);
             }
             $obRow->setAttribute('xmlns:z', "#RowsetSchema");
             $arResponseRows[$arRes['ID']]->addChild($obRow);
             $obResponse->addChild($arResponseRows[$arRes['ID']]);
         }
     }
     foreach ($arResponseRowsError as $obChange) {
         $obResponse->addChild($obChange);
     }
     return array('UpdateListItemsResult' => $obResponse);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:ws_tasks.php


注:本文中的CBPDocument::GetDocumentStates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。