public function Execute()
 {
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $historyService = $this->workflow->GetService("HistoryService");
     $documentService = $this->workflow->GetService("DocumentService");
     $userId = CBPHelper::ExtractUsers($this->UserId, $documentId, true);
     if ($userId == null || intval($userId) <= 0) {
         $userId = 1;
     }
     $historyIndex = $historyService->AddHistory(array("DOCUMENT_ID" => $documentId, "NAME" => "New", "DOCUMENT" => null, "USER_ID" => $userId));
     $arDocument = $documentService->GetDocumentForHistory($documentId, $historyIndex);
     if (!is_array($arDocument)) {
         return CBPActivityExecutionStatus::Closed;
     }
     $name = $this->Name;
     if ($name == null || strlen($name) <= 0) {
         if (array_key_exists("NAME", $arDocument) && is_string($arDocument["NAME"]) && strlen($arDocument["NAME"]) > 0) {
             $name = $arDocument["NAME"];
         } elseif (array_key_exists("TITLE", $arDocument) && is_string($arDocument["TITLE"]) && strlen($arDocument["TITLE"]) > 0) {
             $name = $arDocument["TITLE"];
         } else {
             $name = Date("Y-m-d H:i:s");
         }
     }
     $historyService->UpdateHistory($historyIndex, array("NAME" => $name, "DOCUMENT" => $arDocument));
     return CBPActivityExecutionStatus::Closed;
 }
 public static function formatValueMultiple(FieldType $fieldType, $value, $format = 'printable')
 {
     if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value)) {
         $value = array($value);
     }
     foreach ($value as $k => $v) {
         $value[$k] = static::formatValuePrintable($fieldType, $v);
     }
     return implode(static::getFormatSeparator($format), $value);
 }
 public static function ValidateProperties($testProperties = array(), CBPWorkflowTemplateUser $user = null)
 {
     $errors = array();
     try {
         CBPHelper::ParseDocumentId($testProperties['DocumentType']);
     } catch (Exception $e) {
         $errors[] = array("code" => "NotExist", "parameter" => "DocumentType", "message" => GetMessage("BPCLDA_ERROR_DT"));
     }
     return array_merge($errors, parent::ValidateProperties($testProperties, $user));
 }
