private function GetRealParameterValue($objectName, $fieldName, &$result)
{
$return = false;
if ($objectName == "Document")
{
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$document = $documentService->GetDocument($documentId);
if (array_key_exists($fieldName, $document))
{
$result = $document[$fieldName];
$return = true;
}
}
elseif ($objectName == "Template")
{
$rootActivity = $this->GetRootActivity();
if (substr($fieldName, -strlen("_printable")) == "_printable")
{
$fieldNameTmp = substr($fieldName, 0, strlen($fieldName) - strlen("_printable"));
$result = $rootActivity->{$fieldNameTmp};
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$result = $documentService->GetFieldValuePrintable($documentId, $fieldNameTmp, $rootActivity->arPropertiesTypes[$fieldNameTmp]["Type"], $result, $rootActivity->arPropertiesTypes[$fieldNameTmp]);
if (is_array($result))
$result = implode(", ", $result);
}
else
{
$result = $rootActivity->{$fieldName};
}
$return = true;
}
elseif ($objectName == "Variable")
{
$rootActivity = $this->GetRootActivity();
if (substr($fieldName, -strlen("_printable")) == "_printable")
{
$fieldNameTmp = substr($fieldName, 0, strlen($fieldName) - strlen("_printable"));
$result = $rootActivity->GetVariable($fieldNameTmp);
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$result = $documentService->GetFieldValuePrintable($documentId, $fieldNameTmp, $rootActivity->arVariablesTypes[$fieldNameTmp]["Type"], $result, $rootActivity->arVariablesTypes[$fieldNameTmp]);
if (is_array($result))
$result = implode(", ", $result);
}
else
{
$result = $rootActivity->GetVariable($fieldName);
}
$return = true;
}
elseif ($objectName == "Workflow")
{
$result = $this->GetWorkflowInstanceId();
$return = true;
}
elseif ($objectName == "User")
{
$result = 0;
if ($GLOBALS["USER"]->IsAuthorized())
$result = "user_".$GLOBALS["USER"]->GetID();
$return = true;
}
elseif ($objectName == "System")
{
global $DB;
$result = null;
if ($fieldName == "Now")
$result = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
elseif ($fieldName == "Date")
$result = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")));
if ($result !== null)
$return = true;
}
elseif ($objectName)
{
$activity = $this->workflow->GetActivityByName($objectName);
if ($activity)
{
// _printable is not supported because mapping between activity property types
// and document property types is not supported
$result = $activity->{$fieldName};
$return = true;
}
}
return $return;
}