Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2017 (original work) Open Assessment Technologies SA;
19 *
20 *
21 */
22
23namespace oat\taoEventLog\model\userLastActivityLog;
24
25use oat\oatbox\user\User;
26
27/**
28 * Interface UserLastActivityLog
29 *
30 * Service to log the user activity.
31 * May be used to analize current load, get approximate amount of active users.
32 *
33 * @package oat\taoEventLog\model\userLastActivityLog
34 * @author Aleh Hutnikau, <hutnikau@1pt.com>
35 */
36interface UserLastActivityLog
37{
38    public const USER_ID = 'user_id';
39    public const USER_ROLES = 'user_role';
40    public const ACTION = 'action';
41    public const EVENT_TIME = 'event_time';
42    public const DETAILS = 'details';
43
44    public const SERVICE_ID = 'taoEventLog/UserLastActivityLog';
45
46    /**
47     * Log user activity.
48     *
49     * @param User $user
50     * @param string $action - activity name
51     * @param array $details - additional details
52     * @return boolean
53     */
54    public function log(User $user, $action, array $details = []);
55
56    /**
57     * Find user activities.
58     *
59     * Result example:
60     * ```
61     * [
62     *     [...],
63     *     [
64     *         'user_id' => 'http://sample/first.rdf#i1490617729993174',
65     *         'user_role' => 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole,http://www.tao.lu/Ontologies/TAOLTI.rdf#LtiDeliveryProviderManagerRole',
66     *         'event_time' => '1490617792.5479'
67     *     ],
68     *     [...],
69     * ]
70     * ```
71     *
72     * Filters parameter example:
73     * ```
74     * [
75     *   ['user_id', 'in', ['http://sample/first.rdf#i1490617729993174', 'http://sample/first.rdf#i1490617729993174'],
76     *   ['event_time', 'between', '1490703795.3624', '1490704796.2467'],
77     * ]
78     * ```
79     * Available operations: `<`, `>`, `<>`, `<=`, `>=`, `=`, `between`, `like`
80     *
81     * Options parameter example:
82     * ```
83     * [
84     *      'limit' => 100,
85     *      'offset' => 200,
86     *      'group' => 'user_id,
87     * ]
88     * ```
89     * Available options: 'limit', 'offset', 'group'.
90     *
91     * @param array $filters filters by user id, url, role etc.
92     * @param array $options
93     * @return \Iterator
94     */
95    public function find(array $filters = [], array $options = []);
96
97    /**
98     * Count number of records by given search criteria
99     * For usage details see self::find method.
100     *
101     * @param array $filters @see self::find() description.
102     * @param array $options
103     * @return integer
104     */
105    public function count(array $filters = [], array $options = []);
106}