當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。