Exemple #4
0
 /**
  * @param FieldType $fieldType Document field type.
  * @param array $field Form field.
  * @param mixed $value Field value.
  * @param bool $allowSelection Allow selection flag.
  * @param int $renderMode Control render mode.
  * @return string
  */
 public static function renderControlMultiple(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
 {
     if ($renderMode & FieldType::RENDER_MODE_DESIGNER) {
         if (is_array($value) && !\CBPHelper::isAssociativeArray($value)) {
             reset($value);
             $value = current($value);
         }
         return parent::renderControlSingle($fieldType, $field, $value, $allowSelection, $renderMode);
     }
     return parent::renderControlMultiple($fieldType, $field, $value, $allowSelection, $renderMode);
 }
 public function Execute()
 {
     if (!CModule::IncludeModule("forum")) {
         return CBPActivityExecutionStatus::Closed;
     }
     if (!CModule::IncludeModule("iblock")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $forumId = intval($this->ForumId);
     if ($forumId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $iblockId = $this->IBlockId;
     $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
     $arResult = $dbResult->Fetch();
     if (!$arResult) {
         $obProperty = new CIBlockProperty();
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum topic", "CODE" => "FORUM_TOPIC_ID"));
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum message count", "CODE" => "FORUM_MESSAGE_CNT"));
         $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
         $arResult = $dbResult->Fetch();
     }
     $forumTopicId = intval($arResult["VALUE"]);
     $arForumUserTmp = $this->ForumUser;
     $arForumUser = CBPHelper::ExtractUsers($arForumUserTmp, $documentId, true);
     $forumUserId = 1;
     $forumUserName = "******";
     if ($arForumUser != null) {
         $forumUserId = $arForumUser;
         $dbResult = CUser::GetByID($forumUserId);
         if ($arResult = $dbResult->Fetch()) {
             $forumUserName = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arResult, true);
         }
     }
     $newTopic = "N";
     if ($forumTopicId <= 0) {
         $documentService = $this->workflow->GetService("DocumentService");
         $document = $documentService->GetDocument($documentId);
         $newTopic = "Y";
         $arFields = array("TITLE" => $document["NAME"], "FORUM_ID" => $forumId, "USER_START_ID" => $forumUserId, "USER_START_NAME" => $forumUserName, "LAST_POSTER_NAME" => $forumUserName, "APPROVED" => "Y");
         $forumTopicId = CForumTopic::Add($arFields);
         CIBlockElement::SetPropertyValues($documentId[2], $iblockId, $forumTopicId, "FORUM_TOPIC_ID");
     }
     $arFields = array("POST_MESSAGE" => $this->ForumPostMessage, "AUTHOR_ID" => $forumUserId, "AUTHOR_NAME" => $forumUserName, "FORUM_ID" => $forumId, "TOPIC_ID" => $forumTopicId, "APPROVED" => "Y", "NEW_TOPIC" => $newTopic, "PARAM2" => $documentId[2]);
     $forumMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
     return CBPActivityExecutionStatus::Closed;
 }
Exemple #6
0
 function __bwl1_ParseStringParameterTmp($matches)
 {
     $result = "";
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
             $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$user];
         }
     } elseif ($matches[1] == "group") {
         $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$matches[2]];
     } else {
         $result = $matches[0];
     }
     return $result;
 }
 public function Execute()
 {
     if ($this->isInEventActivityMode) {
         return CBPActivityExecutionStatus::Closed;
     }
     if ($this->TimeoutTime != null && intval($this->TimeoutTime) . "|" != $this->TimeoutTime . "|") {
         $this->TimeoutTime = MakeTimeStamp($this->TimeoutTime);
     }
     $this->Subscribe($this);
     if ($this->TimeoutDuration != null) {
         $timeoutDuration = $this->CalculateTimeoutDuration();
         $this->WriteToTrackingService(str_replace("#PERIOD#", CBPHelper::FormatTimePeriod($timeoutDuration), GetMessage("BPDA_TRACK")));
     } elseif ($this->TimeoutTime != null) {
         $this->WriteToTrackingService(str_replace("#PERIOD#", ConvertTimeStamp($this->TimeoutTime, "FULL"), GetMessage("BPDA_TRACK1")));
     } else {
         $this->WriteToTrackingService(GetMessage("BPDA_TRACK2"));
     }
     $this->isInEventActivityMode = false;
     return CBPActivityExecutionStatus::Executing;
 }
 public function Initialize(CBPActivity $rootActivity, $documentId, $workflowParameters = array(), $workflowVariablesTypes = array(), $workflowParametersTypes = array())
 {
     $this->rootActivity = $rootActivity;
     $rootActivity->SetWorkflow($this);
     $arDocumentId = CBPHelper::ParseDocumentId($documentId);
     $rootActivity->SetDocumentId($arDocumentId);
     $documentService = $this->GetService("DocumentService");
     $documentType = $documentService->GetDocumentType($arDocumentId);
     if ($documentType !== null) {
         $rootActivity->SetDocumentType($documentType);
         $rootActivity->SetFieldTypes($documentService->GetDocumentFieldTypes($documentType));
     }
     $rootActivity->SetProperties($workflowParameters);
     $rootActivity->SetVariablesTypes($workflowVariablesTypes);
     if (is_array($workflowVariablesTypes)) {
         foreach ($workflowVariablesTypes as $k => $v) {
             $rootActivity->SetVariable($k, $v["Default"]);
         }
     }
     $rootActivity->SetPropertiesTypes($workflowParametersTypes);
 }
 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;
 }
Exemple #10
0
 public static function StripUserPrefix($value)
 {
     if (is_array($value) && !CBPHelper::IsAssociativeArray($value)) {
         foreach ($value as &$v) {
             if (substr($v, 0, 5) == "user_") {
                 $v = substr($v, 5);
             }
         }
     } else {
         if (substr($value, 0, 5) == "user_") {
             $value = substr($value, 5);
         }
     }
     return $value;
 }
