You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
roundcubemail/plugins/userinfo/userinfo.php

75 lines
2.5 KiB
PHTML

<?php
/**
* Sample plugin that adds a new tab to the settings section
* to display some information about the current user
*/
class userinfo extends rcube_plugin
{
9 years ago
public $task = 'settings';
public $noajax = true;
public $noframe = true;
9 years ago
function init()
{
$this->add_texts('localization/', array('userinfo'));
$this->add_hook('settings_actions', array($this, 'settings_actions'));
9 years ago
$this->register_action('plugin.userinfo', array($this, 'infostep'));
}
function settings_actions($args)
{
$args['actions'][] = array(
'action' => 'plugin.userinfo',
'class' => 'userinfo',
'label' => 'userinfo',
'domain' => 'userinfo',
);
return $args;
9 years ago
}
function infostep()
{
$this->register_handler('plugin.body', array($this, 'infohtml'));
$rcmail = rcmail::get_instance();
$rcmail->output->set_pagetitle($this->gettext('userinfo'));
$rcmail->output->send('plugin');
9 years ago
}
function infohtml()
{
$rcmail = rcmail::get_instance();
$user = $rcmail->user;
$identity = $user->get_identity();
$table = new html_table(array('cols' => 2, 'class' => 'propform'));
9 years ago
$table->add('title', html::label('', 'ID'));
9 years ago
$table->add('', rcube::Q($user->ID));
$table->add('title', html::label('', rcube::Q($this->gettext('username'))));
9 years ago
$table->add('', rcube::Q($user->data['username']));
$table->add('title', html::label('', rcube::Q($this->gettext('server'))));
9 years ago
$table->add('', rcube::Q($user->data['mail_host']));
$table->add('title', html::label('', rcube::Q($this->gettext('created'))));
9 years ago
$table->add('', rcube::Q($user->data['created']));
$table->add('title', html::label('', rcube::Q($this->gettext('lastlogin'))));
9 years ago
$table->add('', rcube::Q($user->data['last_login']));
$table->add('title', html::label('', rcube::Q($this->gettext('defaultidentity'))));
9 years ago
$table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>'));
$legend = rcube::Q('Infos for ' . $user->get_username());
$out = html::tag('fieldset', '', html::tag('legend', '', $legend) . $table->show());
return html::div(array('class' => 'box formcontent'),
html::div(array('class' => 'boxtitle'), $this->gettext('userinfo'))
. html::div(array('class' => 'boxcontent'), $out));
9 years ago
}
}