本文整理汇总了PHP中CBPActivity::GetRootActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPActivity::GetRootActivity方法的具体用法?PHP CBPActivity::GetRootActivity怎么用?PHP CBPActivity::GetRootActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPActivity
的用法示例。
在下文中一共展示了CBPActivity::GetRootActivity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Evaluate
public function Evaluate(CBPActivity $ownerActivity)
{
if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) {
return true;
}
if (!is_array($this->condition[0])) {
$this->condition = array($this->condition);
}
$rootActivity = $ownerActivity->GetRootActivity();
$result = true;
foreach ($this->condition as $cond) {
if ($rootActivity->IsPropertyExists($cond[0])) {
if (!$this->CheckCondition($rootActivity->{$cond[0]}, $cond[1], $cond[2], $rootActivity->GetPropertyBaseType($cond[0]), $rootActivity)) {
$result = false;
break;
}
} elseif ($rootActivity->IsVariableExists($cond[0])) {
if (!$this->CheckCondition($rootActivity->GetVariable($cond[0]), $cond[1], $cond[2], $rootActivity->GetVariableBaseType($cond[0]), $rootActivity)) {
$result = false;
break;
}
}
}
return $result;
}
示例2: Evaluate
public function Evaluate(CBPActivity $ownerActivity)
{
if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) {
return true;
}
if (!is_array($this->condition[0])) {
$this->condition = array($this->condition);
}
$rootActivity = $ownerActivity->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $ownerActivity->workflow->GetService("DocumentService");
$document = $documentService->GetDocument($documentId);
$documentFields = $documentService->GetDocumentFields($documentService->GetDocumentType($documentId));
$result = false;
foreach ($this->condition as $cond) {
$result = true;
if (array_key_exists($cond[0], $document)) {
$fld = isset($document[$cond[0] . "_XML_ID"]) ? $document[$cond[0] . "_XML_ID"] : $document[$cond[0]];
if (!$this->CheckCondition($fld, $cond[1], $cond[2], $documentFields[$cond[0]]["BaseType"], $rootActivity)) {
$result = false;
break;
}
} else {
throw new Exception("Field '" . $cond[0] . "' is not found in document (if/else condition)");
$result = false;
break;
}
}
return $result;
}
示例3: Evaluate
public function Evaluate(CBPActivity $ownerActivity)
{
if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) {
return true;
}
if (!is_array($this->condition[0])) {
$this->condition = array($this->condition);
}
$rootActivity = $ownerActivity->GetRootActivity();
$result = array(0 => true);
$i = 0;
foreach ($this->condition as $cond) {
$r = true;
$joiner = empty($cond[3]) ? static::CONDITION_JOINER_AND : static::CONDITION_JOINER_OR;
if ($rootActivity->IsPropertyExists($cond[0])) {
if (!$this->CheckCondition($rootActivity->{$cond[0]}, $cond[1], $cond[2], $rootActivity->GetPropertyBaseType($cond[0]), $rootActivity)) {
$r = false;
}
} elseif ($rootActivity->IsVariableExists($cond[0])) {
if (!$this->CheckCondition($rootActivity->GetVariable($cond[0]), $cond[1], $cond[2], $rootActivity->GetVariableBaseType($cond[0]), $rootActivity)) {
$r = false;
}
}
if ($joiner == static::CONDITION_JOINER_OR) {
++$i;
$result[$i] = $r;
} elseif (!$r) {
$result[$i] = false;
}
}
$result = array_filter($result);
return sizeof($result) > 0 ? true : false;
}
示例4: Evaluate
public function Evaluate(CBPActivity $ownerActivity)
{
if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) {
return true;
}
if (!is_array($this->condition[0])) {
$this->condition = array($this->condition);
}
$rootActivity = $ownerActivity->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $ownerActivity->workflow->GetService("DocumentService");
$document = $documentService->GetDocument($documentId);
$documentFields = $documentService->GetDocumentFields($documentService->GetDocumentType($documentId));
$result = array(0 => true);
$i = 0;
foreach ($this->condition as $cond) {
$r = true;
$joiner = empty($cond[3]) ? static::CONDITION_JOINER_AND : static::CONDITION_JOINER_OR;
if (!isset($document[$cond[0]]) && substr($cond[0], -strlen('_PRINTABLE')) == '_PRINTABLE') {
$cond[0] = substr($cond[0], 0, strlen($cond[0]) - strlen('_PRINTABLE'));
}
if (array_key_exists($cond[0], $document)) {
$fld = isset($document[$cond[0] . "_XML_ID"]) ? $document[$cond[0] . "_XML_ID"] : $document[$cond[0]];
if (!$this->CheckCondition($cond[0], $fld, $cond[1], $cond[2], $documentFields[$cond[0]]["BaseType"], $rootActivity)) {
$r = false;
}
} else {
throw new Exception("Field '" . $cond[0] . "' is not found in document (if/else condition)");
}
if ($joiner == static::CONDITION_JOINER_OR) {
++$i;
$result[$i] = $r;
} elseif (!$r) {
$result[$i] = false;
}
}
$result = array_filter($result);
return sizeof($result) > 0 ? true : false;
}
示例5: Evaluate
public function Evaluate(CBPActivity $ownerActivity)
{
if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) {
return true;
}
if (!is_array($this->condition[0])) {
$this->condition = array($this->condition);
}
$rootActivity = $ownerActivity->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $ownerActivity->workflow->GetService("DocumentService");
$document = $documentService->GetDocument($documentId);
$documentFields = $documentService->GetDocumentFields($documentService->GetDocumentType($documentId));
$result = true;
foreach ($this->condition as $cond) {
if (array_key_exists($cond[0], $document)) {
if (!$this->CheckCondition($document[$cond[0]], $cond[1], $cond[2], $documentFields[$cond[0]]["BaseType"], $rootActivity)) {
$result = false;
break;
}
}
}
return $result;
}