Exemple #11
0
 public static function MigrateDocumentType($oldType, $newType, $workflowTemplateIds)
 {
     global $DB;
     $arOldType = CBPHelper::ParseDocumentId($oldType);
     $arNewType = CBPHelper::ParseDocumentId($newType);
     $DB->Query("UPDATE b_bp_workflow_state SET " . "\tENTITY = '" . $DB->ForSql($arNewType[1]) . "', " . "\tMODULE_ID = '" . $DB->ForSql($arNewType[0]) . "' " . "WHERE ENTITY = '" . $DB->ForSql($arOldType[1]) . "' " . "\tAND MODULE_ID = '" . $DB->ForSql($arOldType[0]) . "' " . "\tAND WORKFLOW_TEMPLATE_ID IN (" . implode(",", $workflowTemplateIds) . ") ");
 }
 public static function GetPropertiesDialog($documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = "", $popupWindow = null)
 {
     $runtime = CBPRuntime::GetRuntime();
     if (!is_array($arWorkflowParameters)) {
         $arWorkflowParameters = array();
     }
     if (!is_array($arWorkflowVariables)) {
         $arWorkflowVariables = array();
     }
     $documentService = $runtime->GetService("DocumentService");
     $arDocumentFieldsTmp = $documentService->GetDocumentFields($documentType);
     $arFieldTypes = $documentService->GetDocumentFieldTypes($documentType);
     if (!is_array($arCurrentValues)) {
         $arCurrentValues = array();
         $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
         if (is_array($arCurrentActivity["Properties"]) && array_key_exists("Fields", $arCurrentActivity["Properties"]) && is_array($arCurrentActivity["Properties"]["Fields"])) {
             foreach ($arCurrentActivity["Properties"]["Fields"] as $k => $v) {
                 $arCurrentValues[$k] = $v;
                 if ($arDocumentFieldsTmp[$k]["BaseType"] == "user") {
                     if (!is_array($arCurrentValues[$k])) {
                         $arCurrentValues[$k] = array($arCurrentValues[$k]);
                     }
                     $ar = array();
                     foreach ($arCurrentValues[$k] as $v) {
                         if (intval($v) . "!" == $v . "!") {
                             $v = "user_" . $v;
                         }
                         $ar[] = $v;
                     }
                     $arCurrentValues[$k] = CBPHelper::UsersArrayToString($ar, $arWorkflowTemplate, $documentType);
                 }
             }
         }
     } else {
         foreach ($arDocumentFieldsTmp as $key => $value) {
             if (!$value["Editable"]) {
                 continue;
             }
             $arErrors = array();
             $arCurrentValues[$key] = $documentService->GetFieldInputValue($documentType, $value, $key, $arCurrentValues, $arErrors);
         }
     }
     $arDocumentFields = array();
     $defaultFieldValue = "";
     foreach ($arDocumentFieldsTmp as $key => $value) {
         if (!$value["Editable"]) {
             continue;
         }
         $arDocumentFields[$key] = $value;
         if (strlen($defaultFieldValue) <= 0) {
             $defaultFieldValue = $key;
         }
         /*if ($value["BaseType"] == "select" || $value["BaseType"] == "bool")
         		{
         			if (array_key_exists($key."_text", $arCurrentValues)
         				&& ($value["Multiple"] && count($arCurrentValues[$key."_text"]) > 0
         					|| !$value["Multiple"] && strlen($arCurrentValues[$key."_text"]) > 0)
         				)
         			{
         				$arCurrentValues[$key] = $arCurrentValues[$key."_text"];
         			}
         		}*/
     }
     $javascriptFunctions = $documentService->GetJSFunctionsForFields($documentType, "objFieldsCD", $arDocumentFields, $arFieldTypes);
     return $runtime->ExecuteResourceFile(__FILE__, "properties_dialog.php", array("arCurrentValues" => $arCurrentValues, "arDocumentFields" => $arDocumentFields, "formName" => $formName, "defaultFieldValue" => $defaultFieldValue, "arFieldTypes" => $arFieldTypes, "javascriptFunctions" => $javascriptFunctions, "documentType" => $documentType, "popupWindow" => &$popupWindow));
 }
