]> git.donarmstrong.com Git - roundcube.git/blob - plugins/userinfo/userinfo.php
Merge commit 'debian/0.3.1-1' into debian
[roundcube.git] / plugins / userinfo / userinfo.php
1 <?php
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
11   function init()
12   {
13     $this->add_texts('localization/', array('userinfo'));
14     $this->register_action('plugin.userinfo', array($this, 'infostep'));
15     $this->include_script('userinfo.js');
16   }
17
18   function infostep()
19   {
20     $this->register_handler('plugin.body', array($this, 'infohtml'));
21     rcmail::get_instance()->output->send('plugin');
22   }
23   
24   function infohtml()
25   {
26     $rcmail = rcmail::get_instance();
27     $user = $rcmail->user;
28     
29     $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
30
31     $table->add('title', 'ID');
32     $table->add('', Q($user->ID));
33     
34     $table->add('title', Q($this->gettext('username')));
35     $table->add('', Q($user->data['username']));
36     
37     $table->add('title', Q($this->gettext('server')));
38     $table->add('', Q($user->data['mail_host']));
39
40     $table->add('title', Q($this->gettext('created')));
41     $table->add('', Q($user->data['created']));
42
43     $table->add('title', Q($this->gettext('lastlogin')));
44     $table->add('', Q($user->data['last_login']));
45     
46     $identity = $user->get_identity();
47     $table->add('title', Q($this->gettext('defaultidentity')));
48     $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>'));
49     
50     return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show();
51   }
52
53 }