Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
linkbase.php
1
<?php
2
namespace
Bitrix\Sale\Exchange\Integration\Admin
;
3
4
use
Bitrix\Main\ArgumentException
;
5
use
Bitrix\Main\Web\Uri
;
6
use
Bitrix\Sale\Internals\Fields
;
7
8
abstract
class
LinkBase
9
{
10
protected
$query
;
11
protected
$page
;
12
13
public
function
__construct
()
14
{
15
$this->query =
new
Fields
();
16
}
17
18
public
function
setRequestUri
($url)
19
{
20
$uri =
new
Uri
($url);
21
return
$this
22
->setPage($uri->getPath())
23
->setQuery($uri->getQuery());
24
}
25
26
public
function
setField
($name, $value)
27
{
28
$this->query->set($name, $value);
29
return
$this;
30
}
31
public
function
getField
($name)
32
{
33
return
$this->query->get($name);
34
}
35
public
function
setFieldsValues
($values)
36
{
37
if
(is_array($values))
38
{
39
$this->query->setValues($values);
40
}
41
return
$this;
42
}
43
public
function
getFieldsValues
()
44
{
45
return
$this->query->getValues();
46
}
47
public
function
setQuery
(
$query
)
48
{
49
$params = $this->
parseParams
(
$query
);
50
if
(is_array($params))
51
{
52
foreach
($params as $name=>$value)
53
{
54
$this->query->set($name, $value);
55
}
56
}
57
return
$this;
58
}
59
60
public
function
build
()
61
{
62
$uri =
new
Uri
($this->page);
63
return
$uri
64
->addParams($this->
getFieldsValues
())
65
->getUri();
66
}
67
public
function
redirect
()
68
{
69
LocalRedirect($this->
build
());
70
}
71
72
public
function
setPage
(
$page
)
73
{
74
$this->page =
$page
;
75
return
$this;
76
}
77
public
function
setPageByType
($type)
78
{
79
$registry =
Registry::getRegistry
()[$this->
getType
()];
80
$page
= isset($registry[$type]) ? $registry[$type]:
null
;
81
82
if
(is_null(
$page
))
83
{
84
throw
new
ArgumentException
(
"Unsupported link type: {$type}"
);
85
}
86
87
$this->
setPage
(
$page
);
88
return
$this;
89
}
90
public
function
getPage
()
91
{
92
return
$this->page
;
93
}
94
95
protected
function
parseParams
($data)
96
{
97
parse_str($data, $values);
98
return
$values;
99
}
100
101
abstract
public
function
getType
();
102
106
abstract
public
function
fill
();
//setFieldsValues($this->getDefaultFieldsValues())
107
}
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\Web\Uri
Definition
uri.php:17
Bitrix\Sale\Exchange\Integration\Admin\LinkBase
Definition
linkbase.php:9
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\__construct
__construct()
Definition
linkbase.php:13
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\$page
$page
Definition
linkbase.php:11
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\getPage
getPage()
Definition
linkbase.php:90
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\setPage
setPage($page)
Definition
linkbase.php:72
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\build
build()
Definition
linkbase.php:60
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\fill
fill()
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\setRequestUri
setRequestUri($url)
Definition
linkbase.php:18
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\setFieldsValues
setFieldsValues($values)
Definition
linkbase.php:35
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\getType
getType()
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\getFieldsValues
getFieldsValues()
Definition
linkbase.php:43
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\setPageByType
setPageByType($type)
Definition
linkbase.php:77
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\setQuery
setQuery($query)
Definition
linkbase.php:47
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\parseParams
parseParams($data)
Definition
linkbase.php:95
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\redirect
redirect()
Definition
linkbase.php:67
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\setField
setField($name, $value)
Definition
linkbase.php:26
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\getField
getField($name)
Definition
linkbase.php:31
Bitrix\Sale\Exchange\Integration\Admin\LinkBase\$query
$query
Definition
linkbase.php:10
Bitrix\Sale\Exchange\Integration\Admin\Registry\getRegistry
static getRegistry()
Definition
registry.php:23
Bitrix\Sale\Internals\Fields
Definition
fields.php:6
Bitrix\Sale\Exchange\Integration\Admin
Definition
applayoutlink.php:2
modules
sale
lib
exchange
integration
admin
linkbase.php
Создано системой
1.10.0