Exemple #13
0
$arParams["TASK_ID"] = intval($arParams["TASK_ID"]);
if ($arParams["TASK_ID"] <= 0) {
    $arParams["TASK_ID"] = intval($_REQUEST["TASK_ID"]);
}
if ($arParams["TASK_ID"] <= 0) {
    $arParams["TASK_ID"] = intval($_REQUEST["task_id"]);
}
if (empty($arParams["USER_ID"]) && !empty($_REQUEST['USER_ID'])) {
    $arParams["USER_ID"] = (int) $_REQUEST['USER_ID'];
}
$arParams["USER_ID"] = intval(empty($arParams["USER_ID"]) ? $currentUserId : $arParams["USER_ID"]);
$arResult["ShowMode"] = "Form";
$arResult['ReadOnly'] = false;
$arResult['IsComplete'] = false;
if ($arParams["USER_ID"] != $currentUserId) {
    if (!$isAdmin && !CBPHelper::checkUserSubordination($currentUserId, $arParams["USER_ID"])) {
        ShowError(GetMessage("BPAT_NO_ACCESS"));
        return false;
    }
    $arResult["ShowMode"] = "Success";
    $arResult['ReadOnly'] = true;
}
$arParams["WORKFLOW_ID"] = empty($arParams["WORKFLOW_ID"]) ? $_REQUEST["WORKFLOW_ID"] : $arParams["WORKFLOW_ID"];
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult["backUrl"] = $_REQUEST["back_url"];
$arParams["TASK_EDIT_URL"] = trim($arParams["TASK_EDIT_URL"]);
if (empty($arParams["TASK_EDIT_URL"])) {
    $arParams["TASK_EDIT_URL"] = $APPLICATION->GetCurPage() . "?PAGE_NAME=task_edit&ID=#ID#&back_url=" . urlencode($arResult["backUrl"]);
} else {
    $arParams["TASK_EDIT_URL"] .= (strpos($arParams["TASK_EDIT_URL"], "?") === false ? "?" : "&") . "back_url=" . urlencode($arResult["backUrl"]);
}
Exemple #14
0
 private function checkActivityFilterRules($rules, $documentType, $distrName)
 {
     if (!is_array($rules) || CBPHelper::IsAssociativeArray($rules)) {
         $rules = array($rules);
     }
     foreach ($rules as $rule) {
         $result = false;
         if (is_array($rule)) {
             if (!$documentType) {
                 $result = true;
             } else {
                 foreach ($documentType as $key => $value) {
                     if (!isset($rule[$key])) {
                         break;
                     }
                     $result = $rule[$key] == $value;
                     if (!$result) {
                         break;
                     }
                 }
             }
         } else {
             $result = (string) $rule == $distrName;
         }
         if ($result) {
             return true;
         }
     }
     return false;
 }
 private static function ExtractValuesFromVariables($ar, $variables, $constants = array())
 {
     if (is_string($ar) && preg_match('/^\\{=([A-Za-z0-9_]+)\\:([A-Za-z0-9_]+)\\}$/i', $ar, $arMatches)) {
         $ar = array($arMatches[1], $arMatches[2]);
     }
     if (is_array($ar)) {
         if (!CBPHelper::IsAssociativeArray($ar)) {
             if (count($ar) == 2 && ($ar[0] == 'Variable' || $ar[0] == 'Constant')) {
                 if ($ar[0] == 'Variable' && is_array($variables) && array_key_exists($ar[1], $variables)) {
                     return array($variables[$ar[1]]["Default"]);
                 }
                 if ($ar[0] == 'Constant' && is_array($constants) && array_key_exists($ar[1], $constants)) {
                     return array($constants[$ar[1]]["Default"]);
                 }
             }
             $arResult = array();
             foreach ($ar as $ar1) {
                 $arResult[] = self::ExtractValuesFromVariables($ar1, $variables, $constants);
             }
             return $arResult;
         }
     }
     return $ar;
 }
 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;
 }
 public static function GetPropertiesDialog($documentType, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $defaultValue, $arCurrentValues = null, $formName = "")
 {
     $runtime = CBPRuntime::GetRuntime();
     $documentService = $runtime->GetService("DocumentService");
     $arDocumentFieldsTmp = $documentService->GetDocumentFields($documentType);
     $arFieldTypes = $documentService->GetDocumentFieldTypes($documentType);
     if (!is_array($arCurrentValues)) {
         $arCurrentValues = array();
         if (is_array($defaultValue)) {
             $i = 0;
             foreach ($defaultValue as $value) {
                 if (strlen($arCurrentValues["field_condition_count"]) > 0) {
                     $arCurrentValues["field_condition_count"] .= ",";
                 }
                 $arCurrentValues["field_condition_count"] .= $i;
                 $arCurrentValues["field_condition_field_" . $i] = $value[0];
                 $arCurrentValues["field_condition_condition_" . $i] = $value[1];
                 $arCurrentValues["field_condition_value_" . $i] = $value[2];
                 $arCurrentValues["field_condition_joiner_" . $i] = $value[3];
                 if ($arDocumentFieldsTmp[$arCurrentValues["field_condition_field_" . $i]]["BaseType"] == "user" && $arDocumentFieldsTmp[$arCurrentValues["field_condition_field_" . $i]]["Type"] != 'S:employee') {
                     if (!is_array($arCurrentValues["field_condition_value_" . $i])) {
                         $arCurrentValues["field_condition_value_" . $i] = array($arCurrentValues["field_condition_value_" . $i]);
                     }
                     $arCurrentValues["field_condition_value_" . $i] = CBPHelper::UsersArrayToString($arCurrentValues["field_condition_value_" . $i], $arWorkflowTemplate, $documentType);
                 }
                 $i++;
             }
         }
     } else {
         $arFieldConditionCount = explode(",", $arCurrentValues["field_condition_count"]);
         foreach ($arFieldConditionCount as $i) {
             if (intval($i) . "!" != $i . "!") {
                 continue;
             }
             $i = intval($i);
             if (!array_key_exists("field_condition_field_" . $i, $arCurrentValues) || strlen($arCurrentValues["field_condition_field_" . $i]) <= 0) {
                 continue;
             }
             $arErrors = array();
             $arCurrentValues["field_condition_value_" . $i] = $documentService->GetFieldInputValue($documentType, $arDocumentFieldsTmp[$arCurrentValues["field_condition_field_" . $i]], "field_condition_value_" . $i, $arCurrentValues, $arErrors);
         }
     }
     $arDocumentFields = array();
     foreach ($arDocumentFieldsTmp as $key => $value) {
         //if (!$value["Filterable"])
         //	continue;
         $arDocumentFields[$key] = $value;
     }
     $javascriptFunctions = $documentService->GetJSFunctionsForFields($documentType, "objFieldsFC", $arDocumentFields, $arFieldTypes);
     return $runtime->ExecuteResourceFile(__FILE__, "properties_dialog.php", array("arDocumentFields" => $arDocumentFields, "arCurrentValues" => $arCurrentValues, "formName" => $formName, "arFieldTypes" => $arFieldTypes, "javascriptFunctions" => $javascriptFunctions, 'documentService' => $documentService, 'documentType' => $documentType));
 }
