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


PHP CBPHelper类代码示例

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


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

示例1: Execute

 public function Execute()
 {
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $historyService = $this->workflow->GetService("HistoryService");
     $documentService = $this->workflow->GetService("DocumentService");
     $userId = CBPHelper::ExtractUsers($this->UserId, $documentId, true);
     if ($userId == null || intval($userId) <= 0) {
         $userId = 1;
     }
     $historyIndex = $historyService->AddHistory(array("DOCUMENT_ID" => $documentId, "NAME" => "New", "DOCUMENT" => null, "USER_ID" => $userId));
     $arDocument = $documentService->GetDocumentForHistory($documentId, $historyIndex);
     if (!is_array($arDocument)) {
         return CBPActivityExecutionStatus::Closed;
     }
     $name = $this->Name;
     if ($name == null || strlen($name) <= 0) {
         if (array_key_exists("NAME", $arDocument) && is_string($arDocument["NAME"]) && strlen($arDocument["NAME"]) > 0) {
             $name = $arDocument["NAME"];
         } elseif (array_key_exists("TITLE", $arDocument) && is_string($arDocument["TITLE"]) && strlen($arDocument["TITLE"]) > 0) {
             $name = $arDocument["TITLE"];
         } else {
             $name = Date("Y-m-d H:i:s");
         }
     }
     $historyService->UpdateHistory($historyIndex, array("NAME" => $name, "DOCUMENT" => $arDocument));
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:28,代码来源:savehistoryactivity.php

示例2: formatValueMultiple

 public static function formatValueMultiple(FieldType $fieldType, $value, $format = 'printable')
 {
     if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value)) {
         $value = array($value);
     }
     foreach ($value as $k => $v) {
         $value[$k] = static::formatValuePrintable($fieldType, $v);
     }
     return implode(static::getFormatSeparator($format), $value);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:usertypepropertydiskfile.php

示例3: ValidateProperties

 public static function ValidateProperties($testProperties = array(), CBPWorkflowTemplateUser $user = null)
 {
     $errors = array();
     try {
         CBPHelper::ParseDocumentId($testProperties['DocumentType']);
     } catch (Exception $e) {
         $errors[] = array("code" => "NotExist", "parameter" => "DocumentType", "message" => GetMessage("BPCLDA_ERROR_DT"));
     }
     return array_merge($errors, parent::ValidateProperties($testProperties, $user));
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:10,代码来源:createlistsdocumentactivity.php

示例4: renderControlMultiple

 /**
  * @param FieldType $fieldType Document field type.
  * @param array $field Form field.
  * @param mixed $value Field value.
  * @param bool $allowSelection Allow selection flag.
  * @param int $renderMode Control render mode.
  * @return string
  */
 public static function renderControlMultiple(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
 {
     if ($renderMode & FieldType::RENDER_MODE_DESIGNER) {
         if (is_array($value) && !\CBPHelper::isAssociativeArray($value)) {
             reset($value);
             $value = current($value);
         }
         return parent::renderControlSingle($fieldType, $field, $value, $allowSelection, $renderMode);
     }
     return parent::renderControlMultiple($fieldType, $field, $value, $allowSelection, $renderMode);
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:19,代码来源:file.php

示例5: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("forum")) {
         return CBPActivityExecutionStatus::Closed;
     }
     if (!CModule::IncludeModule("iblock")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $forumId = intval($this->ForumId);
     if ($forumId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $iblockId = $this->IBlockId;
     $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
     $arResult = $dbResult->Fetch();
     if (!$arResult) {
         $obProperty = new CIBlockProperty();
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum topic", "CODE" => "FORUM_TOPIC_ID"));
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum message count", "CODE" => "FORUM_MESSAGE_CNT"));
         $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
         $arResult = $dbResult->Fetch();
     }
     $forumTopicId = intval($arResult["VALUE"]);
     $arForumUserTmp = $this->ForumUser;
     $arForumUser = CBPHelper::ExtractUsers($arForumUserTmp, $documentId, true);
     $forumUserId = 1;
     $forumUserName = "Admin";
     if ($arForumUser != null) {
         $forumUserId = $arForumUser;
         $dbResult = CUser::GetByID($forumUserId);
         if ($arResult = $dbResult->Fetch()) {
             $forumUserName = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arResult, true);
         }
     }
     $newTopic = "N";
     if ($forumTopicId <= 0) {
         $documentService = $this->workflow->GetService("DocumentService");
         $document = $documentService->GetDocument($documentId);
         $newTopic = "Y";
         $arFields = array("TITLE" => $document["NAME"], "FORUM_ID" => $forumId, "USER_START_ID" => $forumUserId, "USER_START_NAME" => $forumUserName, "LAST_POSTER_NAME" => $forumUserName, "APPROVED" => "Y");
         $forumTopicId = CForumTopic::Add($arFields);
         CIBlockElement::SetPropertyValues($documentId[2], $iblockId, $forumTopicId, "FORUM_TOPIC_ID");
     }
     $arFields = array("POST_MESSAGE" => $this->ForumPostMessage, "AUTHOR_ID" => $forumUserId, "AUTHOR_NAME" => $forumUserName, "FORUM_ID" => $forumId, "TOPIC_ID" => $forumTopicId, "APPROVED" => "Y", "NEW_TOPIC" => $newTopic, "PARAM2" => $documentId[2]);
     $forumMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:49,代码来源:forumreviewactivity.php

示例6: __bwl1_ParseStringParameterTmp

 function __bwl1_ParseStringParameterTmp($matches)
 {
     $result = "";
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
             $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$user];
         }
     } elseif ($matches[1] == "group") {
         $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$matches[2]];
     } else {
         $result = $matches[0];
     }
     return $result;
 }
