本文整理汇总了PHP中CBPHelper::ParseDocumentId方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::ParseDocumentId方法的具体用法?PHP CBPHelper::ParseDocumentId怎么用?PHP CBPHelper::ParseDocumentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::ParseDocumentId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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);
}
示例3: CreateWorkflow
/**
* Creates new workflow instance from the specified template.
*
* @param int $workflowTemplateId - ID of the workflow template
* @param string $documentId - ID of the document
* @param mixed $workflowParameters - Optional parameters of the created workflow instance
* @param array|null $parentWorkflow - Parent Workflow information.
* @return CBPWorkflow
* @throws CBPArgumentNullException
* @throws CBPArgumentOutOfRangeException
* @throws Exception
* @throws \Bitrix\Main\ArgumentNullException
*/
public function CreateWorkflow($workflowTemplateId, $documentId, $workflowParameters = array(), $parentWorkflow = null)
{
$workflowTemplateId = intval($workflowTemplateId);
if ($workflowTemplateId <= 0) {
throw new Exception("workflowTemplateId");
}
$arDocumentId = CBPHelper::ParseDocumentId($documentId);
$limit = \Bitrix\Main\Config\Option::get("bizproc", "limit_simultaneous_processes", "0");
if (intval($limit) > 0) {
if (CBPStateService::CountDocumentWorkflows($documentId) >= $limit) {
throw new Exception(GetMessage("BPCGDOC_LIMIT_SIMULTANEOUS_PROCESSES", array("#NUM#" => $limit)));
}
}
if (!$this->isStarted) {
$this->StartRuntime();
}
$workflowId = uniqid("", true);
if ($parentWorkflow) {
$this->addWorkflowToChain($workflowId, $parentWorkflow);
if ($this->checkWorkflowRecursion($workflowId, $workflowTemplateId)) {
throw new Exception(GetMessage("BPCGDOC_WORKFLOW_RECURSION_LOCK"));
}
}
$workflow = new CBPWorkflow($workflowId, $this);
$loader = CBPWorkflowTemplateLoader::GetLoader();
list($rootActivity, $workflowVariablesTypes, $workflowParametersTypes) = $loader->LoadWorkflow($workflowTemplateId);
if ($rootActivity == null) {
throw new Exception("EmptyRootActivity");
}
//if (!is_a($rootActivity, "IBPRootActivity"))
// throw new Exception("RootActivityIsNotAIBPRootActivity");
foreach (GetModuleEvents("bizproc", "OnCreateWorkflow", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($workflowTemplateId, $documentId, &$workflowParameters));
}
$workflow->Initialize($rootActivity, $arDocumentId, $workflowParameters, $workflowVariablesTypes, $workflowParametersTypes, $workflowTemplateId);
$starterUserId = 0;
if (isset($workflowParameters[CBPDocument::PARAM_TAGRET_USER])) {
$starterUserId = intval(substr($workflowParameters[CBPDocument::PARAM_TAGRET_USER], strlen("user_")));
}
$this->arServices["StateService"]->AddWorkflow($workflowId, $workflowTemplateId, $arDocumentId, $starterUserId);
$this->arWorkflows[$workflowId] = $workflow;
return $workflow;
}
示例4: ParseFields
protected function ParseFields(&$arFields, $id = 0, $systemImport = false)
{
$id = intval($id);
$updateMode = $id > 0 ? true : false;
$addMode = !$updateMode;
if ($addMode && !is_set($arFields, "DOCUMENT_TYPE")) {
throw new CBPArgumentNullException("DOCUMENT_TYPE");
}
if (is_set($arFields, "DOCUMENT_TYPE")) {
$arDocumentType = CBPHelper::ParseDocumentId($arFields["DOCUMENT_TYPE"]);
$arFields["MODULE_ID"] = $arDocumentType[0];
$arFields["ENTITY"] = $arDocumentType[1];
$arFields["DOCUMENT_TYPE"] = $arDocumentType[2];
} else {
unset($arFields["MODULE_ID"]);
unset($arFields["ENTITY"]);
unset($arFields["DOCUMENT_TYPE"]);
}
if (is_set($arFields, "NAME") || $addMode) {
$arFields["NAME"] = trim($arFields["NAME"]);
if (strlen($arFields["NAME"]) <= 0) {
throw new CBPArgumentNullException("NAME");
}
}
if ($addMode && !is_set($arFields, "TEMPLATE")) {
throw new CBPArgumentNullException("TEMPLATE");
}
if (is_set($arFields, "TEMPLATE")) {
if (!is_array($arFields["TEMPLATE"])) {
throw new CBPArgumentTypeException("TEMPLATE", "array");
} else {
$userTmp = null;
if (!$systemImport) {
if (array_key_exists("MODIFIER_USER", $arFields)) {
if (is_object($arFields["MODIFIER_USER"]) && is_a($arFields["MODIFIER_USER"], "CBPWorkflowTemplateUser")) {
$userTmp = $arFields["MODIFIER_USER"];
} else {
$userTmp = new CBPWorkflowTemplateUser($arFields["MODIFIER_USER"]);
}
} else {
$userTmp = new CBPWorkflowTemplateUser();
}
$err = array();
foreach ($arFields["TEMPLATE"] as $v) {
$err = $err + $this->ValidateTemplate($v, $userTmp);
}
if (count($err) > 0) {
$m = "";
foreach ($err as $v) {
$m = trim($v["message"]);
if (substr($m, -1) != ".") {
$m .= ".";
}
}
throw new Exception($m);
}
}
$arFields["TEMPLATE"] = $this->GetSerializedForm($arFields["TEMPLATE"]);
}
}
foreach (array('PARAMETERS', 'VARIABLES', 'CONSTANTS') as $field) {
if (is_set($arFields, $field)) {
if ($arFields[$field] == null) {
$arFields[$field] = false;
} elseif (is_array($arFields[$field])) {
if (count($arFields[$field]) > 0) {
$arFields[$field] = $this->GetSerializedForm($arFields[$field]);
} else {
$arFields[$field] = false;
}
} else {
throw new CBPArgumentTypeException($field);
}
}
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != 'N') {
$arFields["ACTIVE"] = 'Y';
}
if (is_set($arFields, "IS_MODIFIED") && $arFields["IS_MODIFIED"] != 'N') {
$arFields["IS_MODIFIED"] = 'Y';
}
unset($arFields["MODIFIED"]);
}
示例5: SetPermissions
public static function SetPermissions($parameterDocumentId, $workflowId, $arPermissions, $bRewrite = true)
{
list($moduleId, $entity, $documentId) = CBPHelper::ParseDocumentId($parameterDocumentId);
if (strlen($moduleId) > 0) {
CModule::IncludeModule($moduleId);
}
if (class_exists($entity) && method_exists($entity, "SetPermissions")) {
return call_user_func_array(array($entity, "SetPermissions"), array($documentId, $workflowId, $arPermissions, $bRewrite));
}
return false;
}
示例6: onWorkflowStatusChange
public function onWorkflowStatusChange($parameterDocumentId, $workflowId, $status)
{
list($moduleId, $entity, $documentId) = CBPHelper::ParseDocumentId($parameterDocumentId);
if (strlen($moduleId) > 0) {
CModule::IncludeModule($moduleId);
}
if (class_exists($entity) && method_exists($entity, "onWorkflowStatusChange")) {
return call_user_func_array(array($entity, "onWorkflowStatusChange"), array($documentId, $workflowId, $status));
}
return false;
}
示例7: 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) . ") ");
}
示例8: GetHistoryList
public function GetHistoryList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB;
if (count($arSelectFields) <= 0) {
$arSelectFields = array("ID", "MODULE_ID", "ENTITY", "DOCUMENT_ID", "NAME", "DOCUMENT", "MODIFIED", "USER_ID");
}
if (count(array_intersect($arSelectFields, array("MODULE_ID", "ENTITY", "DOCUMENT_ID"))) > 0) {
if (!in_array("MODULE_ID", $arSelectFields)) {
$arSelectFields[] = "MODULE_ID";
}
if (!in_array("ENTITY", $arSelectFields)) {
$arSelectFields[] = "ENTITY";
}
if (!in_array("DOCUMENT_ID", $arSelectFields)) {
$arSelectFields[] = "DOCUMENT_ID";
}
}
if (array_key_exists("DOCUMENT_ID", $arFilter)) {
$d = CBPHelper::ParseDocumentId($arFilter["DOCUMENT_ID"]);
$arFilter["MODULE_ID"] = $d[0];
$arFilter["ENTITY"] = $d[1];
$arFilter["DOCUMENT_ID"] = $d[2];
}
static $arFields = array("ID" => array("FIELD" => "H.ID", "TYPE" => "int"), "MODULE_ID" => array("FIELD" => "H.MODULE_ID", "TYPE" => "string"), "ENTITY" => array("FIELD" => "H.ENTITY", "TYPE" => "string"), "DOCUMENT_ID" => array("FIELD" => "H.DOCUMENT_ID", "TYPE" => "string"), "NAME" => array("FIELD" => "H.NAME", "TYPE" => "string"), "DOCUMENT" => array("FIELD" => "H.DOCUMENT", "TYPE" => "string"), "MODIFIED" => array("FIELD" => "H.MODIFIED", "TYPE" => "datetime"), "USER_ID" => array("FIELD" => "H.USER_ID", "TYPE" => "int"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (H.USER_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (H.USER_ID = U.ID)"), "USER_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (H.USER_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (H.USER_ID = U.ID)"));
$arSqls = CBPHelper::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
if (is_array($arGroupBy) && count($arGroupBy) == 0) {
$strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_bp_history H " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql .= "WHERE " . $arSqls["WHERE"] . " ";
}
if (strlen($arSqls["GROUPBY"]) > 0) {
$strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
}
//echo "!1!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
return $arRes["CNT"];
} else {
return False;
}
}
$strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_bp_history H " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql .= "WHERE " . $arSqls["WHERE"] . " ";
}
if (strlen($arSqls["GROUPBY"]) > 0) {
$strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
}
if (strlen($arSqls["ORDERBY"]) > 0) {
$strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
}
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) <= 0) {
$strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_bp_history H " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
}
if (strlen($arSqls["GROUPBY"]) > 0) {
$strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
}
//echo "!2.1!=".htmlspecialcharsbx($strSql_tmp)."<br>";
$dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$cnt = 0;
if (strlen($arSqls["GROUPBY"]) <= 0) {
if ($arRes = $dbRes->Fetch()) {
$cnt = $arRes["CNT"];
}
} else {
// рнкэйн дкъ MYSQL!!! дкъ ORACLE дпсцни йнд
$cnt = $dbRes->SelectedRowsCount();
}
$dbRes = new CDBResult();
//echo "!2.3!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
} else {
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) > 0) {
$strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
}
//echo "!3!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
$dbRes = new CBPHistoryResult($dbRes, $this->useGZipCompression);
return $dbRes;
}
示例9: CreateWorkflow
/**
* Creates new workflow instance from the specified template.
*
* @param int $workflowTemplateId - ID of the workflow template
* @param string $documentId - ID of the document
* @param mixed $workflowParameters - Optional parameters of the created workflow instance
* @return CBPWorkflow
*/
public function CreateWorkflow($workflowTemplateId, $documentId, $workflowParameters = array())
{
$workflowTemplateId = intval($workflowTemplateId);
if ($workflowTemplateId <= 0) {
throw new Exception("workflowTemplateId");
}
$arDocumentId = CBPHelper::ParseDocumentId($documentId);
if (!$this->isStarted) {
$this->StartRuntime();
}
$workflowId = uniqid("", true);
$workflow = new CBPWorkflow($workflowId, $this);
$loader = CBPWorkflowTemplateLoader::GetLoader();
list($rootActivity, $workflowVariablesTypes, $workflowParametersTypes) = $loader->LoadWorkflow($workflowTemplateId);
if ($rootActivity == null) {
throw new Exception("EmptyRootActivity");
}
//if (!is_a($rootActivity, "IBPRootActivity"))
// throw new Exception("RootActivityIsNotAIBPRootActivity");
$events = GetModuleEvents("bizproc", "OnCreateWorkflow");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($workflowTemplateId, $documentId, &$workflowParameters));
}
$workflow->Initialize($rootActivity, $arDocumentId, $workflowParameters, $workflowVariablesTypes, $workflowParametersTypes);
$starterUserId = 0;
if (array_key_exists("TargetUser", $workflowParameters)) {
$starterUserId = intval(substr($workflowParameters["TargetUser"], strlen("user_")));
}
$this->arServices["StateService"]->AddWorkflow($workflowId, $workflowTemplateId, $arDocumentId, $starterUserId);
$this->arWorkflows[$workflowId] = $workflow;
return $workflow;
}
示例10: GetTemplatesList
public function GetTemplatesList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB;
if (count($arSelectFields) <= 0) {
$arSelectFields = array("ID", "MODULE_ID", "ENTITY", "DOCUMENT_TYPE", "AUTO_EXECUTE", "NAME", "DESCRIPTION", "TEMPLATE", "PARAMETERS", "VARIABLES", "CONSTANTS", "MODIFIED", "USER_ID", "ACTIVE", "IS_MODIFIED");
}
if (count(array_intersect($arSelectFields, array("MODULE_ID", "ENTITY", "DOCUMENT_TYPE"))) > 0) {
if (!in_array("MODULE_ID", $arSelectFields)) {
$arSelectFields[] = "MODULE_ID";
}
if (!in_array("ENTITY", $arSelectFields)) {
$arSelectFields[] = "ENTITY";
}
if (!in_array("DOCUMENT_TYPE", $arSelectFields)) {
$arSelectFields[] = "DOCUMENT_TYPE";
}
}
if (array_key_exists("DOCUMENT_TYPE", $arFilter)) {
$d = CBPHelper::ParseDocumentId($arFilter["DOCUMENT_TYPE"]);
$arFilter["MODULE_ID"] = $d[0];
$arFilter["ENTITY"] = $d[1];
$arFilter["DOCUMENT_TYPE"] = $d[2];
}
if (array_key_exists("AUTO_EXECUTE", $arFilter)) {
$arFilter["AUTO_EXECUTE"] = intval($arFilter["AUTO_EXECUTE"]);
if ($arFilter["AUTO_EXECUTE"] == CBPDocumentEventType::None) {
$arFilter["AUTO_EXECUTE"] = 0;
} elseif ($arFilter["AUTO_EXECUTE"] == CBPDocumentEventType::Create) {
$arFilter["AUTO_EXECUTE"] = array(1, 3, 5, 7);
} elseif ($arFilter["AUTO_EXECUTE"] == CBPDocumentEventType::Edit) {
$arFilter["AUTO_EXECUTE"] = array(2, 3, 6, 7);
} elseif ($arFilter["AUTO_EXECUTE"] == CBPDocumentEventType::Delete) {
$arFilter["AUTO_EXECUTE"] = array(4, 5, 6, 7);
} else {
$arFilter["AUTO_EXECUTE"] = array(-1);
}
}
static $arFields = array("ID" => array("FIELD" => "T.ID", "TYPE" => "int"), "MODULE_ID" => array("FIELD" => "T.MODULE_ID", "TYPE" => "string"), "ENTITY" => array("FIELD" => "T.ENTITY", "TYPE" => "string"), "DOCUMENT_TYPE" => array("FIELD" => "T.DOCUMENT_TYPE", "TYPE" => "string"), "AUTO_EXECUTE" => array("FIELD" => "T.AUTO_EXECUTE", "TYPE" => "int"), "NAME" => array("FIELD" => "T.NAME", "TYPE" => "string"), "DESCRIPTION" => array("FIELD" => "T.DESCRIPTION", "TYPE" => "string"), "TEMPLATE" => array("FIELD" => "T.TEMPLATE", "TYPE" => "string"), "PARAMETERS" => array("FIELD" => "T.PARAMETERS", "TYPE" => "string"), "VARIABLES" => array("FIELD" => "T.VARIABLES", "TYPE" => "string"), "CONSTANTS" => array("FIELD" => "T.CONSTANTS", "TYPE" => "string"), "MODIFIED" => array("FIELD" => "T.MODIFIED", "TYPE" => "datetime"), "USER_ID" => array("FIELD" => "T.USER_ID", "TYPE" => "int"), "SYSTEM_CODE" => array("FIELD" => "T.SYSTEM_CODE", "TYPE" => "string"), "ACTIVE" => array("FIELD" => "T.ACTIVE", "TYPE" => "string"), "IS_MODIFIED" => array("FIELD" => "T.IS_MODIFIED", "TYPE" => "string"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (T.USER_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (T.USER_ID = U.ID)"), "USER_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (T.USER_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (T.USER_ID = U.ID)"));
$arSqls = CBPHelper::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
if (is_array($arGroupBy) && count($arGroupBy) == 0) {
$strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_bp_workflow_template T " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql .= "WHERE " . $arSqls["WHERE"] . " ";
}
if (strlen($arSqls["GROUPBY"]) > 0) {
$strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
}
//echo "!1!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
return $arRes["CNT"];
} else {
return False;
}
}
$strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_bp_workflow_template T " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql .= "WHERE " . $arSqls["WHERE"] . " ";
}
if (strlen($arSqls["GROUPBY"]) > 0) {
$strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
}
if (strlen($arSqls["ORDERBY"]) > 0) {
$strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
}
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) <= 0) {
$strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_bp_workflow_template T " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
}
if (strlen($arSqls["GROUPBY"]) > 0) {
$strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
}
//echo "!2.1!=".htmlspecialcharsbx($strSql_tmp)."<br>";
$dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$cnt = 0;
if (strlen($arSqls["GROUPBY"]) <= 0) {
if ($arRes = $dbRes->Fetch()) {
$cnt = $arRes["CNT"];
}
} else {
// not for Oracle!
$cnt = $dbRes->SelectedRowsCount();
}
$dbRes = new CDBResult();
$dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
} else {
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) > 0) {
$strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
}
//echo "!3!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
$dbRes = new CBPWorkflowTemplateResult($dbRes, $this->useGZipCompression);
return $dbRes;
}
示例11: MergeStates
public static function MergeStates($firstDocumentId, $secondDocumentId)
{
global $DB;
$arFirstDocumentId = CBPHelper::ParseDocumentId($firstDocumentId);
$arSecondDocumentId = CBPHelper::ParseDocumentId($secondDocumentId);
$DB->Query("UPDATE b_bp_workflow_state SET " . "\tDOCUMENT_ID = '" . $DB->ForSql($arFirstDocumentId[2]) . "', " . "\tDOCUMENT_ID_INT = " . intval($arFirstDocumentId[2]) . ", " . "\tENTITY = '" . $DB->ForSql($arFirstDocumentId[1]) . "', " . "\tMODULE_ID = '" . $DB->ForSql($arFirstDocumentId[0]) . "' " . "WHERE DOCUMENT_ID = '" . $DB->ForSql($arSecondDocumentId[2]) . "' " . "\tAND ENTITY = '" . $DB->ForSql($arSecondDocumentId[1]) . "' " . "\tAND MODULE_ID = '" . $DB->ForSql($arSecondDocumentId[0]) . "' ");
}
示例12: MergeHistory
public static function MergeHistory($firstDocumentId, $secondDocumentId)
{
global $DB;
$arFirstDocumentId = CBPHelper::ParseDocumentId($firstDocumentId);
$arSecondDocumentId = CBPHelper::ParseDocumentId($secondDocumentId);
$DB->Query("UPDATE b_bp_history SET " . "\tDOCUMENT_ID = '" . $DB->ForSql($arFirstDocumentId[2]) . "', " . "\tENTITY = '" . $DB->ForSql($arFirstDocumentId[1]) . "', " . "\tMODULE_ID = '" . $DB->ForSql($arFirstDocumentId[0]) . "' " . "WHERE DOCUMENT_ID = '" . $DB->ForSql($arSecondDocumentId[2]) . "' " . "\tAND ENTITY = '" . $DB->ForSql($arSecondDocumentId[1]) . "' " . "\tAND MODULE_ID = '" . $DB->ForSql($arSecondDocumentId[0]) . "' ");
}
示例13: GetAllowableUserGroups
public static function GetAllowableUserGroups($parameterDocumentType)
{
list($moduleId, $entity, $documentType) = CBPHelper::ParseDocumentId($parameterDocumentType);
if (strlen($moduleId) > 0)
CModule::IncludeModule($moduleId);
if (class_exists($entity))
{
$result = call_user_func_array(array($entity, "GetAllowableUserGroups"), array($documentType));
$result1 = array();
foreach ($result as $key => $value)
$result1[strtolower($key)] = $value;
return $result1;
}
return array();
}
示例14: MigrateDocumentType
public static function MigrateDocumentType($oldType, $newType, $workflowTemplateIds)
{
global $DB;
$arOldType = CBPHelper::ParseDocumentId($oldType);
$arNewType = CBPHelper::ParseDocumentId($newType);
$DB->Query("UPDATE b_bp_history 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 DOCUMENT_ID IN (SELECT t.DOCUMENT_ID FROM b_bp_workflow_state t WHERE t.WORKFLOW_TEMPLATE_ID in (" . implode(",", $workflowTemplateIds) . ") and t.MODULE_ID='" . $DB->ForSql($arOldType[0]) . "' and t.ENTITY='" . $DB->ForSql($arOldType[1]) . "') ");
}
示例15: UpdateDocumentHistory
public function UpdateDocumentHistory($parameterDocumentId, $historyId)
{
$historyService = self::GetHistoryService();
list($moduleId, $entity, $documentId) = CBPHelper::ParseDocumentId($parameterDocumentId);
$result = false;
if ($moduleId == 'webdav' && class_exists($entity)) {
$doc = call_user_func_array(array($entity, "GetDocumentForHistory"), array($documentId, $historyId, true));
$result = $historyService->UpdateHistory($historyId, array('DOCUMENT' => $doc));
}
return $result;
}