Exemple #18
0
</span>
		</div>

		<div id="bp-task-tabs-content" class="bp-tab-contents">
			<div id="bp-task-tab-1-content" class="bp-tab-content active">

	<?php 
}
?>
				<?php 
if (!isset($arParams['IFRAME']) || $arParams['IFRAME'] == 'N') {
    // A < E < I < M < Q < U < Y
    // A - NO ACCESS, E - READ, I - ANSWER
    // M - NEW TOPIC
    // Q - MODERATE, U - EDIT, Y - FULL_ACCESS
    $APPLICATION->IncludeComponent("bitrix:forum.comments", "bitrix24", array("FORUM_ID" => CBPHelper::getForumId(), "ENTITY_TYPE" => "WF", "ENTITY_ID" => CBPStateService::getWorkflowIntegerId($arResult["TASK"]['WORKFLOW_ID']), "ENTITY_XML_ID" => "WF_" . $arResult["TASK"]['WORKFLOW_ID'], "PERMISSION" => "Y", "URL_TEMPLATES_PROFILE_VIEW" => "/company/personal/user/#user_id#/", "SHOW_RATING" => "Y", "SHOW_LINK_TO_MESSAGE" => "N", "BIND_VIEWER" => "Y"), false, array('HIDE_ICONS' => 'Y'));
} else {
    ?>
				<iframe
					src="/bitrix/components/bitrix/bizproc.task/comments.php?TASK_ID=<?php 
    echo $arResult['TASK']['ID'];
    ?>
&USER_ID=<?php 
    echo $arParams['USER_ID'];
    ?>
&site_id=<?php 
    echo SITE_ID;
    ?>
&sessid=<?php 
    echo bitrix_sessid();
    ?>
Exemple #19
0
 public static function SetPermissions($parameterDocumentId, $workflowId, $arPermissions, $bRewrite = true)
 {
     list($moduleId, $entity, $documentId) = CBPHelper::ParseDocumentId($parameterDocumentId);
     if (strlen($moduleId) > 0) {
         CModule::IncludeModule($moduleId);
     }
     if (class_exists($entity) && method_exists($entity, "SetPermissions")) {
         return call_user_func_array(array($entity, "SetPermissions"), array($documentId, $workflowId, $arPermissions, $bRewrite));
     }
     return false;
 }
Exemple #20
0
 /**
  * @param FieldType $fieldType Document field type.
  * @param mixed $value Field value.
  * @return void
  */
 public static function clearValueMultiple(FieldType $fieldType, $value)
 {
     if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value)) {
         $value = array($value);
     }
     foreach ($value as $v) {
         static::clearValueSingle($fieldType, $v);
     }
 }
 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;
 }
 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;
 }
