egroupware/preferences/index.php

132 lines
4.1 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php
2001-03-08 10:56:18 +01:00
/**************************************************************************\
* phpGroupWare - preferences *
* http://www.phpgroupware.org *
2002-11-04 01:50:18 +01:00
* Written by phpGroupWare coreteam <phpgroupware-developers@gnu.org> *
* ------------------------------------------------------------------ *
2001-03-08 10:56:18 +01:00
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
2000-08-18 05:24:22 +02:00
2002-01-11 15:04:40 +01:00
$phpgw_info = array();
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'preferences';
2001-03-08 10:56:18 +01:00
include('../header.inc.php');
2001-05-11 20:43:47 +02:00
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_file(Array('pref' => 'index.tpl'));
2002-01-11 15:04:40 +01:00
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_block('pref','list');
$GLOBALS['phpgw']->template->set_block('pref','app_row');
$GLOBALS['phpgw']->template->set_block('pref','app_row_noicon');
$GLOBALS['phpgw']->template->set_block('pref','link_row');
$GLOBALS['phpgw']->template->set_block('pref','spacer_row');
2001-05-11 23:18:59 +02:00
if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
{
2002-01-11 15:04:40 +01:00
// This is where we will keep track of our position.
// Developers won't have to pass around a variable then
$session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
if (! is_array($session_data))
{
2002-01-11 15:04:40 +01:00
$session_data = array('type' => 'user');
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
}
$type = get_var('type',Array('GET'));
if(!$type)
{
$type = $session_data['type'];
}
else
{
2002-01-11 15:04:40 +01:00
$session_data = array('type' => $type);
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
}
2002-03-16 02:33:19 +01:00
$tabs[] = array
(
2002-01-11 15:04:40 +01:00
'label' => lang('Your preferences'),
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=user')
);
2002-03-16 02:33:19 +01:00
$tabs[] = array
(
2002-01-11 15:04:40 +01:00
'label' => lang('Default preferences'),
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=default')
);
2002-03-16 02:33:19 +01:00
$tabs[] = array
(
2002-01-11 15:04:40 +01:00
'label' => lang('Forced preferences'),
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=forced')
);
switch($type)
{
2002-01-11 15:04:40 +01:00
case 'user': $selected = 0; break;
case 'default': $selected = 1; break;
case 'forced': $selected = 2; break;
}
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
}
2001-03-08 10:56:18 +01:00
// This func called by the includes to dump a row header
2002-11-04 01:50:18 +01:00
function section_start($appname='',$icon='')
2001-03-08 10:56:18 +01:00
{
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_var('app_name',$appname);
$GLOBALS['phpgw']->template->set_var('app_title',$GLOBALS['phpgw_info']['apps'][$appname]['title']);
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_var('app_icon',$icon);
2002-11-04 01:50:18 +01:00
2001-03-08 10:56:18 +01:00
if ($icon)
{
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->parse('rows','app_row',True);
2001-03-08 10:56:18 +01:00
}
else
{
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->parse('rows','app_row_noicon',True);
}
2001-03-08 10:56:18 +01:00
}
2001-05-11 19:19:20 +02:00
function section_item($pref_link='',$pref_text='')
{
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_var('pref_link',$pref_link);
if (strtolower($pref_text) == 'grant access' && $GLOBALS['phpgw_info']['server']['deny_user_grants_access'])
{
return False;
}
else
{
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->set_var('pref_text',$pref_text);
}
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->parse('rows','link_row',True);
}
2001-05-11 19:19:20 +02:00
2001-03-08 10:56:18 +01:00
function section_end()
{
2002-11-15 01:18:55 +01:00
$GLOBALS['phpgw']->template->parse('rows','spacer_row',True);
}
function display_section($appname,$file,$file2=False)
{
if ($file2)
{
$file = $file2;
}
2002-11-04 01:50:18 +01:00
section_start($appname,$GLOBALS['phpgw']->common->image($appname,'navbar','',True));
2002-11-04 01:55:07 +01:00
while(is_array($file) && list($text,$url) = each($file))
{
section_item($url,lang($text));
}
section_end();
2001-03-08 10:56:18 +01:00
}
2000-12-15 22:56:09 +01:00
2002-01-11 15:04:40 +01:00
$GLOBALS['phpgw']->hooks->process('preferences',array('preferences'));
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array(
2002-11-15 01:18:55 +01:00
'body_data' => $GLOBALS['phpgw']->template->parse('out','list')
));
?>