本文整理汇总了PHP中CBPHelper::ExtractUsersFromUserGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::ExtractUsersFromUserGroups方法的具体用法?PHP CBPHelper::ExtractUsersFromUserGroups怎么用?PHP CBPHelper::ExtractUsersFromUserGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::ExtractUsersFromUserGroups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckCondition
private function CheckCondition($fieldName, $field, $operation, $value, $type = null, $rootActivity = null)
{
$result = false;
$value = $rootActivity->ParseValue($value, $type);
if ($type == "user") {
$field = CBPHelper::ExtractUsersFromUserGroups($field, $rootActivity);
$value = CBPHelper::ExtractUsersFromUserGroups($value, $rootActivity);
} elseif ($type == "select") {
if (is_array($field) && CBPHelper::IsAssociativeArray($field)) {
$field = array_keys($field);
}
}
if (!is_array($field)) {
$field = array($field);
}
if ($operation == "in") {
foreach ($field as $f) {
if (is_array($value)) {
$result = in_array($f, $value);
} else {
$result = strpos($value, $f) !== false;
}
if (!$result) {
break;
}
}
return $result;
}
if ($operation == "contain") {
if (!is_array($value)) {
$value = array($value);
}
foreach ($value as $v) {
foreach ($field as $f) {
if (is_array($f)) {
$result = in_array($v, $f);
} else {
$result = strpos($f, $v) !== false;
}
if ($result) {
break;
}
}
if (!$result) {
break;
}
}
return $result;
}
if ($operation == 'modified') {
$modified = $rootActivity->{CBPDocument::PARAM_MODIFIED_DOCUMENT_FIELDS};
if (!is_array($modified)) {
return true;
}
return in_array($fieldName, $modified);
}
if (!is_array($value)) {
$value = array($value);
}
if (CBPHelper::IsAssociativeArray($field)) {
$field = array_keys($field);
}
if (CBPHelper::IsAssociativeArray($value)) {
$value = array_keys($value);
}
$i = 0;
$fieldCount = count($field);
$valueCount = count($value);
$iMax = max($fieldCount, $valueCount);
while ($i < $iMax) {
$f1 = $fieldCount > $i ? $field[$i] : $field[$fieldCount - 1];
$v1 = $valueCount > $i ? $value[$i] : $value[$valueCount - 1];
if ($type == "datetime" || $type == "date") {
if (($f1Tmp = MakeTimeStamp($f1, FORMAT_DATETIME)) === false) {
if (($f1Tmp = MakeTimeStamp($f1, FORMAT_DATE)) === false) {
if (($f1Tmp = MakeTimeStamp($f1, "YYYY-MM-DD HH:MI:SS")) === false) {
if (($f1Tmp = MakeTimeStamp($f1, "YYYY-MM-DD")) === false) {
$f1Tmp = 0;
}
}
}
}
$f1 = $f1Tmp;
if (($v1Tmp = MakeTimeStamp($v1, FORMAT_DATETIME)) === false) {
if (($v1Tmp = MakeTimeStamp($v1, FORMAT_DATE)) === false) {
if (($v1Tmp = MakeTimeStamp($v1, "YYYY-MM-DD HH:MI:SS")) === false) {
if (($v1Tmp = MakeTimeStamp($v1, "YYYY-MM-DD")) === false) {
$v1Tmp = 0;
}
}
}
}
$v1 = $v1Tmp;
}
switch ($operation) {
case ">":
$result = $f1 > $v1;
break;
case ">=":
$result = $f1 >= $v1;
//.........这里部分代码省略.........
示例2: CheckCondition
private function CheckCondition($field, $operation, $value, $type = null, $rootActivity = null)
{
$result = false;
$value = $rootActivity->ParseValue($value);
if ($type == "user") {
$field = CBPHelper::ExtractUsersFromUserGroups($field, $rootActivity);
$value = CBPHelper::ExtractUsersFromUserGroups($value, $rootActivity);
}
if (!is_array($field)) {
$field = array($field);
}
if ($operation == "in") {
foreach ($field as $f) {
if (is_array($value)) {
$result = in_array($f, $value);
} else {
$result = strpos($value, $f) !== false;
}
if (!$result) {
break;
}
}
return $result;
}
if (!is_array($value)) {
$value = array($value);
}
$i = 0;
$fieldCount = count($field);
$valueCount = count($value);
if ($fieldCount == 0 && $valueCount == 0) {
return in_array($operation, array("=", ">=", "<="));
}
$iMax = max($fieldCount, $valueCount);
while ($i < $iMax) {
$f1 = $fieldCount > $i ? $field[$i] : $field[$fieldCount - 1];
$v1 = $valueCount > $i ? $value[$i] : $value[$valueCount - 1];
if ($type == "datetime") {
if (($f1Tmp = MakeTimeStamp($f1, FORMAT_DATETIME)) === false) {
if (($f1Tmp = MakeTimeStamp($f1, FORMAT_DATE)) === false) {
if (($f1Tmp = MakeTimeStamp($f1, "YYYY-MM-DD HH:MI:SS")) === false) {
if (($f1Tmp = MakeTimeStamp($f1, "YYYY-MM-DD")) === false) {
$f1Tmp = 0;
}
}
}
}
$f1 = $f1Tmp;
if (($v1Tmp = MakeTimeStamp($v1, FORMAT_DATETIME)) === false) {
if (($v1Tmp = MakeTimeStamp($v1, FORMAT_DATE)) === false) {
if (($v1Tmp = MakeTimeStamp($v1, "YYYY-MM-DD HH:MI:SS")) === false) {
if (($v1Tmp = MakeTimeStamp($v1, "YYYY-MM-DD")) === false) {
$v1Tmp = 0;
}
}
}
}
$v1 = $v1Tmp;
}
switch ($operation) {
case ">":
$result = $f1 > $v1;
break;
case ">=":
$result = $f1 >= $v1;
break;
case "<":
$result = $f1 < $v1;
break;
case "<=":
$result = $f1 <= $v1;
break;
case "!=":
$result = $f1 != $v1;
break;
default:
$result = $f1 == $v1;
}
if (!$result) {
break;
}
$i++;
}
return $result;
}