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


PHP CBPHelper::ExtractUsers方法代码示例

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


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

示例1: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("calendar")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $fromTs = CCalendar::Timestamp($this->CalendarFrom);
     $toTs = $this->CalendarTo == '' ? $fromTs : CCalendar::Timestamp($this->CalendarTo);
     $arFields = array("CAL_TYPE" => !$this->CalendarType ? 'user' : $this->CalendarType, "NAME" => trim($this->CalendarName) == '' ? GetMessage('EC_DEFAULT_EVENT_NAME') : $this->CalendarName, "DESCRIPTION" => $this->CalendarDesrc, "SKIP_TIME" => date('H:i', $fromTs) == '00:00' && date('H:i', $toTs) == '00:00', "IS_MEETING" => false, "RRULE" => false);
     if ($fromTs == $toTs && !$arFields["SKIP_TIME"]) {
         $toTs += 3600;
     }
     $arFields['DATE_FROM'] = CCalendar::Date($fromTs);
     $arFields['DATE_TO'] = CCalendar::Date($toTs);
     if ($this->CalendarSection && intVal($this->CalendarSection) > 0) {
         $arFields['SECTIONS'] = array(intVal($this->CalendarSection));
     }
     if ($this->CalendarOwnerId || $arFields["CAL_TYPE"] != "user" && $arFields["CAL_TYPE"] != "group") {
         $arFields["OWNER_ID"] = $this->CalendarOwnerId;
         $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
     } else {
         $arCalendarUser = CBPHelper::ExtractUsers($this->CalendarUser, $documentId);
         foreach ($arCalendarUser as $calendarUser) {
             $arFields["CAL_TYPE"] = "user";
             $arFields["OWNER_ID"] = $calendarUser;
             $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
         }
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:32,代码来源:calendar2activity.php

示例2: getSocnetRights

 private function getSocnetRights($users)
 {
     $users = (array) $users;
     $result = array();
     $toExtract = array();
     foreach ($users as $user) {
         $user = (string) $user;
         if (strpos($user, 'user_') === 0) {
             $result[] = 'U' . substr($user, strlen('user_'));
         } elseif (strpos($user, 'group_') === 0) {
             $code = strtoupper(substr($user, strlen('group_')));
             if (preg_match('#^(DR[0-9]+|SG[0-9]+)$#', $code)) {
                 $result[] = $code;
             } elseif (preg_match('#^SG([0-9]+)_K$#', $code, $matches)) {
                 $result[] = 'SG' . $matches[1];
             } else {
                 $toExtract[] = $user;
             }
         } else {
             $toExtract[] = $user;
         }
     }
     if ($toExtract) {
         $extracted = CBPHelper::ExtractUsers($toExtract, $this->GetDocumentId());
         if (is_array($extracted)) {
             foreach ($extracted as $u) {
                 $result[] = 'U' . $u;
             }
         }
     }
     return array_unique($result);
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:32,代码来源:socnetblogpostactivity.php

示例3: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
     $users = array_unique(CBPHelper::ExtractUsers($this->Users, $documentId, false));
     $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID), false, false, array("ID"));
     $row = $dbSubjects->fetch();
     if (!$row) {
         $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_SUBJECT_ID"));
         return CBPActivityExecutionStatus::Closed;
     }
     $subjectId = $row['ID'];
     unset($dbSubjects, $row);
     $options = array("SITE_ID" => SITE_ID, "NAME" => $this->GroupName, "VISIBLE" => "Y", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $subjectId, "INITIATE_PERMS" => SONET_ROLES_OWNER, "SPAM_PERMS" => SONET_ROLES_USER);
     $groupId = CSocNetGroup::CreateGroup($ownerId, $options);
     if (!$groupId) {
         $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_CREATE_GROUP"));
         return CBPActivityExecutionStatus::Closed;
     }
     $this->GroupId = $groupId;
     foreach ($users as $user) {
         if ($user == $ownerId) {
             continue;
         }
         CSocNetUserToGroup::Add(array("USER_ID" => $user, "GROUP_ID" => $groupId, "ROLE" => SONET_ROLES_USER, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP, "INITIATED_BY_USER_ID" => $ownerId, "MESSAGE" => false));
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:createworkgroup.php

示例4: Execute

 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;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:28,代码来源:savehistoryactivity.php

示例5: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("intranet")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $calendarIblockId = COption::GetOptionInt("intranet", 'iblock_calendar', 0);
     if ($calendarIblockId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arCalendarUser = CBPHelper::ExtractUsers($this->CalendarUser, $documentId);
     foreach ($arCalendarUser as $calendarUser) {
         $Params = array('iblockId' => $calendarIblockId, 'ownerType' => "USER", 'ownerId' => $calendarUser, 'cacheTime' => 0, 'pageUrl' => false, 'allowSuperpose' => false, 'allowResMeeting' => false, 'allowVideoMeeting' => false, 'userIblockId' => $calendarIblockId);
         $EC = new CEventCalendar();
         $EC->Init($Params);
         $sectionId = $EC->GetSectionIDByOwnerId($calendarUser, 'USER', $calendarIblockId);
         if ($sectionId <= 0) {
             $sectionId = CEventCalendar::CreateSectionForOwner($calendarUser, "USER", $calendarIblockId);
         }
         $arGuestCalendars = $EC->GetCalendars(array('sectionId' => $sectionId, 'iblockId' => $calendarIblockId, 'ownerType' => 'USER', 'ownerId' => $calendarUser, 'bOwner' => true, 'forExport' => true, 'bOnlyID' => true));
         $arParams = array('iblockId' => $calendarIblockId, 'ownerType' => "USER", 'ownerId' => $calendarUser, 'sectionId' => $sectionId, 'bNew' => true, 'name' => $this->CalendarName, 'desc' => $this->CalendarDesrc, 'dateFrom' => cutZeroTime($this->CalendarFrom), 'dateTo' => cutZeroTime($this->CalendarTo), 'isMeeting' => false, 'prop' => array('PERIOD_TYPE' => 'NONE', 'ACCESSIBILITY' => 'busy', 'IMPORTANCE' => 'normal', 'PRIVATE' => false), 'userId' => $calendarUser, 'userIblockId' => $calendarIblockId, 'location' => array('new' => '', 'change' => true));
         if (count($arGuestCalendars) > 0) {
             $arParams["calendarId"] = $arGuestCalendars[0];
         }
         $EC->SaveEvent($arParams);
     }
     if (isset($EC)) {
         $EC->ClearCache($EC->cachePath . 'events/' . $calendarIblockId . '/');
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:32,代码来源:calendaractivity.php

示例6: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("intranet")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $absenceIblockId = COption::GetOptionInt("intranet", 'iblock_absence', 0);
     if ($absenceIblockId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $arAbsenceUserTmp = $this->AbsenceUser;
     $arAbsenceUser = CBPHelper::ExtractUsers($arAbsenceUserTmp, $documentId, false);
     $arAbsenceTypes = array();
     $dbTypeRes = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array('IBLOCK_ID' => $absenceIblockId, 'PROPERTY_ID' => 'ABSENCE_TYPE'));
     while ($arTypeValue = $dbTypeRes->GetNext()) {
         $arAbsenceTypes[$arTypeValue['XML_ID']] = $arTypeValue['ID'];
     }
     foreach ($arAbsenceUser as $absenceUser) {
         $arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $absenceIblockId, 'ACTIVE_FROM' => $this->AbsenceFrom, 'ACTIVE_TO' => $this->AbsenceTo, "NAME" => $this->AbsenceName, "PREVIEW_TEXT" => $this->AbsenceDesrc, "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => array("USER" => $absenceUser, "STATE" => $this->AbsenceState, "FINISH_STATE" => $this->AbsenceFinishState, "ABSENCE_TYPE" => $arAbsenceTypes[$this->AbsenceType]));
         $el = new CIBlockElement();
         $el->Add($arFields);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:26,代码来源:absenceactivity.php

示例7: Execute

 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 = "Admin";
     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;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:49,代码来源:forumreviewactivity.php

示例8: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("intranet")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $iblockId = COption::GetOptionInt("intranet", "iblock_tasks", 0);
     if ($iblockId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $parentSectionId = 0;
     $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => $this->TaskType == "group" ? $this->TaskOwnerId : "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
     if ($arSection = $dbSectionsList->GetNext()) {
         $parentSectionId = $arSection["ID"];
     }
     if ($parentSectionId <= 0) {
         $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
         if ($arSection = $dbSectionsList->GetNext()) {
             $parentSectionId = $arSection["ID"];
         }
     }
     if ($parentSectionId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arTaskCreatedBy = CBPHelper::ExtractUsers($this->TaskCreatedBy, $documentId, true);
     $arTaskAssignedTo = CBPHelper::ExtractUsers($this->TaskAssignedTo, $documentId, true);
     if (!$arTaskCreatedBy || !$arTaskAssignedTo) {
         return CBPActivityExecutionStatus::Closed;
     }
     if ($this->TaskType != "group") {
         $this->TaskOwnerId = $arTaskAssignedTo;
     }
     $arTaskTrackers = CBPHelper::ExtractUsers($this->TaskTrackers, $documentId);
     $arFields = array("IBLOCK_SECTION_ID" => $parentSectionId, "MODIFIED_BY" => $arTaskCreatedBy, "CREATED_BY" => $arTaskCreatedBy, "DATE_CREATE" => date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME)), "ACTIVE_FROM" => $this->TaskActiveFrom, "ACTIVE_TO" => $this->TaskActiveTo, "NAME" => $this->TaskName, "DETAIL_TEXT" => $this->TaskDetailText, "PROPERTY_TaskPriority" => $this->TaskPriority, "PROPERTY_TaskAssignedTo" => $arTaskAssignedTo, "PROPERTY_TaskTrackers" => $arTaskTrackers);
     $taskId = CIntranetTasksDocument::CreateDocument($arFields);
     if ($this->TaskType == "group") {
         $pathTemplate = str_replace(array("#GROUP_ID#", "#TASK_ID#"), array($this->TaskOwnerId, "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_group_entry", "/workgroups/group/#GROUP_ID#/tasks/task/view/#TASK_ID#/"));
     } else {
         $pathTemplate = str_replace(array("#USER_ID#", "#TASK_ID#"), array($this->TaskOwnerId, "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_user_entry", "/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/"));
     }
     $pathTemplate = str_replace('#HTTP_HOST#', $_SERVER['HTTP_HOST'], "http://#HTTP_HOST#" . $pathTemplate);
     $arTemplateStates = CBPWorkflowTemplateLoader::GetDocumentTypeStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), CBPDocumentEventType::Create);
     foreach ($arTemplateStates as $arState) {
         CBPDocument::StartWorkflow($arState["TEMPLATE_ID"], array("intranet", "CIntranetTasksDocument", $taskId), array("OwnerId" => $this->TaskOwnerId, "TaskType" => $this->TaskType, "PathTemplate" => $pathTemplate, "ForumId" => intval($this->TaskForumId), "IBlockId" => $iblockId), $arErrorsTmp);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:48,代码来源:taskactivity.php

示例9: GetUsersList

 private function GetUsersList($arUsersList, $bSkipAbsent = true)
 {
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     if (!CModule::IncludeModule("intranet")) {
         $bSkipAbsent = false;
     }
     $arUsers = CBPHelper::ExtractUsers($arUsersList, $documentId, false);
     if ($bSkipAbsent) {
         $arKeys = array_keys($arUsers);
         foreach ($arKeys as $key) {
             if (CIntranetUtils::IsUserAbsent($arUsers[$key])) {
                 unset($arUsers[$key]);
             }
         }
     }
     return $arUsers;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:18,代码来源:getuseractivity.php

示例10: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arMessageUserFrom = CBPHelper::ExtractUsers($this->MessageUserFrom, $documentId, true);
     $arMessageUserTo = CBPHelper::ExtractUsers($this->MessageUserTo, $documentId, false);
     $arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $arMessageUserFrom, "MESSAGE" => CBPHelper::ConvertTextForMail($this->MessageText));
     $ar = array();
     foreach ($arMessageUserTo as $userTo) {
         if (in_array($userTo, $ar)) {
             continue;
         }
         $ar[] = $userTo;
         $arMessageFields["TO_USER_ID"] = $userTo;
         CSocNetMessages::Add($arMessageFields);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:21,代码来源:socnetmessageactivity.php

示例11: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("im")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arMessageUserFrom = CBPHelper::ExtractUsers($this->MessageUserFrom, $documentId, true);
     $arMessageUserTo = CBPHelper::ExtractUsers($this->MessageUserTo, $documentId, false);
     $arMessageFields = array("FROM_USER_ID" => $arMessageUserFrom, "NOTIFY_TYPE" => intval($this->MessageType), "NOTIFY_MESSAGE" => $this->MessageSite, "NOTIFY_MESSAGE_OUT" => $this->MessageOut, "NOTIFY_MODULE" => "bizproc", "NOTIFY_EVENT" => "activity");
     $ar = array();
     foreach ($arMessageUserTo as $userTo) {
         if (in_array($userTo, $ar)) {
             continue;
         }
         $ar[] = $userTo;
         $arMessageFields["TO_USER_ID"] = $userTo;
         CIMNotify::Add($arMessageFields);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:imnotifyactivity.php

示例12: Execute

 public function Execute()
 {
     $activityData = $this->getRestActivityData();
     if (!$activityData) {
         throw new Exception(Loc::getMessage('BPRA_NOT_FOUND_ERROR'));
     }
     if (!Loader::includeModule('rest')) {
         return CBPActivityExecutionStatus::Closed;
     }
     $propertiesData = array();
     if (!empty($activityData['PROPERTIES'])) {
         foreach ($activityData['PROPERTIES'] as $name => $property) {
             $propertiesData[$name] = $this->{$name};
         }
     }
     $auth = null;
     $userId = CBPHelper::ExtractUsers($this->AuthUserId, $this->GetDocumentId(), true);
     if ($userId > 0) {
         $auth = CRestUtil::getAuthForEvent($activityData['APP_ID'], $userId, array('WORKFLOW_ID' => $this->getWorkflowInstanceId(), 'ACTIVITY_NAME' => $this->name, 'CODE' => $activityData['CODE']));
     }
     $this->eventId = \Bitrix\Main\Security\Random::getString(32, true);
     $queryItems = array(Sqs::queryItem($activityData['HANDLER'], array('workflow_id' => $this->getWorkflowInstanceId(), 'code' => $activityData['CODE'], 'document_id' => $this->GetDocumentId(), 'event_token' => self::generateToken($this->getWorkflowInstanceId(), $this->name, $this->eventId), 'properties' => $propertiesData, 'auth' => $auth, 'ts' => time())));
     Sqs::query($queryItems);
     if ($this->SetStatusMessage == 'Y') {
         $message = $this->StatusMessage;
         if (empty($message)) {
             $message = Loc::getMessage('BPRA_DEFAULT_STATUS_MESSAGE');
         }
         $this->SetStatusTitle($message);
     }
     if ($this->UseSubscription != 'Y') {
         return CBPActivityExecutionStatus::Closed;
     }
     $this->Subscribe($this);
     return CBPActivityExecutionStatus::Executing;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:restactivity.php

示例13: OnExternalEvent

 public function OnExternalEvent($arEventParameters = array())
 {
     if ($this->executionStatus == CBPActivityExecutionStatus::Closed) {
         return;
     }
     $timeoutDuration = $this->CalculateTimeoutDuration();
     if ($timeoutDuration > 0) {
         if (array_key_exists("SchedulerService", $arEventParameters) && $arEventParameters["SchedulerService"] == "OnAgent") {
             $this->IsTimeout = 1;
             $this->taskStatus = CBPTaskStatus::Timeout;
             $this->Unsubscribe($this);
             $this->workflow->CloseActivity($this);
             return;
         }
     }
     if (!array_key_exists("USER_ID", $arEventParameters) || intval($arEventParameters["USER_ID"]) <= 0) {
         return;
     }
     if (empty($arEventParameters["REAL_USER_ID"])) {
         $arEventParameters["REAL_USER_ID"] = $arEventParameters["USER_ID"];
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arUsers = CBPHelper::ExtractUsers($this->Users, $documentId, false);
     $arEventParameters["USER_ID"] = intval($arEventParameters["USER_ID"]);
     $arEventParameters["REAL_USER_ID"] = intval($arEventParameters["REAL_USER_ID"]);
     if (!in_array($arEventParameters["USER_ID"], $arUsers)) {
         return;
     }
     if ($this->IsPropertyExists("LastReviewer")) {
         $this->LastReviewer = "user_" . $arEventParameters["REAL_USER_ID"];
     }
     $taskService = $this->workflow->GetService("TaskService");
     $taskService->MarkCompleted($this->taskId, $arEventParameters["REAL_USER_ID"], CBPTaskUserStatus::Ok);
     $dbUser = CUser::GetById($arEventParameters["REAL_USER_ID"]);
     if ($arUser = $dbUser->Fetch()) {
         $this->Comments = $this->Comments . CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUser) . " (" . $arUser["LOGIN"] . ")" . (strlen($arEventParameters["COMMENT"]) > 0 ? ": " : "") . $arEventParameters["COMMENT"] . "\n";
     }
     $this->WriteToTrackingService(str_replace(array("#PERSON#", "#COMMENT#"), array("{=user:user_" . $arEventParameters["REAL_USER_ID"] . "}", strlen($arEventParameters["COMMENT"]) > 0 ? ": " . $arEventParameters["COMMENT"] : ""), GetMessage("BPAR_ACT_REVIEW_TRACK")), $arEventParameters["REAL_USER_ID"]);
     $result = "Continue";
     $this->arReviewOriginalResults[] = $arEventParameters["USER_ID"];
     $this->arReviewResults[] = $arEventParameters["REAL_USER_ID"];
     $this->ReviewedCount = count($this->arReviewResults);
     if ($this->IsPropertyExists("ApproveType") && $this->ApproveType == "any") {
         $result = "Finish";
     } else {
         $allAproved = true;
         foreach ($arUsers as $userId) {
             if (!in_array($userId, $this->arReviewOriginalResults)) {
                 $allAproved = false;
             }
         }
         if ($allAproved) {
             $result = "Finish";
         }
     }
     if (!$this->IsPropertyExists("SetStatusMessage") || $this->SetStatusMessage == "Y") {
         $messageTemplate = $this->IsPropertyExists("StatusMessage") && strlen($this->StatusMessage) > 0 ? $this->StatusMessage : GetMessage("BPAR_ACT_INFO");
         $votedPercent = intval($this->ReviewedCount / $this->TotalCount * 100);
         $votedCount = $this->ReviewedCount;
         $totalCount = $this->TotalCount;
         $reviewers = "";
         if (strpos($messageTemplate, "#REVIEWERS#") !== false) {
             $reviewers = $this->GetReviewersNames();
         }
         if ($reviewers == "") {
             $reviewers = GetMessage("BPAA_ACT_APPROVERS_NONE");
         }
         $this->SetStatusTitle(str_replace(array("#PERC#", "#PERCENT#", "#REV#", "#REVIEWED#", "#TOT#", "#TOTAL#", "#REVIEWERS#"), array($votedPercent, $votedPercent, $votedCount, $votedCount, $totalCount, $totalCount, $reviewers), $messageTemplate));
     }
     if ($result != "Continue") {
         $this->WriteToTrackingService(GetMessage("BPAR_ACT_REVIEWED"));
         $this->taskStatus = CBPTaskStatus::CompleteOk;
         $this->Unsubscribe($this);
         $this->workflow->CloseActivity($this);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:77,代码来源:reviewactivity.php

示例14: Execute

 public function Execute()
 {
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $strMailUserFrom = "";
     list($mailUserFromArray, $mailUserFromArrayString) = static::ExtractEmails($this->MailUserFromArray);
     $arMailUserFromArray = CBPHelper::ExtractUsers($mailUserFromArray, $documentId, false);
     foreach ($arMailUserFromArray as $user) {
         $dbUser = CUser::GetList($b = "", $o = "", array("ID_EQUAL_EXACT" => $user));
         if ($arUser = $dbUser->Fetch()) {
             if (strlen($strMailUserFrom) > 0) {
                 $strMailUserFrom .= ", ";
             }
             if (!defined("BX_MS_SMTP") || BX_MS_SMTP !== true) {
                 if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
                     $strMailUserFrom .= "'" . preg_replace("#['\r\n]+#", "", CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUser)) . "' <";
                 }
             }
             $strMailUserFrom .= preg_replace("#[\r\n]+#", "", $arUser["EMAIL"]);
             if (!defined("BX_MS_SMTP") || BX_MS_SMTP !== true) {
                 if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
                     $strMailUserFrom .= ">";
                 }
             }
         }
     }
     $mailUserFromTmp = $this->MailUserFrom;
     if (strlen($mailUserFromTmp) > 0) {
         if (strlen($strMailUserFrom) > 0) {
             $strMailUserFrom .= ", ";
         }
         $strMailUserFrom .= preg_replace("#[\r\n]+#", "", $mailUserFromTmp);
     }
     if (!empty($mailUserFromArrayString)) {
         foreach ($mailUserFromArrayString as $s) {
             if (strlen($strMailUserFrom) > 0) {
                 $strMailUserFrom .= ", ";
             }
             $strMailUserFrom .= $s;
         }
     }
     $strMailUserTo = "";
     list($MailUserToArray, $MailUserToArrayString) = static::ExtractEmails($this->MailUserToArray);
     $arMailUserToArray = CBPHelper::ExtractUsers($MailUserToArray, $documentId, false);
     foreach ($arMailUserToArray as $user) {
         $dbUser = CUser::GetList($b = "", $o = "", array("ID_EQUAL_EXACT" => $user));
         if ($arUser = $dbUser->Fetch()) {
             if (strlen($strMailUserTo) > 0) {
                 $strMailUserTo .= ", ";
             }
             $strMailUserTo .= preg_replace("#[\r\n]+#", "", $arUser["EMAIL"]);
         }
     }
     $mailUserToTmp = $this->MailUserTo;
     if (strlen($mailUserToTmp) > 0) {
         if (strlen($strMailUserTo) > 0) {
             $strMailUserTo .= ", ";
         }
         $strMailUserTo .= preg_replace("#[\r\n]+#", "", $mailUserToTmp);
     }
     if (!empty($MailUserToArrayString)) {
         foreach ($MailUserToArrayString as $s) {
             if (strlen($strMailUserTo) > 0) {
                 $strMailUserTo .= ", ";
             }
             $strMailUserTo .= $s;
         }
     }
     $charset = $this->MailCharset;
     if (!$this->IsPropertyExists("DirrectMail") || $this->DirrectMail == "Y") {
         global $APPLICATION;
         $strMailUserFrom = $APPLICATION->ConvertCharset($strMailUserFrom, SITE_CHARSET, $charset);
         $strMailUserFrom = CBPMailActivity::EncodeHeaderFrom($strMailUserFrom, $charset);
         $strMailUserTo = $APPLICATION->ConvertCharset($strMailUserTo, SITE_CHARSET, $charset);
         $strMailUserTo = CBPMailActivity::EncodeMimeString($strMailUserTo, $charset);
         $mailSubject = $APPLICATION->ConvertCharset($this->MailSubject, SITE_CHARSET, $charset);
         $mailSubject = CBPMailActivity::EncodeSubject($mailSubject, $charset);
         $mailText = $APPLICATION->ConvertCharset(CBPHelper::ConvertTextForMail($this->MailText), SITE_CHARSET, $charset);
         $eol = CAllEvent::GetMailEOL();
         mail($strMailUserTo, $mailSubject, $mailText, "From: " . $strMailUserFrom . $eol . "Reply-To: " . $strMailUserFrom . $eol . "X-Priority: 3 (Normal)" . $eol . "Content-Type: text/" . ($this->MailMessageType == "html" ? "html" : "plain") . "; charset=" . $charset . $eol . "X-Mailer: PHP/" . phpversion());
     } else {
         $siteId = null;
         if ($this->IsPropertyExists("MailSite")) {
             $siteId = $this->MailSite;
         }
         if (strlen($siteId) <= 0) {
             $siteId = SITE_ID;
         }
         $arFields = array("SENDER" => $strMailUserFrom, "RECEIVER" => $strMailUserTo, "TITLE" => $this->MailSubject, "MESSAGE" => CBPHelper::ConvertTextForMail($this->MailText));
         $event = new CEvent();
         $event->Send("BIZPROC_MAIL_TEMPLATE", $siteId, $arFields, "N");
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:95,代码来源:mailactivity.php

示例15: OnExternalEvent

 public function OnExternalEvent($arEventParameters = array())
 {
     if ($this->executionStatus == CBPActivityExecutionStatus::Closed) {
         return;
     }
     $timeoutDuration = $this->CalculateTimeoutDuration();
     if ($timeoutDuration > 0) {
         if (array_key_exists("SchedulerService", $arEventParameters) && $arEventParameters["SchedulerService"] == "OnAgent") {
             $this->IsTimeout = 1;
             $this->taskStatus = CBPTaskStatus::Timeout;
             $this->Unsubscribe($this);
             $this->workflow->CloseActivity($this);
             return;
         }
     }
     if (!array_key_exists("USER_ID", $arEventParameters) || intval($arEventParameters["USER_ID"]) <= 0) {
         return;
     }
     if (empty($arEventParameters["REAL_USER_ID"])) {
         $arEventParameters["REAL_USER_ID"] = $arEventParameters["USER_ID"];
     }
     $rootActivity = $this->GetRootActivity();
     $arUsers = $this->taskUsers;
     if (empty($arUsers)) {
         //compatibility
         $arUsers = CBPHelper::ExtractUsers($this->Users, $this->GetDocumentId(), false);
     }
     $arEventParameters["USER_ID"] = intval($arEventParameters["USER_ID"]);
     $arEventParameters["REAL_USER_ID"] = intval($arEventParameters["REAL_USER_ID"]);
     if (!in_array($arEventParameters["USER_ID"], $arUsers)) {
         return;
     }
     $taskService = $this->workflow->GetService("TaskService");
     $taskService->MarkCompleted($this->taskId, $arEventParameters["REAL_USER_ID"], CBPTaskUserStatus::Ok);
     $this->Comments = $arEventParameters["COMMENT"];
     if ($this->IsPropertyExists("InfoUser")) {
         $this->InfoUser = "user_" . $arEventParameters["REAL_USER_ID"];
     }
     $this->WriteToTrackingService(str_replace(array("#PERSON#", "#COMMENT#"), array("{=user:user_" . $arEventParameters["REAL_USER_ID"] . "}", strlen($arEventParameters["COMMENT"]) > 0 ? ": " . $arEventParameters["COMMENT"] : ""), GetMessage("BPRIA_ACT_APPROVE_TRACK")), $arEventParameters["REAL_USER_ID"]);
     $this->ResponcedInformation = $arEventParameters["RESPONCE"];
     //$rootActivity->SetVariablesTypes($arEventParameters["RESPONCE_TYPES"]);
     $rootActivity->SetVariables($arEventParameters["RESPONCE"]);
     $this->taskStatus = CBPTaskStatus::CompleteOk;
     $this->Unsubscribe($this);
     //$this->SetStatusTitle();
     $this->workflow->CloseActivity($this);
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:47,代码来源:requestinformationactivity.php


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