Exemple #23
0
 /**
  * ћетод создает новый документ с указанными свойствами (пол¤ми).
  *
  * @param array $arFields - массив значений свойств документа в виде array(код_свойства => значение, ...).  оды свойств соответствуют кодам свойств, возвращаемым методом GetDocumentFields.
  * @return int - код созданного документа.
  */
 public function CreateDocument($parentDocumentId, $arFields)
 {
     if (!array_key_exists("IBLOCK_ID", $arFields) || intval($arFields["IBLOCK_ID"]) <= 0) {
         throw new Exception("IBlock ID is not found");
     }
     $arFieldsPropertyValues = array();
     $arDocumentFields = self::GetDocumentFields("iblock_" . $arFields["IBLOCK_ID"]);
     $arKeys = array_keys($arFields);
     foreach ($arKeys as $key) {
         if (!array_key_exists($key, $arDocumentFields)) {
             continue;
         }
         $arFields[$key] = is_array($arFields[$key]) && !CBPHelper::IsAssociativeArray($arFields[$key]) ? $arFields[$key] : array($arFields[$key]);
         if ($arDocumentFields[$key]["Type"] == "user") {
             $ar = array();
             foreach ($arFields[$key] as $v1) {
                 if (substr($v1, 0, strlen("user_")) == "user_") {
                     $ar[] = substr($v1, strlen("user_"));
                 } else {
                     $a1 = self::GetUsersFromUserGroup($v1, $documentId);
                     foreach ($a1 as $a11) {
                         $ar[] = $a11;
                     }
                 }
             }
             $arFields[$key] = $ar;
         } elseif ($arDocumentFields[$key]["Type"] == "select") {
             $realKey = substr($key, 0, strlen("PROPERTY_")) == "PROPERTY_" ? substr($key, strlen("PROPERTY_")) : $key;
             $arV = array();
             $db = CIBlockProperty::GetPropertyEnum($realKey, false, array("IBLOCK_ID" => $arFields["IBLOCK_ID"]));
             while ($ar = $db->GetNext()) {
                 $arV[$ar["XML_ID"]] = $ar["ID"];
             }
             foreach ($arFields[$key] as &$value) {
                 if (array_key_exists($value, $arV)) {
                     $value = $arV[$value];
                 }
             }
         } elseif ($arDocumentFields[$key]["Type"] == "file") {
             foreach ($arFields[$key] as &$value) {
                 $value = CFile::MakeFileArray($value);
             }
         } elseif ($arDocumentFields[$key]["Type"] == "S:HTML") {
             foreach ($arFields[$key] as &$value) {
                 $value = array("VALUE" => $value);
             }
         }
         if (!$arDocumentFields[$key]["Multiple"] && is_array($arFields[$key])) {
             if (count($arFields[$key]) > 0) {
                 $a = array_values($arFields[$key]);
                 $arFields[$key] = $a[0];
             } else {
                 $arFields[$key] = null;
             }
         }
         if (substr($key, 0, strlen("PROPERTY_")) == "PROPERTY_") {
             $realKey = substr($key, strlen("PROPERTY_"));
             $arFieldsPropertyValues[$realKey] = is_array($arFields[$key]) && !CBPHelper::IsAssociativeArray($arFields[$key]) ? $arFields[$key] : array($arFields[$key]);
             unset($arFields[$key]);
         }
     }
     if (count($arFieldsPropertyValues) > 0) {
         $arFields["PROPERTY_VALUES"] = $arFieldsPropertyValues;
     }
     $iblockElement = new CIBlockElement();
     $id = $iblockElement->Add($arFields, false, true, true);
     if (!$id || $id <= 0) {
         throw new Exception($iblockElement->LAST_ERROR);
     }
     return $id;
 }
 public function onWorkflowStatusChange($parameterDocumentId, $workflowId, $status)
 {
     list($moduleId, $entity, $documentId) = CBPHelper::ParseDocumentId($parameterDocumentId);
     if (strlen($moduleId) > 0) {
         CModule::IncludeModule($moduleId);
     }
     if (class_exists($entity) && method_exists($entity, "onWorkflowStatusChange")) {
         return call_user_func_array(array($entity, "onWorkflowStatusChange"), array($documentId, $workflowId, $status));
     }
     return false;
 }
 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));
 }
