Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
mapresult.php
1<?
3
5
12{
13 protected $lastProcessedId = 0;
14 protected $supportedCount = 0;
15
16 protected $mapped = array();
17 protected $notFound = array();
18 protected $duplicated = array();
19
20 public function setSupportedCount($count) { $this->supportedCount = intval($count); }
21 public function setLastProcessedId($id) { $this->lastProcessedId = intval($id); }
22 public function getLastProcessedId() { return $this->lastProcessedId; }
23 public function getSupportedCount() { return $this->supportedCount; }
24 public function getDuplicated() { return $this->duplicated; }
25 public function getNotFound() { return $this->notFound; }
26 public function getMapped() { return $this->mapped; }
27
28 public function addNotFound($eLocId, $eLocName)
29 {
30 $this->notFound[] = array($eLocId, $eLocName);
31 }
32
33 public function addDuplicated($eLocId, $eLocName, $bLocId)
34 {
35 $this->duplicated[] = array($eLocId, $eLocName, $bLocId);
36 }
37
38 public function addMapped($eLocId, $eLocName, $bLocId)
39 {
40 $this->mapped[] = array($eLocId, $eLocName, $bLocId, $this->getLocationChain($bLocId));
41 }
42
43 protected function getLocationChain($locationId)
44 {
45 $res = LocationTable::getList(array(
46 'filter' => array(
47 array(
48 'LOGIC' => 'OR',
49 '=CODE' => $locationId,
50 '=ID' => $locationId
51 ),
52 ),
53 'select' => array(
54 'ID', 'CODE', 'LEFT_MARGIN', 'RIGHT_MARGIN'
55 )
56 ));
57
58 if(!$loc = $res->fetch())
59 return '';
60
61 $result = '';
62 $res = LocationTable::getList(array(
63 'filter' => array(
64 '<=LEFT_MARGIN' => $loc['LEFT_MARGIN'],
65 '>=RIGHT_MARGIN' => $loc['RIGHT_MARGIN'],
66 'NAME.LANGUAGE_ID' => 'ru'
67 ),
68 'select' => array(
69 'ID', 'CODE',
70 'LOC_NAME' => 'NAME.NAME'
71 ),
72 'order' => array('LEFT_MARGIN' => 'ASC')
73 ));
74
75 while($loc = $res->fetch())
76 $result .= $loc['LOC_NAME'].', ';
77
78 return $result;
79 }
80}
addDuplicated($eLocId, $eLocName, $bLocId)
Definition mapresult.php:33
addMapped($eLocId, $eLocName, $bLocId)
Definition mapresult.php:38