Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
inttype.php
1
<?php
2
namespace
Bitrix\Bizproc\BaseType
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Bizproc\FieldType
;
6
7
Loc::loadMessages
(__FILE__);
8
13
class
IntType
extends
Double
14
{
15
19
public
static
function
getType
()
20
{
21
return
FieldType::INT
;
22
}
23
31
public
static
function
toSingleValue
(
FieldType
$fieldType, $value)
32
{
33
if
(is_array($value))
34
{
35
reset($value);
36
$value = current($value);
37
}
38
return
$value;
39
}
40
47
protected
static
function
extractValue
(
FieldType
$fieldType, array $field, array $request)
48
{
49
$value = Base::extractValue($fieldType, $field, $request);
50
51
if
($value !==
null
&& is_string($value) && $value <>
''
)
52
{
53
if
(\CBPActivity::isExpression($value))
54
return
$value;
55
56
$value = str_replace(
' '
,
''
, $value);
57
if
(preg_match(
'#^[0-9\-]+$#'
, $value))
58
{
59
$value = (int) $value;
60
}
61
else
62
{
63
$value =
null
;
64
static::addError(array(
65
'code'
=>
'ErrorValue'
,
66
'message'
=>
Loc::getMessage
(
'BPDT_INT_INVALID'
),
67
'parameter'
=> static::generateControlName($field),
68
));
69
}
70
}
71
elseif (is_numeric($value))
72
{
73
$value = (int)$value;
74
}
75
else
76
{
77
$value =
null
;
78
}
79
80
return
$value;
81
}
82
}
Bitrix\Bizproc\BaseType\Double
Definition
double.php:15
Bitrix\Bizproc\BaseType\IntType
Definition
inttype.php:14
Bitrix\Bizproc\BaseType\IntType\getType
static getType()
Definition
inttype.php:19
Bitrix\Bizproc\BaseType\IntType\extractValue
static extractValue(FieldType $fieldType, array $field, array $request)
Definition
inttype.php:47
Bitrix\Bizproc\BaseType\IntType\toSingleValue
static toSingleValue(FieldType $fieldType, $value)
Definition
inttype.php:31
Bitrix\Bizproc\FieldType
Definition
fieldtype.php:12
Bitrix\Bizproc\FieldType\INT
const INT
Definition
fieldtype.php:42
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Bizproc\BaseType
Definition
base.php:3
modules
bizproc
lib
basetype
inttype.php
Создано системой
1.10.0