本文整理汇总了PHP中CBPHelper::UsersStringToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::UsersStringToArray方法的具体用法?PHP CBPHelper::UsersStringToArray怎么用?PHP CBPHelper::UsersStringToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::UsersStringToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array("Permission" => array(), "Rewrite" => true);
$documentService = $runtime->GetService("DocumentService");
$arAllowableOperations = $documentService->GetAllowableOperations($documentType);
foreach ($arAllowableOperations as $operationKey => $operationValue) {
$arProperties["Permission"][$operationKey] = CBPHelper::UsersStringToArray($arCurrentValues["permission_" . $operationKey], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
}
$arProperties["Rewrite"] = $arCurrentValues["rewrite"] == "Y" ? "Y" : "N";
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例2: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("message_user_from" => "MessageUserFrom", "message_user_to" => "MessageUserTo", "message_text" => "MessageText");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "message_user_from" || $key == "message_user_to") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
global $USER;
if ($USER->IsAdmin() || CModule::IncludeModule("bitrix24") && CBitrix24::IsPortalAdmin($USER->GetID())) {
$arProperties["MessageUserFrom"] = CBPHelper::UsersStringToArray($arCurrentValues["message_user_from"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
} else {
$arProperties["MessageUserFrom"] = "user_" . $USER->GetID();
}
//global $USER;
//if (!$USER->IsAdmin())
// $arProperties["MessageUserFrom"] = "user_".$USER->GetID();
$arProperties["MessageUserTo"] = CBPHelper::UsersStringToArray($arCurrentValues["message_user_to"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例3: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("review_users" => "Users", "approve_type" => "ApproveType", "review_overdue_date" => "OverdueDate", "review_name" => "Name", "review_description" => "Description", "review_parameters" => "Parameters", "status_message" => "StatusMessage", "set_status_message" => "SetStatusMessage", "task_button_message" => "TaskButtonMessage", "comment_label_message" => "CommentLabelMessage", "show_comment" => "ShowComment", "timeout_duration" => "TimeoutDuration", "timeout_duration_type" => "TimeoutDurationType", "access_control" => "AccessControl");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "review_users") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
$arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["review_users"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例4: GetFieldInputValue
public static function GetFieldInputValue($documentType, $arFieldType, $arFieldName, $arRequest, &$arErrors)
{
$result = array();
if ($arFieldType["Type"] == "user") {
$value = $arRequest[$arFieldName["Field"]];
if (strlen($value) > 0) {
$result = CBPHelper::UsersStringToArray($value, $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 (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value)) && substr(trim($value), 0, 1) != "=") {
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 ($value . "|" == doubleval($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;
} elseif (!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 (array_key_exists("name", $value) && strlen($value["name"]) > 0) {
if (!array_key_exists("MODULE_ID", $value) || strlen($value["MODULE_ID"]) <= 0) {
$value["MODULE_ID"] = "bizproc";
}
$value = CFile::SaveFile($value, "bizproc_wf", true, true);
if (!$value) {
$value = null;
$arErrors[] = array("code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID915"), "parameter" => $arFieldName["Field"]);
}
} else {
$value = null;
}
} else {
if (!is_array($value) && strlen($value) <= 0) {
$value = null;
}
}
}
if ($value != null) {
$result[] = $value;
}
}
//.........这里部分代码省略.........
示例5: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$arMap = array("group_name" => "GroupName", "owner_id" => "OwnerId", "users" => "Users");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "owner_id" || $key == "users") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
$arProperties["OwnerId"] = CBPHelper::UsersStringToArray($arCurrentValues["owner_id"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["users"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例6: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("requested_users" => "Users", "requested_overdue_date" => "OverdueDate", "requested_name" => "Name", "requested_description" => "Description", "requested_parameters" => "Parameters", "requested_information" => "RequestedInformation", "task_button_message" => "TaskButtonMessage", "comment_label_message" => "CommentLabelMessage", "show_comment" => "ShowComment", "status_message" => "StatusMessage", "set_status_message" => "SetStatusMessage", 'access_control' => 'AccessControl', "timeout_duration" => "TimeoutDuration", "timeout_duration_type" => "TimeoutDurationType");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "requested_users") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
$arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["requested_users"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$ar = array();
$j = -1;
if (array_key_exists("RequestedInformation", $arProperties) && is_array($arProperties["RequestedInformation"])) {
foreach ($arProperties["RequestedInformation"] as $arRI) {
if (strlen($arRI["Name"]) <= 0) {
continue;
}
$j++;
$ar[$j] = $arRI;
$ar[$j]["Required"] = $arRI["Required"] == "Y";
$ar[$j]["Multiple"] = $arRI["Multiple"] == "Y";
}
}
$arProperties["RequestedInformation"] = $ar;
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
if (is_array($arProperties["RequestedInformation"])) {
foreach ($arProperties["RequestedInformation"] as $v) {
$arWorkflowVariables[$v["Name"]] = $v;
$arWorkflowVariables[$v["Name"]]["Name"] = $v["Title"];
}
}
return true;
}
示例7: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("mail_user_from" => "MailUserFrom", "mail_user_to" => "MailUserTo", "mail_subject" => "MailSubject", "mail_text" => "MailText", "mail_message_type" => "MailMessageType", "mail_charset" => "MailCharset", "dirrect_mail" => "DirrectMail", "mail_site" => "MailSite");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "mail_user_from" || $key == "mail_user_to") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
if (strlen($arProperties["MailSite"]) <= 0) {
$arProperties["MailSite"] = $arCurrentValues["mail_site_x"];
}
list($mailUserFromArray, $mailUserFrom) = CBPHelper::UsersStringToArray($arCurrentValues["mail_user_from"], $documentType, $arErrors, array(__CLASS__, "CheckEmailUserValue"));
if (count($arErrors) > 0) {
return false;
}
$arProperties["MailUserFrom"] = implode(", ", $mailUserFrom);
$arProperties["MailUserFromArray"] = $mailUserFromArray;
list($mailUserToArray, $mailUserTo) = CBPHelper::UsersStringToArray($arCurrentValues["mail_user_to"], $documentType, $arErrors, array(__CLASS__, "CheckEmailUserValue"));
if (count($arErrors) > 0) {
return false;
}
$arProperties["MailUserTo"] = implode(", ", $mailUserTo);
$arProperties["MailUserToArray"] = $mailUserToArray;
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例8: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array();
if (!isset($arCurrentValues["user_type"]) || !in_array($arCurrentValues["user_type"], array("boss", "random"))) {
$arCurrentValues["user_type"] = "random";
}
$arProperties["UserType"] = $arCurrentValues["user_type"];
if (!isset($arCurrentValues["max_level"]) || $arCurrentValues["max_level"] < 1 || $arCurrentValues["max_level"] > 10) {
$arCurrentValues["max_level"] = 1;
}
$arProperties["MaxLevel"] = $arCurrentValues["max_level"];
$arProperties["UserParameter"] = CBPHelper::UsersStringToArray($arCurrentValues["user_parameter"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arProperties["ReserveUserParameter"] = CBPHelper::UsersStringToArray($arCurrentValues["reserve_user_parameter"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
if (!isset($arCurrentValues["skip_absent"]) || !in_array($arCurrentValues["skip_absent"], array("Y", "N"))) {
$arCurrentValues["skip_absent"] = "Y";
}
$arProperties["SkipAbsent"] = $arCurrentValues["skip_absent"];
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例9: strlen
} else {
$op = "";
$newKey = $key;
}
if (array_key_exists($newKey, $arDocumentFields) && $arDocumentFields[$newKey]["Filterable"]) {
if ($arDocumentFields[$newKey]["BaseType"] == "select") {
$db = CIBlockProperty::GetPropertyEnum(substr($newKey, strlen("PROPERTY_")), array(), array("XML_ID" => $value, "IBLOCK_ID" => $arParams["BLOCK_ID"]));
while ($ar = $db->Fetch()) {
$value = $ar["ID"];
}
} elseif ($arDocumentFields[$newKey]["BaseType"] == "string" || $arDocumentFields[$newKey]["BaseType"] == "text") {
if ($op == "") {
$op = "?";
}
} elseif ($arDocumentFields[$newKey]["BaseType"] == "user") {
$value = CBPHelper::UsersStringToArray($value, $documentType, $arErrors);
if (is_array($value) && count($value) > 0) {
$value = $value[0];
}
if (substr($value, 0, strlen("user_")) == "user_") {
$value = substr($value, strlen("user_"));
}
} elseif ($arDocumentFields[$newKey]["BaseType"] == "datetime" && strlen($value) > 0 && CheckDateTime($value)) {
$isShort = strlen(trim($value)) <= 10;
$appendTime = $op == '<=' ? '23:59:59' : '00:00:00';
if (strpos($newKey, 'PROPERTY_') === 0) {
if ($timeZoneOffset != 0) {
$value = date("Y-m-d " . ($isShort ? $appendTime : 'H:i:s'), MakeTimeStamp($value, CLang::GetDateFormat("FULL")) - $timeZoneOffset);
} else {
$value = CDatabase::FormatDate($value, CLang::GetDateFormat("FULL"), "YYYY-MM-DD " . ($isShort ? $appendTime : 'HH:MI:SS'));
}
示例10: array
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), array(MODULE_ID, ENTITY, $_POST['document_type']));
} catch (Exception $e) {
$canWrite = false;
}
if (!$canWrite || !check_bitrix_sessid()) {
ShowError(GetMessage("ACCESS_DENIED"));
die;
}
if ($_POST["save"] == "Y") {
$perms = array();
if (!isset($arErrors)) {
$arErrors = array();
}
if (is_array($_POST['perm'])) {
foreach ($_POST['perm'] as $t => $v) {
$perms[$t] = CBPHelper::UsersStringToArray($v, array(MODULE_ID, ENTITY, $_POST['document_type']), $arErrors);
}
}
echo CUtil::PhpToJSObject($perms, false);
die;
}
$APPLICATION->ShowTitle(GetMessage("BIZPROC_WFS_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
echo $documentService->GetJSFunctionsForFields(array(MODULE_ID, ENTITY, $_POST['document_type']), "objFields");
$arAllowableOperations = $documentService->GetAllowableOperations(array(MODULE_ID, ENTITY, $_POST['document_type']));
if (defined('DISABLE_BIZPROC_PERMISSIONS') && DISABLE_BIZPROC_PERMISSIONS) {
$arAllowableOperations = array();
}
示例11: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$arProperties = array("Fields" => array());
$arTaskPriority = array(0, 1, 2);
foreach ($arTaskPriority as $k => $v) {
$arTaskPriority[$v] = GetMessage("TASK_PRIORITY_" . $v);
}
$arGroups = array(GetMessage("TASK_EMPTY_GROUP"));
if (CModule::IncludeModule("socialnetwork")) {
$db = CSocNetGroup::GetList(array("NAME" => "ASC"), array("ACTIVE" => "Y"), false, false, array("ID", "NAME"));
while ($ar = $db->GetNext()) {
$arGroups[$ar["ID"]] = "[" . $ar["ID"] . "]" . $ar["NAME"];
}
}
$arDF = self::__GetFields();
foreach (static::$arAllowedTasksFieldNames as $field) {
$r = null;
if (in_array($field, array("CREATED_BY", "RESPONSIBLE_ID", "ACCOMPLICES", "AUDITORS"))) {
$value = $arCurrentValues[$field];
if (strlen($value) > 0) {
$arErrorsTmp = array();
$r = CBPHelper::UsersStringToArray($value, $documentType, $arErrorsTmp);
if (count($arErrorsTmp) > 0) {
$arErrors = array_merge($arErrors, $arErrorsTmp);
}
}
} elseif (array_key_exists($field, $arCurrentValues) || array_key_exists($field . "_text", $arCurrentValues)) {
$arValue = array();
if (array_key_exists($field, $arCurrentValues)) {
$arValue = $arCurrentValues[$field];
if (!is_array($arValue) || is_array($arValue) && CBPHelper::IsAssociativeArray($arValue)) {
$arValue = array($arValue);
}
}
if (array_key_exists($field . "_text", $arCurrentValues)) {
$arValue[] = $arCurrentValues[$field . "_text"];
}
foreach ($arValue as $value) {
$value = trim($value);
if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", $value) && substr($value, 0, 1) !== "=") {
if ($field == "PRIORITY") {
if (strlen($value) <= 0) {
$value = null;
}
if ($value != null && !array_key_exists($value, $arTaskPriority)) {
$value = null;
$arErrors[] = array("code" => "ErrorValue", "message" => "Priority is empty", "parameter" => $field);
}
} elseif ($field == "GROUP_ID") {
if (strlen($value) <= 0) {
$value = null;
}
if ($value != null && !array_key_exists($value, $arGroups)) {
$value = null;
$arErrors[] = array("code" => "ErrorValue", "message" => "Group is empty", "parameter" => $field);
}
} elseif (in_array($field, array("ALLOW_CHANGE_DEADLINE", "TASK_CONTROL", "ADD_IN_REPORT", 'ALLOW_TIME_TRACKING'))) {
if (strtoupper($value) == "Y" || $value === true || $value . "!" == "1!") {
$value = "Y";
} elseif (strtoupper($value) == "N" || $value === false || $value . "!" == "0!") {
$value = "N";
} else {
$value = null;
}
} else {
if (!is_array($value) && strlen($value) <= 0) {
$value = null;
}
}
}
if ($value != null) {
$r[] = $value;
}
}
}
$r_orig = $r;
if (!in_array($field, array("ACCOMPLICES", "AUDITORS"))) {
if (count($r) > 0) {
$r = $r[0];
} else {
$r = null;
}
}
if (in_array($field, array("TITLE", "CREATED_BY", "RESPONSIBLE_ID")) && ($r == null || is_array($r) && count($r) <= 0)) {
$arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $arDF[$field]["Name"], GetMessage("BPCDA_FIELD_REQUIED")));
}
$arProperties["Fields"][$field] = $r;
if (array_key_exists($field . "_text", $arCurrentValues) && isset($r_orig[1])) {
$arProperties["Fields"][$field . '_text'] = $r_orig[1];
}
}
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("TASKS_TASK", 0, LANGUAGE_ID);
foreach ($arUserFields as $field) {
$r = $arCurrentValues[$field["FIELD_NAME"]];
if ($field["MULTIPLE"] == "Y" && (!$r || is_array($r) && count($r) <= 0)) {
$arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $field["EDIT_FORM_LABEL"], GetMessage("BPCDA_FIELD_REQUIED")));
}
$arProperties["Fields"][$field["FIELD_NAME"]] = $r;
}
//.........这里部分代码省略.........
示例12: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arMap = array("absence_user" => "AbsenceUser", "absence_name" => "AbsenceName", "absence_desrc" => "AbsenceDesrc", "absence_from" => "AbsenceFrom", "absence_to" => "AbsenceTo", "absence_state" => "AbsenceState", "absence_finish_state" => "AbsenceFinishState", "absence_type" => "AbsenceType");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "absence_user") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
$arProperties["AbsenceUser"] = CBPHelper::UsersStringToArray($arCurrentValues["absence_user"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例13: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$arProperties = array();
$arProperties["Permission"] = CBPHelper::UsersStringToArray($arCurrentValues["permission"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
$currentParent =& CBPWorkflowTemplateLoader::FindParentActivityByName($arWorkflowTemplate, $activityName);
$c = count($currentParent['Children']);
if ($c == 1) {
if ($arCurrentValues["setstate"] != '') {
$currentParent['Children'][] = array('Type' => 'SetStateActivity', 'Name' => md5(uniqid(mt_rand(), true)), 'Properties' => array('TargetStateName' => $arCurrentValues["setstate"]), 'Children' => array());
}
} elseif ($currentParent['Children'][$c - 1]["Type"] == 'SetStateActivity') {
if ($arCurrentValues["setstate"] != '') {
$currentParent['Children'][$c - 1]["Properties"]['TargetStateName'] = $arCurrentValues["setstate"];
} else {
unset($currentParent['Children'][$c - 1]);
}
}
return true;
}
示例14: GetPropertiesDialogValues
public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
{
$arErrors = array();
$arMap = array("owner_id" => "OwnerId", "users_to" => "UsersTo", "post_title" => "PostTitle", "post_message" => "PostMessage", 'post_message_type' => "PostMessageType", 'post_site' => "PostSite");
$arProperties = array();
foreach ($arMap as $key => $value) {
if ($key == "owner_id" || $key == "users_to") {
continue;
}
$arProperties[$value] = $arCurrentValues[$key];
}
if (strlen($arProperties["PostSite"]) <= 0) {
$arProperties["PostSite"] = $arCurrentValues["post_site_x"];
}
$arProperties["OwnerId"] = CBPHelper::UsersStringToArray($arCurrentValues["owner_id"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arProperties["UsersTo"] = CBPHelper::UsersStringToArray($arCurrentValues["users_to"], $documentType, $arErrors);
if (count($arErrors) > 0) {
return false;
}
$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (count($arErrors) > 0) {
return false;
}
$arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
$arCurrentActivity["Properties"] = $arProperties;
return true;
}
示例15: GetFieldInputValue
function GetFieldInputValue($documentType, $arFieldType, $arFieldName, $arRequest, &$arErrors)
{
$v = substr($documentType, strlen("type_"));
if (intval($v)."!" != $v."!")
return null;
$iblockId = intval($v);
$result = array();
if ($arFieldType["Type"] == "S:UserID")
{
$value = $arRequest[$arFieldName["Field"]];
if (strlen($value) > 0)
{
$arErrorsTmp1 = array();
$result = CBPHelper::UsersStringToArray($value, array("bizproc", "CBPVirtualDocument", $documentType), $arErrorsTmp1);
if (count($arErrorsTmp1) > 0)
{
foreach ($arErrorsTmp1 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) && (!preg_match("#^\{=[a-z0-9_]+:[a-z0-9_]+\}$#i", trim($value)) && (substr(trim($value), 0, 1) != "=")))
{
if ($arFieldType["Type"] == "N")
{
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_INVALID1N"),
"parameter" => $arFieldName["Field"],
);
}
}
else
{
$value = null;
}
}
elseif ($arFieldType["Type"] == "L")
{
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_INVALID3N"),
"parameter" => $arFieldName["Field"],
);
}
}
else
{
if (!array_key_exists($value, $arFieldType["Options"]))
{
$value = null;
$arErrors[] = array(
//.........这里部分代码省略.........