Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
userauthaction.php
1<?php
8namespace Bitrix\Main;
9
12
29class UserAuthActionTable extends Entity\DataManager
30{
31 use Data\Internal\DeleteByFilterTrait;
32
33 const PRIORITY_HIGH = 100;
34 const PRIORITY_LOW = 200;
35
36 const ACTION_LOGOUT = 'logout';
37 const ACTION_UPDATE = 'update';
38
39 public static function getTableName()
40 {
41 return 'b_user_auth_action';
42 }
43
44 public static function getMap()
45 {
46 return array(
47 'ID' => array(
48 'data_type' => 'integer',
49 'primary' => true,
50 'autocomplete' => true,
51 ),
52 'USER_ID' => array(
53 'data_type' => 'integer'
54 ),
55 'PRIORITY' => array(
56 'data_type' => 'integer'
57 ),
58 'ACTION' => array(
59 'data_type' => 'string'
60 ),
61 'ACTION_DATE' => array(
62 'data_type' => 'datetime'
63 ),
64 'APPLICATION_ID' => array(
65 'data_type' => 'string'
66 ),
67 );
68 }
69
76 public static function addLogoutAction($userId, $applicationId = null)
77 {
78 return static::add(array(
79 'USER_ID' => $userId,
80 'PRIORITY' => self::PRIORITY_HIGH,
81 'ACTION' => self::ACTION_LOGOUT,
82 'ACTION_DATE' => new Type\DateTime(),
83 'APPLICATION_ID' => $applicationId,
84 ));
85 }
86
92 public static function addUpdateAction($userId, Type\DateTime $date = null)
93 {
94 if($date === null)
95 {
96 $date = new Type\DateTime();
97 }
98
99 return static::add(array(
100 'USER_ID' => $userId,
101 'PRIORITY' => self::PRIORITY_LOW,
102 'ACTION' => self::ACTION_UPDATE,
103 'ACTION_DATE' => $date,
104 ));
105 }
106}
static addUpdateAction($userId, Type\DateTime $date=null)
static addLogoutAction($userId, $applicationId=null)