开发者ID:vim84,项目名称:b-markt,代码行数:18,代码来源:component.php

示例7: Execute

 public function Execute()
 {
     if ($this->isInEventActivityMode) {
         return CBPActivityExecutionStatus::Closed;
     }
     if ($this->TimeoutTime != null && intval($this->TimeoutTime) . "|" != $this->TimeoutTime . "|") {
         $this->TimeoutTime = MakeTimeStamp($this->TimeoutTime);
     }
     $this->Subscribe($this);
     if ($this->TimeoutDuration != null) {
         $timeoutDuration = $this->CalculateTimeoutDuration();
         $this->WriteToTrackingService(str_replace("#PERIOD#", CBPHelper::FormatTimePeriod($timeoutDuration), GetMessage("BPDA_TRACK")));
     } elseif ($this->TimeoutTime != null) {
         $this->WriteToTrackingService(str_replace("#PERIOD#", ConvertTimeStamp($this->TimeoutTime, "FULL"), GetMessage("BPDA_TRACK1")));
     } else {
         $this->WriteToTrackingService(GetMessage("BPDA_TRACK2"));
     }
     $this->isInEventActivityMode = false;
     return CBPActivityExecutionStatus::Executing;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:20,代码来源:delayactivity.php

示例8: Initialize

 public function Initialize(CBPActivity $rootActivity, $documentId, $workflowParameters = array(), $workflowVariablesTypes = array(), $workflowParametersTypes = array())
 {
     $this->rootActivity = $rootActivity;
     $rootActivity->SetWorkflow($this);
     $arDocumentId = CBPHelper::ParseDocumentId($documentId);
     $rootActivity->SetDocumentId($arDocumentId);
     $documentService = $this->GetService("DocumentService");
     $documentType = $documentService->GetDocumentType($arDocumentId);
     if ($documentType !== null) {
         $rootActivity->SetDocumentType($documentType);
         $rootActivity->SetFieldTypes($documentService->GetDocumentFieldTypes($documentType));
     }
     $rootActivity->SetProperties($workflowParameters);
     $rootActivity->SetVariablesTypes($workflowVariablesTypes);
     if (is_array($workflowVariablesTypes)) {
         foreach ($workflowVariablesTypes as $k => $v) {
             $rootActivity->SetVariable($k, $v["Default"]);
         }
     }
     $rootActivity->SetPropertiesTypes($workflowParametersTypes);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:21,代码来源:workflow.php

示例9: GetPropertiesDialogValues

 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("Permission" => array(), "Rewrite" => true);
     $documentService = $runtime->GetService("DocumentService");
     $arAllowableOperations = $documentService->GetAllowableOperations($documentType);
     foreach ($arAllowableOperations as $operationKey => $operationValue) {
         $arProperties["Permission"][$operationKey] = CBPHelper::UsersStringToArray($arCurrentValues["permission_" . $operationKey], $documentType, $arErrors);
         if (count($arErrors) > 0) {
             return false;
         }
     }
     $arProperties["Rewrite"] = $arCurrentValues["rewrite"] == "Y" ? "Y" : "N";
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:22,代码来源:setpermissionsactivity.php

示例10: StripUserPrefix

 public static function StripUserPrefix($value)
 {
     if (is_array($value) && !CBPHelper::IsAssociativeArray($value)) {
         foreach ($value as &$v) {
             if (substr($v, 0, 5) == "user_") {
                 $v = substr($v, 5);
             }
         }
     } else {
         if (substr($value, 0, 5) == "user_") {
             $value = substr($value, 5);
         }
     }
     return $value;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:15,代码来源:helper.php

示例11: MigrateDocumentType

 public static function MigrateDocumentType($oldType, $newType, $workflowTemplateIds)
 {
     global $DB;
     $arOldType = CBPHelper::ParseDocumentId($oldType);
     $arNewType = CBPHelper::ParseDocumentId($newType);
     $DB->Query("UPDATE b_bp_workflow_state SET " . "\tENTITY = '" . $DB->ForSql($arNewType[1]) . "', " . "\tMODULE_ID = '" . $DB->ForSql($arNewType[0]) . "' " . "WHERE ENTITY = '" . $DB->ForSql($arOldType[1]) . "' " . "\tAND MODULE_ID = '" . $DB->ForSql($arOldType[0]) . "' " . "\tAND WORKFLOW_TEMPLATE_ID IN (" . implode(",", $workflowTemplateIds) . ") ");
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:7,代码来源:stateservice.php

示例12: GetPropertiesDialog

 public static function GetPropertiesDialog($documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = "", $popupWindow = null)
 {
     $runtime = CBPRuntime::GetRuntime();
     if (!is_array($arWorkflowParameters)) {
         $arWorkflowParameters = array();
     }
     if (!is_array($arWorkflowVariables)) {
         $arWorkflowVariables = array();
     }
     $documentService = $runtime->GetService("DocumentService");
     $arDocumentFieldsTmp = $documentService->GetDocumentFields($documentType);
     $arFieldTypes = $documentService->GetDocumentFieldTypes($documentType);
     if (!is_array($arCurrentValues)) {
         $arCurrentValues = array();
         $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
         if (is_array($arCurrentActivity["Properties"]) && array_key_exists("Fields", $arCurrentActivity["Properties"]) && is_array($arCurrentActivity["Properties"]["Fields"])) {
             foreach ($arCurrentActivity["Properties"]["Fields"] as $k => $v) {
                 $arCurrentValues[$k] = $v;
                 if ($arDocumentFieldsTmp[$k]["BaseType"] == "user") {
                     if (!is_array($arCurrentValues[$k])) {
                         $arCurrentValues[$k] = array($arCurrentValues[$k]);
                     }
                     $ar = array();
                     foreach ($arCurrentValues[$k] as $v) {
                         if (intval($v) . "!" == $v . "!") {
                             $v = "user_" . $v;
                         }
                         $ar[] = $v;
                     }
                     $arCurrentValues[$k] = CBPHelper::UsersArrayToString($ar, $arWorkflowTemplate, $documentType);
                 }
             }
         }
     } else {
         foreach ($arDocumentFieldsTmp as $key => $value) {
             if (!$value["Editable"]) {
                 continue;
             }
             $arErrors = array();
             $arCurrentValues[$key] = $documentService->GetFieldInputValue($documentType, $value, $key, $arCurrentValues, $arErrors);
         }
     }
     $arDocumentFields = array();
     $defaultFieldValue = "";
     foreach ($arDocumentFieldsTmp as $key => $value) {
         if (!$value["Editable"]) {
             continue;
         }
         $arDocumentFields[$key] = $value;
         if (strlen($defaultFieldValue) <= 0) {
             $defaultFieldValue = $key;
         }
         /*if ($value["BaseType"] == "select" || $value["BaseType"] == "bool")
         		{
         			if (array_key_exists($key."_text", $arCurrentValues)
         				&& ($value["Multiple"] && count($arCurrentValues[$key."_text"]) > 0
         					|| !$value["Multiple"] && strlen($arCurrentValues[$key."_text"]) > 0)
         				)
         			{
         				$arCurrentValues[$key] = $arCurrentValues[$key."_text"];
         			}
         		}*/
     }
     $javascriptFunctions = $documentService->GetJSFunctionsForFields($documentType, "objFieldsCD", $arDocumentFields, $arFieldTypes);
     return $runtime->ExecuteResourceFile(__FILE__, "properties_dialog.php", array("arCurrentValues" => $arCurrentValues, "arDocumentFields" => $arDocumentFields, "formName" => $formName, "defaultFieldValue" => $defaultFieldValue, "arFieldTypes" => $arFieldTypes, "javascriptFunctions" => $javascriptFunctions, "documentType" => $documentType, "popupWindow" => &$popupWindow));
 }
开发者ID:Satariall,项目名称:izurit,代码行数:66,代码来源:createdocumentactivity.php

示例13: intval

$arParams["TASK_ID"] = intval($arParams["TASK_ID"]);
if ($arParams["TASK_ID"] <= 0) {
    $arParams["TASK_ID"] = intval($_REQUEST["TASK_ID"]);
}
if ($arParams["TASK_ID"] <= 0) {
    $arParams["TASK_ID"] = intval($_REQUEST["task_id"]);
}
if (empty($arParams["USER_ID"]) && !empty($_REQUEST['USER_ID'])) {
    $arParams["USER_ID"] = (int) $_REQUEST['USER_ID'];
}
$arParams["USER_ID"] = intval(empty($arParams["USER_ID"]) ? $currentUserId : $arParams["USER_ID"]);
$arResult["ShowMode"] = "Form";
$arResult['ReadOnly'] = false;
$arResult['IsComplete'] = false;
if ($arParams["USER_ID"] != $currentUserId) {
    if (!$isAdmin && !CBPHelper::checkUserSubordination($currentUserId, $arParams["USER_ID"])) {
        ShowError(GetMessage("BPAT_NO_ACCESS"));
        return false;
    }
    $arResult["ShowMode"] = "Success";
    $arResult['ReadOnly'] = true;
}
$arParams["WORKFLOW_ID"] = empty($arParams["WORKFLOW_ID"]) ? $_REQUEST["WORKFLOW_ID"] : $arParams["WORKFLOW_ID"];
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult["backUrl"] = $_REQUEST["back_url"];
$arParams["TASK_EDIT_URL"] = trim($arParams["TASK_EDIT_URL"]);
if (empty($arParams["TASK_EDIT_URL"])) {
    $arParams["TASK_EDIT_URL"] = $APPLICATION->GetCurPage() . "?PAGE_NAME=task_edit&ID=#ID#&back_url=" . urlencode($arResult["backUrl"]);
} else {
    $arParams["TASK_EDIT_URL"] .= (strpos($arParams["TASK_EDIT_URL"], "?") === false ? "?" : "&") . "back_url=" . urlencode($arResult["backUrl"]);
}
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例14: checkActivityFilterRules

 private function checkActivityFilterRules($rules, $documentType, $distrName)
 {
     if (!is_array($rules) || CBPHelper::IsAssociativeArray($rules)) {
         $rules = array($rules);
     }
     foreach ($rules as $rule) {
         $result = false;
         if (is_array($rule)) {
             if (!$documentType) {
                 $result = true;
             } else {
                 foreach ($documentType as $key => $value) {
                     if (!isset($rule[$key])) {
                         break;
                     }
                     $result = $rule[$key] == $value;
                     if (!$result) {
                         break;
                     }
                 }
             }
         } else {
             $result = (string) $rule == $distrName;
         }
         if ($result) {
             return true;
         }
     }
     return false;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:runtime.php

示例15: ExtractValuesFromVariables

 private static function ExtractValuesFromVariables($ar, $variables, $constants = array())
 {
     if (is_string($ar) && preg_match('/^\\{=([A-Za-z0-9_]+)\\:([A-Za-z0-9_]+)\\}$/i', $ar, $arMatches)) {
         $ar = array($arMatches[1], $arMatches[2]);
     }
     if (is_array($ar)) {
         if (!CBPHelper::IsAssociativeArray($ar)) {
             if (count($ar) == 2 && ($ar[0] == 'Variable' || $ar[0] == 'Constant')) {
                 if ($ar[0] == 'Variable' && is_array($variables) && array_key_exists($ar[1], $variables)) {
                     return array($variables[$ar[1]]["Default"]);
                 }
                 if ($ar[0] == 'Constant' && is_array($constants) && array_key_exists($ar[1], $constants)) {
                     return array($constants[$ar[1]]["Default"]);
                 }
             }
             $arResult = array();
             foreach ($ar as $ar1) {
                 $arResult[] = self::ExtractValuesFromVariables($ar1, $variables, $constants);
             }
             return $arResult;
         }
     }
     return $ar;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:24,代码来源:workflowtemplateloader.php


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