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


PHP CBPDocument::IsExpression方法代码示例

本文整理汇总了PHP中CBPDocument::IsExpression方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::IsExpression方法的具体用法?PHP CBPDocument::IsExpression怎么用?PHP CBPDocument::IsExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPDocument的用法示例。


在下文中一共展示了CBPDocument::IsExpression方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetFieldInputValue

 public function GetFieldInputValue($documentType, $fieldType, $fieldName, $request, &$errors)
 {
     $iblockId = intval(substr($documentType, strlen("iblock_")));
     if ($iblockId <= 0) {
         throw new CBPArgumentOutOfRangeException("documentType", $documentType);
     }
     $result = array();
     if ($fieldType["Type"] == "user") {
         $value = $request[$fieldName["Field"]];
         if (strlen($value) > 0) {
             $result = CBPHelper::usersStringToArray($value, array("lists", get_called_class(), $documentType), $errors);
             if (count($errors) > 0) {
                 foreach ($errors as $e) {
                     $errors[] = $e;
                 }
             }
         } else {
             $result = null;
         }
     } 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" => GetMessage("LISTS_BIZPROC_INVALID_INT"), "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" => GetMessage("LISTS_BIZPROC_INVALID_INT"), "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" => GetMessage("LISTS_BIZPROC_INVALID_SELECT"), "parameter" => $fieldName["Field"]);
                             }
                         } else {
                             if (!array_key_exists($value, $fieldType["Options"])) {
                                 $value = null;
                                 $errors[] = array("code" => "ErrorValue", "message" => GetMessage("LISTS_BIZPROC_INVALID_SELECT"), "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" => GetMessage("BPCGWTL_INVALID45"), "parameter" => $fieldName["Field"]);
                             }
                         } else {
                             $value = null;
                         }
                     }
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:bizprocdocument.php

