|
+-----------------------------------------------------------------------+
$Id$
*/
// get user record
$sql_result = $DB->query("SELECT username, mail_host FROM ".get_table_name('users')."
WHERE user_id=?",
$_SESSION['user_id']);
if ($USER_DATA = $DB->fetch_assoc($sql_result))
$OUTPUT->set_pagetitle(sprintf('%s %s@%s', rcube_label('settingsfor'), $USER_DATA['username'], $USER_DATA['mail_host']));
function rcmail_user_prefs_form($attrib)
{
global $DB, $CONFIG, $sess_user_lang;
$no_override = is_array($CONFIG['dont_override']) ? array_flip($CONFIG['dont_override']) : array();
// add some labels to client
rcube_add_label('nopagesizewarning');
list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs');
unset($attrib['form']);
// allow the following attributes to be added to the
tag
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));
// return the complete edit form as table
$out = "$form_start
\n\n";
// show language selection
if (!isset($no_override['language']))
{
$a_lang = rcube_list_languages();
asort($a_lang);
$field_id = 'rcmfd_lang';
$select_lang = new select(array('name' => '_language', 'id' => $field_id));
$select_lang->add(array_values($a_lang), array_keys($a_lang));
$out .= sprintf("
$form_end";
return $out;
}
function rcmail_identities_list($attrib)
{
global $DB, $CONFIG, $OUTPUT;
// get contacts from DB
$sql_result = $DB->query("SELECT * FROM ".get_table_name('identities')."
WHERE del<>1
AND user_id=?
ORDER BY standard DESC, name ASC",
$_SESSION['user_id']);
// add id to message list table if not specified
if (!strlen($attrib['id']))
$attrib['id'] = 'rcmIdentitiesList';
// define list of cols to be displayed
$a_show_cols = array('name', 'email', 'organization', 'reply-to');
// create XHTML table
$out = rcube_table_output($attrib, $sql_result, $a_show_cols, 'identity_id');
// set client env
$OUTPUT->add_gui_object('identitieslist', $attrib['id']);
return $out;
}
// similar function as in /steps/addressbook/edit.inc
function get_form_tags($attrib, $action, $add_hidden=array())
{
global $OUTPUT, $EDIT_FORM, $SESS_HIDDEN_FIELD;
$form_start = '';
if (!strlen($EDIT_FORM))
{
$hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
$hiddenfields->add(array('name' => '_action', 'value' => $action));
if ($add_hidden)
$hiddenfields->add($add_hidden);
if ($_GET['_framed'] || $_POST['_framed'])
$hiddenfields->add(array('name' => '_framed', 'value' => 1));
$form_start = !strlen($attrib['form']) ? '' : '';
$form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';
if (!strlen($EDIT_FORM))
$OUTPUT->add_gui_object('editform', $form_name);
$EDIT_FORM = $form_name;
return array($form_start, $form_end);
}
// register UI objects
$OUTPUT->add_handlers(array(
'userprefs' => 'rcmail_user_prefs_form',
'itentitieslist' => 'rcmail_identities_list'
));
?>