本文整理汇总了PHP中CBPDocument::isExpression方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::isExpression方法的具体用法?PHP CBPDocument::isExpression怎么用?PHP CBPDocument::isExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::isExpression方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldInputValue
public static function getFieldInputValue($documentType, $fieldType, $fieldName, $request, &$errors)
{
$storageId = self::getStorageIdByType($documentType);
if (!$storageId) {
throw new CBPArgumentOutOfRangeException('documentType');
}
$result = array();
if ($fieldType["Type"] == "user" || $fieldType['Type'] == static::getPrefixForCustomType() . 'employee') {
$value = $request[$fieldName["Field"]];
if (strlen($value) > 0) {
$result = CBPHelper::usersStringToArray($value, self::generateDocumentComplexType($storageId), $errors);
if (count($errors) > 0) {
foreach ($errors as $e) {
$errors[] = $e;
}
}
}
} elseif (array_key_exists($fieldName["Field"], $request) || array_key_exists($fieldName["Field"] . "_text", $request)) {
$valueArray = array();
if (array_key_exists($fieldName["Field"], $request)) {
$valueArray = $request[$fieldName["Field"]];
if (!is_array($valueArray) || is_array($valueArray) && CBPHelper::isAssociativeArray($valueArray)) {
$valueArray = array($valueArray);
}
}
if (array_key_exists($fieldName["Field"] . "_text", $request)) {
$valueArray[] = $request[$fieldName["Field"] . "_text"];
}
foreach ($valueArray as $value) {
if (is_array($value) || !is_array($value) && !\CBPDocument::isExpression(trim($value))) {
if ($fieldType["Type"] == "int") {
if (strlen($value) > 0) {
$value = str_replace(" ", "", $value);
if ($value . "|" == intval($value) . "|") {
$value = intval($value);
} else {
$value = null;
$errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_INVALID1"), "parameter" => $fieldName["Field"]);
}
} else {
$value = null;
}
} elseif ($fieldType["Type"] == "double") {
if (strlen($value) > 0) {
$value = str_replace(" ", "", str_replace(",", ".", $value));
if (is_numeric($value)) {
$value = doubleval($value);
} else {
$value = null;
$errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_INVALID1"), "parameter" => $fieldName["Field"]);
}
} else {
$value = null;
}
} elseif ($fieldType["Type"] == "select") {
if (!is_array($fieldType["Options"]) || count($fieldType["Options"]) <= 0 || strlen($value) <= 0) {
$value = null;
} else {
$ar = array_values($fieldType["Options"]);
if (is_array($ar[0])) {
$b = false;
foreach ($ar as $a) {
if ($a[0] == $value) {
$b = true;
break;
}
}
if (!$b) {
$value = null;
$errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
}
} else {
if (!array_key_exists($value, $fieldType["Options"])) {
$value = null;
$errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
}
}
}
} elseif ($fieldType["Type"] == "bool") {
if ($value !== "Y" && $value !== "N") {
if ($value === true) {
$value = "Y";
} elseif ($value === false) {
$value = "N";
} elseif (strlen($value) > 0) {
$value = strtolower($value);
if (in_array($value, array("y", "yes", "true", "1"))) {
$value = "Y";
} elseif (in_array($value, array("n", "no", "false", "0"))) {
$value = "N";
} else {
$value = null;
$errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
}
} else {
$value = null;
}
}
} elseif ($fieldType["Type"] == "file") {
if (is_array($value) && array_key_exists("name", $value) && strlen($value["name"]) > 0) {
//.........这里部分代码省略.........