Exemple #26
0
 protected function getData()
 {
     $this->arResult['SHOW_MODE'] = 'SelectWorkflow';
     $this->arResult['TEMPLATES'] = array();
     $this->arResult['PARAMETERS_VALUES'] = array();
     $this->arResult['ERROR_MESSAGE'] = '';
     $runtime = CBPRuntime::getRuntime();
     $runtime->startRuntime();
     $this->arResult['DocumentService'] = $runtime->getService('DocumentService');
     foreach ($this->arResult['DOCUMENT_DATA'] as $nameModule => $data) {
         $workflowTemplateObject = CBPWorkflowTemplateLoader::getList(array(), array('DOCUMENT_TYPE' => $data['DOCUMENT_TYPE'], 'ACTIVE' => 'Y'), false, false, array('ID', 'NAME', 'DESCRIPTION', 'MODIFIED', 'USER_ID', 'PARAMETERS'));
         while ($workflowTemplate = $workflowTemplateObject->getNext()) {
             if (!CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getID(), $data['DOCUMENT_ID'], array())) {
                 continue;
             }
             if ($nameModule == 'DISK') {
                 $this->arResult['TEMPLATES'][$workflowTemplate['ID']] = $workflowTemplate;
                 $this->arResult['TEMPLATES'][$workflowTemplate['ID']]['URL'] = htmlspecialcharsex($this->getApplication()->getCurPageParam('workflow_template_id=' . $workflowTemplate['ID'] . '&' . bitrix_sessid_get(), array('workflow_template_id', 'sessid')));
             } else {
                 $this->arResult['TEMPLATES_OLD'][$workflowTemplate['ID']] = $workflowTemplate;
                 $this->arResult['TEMPLATES_OLD'][$workflowTemplate['ID']]['URL'] = htmlspecialcharsex($this->getApplication()->getCurPageParam('workflow_template_id=' . $workflowTemplate['ID'] . '&old=1&' . bitrix_sessid_get(), array('workflow_template_id', 'sessid')));
             }
         }
     }
     if ($this->arParams['TEMPLATE_ID'] > 0 && strlen($this->request->getPost('CancelStartParamWorkflow')) <= 0 && (array_key_exists($this->arParams['TEMPLATE_ID'], $this->arResult['TEMPLATES']) || array_key_exists($this->arParams['TEMPLATE_ID'], $this->arResult['TEMPLATES_OLD']))) {
         if (array_key_exists($this->arParams['TEMPLATE_ID'], $this->arResult['TEMPLATES'])) {
             $templates = $this->arResult['TEMPLATES'];
             $documentParameters = $this->arResult['DOCUMENT_DATA']['DISK'];
             $this->arResult['CHECK_TEMPLATE'] = 'DISK';
         } else {
             $templates = $this->arResult['TEMPLATES_OLD'];
             $documentParameters = $this->arResult['DOCUMENT_DATA']['WEBDAV'];
             $this->arResult['CHECK_TEMPLATE'] = 'WEBDAV';
         }
         $workflowTemplate = $templates[$this->arParams['TEMPLATE_ID']];
         $arWorkflowParameters = array();
         $canStartWorkflow = false;
         if (count($workflowTemplate['PARAMETERS']) <= 0) {
             $canStartWorkflow = true;
         } elseif ($this->request->isPost() && strlen($this->request->getPost('DoStartParamWorkflow')) > 0 && check_bitrix_sessid()) {
             $errorsTemporary = array();
             $request = $this->request->getPostList()->toArray();
             foreach ($_FILES as $key => $value) {
                 if (array_key_exists('name', $value)) {
                     if (is_array($value['name'])) {
                         $keys = array_keys($value['name']);
                         for ($i = 0, $cnt = count($keys); $i < $cnt; $i++) {
                             $array = array();
                             foreach ($value as $k1 => $v1) {
                                 $array[$k1] = $v1[$keys[$i]];
                             }
                             $request[$key][] = $array;
                         }
                     } else {
                         $request[$key] = $value;
                     }
                 }
             }
             $arWorkflowParameters = CBPWorkflowTemplateLoader::checkWorkflowParameters($workflowTemplate['PARAMETERS'], $request, $documentParameters['DOCUMENT_TYPE'], $errorsTemporary);
             if (count($errorsTemporary) > 0) {
                 $canStartWorkflow = false;
                 foreach ($errorsTemporary as $e) {
                     $this->errorCollection->add(array(new Error($e['message'])));
                 }
             } else {
                 $canStartWorkflow = true;
             }
         }
         if ($canStartWorkflow) {
             $errorsTemporary = array();
             $workflowId = CBPDocument::startWorkflow($this->arParams['TEMPLATE_ID'], $documentParameters['DOCUMENT_ID'], array_merge($arWorkflowParameters, array('TargetUser' => 'user_' . intval($this->getUser()->getID()))), $errorsTemporary);
             if (count($errorsTemporary) > 0) {
                 $this->arResult['SHOW_MODE'] = 'StartWorkflowError';
                 foreach ($errorsTemporary as $e) {
                     $this->errorCollection->add(array(new Error('[' . $e['code'] . '] ' . $e['message'])));
                 }
             } else {
                 $this->arResult['SHOW_MODE'] = 'StartWorkflowSuccess';
                 if (strlen($this->arResult['back_url']) > 0) {
                     LocalRedirect(str_replace('#WF#', $workflowId, $this->request->getQuery('back_url')));
                     $this->end(true);
                 }
             }
         } else {
             $doStartParam = $this->request->isPost() && strlen($this->request->getPost('DoStartParamWorkflow') && check_bitrix_sessid()) > 0;
             $keys = array_keys($workflowTemplate['PARAMETERS']);
             foreach ($keys as $key) {
                 $value = $doStartParam ? $this->request->getQuery($key) : $workflowTemplate['PARAMETERS'][$key]['Default'];
                 if (!is_array($value)) {
                     $this->arResult['PARAMETERS_VALUES'][$key] = CBPHelper::convertParameterValues($value);
                 } else {
                     $keys1 = array_keys($value);
                     foreach ($keys1 as $key1) {
                         $this->arResult['PARAMETERS_VALUES'][$key][$key1] = CBPHelper::convertParameterValues($value[$key1]);
                     }
                 }
             }
             $this->arResult['SHOW_MODE'] = 'WorkflowParameters';
         }
         if ($this->errorCollection->hasErrors()) {
             $error = array_shift($this->getErrors());
             ShowError($error->getMessage());
         }
     } else {
         $this->arResult['SHOW_MODE'] = 'SelectWorkflow';
     }
 }
echo $arCurrentValues["timeout_duration_type"] == "d" ? " selected" : "";
?>
><?php 
echo GetMessage("BPAA_PD_TIME_D");
?>
</option>
		</select>
		<?php 
$delayMinLimit = CBPSchedulerService::getDelayMinLimit();
if ($delayMinLimit) {
    ?>
		<p style="color: red;">* <?php 
    echo GetMessage("BPAA_PD_TIMEOUT_LIMIT");
    ?>
: <?php 
    echo CBPHelper::FormatTimePeriod($delayMinLimit);
    ?>
</p>
		<?php 
}
?>
	</td>
</tr>
<tr>
	<td align="right"><?php 
