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


PHP CBPHelper::ExtractUsersFromUserGroups方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:webgksupport,项目名称:alpina,代码行数:101,代码来源:fieldcondition.php

示例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;
 }
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:85,代码来源:propertyvariablecondition.php


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