commit | author | age
|
48e9c1
|
1 |
<?php |
T |
2 |
|
|
3 |
/** |
|
4 |
* Sample plugin that adds a new tab to the settings section |
|
5 |
* to display some information about the current user |
|
6 |
*/ |
|
7 |
class userinfo extends rcube_plugin |
|
8 |
{ |
|
9 |
public $task = 'settings'; |
|
10 |
public $noajax = true; |
|
11 |
public $noframe = true; |
|
12 |
|
|
13 |
function init() |
|
14 |
{ |
|
15 |
$this->add_texts('localization/', array('userinfo')); |
|
16 |
$this->register_action('plugin.userinfo', array($this, 'infostep')); |
|
17 |
$this->include_script('userinfo.js'); |
|
18 |
} |
|
19 |
|
|
20 |
function infostep() |
|
21 |
{ |
|
22 |
$this->register_handler('plugin.body', array($this, 'infohtml')); |
|
23 |
rcmail::get_instance()->output->send('plugin'); |
|
24 |
} |
|
25 |
|
|
26 |
function infohtml() |
|
27 |
{ |
|
28 |
$rcmail = rcmail::get_instance(); |
|
29 |
$user = $rcmail->user; |
|
30 |
|
|
31 |
$table = new html_table(array('cols' => 2, 'cellpadding' => 3)); |
|
32 |
|
|
33 |
$table->add('title', 'ID'); |
61be82
|
34 |
$table->add('', rcube::Q($user->ID)); |
48e9c1
|
35 |
|
61be82
|
36 |
$table->add('title', rcube::Q($this->gettext('username'))); |
AM |
37 |
$table->add('', rcube::Q($user->data['username'])); |
48e9c1
|
38 |
|
61be82
|
39 |
$table->add('title', rcube::Q($this->gettext('server'))); |
AM |
40 |
$table->add('', rcube::Q($user->data['mail_host'])); |
48e9c1
|
41 |
|
61be82
|
42 |
$table->add('title', rcube::Q($this->gettext('created'))); |
AM |
43 |
$table->add('', rcube::Q($user->data['created'])); |
48e9c1
|
44 |
|
61be82
|
45 |
$table->add('title', rcube::Q($this->gettext('lastlogin'))); |
AM |
46 |
$table->add('', rcube::Q($user->data['last_login'])); |
48e9c1
|
47 |
|
T |
48 |
$identity = $user->get_identity(); |
61be82
|
49 |
$table->add('title', rcube::Q($this->gettext('defaultidentity'))); |
AM |
50 |
$table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>')); |
48e9c1
|
51 |
|
61be82
|
52 |
return html::tag('h4', null, rcube::Q('Infos for ' . $user->get_username())) . $table->show(); |
48e9c1
|
53 |
} |
T |
54 |
|
|
55 |
} |