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


PHP CBPWorkflowTemplateLoader::Add方法代码示例

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


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

示例1: __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);
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:57,代码来源:webdav.php

示例2: array_keys

 global $CACHE_MANAGER;
 $CACHE_MANAGER->Clean("component_bizproc_wizards_templates");
 if (intval($arResult["Data"]["Image"]) > 0) {
     CFile::Delete($arResult["Data"]["Image"]);
 }
 if ($arParams["BLOCK_ID"] <= 0 && strlen($arResult["Data"]["Template"]) > 0) {
     $arVariables = false;
     if (method_exists($bpTemplateObject, "GetVariables")) {
         $arVariables = $bpTemplateObject->GetVariables();
         $ks = array_keys($arVariables);
         foreach ($ks as $k) {
             $arVariables[$k]["Default"] = $arResult["Data"]["TemplateVariables"][$k];
         }
     }
     $arFieldsT = array("DOCUMENT_TYPE" => array("bizproc", "CBPVirtualDocument", "type_" . $iblockId), "AUTO_EXECUTE" => CBPDocumentEventType::Create, "NAME" => $arResult["Data"]["Name"], "DESCRIPTION" => $arResult["Data"]["Description"], "TEMPLATE" => $bpTemplateObject->GetTemplate(), "PARAMETERS" => $bpTemplateObject->GetParameters(), "VARIABLES" => $arVariables, "USER_ID" => $GLOBALS["USER"]->GetID(), "ACTIVE" => 'Y', "MODIFIER_USER" => new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     CBPWorkflowTemplateLoader::Add($arFieldsT);
     if (method_exists($bpTemplateObject, "GetDocumentFields")) {
         $runtime = CBPRuntime::GetRuntime();
         $runtime->StartRuntime();
         $arResult["DocumentService"] = $runtime->GetService("DocumentService");
         $arDocumentFields = $bpTemplateObject->GetDocumentFields();
         if ($arDocumentFields && is_array($arDocumentFields) && count($arDocumentFields) > 0) {
             foreach ($arDocumentFields as $f) {
                 $arResult["DocumentService"]->AddDocumentField(array("bizproc", "CBPVirtualDocument", "type_" . $iblockId), $f);
             }
         }
     }
 }
 $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LIST"], array("block_id" => $iblockId));
 $redirectPath .= (strpos($redirectPath, "?") !== false ? "&" : "?") . "template_type=" . $arResult["NewTemplateType"];
 LocalRedirect($redirectPath);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例3: AddDefaultWorkflowTemplates

	public static function AddDefaultWorkflowTemplates($documentType, $additionalModuleId = null)
	{
		if (!empty($additionalModuleId))
		{
			$additionalModuleId = preg_replace("/[^a-z0-9_.]/i", "", $additionalModuleId);
			$arModule = array($additionalModuleId, $documentType[0], 'bizproc');
		}
		else
		{
			$arModule = array($documentType[0], 'bizproc');
		}

		$bIn = false;
		foreach ($arModule as $sModule)
		{
			if($handle = opendir($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.$sModule.'/templates'))
			{
				$bIn = true;
				while(false !== ($file = readdir($handle)))
				{
					if(!is_file($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.$sModule.'/templates/'.$file))
						continue;
					$arFields = false;
					include($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.$sModule.'/templates/'.$file);
					if(is_array($arFields))
					{
						/*
						 * If DOCUMENT_TYPE not defined, use current documentType
						 * Overwise check if DOCUMENT_TYPE equals to current documentType
						 */
						if (!array_key_exists("DOCUMENT_TYPE", $arFields))
							$arFields["DOCUMENT_TYPE"] = $documentType;
						elseif($arFields["DOCUMENT_TYPE"] != $documentType)
							continue;
						
						$arFields["SYSTEM_CODE"] = $file;
						if(is_object($GLOBALS['USER']))
							$arFields["USER_ID"] = $GLOBALS['USER']->GetID();
						$arFields["MODIFIER_USER"] = new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser);
						try
						{
							CBPWorkflowTemplateLoader::Add($arFields);
						}
						catch (Exception $e)
						{
						}
					}
				}
				closedir($handle);
			}
			if ($bIn)
				break;
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:54,代码来源:document.php

示例4: addBP

 /**
  *
  * 1) шаг первый - создание Инфоблока
  * 2) шаг второй - создание шаблона Бизнес-Процесса
  * @param array $arResult - массив с данными
  * @param array $arParams - 
  */
 public static function addBP($arResult, $arParams)
 {
     if (!CModule::IncludeModule("iblock")) {
         ShowError('Нет модуля iblock');
     }
     if (!CModule::IncludeModule("bizproc")) {
         ShowError('Нет модуля bizproc');
     }
     $ib = new CIBlock();
     $description = 'описание';
     /*
      ШАГ 1
     */
     $arFields = array("IBLOCK_TYPE_ID" => $arParams["IBLOCK_TYPE"], "LID" => "s1", "NAME" => $arResult["Data"]["Name"], "CODE" => "select_color", "ACTIVE" => 'Y', "SORT" => $arResult["Data"]["Sort"], "PICTURE" => intval($arResult["Data"]["Image"]) > 0 ? CFile::MakeFileArray($arResult["Data"]["Image"]) : false, "DESCRIPTION" => $description, "DESCRIPTION_TYPE" => 'text', "WORKFLOW" => 'N', "BIZPROC" => 'Y', "VERSION" => 1, "ELEMENT_ADD" => $arResult["Data"]["ElementAdd"]);
     foreach ($arResult["Data"]["UserGroups"] as $v) {
         $arFields["GROUP_ID"][$v] = "R";
     }
     if ($arParams["BLOCK_ID"] <= 0) {
         $opRes = $iblockId = $ib->Add($arFields);
     } else {
         $opRes = $ib->Update($arParams["BLOCK_ID"], $arFields);
         $iblockId = $arParams["BLOCK_ID"];
     }
     /*
      ШАГ 2
     */
     if ($opRes) {
         global $CACHE_MANAGER;
         $CACHE_MANAGER->Clean("component_bizproc_wizards_templates");
         if (intval($arResult["Data"]["Image"]) > 0) {
             CFile::Delete($arResult["Data"]["Image"]);
         }
         if ($arParams["BLOCK_ID"] <= 0 && strlen($arResult["Data"]["Template"]) > 0) {
             $arVariables = false;
             if (method_exists($bpTemplateObject, "GetVariables")) {
                 $arVariables = $bpTemplateObject->GetVariables();
                 $ks = array_keys($arVariables);
                 foreach ($ks as $k) {
                     $arVariables[$k]["Default"] = $arResult["Data"]["TemplateVariables"][$k];
                 }
             }
             $arFieldsT = array("DOCUMENT_TYPE" => array("bizproc", "CBPVirtualDocument", "type_" . $iblockId), "AUTO_EXECUTE" => CBPDocumentEventType::Create, "NAME" => $arResult["Data"]["Name"], "DESCRIPTION" => $arResult["Data"]["Description"], "TEMPLATE" => $bpTemplateObject->GetTemplate(), "PARAMETERS" => $bpTemplateObject->GetParameters(), "VARIABLES" => $arVariables, "USER_ID" => $GLOBALS["USER"]->GetID(), "ACTIVE" => 'Y', "MODIFIER_USER" => new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
             CBPWorkflowTemplateLoader::Add($arFieldsT);
             if (method_exists($bpTemplateObject, "GetDocumentFields")) {
                 $runtime = CBPRuntime::GetRuntime();
                 $runtime->StartRuntime();
                 $arResult["DocumentService"] = $runtime->GetService("DocumentService");
                 $arDocumentFields = $bpTemplateObject->GetDocumentFields();
                 if ($arDocumentFields && is_array($arDocumentFields) && count($arDocumentFields) > 0) {
                     foreach ($arDocumentFields as $f) {
                         $arResult["DocumentService"]->AddDocumentField(array("bizproc", "CBPVirtualDocument", "type_" . $iblockId), $f);
                     }
                 }
             }
         }
         /*
          * разворачиваем шаблон БП из файла
          */
         $templateFileNameBP = $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/adeveloper.bp/data/bp-sc.bpt';
         $f = fopen($templateFileNameBP, "rb");
         $datum = fread($f, filesize($templateFileNameBP));
         fclose($f);
         try {
             $BLOCK_ID = $opRes;
             $r = CBPWorkflowTemplateLoader::ImportTemplate($ID, array("bizproc", "CBPVirtualDocument", "type_" . $BLOCK_ID), 1, "Шаблон БП", "Описание шаблона", $datum);
         } catch (Exception $e) {
             $errTmp = preg_replace("#[\r\n]+#", " ", $e->getMessage());
         }
     } else {
         ShowError("Инфоблока нет");
     }
     return $opRes;
 }
开发者ID:st7art22,项目名称:bitrix,代码行数:80,代码来源:cbpvisitor.php

示例5: InitializeIBlock

 function InitializeIBlock($taskType, $ownerId, $forumId)
 {
     $iblockId = COption::GetOptionInt("intranet", "iblock_tasks", 0);
     if ($iblockId <= 0) {
         return 0;
     }
     $forumId = intval($forumId);
     $arTasksConverted2BP = array();
     $keyTasksConverted2BP = $iblockId . "_" . $taskType . ($taskType == "group" ? "_" . $ownerId : "");
     global $CACHE_MANAGER;
     if ($CACHE_MANAGER->Read(2592000, "IntranetTasksConverted2BP")) {
         $arTasksConverted2BP = $CACHE_MANAGER->Get("IntranetTasksConverted2BP");
         if (array_key_exists($keyTasksConverted2BP, $arTasksConverted2BP)) {
             return $arTasksConverted2BP[$keyTasksConverted2BP];
         }
     }
     $globalParentSectionId = 0;
     $dbIBlock = CIBlock::GetList(array(), array("ID" => $iblockId, "ACTIVE" => "Y"));
     if ($arIBlock = $dbIBlock->Fetch()) {
         $arIBlockProperties = array();
         $dbIBlockProps = CIBlock::GetProperties($iblockId);
         while ($arIBlockProps = $dbIBlockProps->Fetch()) {
             $ind = StrLen($arIBlockProps["CODE"]) > 0 ? $arIBlockProps["CODE"] : $arIBlockProps["ID"];
             $arIBlockProperties[StrToUpper($ind)] = $arIBlockProps;
         }
         $arTasksProps = array("TASKPRIORITY" => array("NAME" => GetMessage("INTI_TASKPRIORITY"), "ACTIVE" => "Y", "SORT" => 100, "CODE" => "TaskPriority", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => "   " . GetMessage("INTI_TASKPRIORITY_1"), "DEF" => "N", "SORT" => 100, "XML_ID" => "1"), array("VALUE" => "  " . GetMessage("INTI_TASKPRIORITY_2"), "DEF" => "Y", "SORT" => 200, "XML_ID" => "2"), array("VALUE" => " " . GetMessage("INTI_TASKPRIORITY_3"), "DEF" => "N", "SORT" => 300, "XML_ID" => "3"))), "TASKCOMPLETE" => array("NAME" => GetMessage("INTI_TASKCOMPLETE"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskComplete", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKASSIGNEDTO" => array("NAME" => GetMessage("INTI_TASKASSIGNEDTO"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskAssignedTo", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKTRACKERS" => array("NAME" => GetMessage("INTI_TASKTRACKERS"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskTrackers", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKALERT" => array("NAME" => GetMessage("INTI_TASKALERT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "TaskAlert", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZE" => array("NAME" => GetMessage("INTI_TASKSIZE"), "ACTIVE" => "Y", "SORT" => 600, "CODE" => "TaskSize", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZEREAL" => array("NAME" => GetMessage("INTI_TASKSIZEREAL"), "ACTIVE" => "Y", "SORT" => 700, "CODE" => "TaskSizeReal", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFINISH" => array("NAME" => GetMessage("INTI_TASKFINISH"), "ACTIVE" => "Y", "SORT" => 800, "CODE" => "TaskFinish", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFILES" => array("NAME" => GetMessage("INTI_TASKFILES"), "ACTIVE" => "Y", "SORT" => 900, "CODE" => "TaskFiles", "PROPERTY_TYPE" => "F", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREPORT" => array("NAME" => GetMessage("INTI_TASKREPORT"), "ACTIVE" => "Y", "SORT" => 1000, "CODE" => "TaskReport", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREMIND" => array("NAME" => GetMessage("INTI_TASKREMIND"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskRemind", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "VERSION" => array("NAME" => GetMessage("INTI_VERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "VERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKVERSION" => array("NAME" => GetMessage("INTI_TASKVERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "TASKVERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
         foreach ($arTasksProps as $propKey => $arProp) {
             if (!array_key_exists($propKey, $arIBlockProperties)) {
                 $ibp = new CIBlockProperty();
                 $ibp->Add($arProp);
             }
         }
         $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => $taskType == "group" ? $ownerId : "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
         if ($arSection = $dbSectionsList->GetNext()) {
             $globalParentSectionId = $arSection["ID"];
         }
         if ($globalParentSectionId <= 0) {
             if ($taskType == "group") {
                 $folderName = "-";
                 $folderXmlId = $ownerId;
                 if ($arGroup = CSocNetGroup::GetByID($ownerId)) {
                     $folderName = $arGroup["NAME"] . " [" . $ownerId . "]";
                     $folderXmlId = $ownerId;
                 }
             } else {
                 $folderName = "User Tasks";
                 $folderXmlId = "users_tasks";
             }
             $arFields = array("IBLOCK_ID" => $iblockId, "IBLOCK_SECTION_ID" => 0, "ACTIVE" => "Y", "NAME" => $folderName, "XML_ID" => $folderXmlId);
             $iblockSection = new CIBlockSection();
             $globalParentSectionId = $iblockSection->Add($arFields, true);
             CIntranetTasks::InstallDefaultViews($taskType, $ownerId);
         }
         $db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("intranet", "CIntranetTasksDocument", "x" . $iblockId)), false, false, array("ID"));
         //			while ($ar = $db->Fetch())
         //			{
         //				try
         //				{
         //					CBPWorkflowTemplateLoader::Delete($ar["ID"]);
         //				}
         //				catch(Exception $e)
         //				{
         //					CBPWorkflowTemplateLoader::Update($ar["ID"], array("AUTO_EXECUTE" => 0));
         //				}
         //			}
         $workflowTemplateId = 0;
         if ($ar = $db->Fetch()) {
             $workflowTemplateId = $ar["ID"];
         } else {
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/classes/general/tasks_wf_template.php";
             $workflowTemplateId = CBPWorkflowTemplateLoader::Add($arFields);
         }
         $arTaskStatusTmp = array();
         $arTaskStatusTmpAlt = array();
         $dbRes = CIBlockProperty::GetPropertyEnum("TaskStatus", array("SORT" => "ASC"), array("IBLOCK_ID" => $iblockId));
         while ($arRes = $dbRes->Fetch()) {
             $arTaskStatusTmp[StrToUpper($arRes["XML_ID"])] = $arRes["ID"];
             $arTaskStatusTmpAlt[$arRes["ID"]] = $arRes["XML_ID"];
         }
         $dbResult = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockId, "INCLUDE_SUBSECTIONS" => "Y", "!PROPERTY_TASKVERSION" => 2), false, false, array("ID", "PROPERTY_TASKSTATUS", "PROPERTY_TASKASSIGNEDTO", "IBLOCK_SECTION_ID"));
         if ($arResult = $dbResult->Fetch()) {
             $arOldTasksWFs = array();
             $arOldTasksSTs = array();
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/classes/general/tasks_wf_template1.php";
             $arOldTasksWFsTmp = array();
             foreach ($arOldTasksWFs as $t1 => $t2) {
                 if (array_key_exists($t1, $arTaskStatusTmp)) {
                     $arOldTasksWFsTmp[$arTaskStatusTmp[$t1]] = $t2;
                 }
             }
             $arOldTasksSTsTmp = array();
             foreach ($arOldTasksSTs as $t1 => $t2) {
                 if (array_key_exists($t1, $arTaskStatusTmp)) {
                     $arOldTasksSTsTmp[$arTaskStatusTmp[$t1]] = $t2;
                 }
             }
             do {
                 $taskTypeTmp = "";
                 $ownerIdTmp = "";
                 $v = CIntranetTasks::PrepareSectionForPrint($arResult["IBLOCK_SECTION_ID"]);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasks.php

示例6: GetContent

    function GetContent($arParams)
    {
        if (!CModule::IncludeModule('iblock')) {
            return false;
        }
        if ($_POST['library_resource_type'] != "folder") {
            //iblock
            $iblock_type = '';
            $iblock_id = 0;
            if ($_POST['library_IBLOCK_TYPE'] != '') {
                $res = CIBlockType::GetByID($_POST['library_IBLOCK_TYPE']);
                if ($res_arr = $res->Fetch()) {
                    $iblock_type = $res_arr["ID"];
                }
                if ($iblock_type != '') {
                    if ($_POST['library_NEW_IBLOCK'] == 'Y') {
                        //new iblock
                        $ib = new CIBlock();
                        $arFields = array("ACTIVE" => "Y", "VERSION" => 1, "LIST_PAGE_URL" => $arParams['path'], "DETAIL_PAGE_URL" => $arParams['path'] . 'element/view/#ID#/', "NAME" => $_POST['library_TITLE'], "IBLOCK_TYPE_ID" => $iblock_type, "LID" => array($arParams['site']), "SORT" => "500", "WORKFLOW" => "N", "BIZPROC" => "N", "SECTION_CHOOSER" => "L");
                        if (is_array($_POST['library_PERMISSION'])) {
                            $arPerm = array();
                            foreach ($_POST['library_PERMISSION'] as $grp => $perm) {
                                if ($perm == 'R' || $perm == 'U' || $perm == 'W') {
                                    $arPerm[$grp] = $perm;
                                }
                                if ($perm == 'U') {
                                    $arFields['BIZPROC'] = 'Y';
                                }
                            }
                            $arFields["GROUP_ID"] = $arPerm;
                        }
                        $iblock_id = $ib->Add($arFields);
                    } elseif (intval($_POST['library_IBLOCK_ID']) > 0) {
                        //existing iblock: need check permissions
                        if (CIBlock::GetPermission($_POST['library_IBLOCK_ID']) >= "X") {
                            $iblock_id = intval($_POST['library_IBLOCK_ID']);
                        }
                    }
                }
            }
            //forum for comments
            $forum_id = 0;
            if ($_POST['library_USE_COMMENTS'] == 'Y') {
                if ($_POST['library_NEW_FORUM'] == 'Y') {
                    CModule::IncludeModule('forum');
                    //new forum
                    $arFields = array("NAME" => GetMessage("library_wizard_forum_name") . " \"" . $_POST['library_TITLE'] . "\"", "SITES" => array($arParams['site'] => $arParams["path"] . "element/view/#PARAM2#/"), "ACTIVE" => "Y", "INDEXATION" => "N", "SORT" => 150, "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_TOPIC_TITLED" => "Y");
                    if (is_array($_POST['library_FORUM_PERMISSION'])) {
                        $arPerm = array();
                        foreach ($_POST['library_FORUM_PERMISSION'] as $grp => $perm) {
                            if ($perm == 'E' || $perm == 'M') {
                                $arPerm[$grp] = $perm;
                            }
                        }
                        $arFields["GROUP_ID"] = $arPerm;
                    }
                    $forum_id = CForumNew::Add($arFields);
                } elseif (intval($_POST['library_FORUM_ID']) > 0) {
                    $forum_id = intval($_POST['library_FORUM_ID']);
                }
            }
            //file size
            $iUploadMaxFilesize = intval(ini_get('upload_max_filesize'));
            $iPostMaxSize = intval(ini_get('post_max_size'));
            $iUploadMaxFilesize = min($iUploadMaxFilesize, $iPostMaxSize);
            //bizproc templates
            if ($_POST['library_NEW_IBLOCK'] == 'Y' && $iblock_id > 0 && CModule::IncludeModule("bizproc")) {
                $documentType = array("webdav", "CIBlockDocumentWebdav", "iblock_" . $iblock_id);
                if (!function_exists("__wd_replace_user_and_groups")) {
                    function __wd_replace_user_and_groups(&$val, $key, $params = array())
                    {
                        if ($key == "MailText") {
                            $val = str_replace("/company/personal/bizproc/{=Workflow:id}/", $params["path"], $val);
                        }
                        return true;
                    }
                }
                if ($handle = opendir($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bizproc/templates')) {
                    $arr = array("path" => str_replace("//", "/", $arParams["path"] . "/webdav_bizproc_view/{=Document:ID}/"));
                    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;
                        array_walk_recursive($arFields["TEMPLATE"], "__wd_replace_user_and_groups", $arr);
                        if ($file == "status.php") {
                            $arFields["AUTO_EXECUTE"] = CBPDocumentEventType::Create;
                        }
                        if (is_array($arFields)) {
                            $arFields["DOCUMENT_TYPE"] = $documentType;
                            $arFields["SYSTEM_CODE"] = $file;
                            if (is_object($GLOBALS['USER'])) {
                                $arFields["USER_ID"] = $GLOBALS['USER']->GetID();
                            }
                            try {
                                CBPWorkflowTemplateLoader::Add($arFields);
                            } catch (Exception $e) {
                            }
                        }
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:template.php


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