[bitrix] БП start.php

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?
require_once($_SERVER['DOCUMENT_ROOT'].'/main/interaction/support/.conf.php');
$userPrefix = 'user_';
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$arResult = $documentService->GetDocument($documentId);
$SUPPORT_ID = $arResult['PROPERTY_SUPPORT_ID'];
$this->SetVariable('HTTP_ORIGIN', $_SERVER['HTTP_ORIGIN'] ?: 'http://'.$_SERVER['HTTP_HOST']);
$this->SetVariable("SUPPORT_ID", $SUPPORT_ID);
$VOTERS_IB = $rootActivity->arProperties['VOTERS_IB'];
CModule::IncludeModule('support');
$arTicket = CTicket::GetByID($SUPPORT_ID, LANG, 'N', 'N', 'N',Array("SELECT" => array("UF_CITY")))->GetNext();
$CATEGORY_ID = $arTicket['CATEGORY_ID'];
$arCITY_ID = $arTicket['UF_CITY'];
if(/*!$arCITY_ID || */!$VOTERS_IB || !$SUPPORT_ID || !$CATEGORY_ID){
$this->workflow->Terminate();
}
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/include/bp/matching_system/ticketvoters.class.php');
$obVoters = new TicketVotersManager($VOTERS_IB, $CATEGORY_ID, $arCITY_ID);
$arAllVoters = $obVoters->getVotersList();
$wVoters = [];
foreach($arAllVoters AS $keyVoters => $arVoters)
{
$this->SetVariable($keyVoters, $arVoters);
if(!empty($arVoters))
$wVoters[$keyVoters] = $arVoters;
if(strpos($arVoters[0], "user_")!==false)
{
$this->SetVariable('CUR_STEP', str_replace('VOTERS_STEP_', '', $keyVoters));
}
}
$this->SetVariable('CNT_STEPS', count($wVoters));
//Заполняем поле город
$rsCityList = CIBlockSection::GetList(Array('LEFT_MARGIN' => 'ASC'), Array(
'IBLOCK_ID' => IB_CONTACTS,
'ID' => $arCITY_ID
), false, Array('NAME'));
$arCityName = Array();
if($rsCityList->SelectedRowsCount()>0)
{
while($arSection = $rsCityList->Fetch())
{
$arCityName[] = $arSection['NAME'];
}
}
$this->SetVariable('SUPPORT_REGION', $arCityName);
//Заполняем дерево категорий мастера
$MASTER_SECTION_ID = substr(array_search($CATEGORY_ID, $arAccordingCategories), 8);
$rsMasterNavChain = CIBlockSection::GetNavChain(IB_MASTER_SUPPORT, $MASTER_SECTION_ID, Array('NAME'));
$arMasterNavChain = Array();
while($arSection = $rsMasterNavChain->Fetch())
{
$arMasterNavChain[] = $arSection['NAME'];
}
$this->SetVariable('MASTER_NAV_CHAIN', $arMasterNavChain);
//DebugInfo::log("SUPPORT_REGION: " . serialize($arCityName));
return true;