Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userdontauth.php
1
<?
2
3
namespace
Bitrix\Sender\Integration\Main\Triggers
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Main\UserTable
;
7
use
Bitrix\Main\Type\DateTime
;
8
use
Bitrix\Sender\Trigger\TriggerConnectorClosed
;
9
10
Loc::loadMessages
(__FILE__);
11
12
class
UserDontAuth
extends
TriggerConnectorClosed
13
{
14
public
function
getName
()
15
{
16
return
Loc::getMessage
(
'sender_trigger_user_dontauth_name'
);
17
}
18
19
public
function
getCode
()
20
{
21
return
"user_dontauth"
;
22
}
23
25
public
static
function
canBeTarget
()
26
{
27
return
false
;
28
}
29
31
public
static
function
canRunForOldData
()
32
{
33
return
true
;
34
}
35
36
public
function
filter
()
37
{
38
$daysDontAuth = $this->
getFieldValue
(
'DAYS_DONT_AUTH'
);
39
if
(!is_numeric($daysDontAuth))
40
$daysDontAuth = 90;
41
42
$dateFrom =
new
DateTime
;
43
$dateTo =
new
DateTime
;
44
45
$dateFrom->
setTime
(0, 0, 0)->add(
'-'
. $daysDontAuth .
' days'
);
46
$dateTo->setTime(0, 0, 0)->add(
'1 days'
)->add(
'-'
. $daysDontAuth .
' days'
);
47
48
if
($this->isRunForOldData())
49
{
50
$filter = array(
51
'!LAST_LOGIN'
=>
null
,
52
'<LAST_LOGIN'
=> $dateTo,
53
);
54
}
55
else
56
{
57
$filter = array(
58
'>LAST_LOGIN'
=> $dateFrom,
59
'<LAST_LOGIN'
=> $dateTo,
60
);
61
}
62
63
$filter[
'=ACTIVE'
] =
true
;
64
$userListDb = UserTable::getList(array(
65
'select'
=> array(
'EMAIL'
,
'ID'
,
'NAME'
),
66
'filter'
=> $filter,
67
'order'
=> array(
'ID'
=>
'ASC'
)
68
));
69
if
($userListDb->getSelectedRowsCount() > 0)
70
{
71
$userListDb->addFetchDataModifier(array($this,
'getFetchDataModifier'
));
72
$this->recipient = $userListDb;
73
return
true
;
74
}
75
else
76
return
false
;
77
}
78
79
public
function
getRecipient
()
80
{
81
return
$this->recipient;
82
}
83
84
public
function
getForm
()
85
{
86
$daysDontAuth =
' <input size=3 type="text" name="'
.$this->getFieldName(
'DAYS_DONT_AUTH'
).
'" value="'
.htmlspecialcharsbx($this->
getFieldValue
(
'DAYS_DONT_AUTH'
, 90)).
'"> '
;
87
88
return
'
89
<table>
90
<tr>
91
<td>'
.Loc::getMessage(
'sender_trigger_user_dontauth_days'
).
'</td>
92
<td>'
.$daysDontAuth.
'</td>
93
</tr>
94
</table>
95
'
;
96
}
97
98
public
function
getFetchDataModifier
($fields)
99
{
100
if
(isset($fields[
'ID'
]))
101
{
102
$fields[
'USER_ID'
] = $fields[
'ID'
];
103
unset($fields[
'ID'
]);
104
}
105
106
return
$fields;
107
}
108
}
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\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Main\Type\DateTime\setTime
setTime($hour, $minute, $second=0, $microseconds=0)
Definition
datetime.php:144
Bitrix\Main\UserTable
Definition
user.php:46
Bitrix\Sender\Connector\Base\getFieldValue
getFieldValue($name, $defaultValue=null)
Definition
base.php:195
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth
Definition
userdontauth.php:13
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\getRecipient
getRecipient()
Definition
userdontauth.php:79
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\getName
getName()
Definition
userdontauth.php:14
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\canRunForOldData
static canRunForOldData()
Definition
userdontauth.php:31
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\getForm
getForm()
Definition
userdontauth.php:84
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\getFetchDataModifier
getFetchDataModifier($fields)
Definition
userdontauth.php:98
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\filter
filter()
Definition
userdontauth.php:36
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\getCode
getCode()
Definition
userdontauth.php:19
Bitrix\Sender\Integration\Main\Triggers\UserDontAuth\canBeTarget
static canBeTarget()
Definition
userdontauth.php:25
Bitrix\Sender\Trigger\TriggerConnectorClosed
Definition
triggerconnectorclosed.php:12
Bitrix\Sender\Integration\Main\Triggers
Definition
userauth.php:3
modules
sender
lib
integration
main
triggers
userdontauth.php
Создано системой
1.10.0