示例2: GetFieldInputValue

 public static function GetFieldInputValue($documentType, $arFieldType, $arFieldName, $arRequest, &$arErrors)
 {
     if (strpos($documentType, '_') === false) {
         $documentType .= '_0';
     }
     $arDocumentID = self::GetDocumentInfo($documentType);
     if (empty($arDocumentID)) {
         throw new CBPArgumentNullException('documentId');
     }
     $result = array();
     if ($arFieldType["Type"] == "user") {
         $value = array_key_exists($arFieldName["Field"], $arRequest) ? $arRequest[$arFieldName["Field"]] : '';
         if ($value !== '') {
             $arErrorsTmp1 = array();
             $result = CBPHelper::UsersStringToArray($value, $arDocumentID["DOCUMENT_TYPE"], $arErrorsTmp1);
             if (count($arErrorsTmp1) > 0) {
                 foreach ($arErrorsTmp1 as $e) {
                     $arErrors[] = $e;
                 }
             }
         } elseif (array_key_exists($arFieldName["Field"] . "_text", $arRequest)) {
             $result[] = $arRequest[$arFieldName["Field"] . "_text"];
         }
     } elseif (array_key_exists($arFieldName["Field"], $arRequest) || array_key_exists($arFieldName["Field"] . "_text", $arRequest)) {
         $arValue = array();
         if (array_key_exists($arFieldName["Field"], $arRequest)) {
             $arValue = $arRequest[$arFieldName["Field"]];
             if (!is_array($arValue) || is_array($arValue) && CBPHelper::IsAssociativeArray($arValue)) {
                 $arValue = array($arValue);
             }
         }
         if (array_key_exists($arFieldName["Field"] . "_text", $arRequest)) {
             $arValue[] = $arRequest[$arFieldName["Field"] . "_text"];
         }
         foreach ($arValue as $value) {
             if (is_array($value) || !is_array($value) && !CBPDocument::IsExpression(trim($value))) {
                 if ($arFieldType['Type'] == 'email' || $arFieldType['Type'] == 'im' || $arFieldType['Type'] == 'web' || $arFieldType['Type'] == 'phone') {
                     if (is_array($value)) {
                         $keys1 = array_keys($value);
                         foreach ($keys1 as $key1) {
                             if (is_array($value[$key1])) {
                                 $keys2 = array_keys($value[$key1]);
                                 foreach ($keys2 as $key2) {
                                     if (!isset($value[$key1][$key2]["VALUE"]) || empty($value[$key1][$key2]["VALUE"])) {
                                         unset($value[$key1][$key2]);
                                     }
                                 }
                                 if (count($value[$key1]) <= 0) {
                                     unset($value[$key1]);
                                 }
                             } else {
                                 unset($value[$key1]);
                             }
                         }
                         if (count($value) <= 0) {
                             $value = null;
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($arFieldType["Type"] == "int") {
                     if (strlen($value) > 0) {
                         $value = str_replace(" ", "", $value);
                         if ($value . "|" == intval($value) . "|") {
                             $value = intval($value);
                         } else {
                             $value = null;
                             $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID1"), "parameter" => $arFieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($arFieldType["Type"] == "double") {
                     if (strlen($value) > 0) {
                         $value = str_replace(" ", "", str_replace(",", ".", $value));
                         if (is_numeric($value)) {
                             $value = doubleval($value);
                         } else {
                             $value = null;
                             $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID11"), "parameter" => $arFieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($arFieldType["Type"] == "select") {
                     if (!is_array($arFieldType["Options"]) || count($arFieldType["Options"]) <= 0 || strlen($value) <= 0) {
                         $value = null;
                     } else {
                         $ar = array_values($arFieldType["Options"]);
                         if (is_array($ar[0])) {
                             $b = false;
                             foreach ($ar as $a) {
                                 if ($a[0] == $value) {
                                     $b = true;
                                     break;
                                 }
                             }
                             if (!$b) {
                                 $value = null;
                                 $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID35"), "parameter" => $arFieldName["Field"]);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_document.php

示例3: GetFieldInputValue

 function GetFieldInputValue($documentType, $arFieldType, $arFieldName, $arRequest, &$arErrors)
 {
     $iblockId = intval(substr($documentType, strlen("iblock_")));
     if ($iblockId <= 0) {
         throw new CBPArgumentOutOfRangeException("documentType", $documentType);
     }
     $result = array();
     if ($arFieldType["Type"] == "user") {
         $value = $arRequest[$arFieldName["Field"]];
         if (strlen($value) > 0) {
             $result = CBPHelper::UsersStringToArray($value, array("iblock", "CIBlockDocument", $documentType), $arErrors);
             if (count($arErrors) > 0) {
                 foreach ($arErrors as $e) {
                     $arErrors[] = $e;
                 }
             }
         }
     } elseif (array_key_exists($arFieldName["Field"], $arRequest) || array_key_exists($arFieldName["Field"] . "_text", $arRequest)) {
         $arValue = array();
         if (array_key_exists($arFieldName["Field"], $arRequest)) {
             $arValue = $arRequest[$arFieldName["Field"]];
             if (!is_array($arValue) || is_array($arValue) && CBPHelper::IsAssociativeArray($arValue)) {
                 $arValue = array($arValue);
             }
         }
         if (array_key_exists($arFieldName["Field"] . "_text", $arRequest)) {
             $arValue[] = $arRequest[$arFieldName["Field"] . "_text"];
         }
         foreach ($arValue as $value) {
             if (is_array($value) || !is_array($value) && !CBPDocument::IsExpression(trim($value))) {
                 if ($arFieldType["Type"] == "int") {
                     if (strlen($value) > 0) {
                         $value = str_replace(" ", "", $value);
                         if ($value . "|" == intval($value) . "|") {
                             $value = intval($value);
                         } else {
                             $value = null;
                             $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID1"), "parameter" => $arFieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($arFieldType["Type"] == "double") {
                     if (strlen($value) > 0) {
                         $value = str_replace(" ", "", str_replace(",", ".", $value));
                         if (is_numeric($value)) {
                             $value = doubleval($value);
                         } else {
                             $value = null;
                             $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID11"), "parameter" => $arFieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($arFieldType["Type"] == "select") {
                     if (!is_array($arFieldType["Options"]) || count($arFieldType["Options"]) <= 0 || strlen($value) <= 0) {
                         $value = null;
                     } else {
                         $ar = array_values($arFieldType["Options"]);
                         if (is_array($ar[0])) {
                             $b = false;
                             foreach ($ar as $a) {
                                 if ($a[0] == $value) {
                                     $b = true;
                                     break;
                                 }
                             }
                             if (!$b) {
                                 $value = null;
                                 $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID35"), "parameter" => $arFieldName["Field"]);
                             }
                         } else {
                             if (!array_key_exists($value, $arFieldType["Options"])) {
                                 $value = null;
                                 $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID35"), "parameter" => $arFieldName["Field"]);
                             }
                         }
                     }
                 } elseif ($arFieldType["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;
                                 $arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID45"), "parameter" => $arFieldName["Field"]);
                             }
                         } else {
                             $value = null;
                         }
                     }
                 } elseif ($arFieldType["Type"] == "file") {
                     if (is_array($value) && array_key_exists("name", $value) && strlen($value["name"]) > 0) {
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:iblockdocument.php

示例4: GetMessage

	</td>
</tr>
<tr>
	<td align="right" width="40%" valign="top"><?php 
echo GetMessage("SNBPA_PD_POST_SITE");
?>
:</td>
	<td width="60%">
		<select name="post_site">
			<option value="">(<?php 
echo GetMessage("SNBPA_PD_POST_SITE_OTHER");
?>
)</option>
			<?php 
$b = $o = "";
$expression = CBPDocument::IsExpression($arCurrentValues["post_site"]) ? htmlspecialcharsbx($arCurrentValues["post_site"]) : '';
$dbSites = CSite::GetList($b, $o, array("ACTIVE" => "Y"));
while ($site = $dbSites->GetNext()) {
    ?>
<option value="<?php 
    echo $site["LID"];
    ?>
"<?php 
    echo $site["LID"] == $arCurrentValues["post_site"] ? " selected" : "";
    ?>
>[<?php 
    echo $site["LID"];
    ?>
] <?php 
    echo $site["NAME"];
    ?>
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:properties_dialog.php

示例5: GetPropertiesDialogValues

 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("Fields" => array());
     $documentService = $runtime->GetService("DocumentService");
     $arDocumentFields = $documentService->GetDocumentFields($documentType);
     foreach ($arDocumentFields as $fieldKey => $fieldValue) {
         if (!$fieldValue["Editable"]) {
             continue;
         }
         $arErrors = array();
         $r = $documentService->GetFieldInputValue($documentType, $fieldValue, $fieldKey, $arCurrentValues, $arErrors);
         if ($fieldValue["BaseType"] == "user" && !CBPDocument::IsExpression($r)) {
             if (!is_array($r)) {
                 $r = array($r);
             }
             $ar = array();
             foreach ($r as $v) {
                 if (substr($v, 0, strlen("user_")) == "user_") {
                     $ar[] = substr($v, strlen("user_"));
                 }
             }
             if (count($ar) == 0) {
                 $r = null;
             } elseif (count($ar) == 1) {
                 $r = $ar[0];
             } else {
                 $r = $ar;
             }
         }
         if ($fieldValue["Required"] && $r == null) {
             $arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $fieldValue["Name"], GetMessage("BPCDA_FIELD_REQUIED")));
         }
         if ($r != null) {
             $arProperties["Fields"][$fieldKey] = $r;
         }
     }
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:45,代码来源:createdocumentactivity.php


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