echo GetMessage("BPAR_PD_ACCESS_CONTROL");
?>
:</td>
	<td>
		<select name="access_control">
			<option value="Y"<?php 
 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;
 }
Exemple #29
0
 public function GetFieldInputValuePrintable($documentType, $fieldType, $fieldValue)
 {
     $result = $fieldValue;
     switch ($fieldType['Type']) {
         case "user":
             if (!is_array($fieldValue)) {
                 $fieldValue = array($fieldValue);
             }
             $result = CBPHelper::usersArrayToString($fieldValue, null, array("lists", get_called_class(), $documentType));
             break;
         case "bool":
             if (is_array($fieldValue)) {
                 $result = array();
                 foreach ($fieldValue as $r) {
                     $result[] = strtoupper($r) != "N" && !empty($r) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
                 }
             } else {
                 $result = strtoupper($fieldValue) != "N" && !empty($fieldValue) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
             }
             break;
         case "file":
             if (is_array($fieldValue)) {
                 $result = array();
                 foreach ($fieldValue as $r) {
                     $r = intval($r);
                     $imgQuery = CFile::getByID($r);
                     if ($img = $imgQuery->fetch()) {
                         $result[] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($img["FILE_NAME"]) . "&i=" . $r . "&h=" . md5($img["SUBDIR"]) . "]" . htmlspecialcharsbx($img["ORIGINAL_NAME"]) . "[/url]";
                     }
                 }
             } else {
                 $fieldValue = intval($fieldValue);
                 $imgQuery = CFile::getByID($fieldValue);
                 if ($img = $imgQuery->fetch()) {
                     $result = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($img["FILE_NAME"]) . "&i=" . $fieldValue . "&h=" . md5($img["SUBDIR"]) . "]" . htmlspecialcharsbx($img["ORIGINAL_NAME"]) . "[/url]";
                 }
             }
             break;
         case "select":
             if (is_array($fieldType["Options"])) {
                 if (is_array($fieldValue)) {
                     $result = array();
                     foreach ($fieldValue as $r) {
                         if (array_key_exists($r, $fieldType["Options"])) {
                             $result[] = $fieldType["Options"][$r];
                         }
                     }
                 } else {
                     if (array_key_exists($fieldValue, $fieldType["Options"])) {
                         $result = $fieldType["Options"][$fieldValue];
                     }
                 }
             }
             break;
     }
     if (strpos($fieldType['Type'], ":") !== false) {
         if ($fieldType["Type"] == "S:employee") {
             $fieldValue = CBPHelper::stripUserPrefix($fieldValue);
         }
         $customType = CIBlockProperty::getUserType(substr($fieldType['Type'], 2));
         if (array_key_exists("GetPublicViewHTML", $customType)) {
             if (is_array($fieldValue) && !CBPHelper::isAssociativeArray($fieldValue)) {
                 $result = array();
                 foreach ($fieldValue as $value) {
                     $r = call_user_func_array($customType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value), ""));
                     $result[] = HTMLToTxt($r);
                 }
             } else {
                 $result = call_user_func_array($customType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $fieldValue), ""));
                 $result = HTMLToTxt($result);
             }
         }
     }
     return $result;
 }
Exemple #30
0
 private function FunctionConvert($args)
 {
     if (!is_array($args)) {
         $args = array($args);
     }
     $ar = $this->ArrgsToArray($args);
     $val = array_shift($ar);
     $type = array_shift($ar);
     $attr = array_shift($ar);
     $type = strtolower($type);
     if ($type === 'printableuserb24') {
         $result = array();
         $users = CBPHelper::StripUserPrefix($val);
         if (!is_array($users)) {
             $users = array($users);
         }
         foreach ($users as $userId) {
             $db = CUser::GetByID($userId);
             if ($ar = $db->GetNext()) {
                 $ix = randString(5);
                 $attr = !empty($attr) ? 'href="' . $attr . '"' : 'href="#" onClick="return false;"';
                 $result[] = '<a class="feed-post-user-name" id="bp_' . $userId . '_' . $ix . '" ' . $attr . ' bx-post-author-id="' . $userId . '">' . CUser::FormatName(CSite::GetNameFormat(false), $ar, false) . '</a><script type="text/javascript">BX.tooltip(\'' . $userId . '\', "bp_' . $userId . '_' . $ix . '", "");</script>';
             }
         }
         $result = implode(", ", $result);
     } elseif ($type == 'printableuser') {
         $result = array();
         $users = CBPHelper::StripUserPrefix($val);
         if (!is_array($users)) {
             $users = array($users);
         }
         foreach ($users as $userId) {
             $db = CUser::GetByID($userId);
             if ($ar = $db->GetNext()) {
                 $result[] = CUser::FormatName(CSite::GetNameFormat(false), $ar, false);
             }
         }
         $result = implode(", ", $result);
     } else {
         $result = $val;
     }
     return $result;
 }