]> git.donarmstrong.com Git - roundcube.git/blob - plugins/userinfo/userinfo.php
Merge commit 'upstream/0.7'
[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   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');
34     $table->add('', Q($user->ID));
35     
36     $table->add('title', Q($this->gettext('username')));
37     $table->add('', Q($user->data['username']));
38     
39     $table->add('title', Q($this->gettext('server')));
40     $table->add('', Q($user->data['mail_host']));
41
42     $table->add('title', Q($this->gettext('created')));
43     $table->add('', Q($user->data['created']));
44
45     $table->add('title', Q($this->gettext('lastlogin')));
46     $table->add('', Q($user->data['last_login']));
47     
48     $identity = $user->get_identity();
49     $table->add('title', Q($this->gettext('defaultidentity')));
50     $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>'));
51     
52     return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show();
53   }
54
55 }