1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
userdontauth.php
См. документацию.
1<?
2
3namespace Bitrix\Sender\Integration\Main\Triggers;
4
5use Bitrix\Main\Localization\Loc;
6use Bitrix\Main\UserTable;
7use Bitrix\Main\Type\DateTime;
8use Bitrix\Sender\Trigger\TriggerConnectorClosed;
9
10Loc::loadMessages(__FILE__);
11
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
99 {
100 if(isset($fields['ID']))
101 {
102 $fields['USER_ID'] = $fields['ID'];
103 unset($fields['ID']);
104 }
105
106 return $fields;
107 }
108}
setTime($hour, $minute, $second=0, $microseconds=0)
Определения datetime.php:144
getFieldValue($name, $defaultValue=null)
Определения base.php:195
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$filter
Определения iblock_catalog_list.php:54
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
$fields
Определения yandex_run.php:501