blob: e5ebc761d0678a692bfc9bbd1c612405093ad06e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
class ChatUserRecord extends TActiveRecord
{
public $username;
private $_last_activity;
public static $_tablename='chat_users';
public function getLast_Activity()
{
if($this->_last_activity === null)
$this->_last_activity = time();
return $this->_last_activity;
}
public function setLast_Activity($value)
{
$this->_last_activity = $value;
}
public static function finder($className=__CLASS__)
{
return parent::finder($className);
}
public function getUserList()
{
$this->deleteAll('last_activity < ?', time()-300); //5 min inactivity
$content = '<ul>';
foreach($this->findAll() as $user)
{
$content .= '<li>'.htmlspecialchars($user->username).'</li>';
}
$content .= '</ul>';
return $content;
}
}
?>
|