本文整理汇总了PHP中CBPHelper::isEmptyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::isEmptyValue方法的具体用法?PHP CBPHelper::isEmptyValue怎么用?PHP CBPHelper::isEmptyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::isEmptyValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckWorkflowParameters
public static function CheckWorkflowParameters($arTemplateParameters, $arPossibleValues, $documentType, &$arErrors)
{
$arErrors = array();
$arWorkflowParameters = array();
if (count($arTemplateParameters) <= 0) {
return array();
}
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
foreach ($arTemplateParameters as $parameterKey => $arParameter) {
$arErrorsTmp = array();
$arWorkflowParameters[$parameterKey] = $documentService->GetFieldInputValue($documentType, $arParameter, $parameterKey, $arPossibleValues, $arErrorsTmp);
if (CBPHelper::getBool($arParameter['Required']) && CBPHelper::isEmptyValue($arWorkflowParameters[$parameterKey])) {
$arErrorsTmp[] = array("code" => "RequiredValue", "message" => str_replace("#NAME#", $arParameter["Name"], GetMessage("BPCGWTL_INVALID8")), "parameter" => $parameterKey);
}
$arErrors = array_merge($arErrors, $arErrorsTmp);
}
return $arWorkflowParameters;
}
示例2: PostTaskForm
public static function PostTaskForm($arTask, $userId, $arRequest, &$arErrors, $userName = "", $realUserId = null)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
try {
$userId = intval($userId);
if ($userId <= 0) {
throw new CBPArgumentNullException("userId");
}
$arEventParameters = array("USER_ID" => $userId, "REAL_USER_ID" => $realUserId, "USER_NAME" => $userName, "COMMENT" => $arRequest["task_comment"], "RESPONCE" => array());
if ($arTask["PARAMETERS"] && is_array($arTask["PARAMETERS"]) && count($arTask["PARAMETERS"]) > 0 && $arTask["PARAMETERS"]["REQUEST"] && is_array($arTask["PARAMETERS"]["REQUEST"]) && count($arTask["PARAMETERS"]["REQUEST"]) > 0) {
$arRequest = $_REQUEST;
foreach ($_FILES as $k => $v) {
if (array_key_exists("name", $v)) {
if (is_array($v["name"])) {
$ks = array_keys($v["name"]);
for ($i = 0, $cnt = count($ks); $i < $cnt; $i++) {
$ar = array();
foreach ($v as $k1 => $v1) {
$ar[$k1] = $v1[$ks[$i]];
}
$arRequest[$k][] = $ar;
}
} else {
$arRequest[$k] = $v;
}
}
}
foreach ($arTask["PARAMETERS"]["REQUEST"] as $parameter) {
$arErrorsTmp = array();
$arEventParameters["RESPONCE"][$parameter["Name"]] = $documentService->GetFieldInputValue($arTask["PARAMETERS"]["DOCUMENT_TYPE"], $parameter, $parameter["Name"], $arRequest, $arErrorsTmp);
if (count($arErrorsTmp) > 0) {
$m = "";
foreach ($arErrorsTmp as $e) {
$m .= $e["message"] . "<br />";
}
throw new CBPArgumentException($m);
}
if (CBPHelper::getBool($parameter['Required']) && CBPHelper::isEmptyValue($arEventParameters['RESPONCE'][$parameter['Name']])) {
throw new CBPArgumentNullException($parameter["Name"], str_replace("#PARAM#", htmlspecialcharsbx($parameter["Title"]), GetMessage("BPRIA_ARGUMENT_NULL")));
}
}
}
CBPRuntime::SendExternalEvent($arTask["WORKFLOW_ID"], $arTask["ACTIVITY_NAME"], $arEventParameters);
return true;
} catch (Exception $e) {
$arErrors[] = array("code" => $e->getCode(), "message" => $e->getMessage(), "file" => $e->getFile() . " [" . $e->getLine() . "]");
}
return false;
}
示例3: ValidateProperties
public static function ValidateProperties($testProperties = array(), CBPWorkflowTemplateUser $user = null)
{
$errors = array();
$activityData = self::getRestActivityData();
$properties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : array();
foreach ($properties as $name => $property) {
$value = isset($property['DEFAULT']) ? $property['DEFAULT'] : null;
if (isset($testProperties[$name])) {
$value = $testProperties[$name];
}
if (CBPHelper::getBool($property['REQUIRED']) && CBPHelper::isEmptyValue($value)) {
$errors[] = array('code' => 'NotExist', 'parameter' => $name, 'message' => Loc::getMessage('BPRA_PD_ERROR_EMPTY_PROPERTY', array('#NAME#' => RestActivityTable::getLocalization($property['NAME'], LANGUAGE_ID))));
}
}
if (isset($testProperties['AuthUserId']) && (string) $testProperties['AuthUserId'] !== $activityData['AUTH_USER_ID'] && !static::checkAdminPermissions()) {
$errors[] = array('code' => 'NotExist', 'parameter' => 'AuthUserId', 'message' => Loc::getMessage('BPRA_PD_ERROR_EMPTY_PROPERTY', array('#NAME#' => Loc::getMessage('BPRA_PD_USER_ID'))));
}
return array_merge($errors, parent::ValidateProperties($testProperties, $user));
}
示例4: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array("FieldValue" => array());
/** @var CBPDocumentService $documentService */
$documentService = $runtime->GetService("DocumentService");
$arNewFieldsMap = array();
if (array_key_exists("new_field_name", $arCurrentValues) && is_array($arCurrentValues["new_field_name"])) {
$arNewFieldKeys = array_keys($arCurrentValues["new_field_name"]);
foreach ($arNewFieldKeys as $k) {
$code = trim($arCurrentValues["new_field_code"][$k]);
$arFieldsTmp = array("name" => $arCurrentValues["new_field_name"][$k], "code" => $code, "type" => $arCurrentValues["new_field_type"][$k], "multiple" => $arCurrentValues["new_field_mult"][$k], "required" => $arCurrentValues["new_field_req"][$k], "options" => $arCurrentValues["new_field_options"][$k]);
$newCode = $documentService->AddDocumentField($documentType, $arFieldsTmp);
$property = FieldType::normalizeProperty($arFieldsTmp);
$property['Code'] = $newCode;
$property['Name'] = $arFieldsTmp['name'];
$arNewFieldsMap[$code] = $property;
}
}
$arDocumentFields = $documentService->GetDocumentFields($documentType);
foreach ($arCurrentValues as $key => $value) {
if (strpos($key, 'document_field_') !== 0) {
continue;
}
$fieldKey = array_key_exists($value, $arNewFieldsMap) ? $arNewFieldsMap[$value]['Code'] : $value;
if (!isset($arDocumentFields[$fieldKey]) || !$arDocumentFields[$fieldKey]["Editable"]) {
continue;
}
$property = array_key_exists($value, $arNewFieldsMap) ? $arNewFieldsMap[$value] : $arDocumentFields[$fieldKey];
$r = $documentService->GetFieldInputValue($documentType, $property, $value, $arCurrentValues, $arErrors);
if (count($arErrors) > 0) {
return false;
}
if (CBPHelper::getBool($property['Required']) && CBPHelper::isEmptyValue($r)) {
$arErrors[] = array("code" => "NotExist", "parameter" => $fieldKey, "message" => GetMessage("BPSFA_ARGUMENT_NULL", array('#PARAM#' => $property['Name'])));
return false;
}
$arProperties["FieldValue"][$fieldKey] = $r;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}