1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Chats |
||
5 | * |
||
6 | * @author Alexey Krupskiy <[email protected]> |
||
7 | * @link http://inji.ru/ |
||
8 | * @copyright 2015 Alexey Krupskiy |
||
9 | * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
||
10 | */ |
||
11 | class Chats extends Module { |
||
12 | |||
13 | public function init() { |
||
14 | App::$primary->view->customAsset('js', '/moduleAsset/Chats/js/chat.js'); |
||
15 | } |
||
16 | |||
17 | public function getMembers($chatId) { |
||
18 | $members = \Chats\Chat\Member::getList(['where' => ['chat_id', $chatId]]); |
||
19 | foreach ($members as $key => $member) { |
||
20 | if (strtotime($member->date_last_active) - time() > 30) { |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
21 | $member->delete(); |
||
22 | unset($members[$key]); |
||
23 | } |
||
24 | } |
||
25 | return $members; |
||
26 | } |
||
27 | |||
28 | } |
||
29 |