1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
sitelink.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sale\Location\Search;
9
10
use Bitrix\Main;
11
use Bitrix\Main\DB;
12
use Bitrix\Main\Entity;
13
use Bitrix\Main\Localization\Loc;
14
15
use Bitrix\Sale\Location;
16
use Bitrix\Sale\Location\DB\Helper;
17
18
Loc::loadMessages(__FILE__);
19
36
final
class
SiteLinkTable
extends
Entity\DataManager
37
{
38
public
static
function
getFilePath
()
39
{
40
return
__FILE__;
41
}
42
43
public
static
function
getTableName
()
44
{
45
return
'b_sale_loc_search_sitlnk'
;
46
}
47
48
public
static
function
checkTableExists
()
49
{
50
static
$tableExists;
51
52
if
($tableExists ===
null
)
53
$tableExists =
Main\HttpApplication::getConnection
()->isTableExists(static::getTableName());
54
55
return
$tableExists;
56
}
57
58
public
static
function
cleanUpData
()
59
{
60
Helper::dropTable(static::getTableName());
61
62
// ORACLE: OK, MSSQL: OK
63
$sql =
"create table "
.static::getTableName().
"
64
(
65
LOCATION_ID "
.Helper::getSqlForDataType(
'int'
).
",
66
SITE_ID "
.Helper::getSqlForDataType(
'char'
, 2).
",
67
68
primary key (LOCATION_ID, SITE_ID)
69
)"
;
70
71
Main\HttpApplication::getConnection
()->query($sql);
72
}
73
74
public
static
function
initializeData
()
75
{
76
$locationTable =
Location\LocationTable::getTableName
();
77
$groupLocationTable =
Location\GroupLocationTable::getTableName
();
78
$siteLocationTable =
Location\SiteLocationTable::getTableName
();
79
80
// ORACLE: OK, MSSQL: OK
81
$sql =
"
82
insert into "
.static::getTableName().
"
83
(LOCATION_ID, SITE_ID)
84
select LC.ID, LS.SITE_ID
85
from "
.$siteLocationTable.
" LS
86
inner join "
.$locationTable.
" L on LS.LOCATION_ID = L.ID and LS.LOCATION_TYPE = 'L'
87
inner join "
.$locationTable.
" LC on LC.LEFT_MARGIN >= L.LEFT_MARGIN and LC.RIGHT_MARGIN <= L.RIGHT_MARGIN
88
union
89
select LC.ID, LS.SITE_ID
90
from "
.$siteLocationTable.
" LS
91
inner join "
.$groupLocationTable.
" LG on LS.LOCATION_ID = LG.LOCATION_GROUP_ID and LS.LOCATION_TYPE = 'G'
92
inner join "
.$locationTable.
" L on LG.LOCATION_ID = L.ID
93
inner join "
.$locationTable.
" LC on LC.LEFT_MARGIN >= L.LEFT_MARGIN and LC.RIGHT_MARGIN <= L.RIGHT_MARGIN
94
"
;
95
96
Main\HttpApplication::getConnection
()->query($sql);
97
}
98
99
public
static
function
createIndex
()
100
{
101
Helper::createIndex(static::getTableName(),
'S'
,
array
(
'SITE_ID'
));
102
}
103
104
public
static
function
getMap
()
105
{
106
return
array
(
107
108
'LOCATION_ID'
=>
array
(
109
'data_type'
=>
'integer'
,
110
'required'
=>
true
,
111
'primary'
=>
true
112
),
113
'SITE_ID'
=>
array
(
114
'data_type'
=>
'integer'
,
115
'required'
=>
true
,
116
'primary'
=>
true
117
),
118
);
119
}
120
}
121
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Sale\Location\GroupLocationTable\getTableName
static getTableName()
Определения
grouplocation.php:33
Bitrix\Sale\Location\LocationTable\getTableName
static getTableName()
Определения
location.php:45
Bitrix\Sale\Location\Search\SiteLinkTable
Определения
sitelink.php:37
Bitrix\Sale\Location\Search\SiteLinkTable\getMap
static getMap()
Определения
sitelink.php:104
Bitrix\Sale\Location\Search\SiteLinkTable\createIndex
static createIndex()
Определения
sitelink.php:99
Bitrix\Sale\Location\Search\SiteLinkTable\cleanUpData
static cleanUpData()
Определения
sitelink.php:58
Bitrix\Sale\Location\Search\SiteLinkTable\getFilePath
static getFilePath()
Определения
sitelink.php:38
Bitrix\Sale\Location\Search\SiteLinkTable\initializeData
static initializeData()
Определения
sitelink.php:74
Bitrix\Sale\Location\Search\SiteLinkTable\checkTableExists
static checkTableExists()
Определения
sitelink.php:48
Bitrix\Sale\Location\Search\SiteLinkTable\getTableName
static getTableName()
Определения
sitelink.php:43
Bitrix\Sale\Location\SiteLocationTable\getTableName
static getTableName()
Определения
sitelocation.php:35
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
bitrix
modules
sale
lib
location
search
sitelink.php
Создано системой
1.14.0