1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
config.php
См. документацию.
1
<?php
2
namespace
Bitrix\MobileApp\Designer;
3
4
use Bitrix\Main\Entity;
5
use Bitrix\Main\Entity\Event;
6
use Bitrix\Main\Entity\FieldError;
7
use Bitrix\Main\Entity\Result;
8
use Bitrix\Main\Entity\ScalarField;
9
use Bitrix\Main\Localization\Loc;
10
use Bitrix\Main;
11
12
Loc::loadMessages(__FILE__);
13
41
class
ConfigTable
extends
Entity\DataManager
42
{
43
public
static
function
getFilePath
()
44
{
45
return
__FILE__;
46
}
47
48
public
static
function
getTableName
()
49
{
50
return
'b_mobileapp_config'
;
51
}
52
53
public
static
function
getMap
()
54
{
55
return
array
(
56
new
Entity
\
StringField
(
'APP_CODE'
,
array
(
57
'primary'
=>
true
,
58
'validation'
=>
array
(__CLASS__,
'validateAppCode'
),
59
'title'
=> Loc::getMessage(
'CONFIG_ENTITY_APP_CODE_FIELD'
),
60
)),
61
new
Entity
\
StringField
(
'PLATFORM'
,
array
(
62
'primary'
=>
true
,
63
'validation'
=>
array
(__CLASS__,
'validatePlatform'
),
64
'title'
=> Loc::getMessage(
'CONFIG_ENTITY_PLATFORM_FIELD'
),
65
)),
66
new
Entity
\
TextField
(
'PARAMS'
,
array
(
67
'serialized'
=>
true
,
68
'title'
=> Loc::getMessage(
'CONFIG_ENTITY_PARAMS_FIELD'
),
69
)),
70
71
new
Entity
\
DatetimeField
(
'DATE_CREATE'
,
array
(
72
'default_value'
=>
new
\
Bitrix
\
Main
\
Type
\
DateTime
,
73
'title'
=> Loc::getMessage(
'CONFIG_ENTITY_DATE_CREATE_FIELD'
),
74
)),
75
new
Entity
\ReferenceField(
76
'APP'
,
77
'Bitrix\MobileApp\AppTable'
,
78
array
(
'=this.APP_CODE'
=>
'ref.CODE'
)
79
)
80
);
81
}
82
83
public
static
function
validateAppCode
()
84
{
85
return
array
(
86
new
Entity
\Validator\Length(
null
, 255),
87
);
88
}
89
90
91
public
static
function
validatePlatform
()
92
{
93
return
array
(
94
new
Entity
\Validator\Length(
null
, 255),
95
);
96
}
97
98
99
public
static
function
getSupportedPlatforms
()
100
{
101
$platforms =
AppTable::getSupportedPlatforms
();
102
$platforms[] =
"global"
;
103
return
$platforms;
104
}
105
106
public
static
function
checkFields
(
Result
$result
, $primary,
array
$data
)
107
{
108
parent::checkFields(
$result
, $primary,
$data
);
109
$availablePlatforms =
self::getSupportedPlatforms
();
110
111
if
(
$result
instanceof
Entity
\
AddResult
)
112
{
113
$entity
= self::getEntity();
114
if
(!
$data
[
"APP_CODE"
])
115
{
116
$result
->addError(
new
Entity
\
FieldError
(
$entity
->getField(
"APP_CODE"
),
"Can not be empty!"
, 1));
117
}
118
else
if
(!
$data
[
"PLATFORM"
])
119
{
120
$result
->addError(
new
Entity
\
FieldError
(
$entity
->getField(
"PLATFORM"
),
"Can not be empty!"
, 1));
121
}
122
elseif
(!in_array(
$data
[
"PLATFORM"
], $availablePlatforms))
123
{
124
$result
->addError(
new
Entity
\
FieldError
(
$entity
->getField(
"PLATFORM"
),
"The passed value in not available!"
, 1));
125
}
126
127
$selectResult = self::getList(
array
(
128
"filter"
=>
array
(
129
"APP_CODE"
=>
$data
[
"APP_CODE"
],
130
"PLATFORM"
=>
$data
[
"PLATFORM"
]
131
)
132
));
133
134
if
($selectResult->getSelectedRowsCount() > 0)
135
{
136
$result
->addError(
new
Entity
\
EntityError
(
"Such configuration is already exists!"
, 1000));
137
}
138
}
139
}
140
141
public
static
function
isExists
($appCode,
$platform
)
142
{
143
//this is not such heavy operation as it might be expected
144
$config
= self::getRowById(Array(
"APP_CODE"
=> $appCode,
"PLATFORM"
=>
$platform
));
145
return
(is_array(
$config
) &&
count
(
$config
) > 0);
146
}
147
}
148
Bitrix\Main\ORM\Data\AddResult
Определения
addresult.php:12
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
Bitrix\Main\ORM\EntityError
Определения
entityerror.php:12
Bitrix\Main\ORM\Fields\DatetimeField
Определения
datetimefield.php:22
Bitrix\Main\ORM\Fields\FieldError
Определения
fielderror.php:14
Bitrix\Main\ORM\Fields\StringField
Определения
stringfield.php:20
Bitrix\Main\ORM\Fields\TextField
Определения
textfield.php:20
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
Bitrix\MobileApp\AppTable\getSupportedPlatforms
static getSupportedPlatforms()
Определения
app.php:177
Bitrix\MobileApp\Designer\ConfigTable
Определения
config.php:42
Bitrix\MobileApp\Designer\ConfigTable\getMap
static getMap()
Определения
config.php:53
Bitrix\MobileApp\Designer\ConfigTable\validateAppCode
static validateAppCode()
Определения
config.php:83
Bitrix\MobileApp\Designer\ConfigTable\getFilePath
static getFilePath()
Определения
config.php:43
Bitrix\MobileApp\Designer\ConfigTable\validatePlatform
static validatePlatform()
Определения
config.php:91
Bitrix\MobileApp\Designer\ConfigTable\isExists
static isExists($appCode, $platform)
Определения
config.php:141
Bitrix\MobileApp\Designer\ConfigTable\checkFields
static checkFields(Result $result, $primary, array $data)
Определения
config.php:106
Bitrix\MobileApp\Designer\ConfigTable\getSupportedPlatforms
static getSupportedPlatforms()
Определения
config.php:99
Bitrix\MobileApp\Designer\ConfigTable\getTableName
static getTableName()
Определения
config.php:48
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
$platform
$platform
Определения
settings.php:7
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main\Type
Определения
collection.php:2
Bitrix\Main
Bitrix
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$config
$config
Определения
quickway.php:69
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
bitrix
modules
mobileapp
lib
designer
config.php
Создано системой
1.14.0