[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/preferences/ -> index.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - preferences                                                 *
   4      * http://www.egroupware.org                                                *
   5      * Written by Joseph Engo <jengo@phpgroupware.org>                          *
   6      * --------------------------------------------                             *
   7      *  This program is free software; you can redistribute it and/or modify it *
   8      *  under the terms of the GNU General Public License as published by the   *
   9      *  Free Software Foundation; either version 2 of the License, or (at your  *
  10      *  option) any later version.                                              *
  11      \**************************************************************************/
  12  
  13      /* $Id: index.php 20295 2006-02-15 12:31:25Z  $ */
  14  
  15      $GLOBALS['egw_info'] = array(
  16          'flags' => array(
  17              'currentapp' => 'preferences',
  18              'disable_Template_class' => True,
  19          ),
  20      );
  21      include('../header.inc.php');
  22  
  23      $pref_tpl =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
  24      $templates = Array(
  25          'pref' => 'index.tpl'
  26      );
  27  
  28      $pref_tpl->set_file($templates);
  29  
  30      $pref_tpl->set_block('pref','list');
  31      $pref_tpl->set_block('pref','app_row');
  32      $pref_tpl->set_block('pref','app_row_noicon');
  33      $pref_tpl->set_block('pref','link_row');
  34      $pref_tpl->set_block('pref','spacer_row');
  35  
  36      if ($GLOBALS['egw']->acl->check('run',1,'admin'))
  37      {
  38          // This is where we will keep track of our position.
  39          // Developers won't have to pass around a variable then
  40          $session_data = $GLOBALS['egw']->session->appsession('session_data','preferences');
  41  
  42          if (! is_array($session_data))
  43          {
  44              $session_data = array('type' => 'user');
  45              $GLOBALS['egw']->session->appsession('session_data','preferences',$session_data);
  46          }
  47  
  48          if (! $_GET['type'])
  49          {
  50              $type = $session_data['type'];
  51          }
  52          else
  53          {
  54              $type = $_GET['type'];
  55              $session_data = array('type' => $type);
  56              $GLOBALS['egw']->session->appsession('session_data','preferences',$session_data);
  57          }
  58  
  59          $tabs[] = array(
  60              'label' => lang('Your preferences'),
  61              'link'  => $GLOBALS['egw']->link('/preferences/index.php','type=user')
  62          );
  63          $tabs[] = array(
  64              'label' => lang('Default preferences'),
  65              'link'  => $GLOBALS['egw']->link('/preferences/index.php','type=default')
  66          );
  67          $tabs[] = array(
  68              'label' => lang('Forced preferences'),
  69              'link'  => $GLOBALS['egw']->link('/preferences/index.php','type=forced')
  70          );
  71  
  72          switch($type)
  73          {
  74              case 'user':    $selected = 0; break;
  75              case 'default': $selected = 1; break;
  76              case 'forced':  $selected = 2; break;
  77          }
  78          $pref_tpl->set_var('tabs',$GLOBALS['egw']->common->create_tabs($tabs,$selected));
  79      }
  80  
  81      // This func called by the includes to dump a row header
  82  	function section_start($appname='',$icon='')
  83      {
  84          global $pref_tpl;
  85  
  86          $pref_tpl->set_var('a_name',$appname);
  87          $pref_tpl->set_var('app_name',$GLOBALS['egw_info']['apps'][$appname]['title']);
  88          $pref_tpl->set_var('app_icon',$icon);
  89          if ($icon)
  90          {
  91              $pref_tpl->parse('rows','app_row',True);
  92          }
  93          else
  94          {
  95              $pref_tpl->parse('rows','app_row_noicon',True);
  96          }
  97      }
  98  
  99  	function section_item($pref_link='',$pref_text='')
 100      {
 101          global $pref_tpl;
 102  
 103          $pref_tpl->set_var('pref_link',$pref_link);
 104  
 105          if (strtolower($pref_text) == 'grant access' && $GLOBALS['egw_info']['server']['deny_user_grants_access'])
 106          {
 107              return False;
 108          }
 109          else
 110          {
 111              $pref_tpl->set_var('pref_text',$pref_text);
 112          }
 113  
 114          $pref_tpl->parse('rows','link_row',True);
 115      }
 116  
 117  	function section_end()
 118      {
 119          global $pref_tpl;
 120  
 121          $pref_tpl->parse('rows','spacer_row',True);
 122      }
 123  
 124  	function display_section($appname,$file,$file2=False)
 125      {
 126          if ($file2)
 127          {
 128              $file = $file2;
 129          }
 130          section_start($appname,$GLOBALS['egw']->common->image($appname,Array('navbar',$appname)));
 131  
 132          while(list($text,$url) = each($file))
 133          {
 134              section_item($url,lang($text));
 135          }
 136          section_end();
 137      }
 138  
 139      $GLOBALS['egw']->hooks->process('preferences',array('preferences'));
 140      $pref_tpl->pfp('out','list');
 141      $GLOBALS['egw']->common->egw_footer();
 142  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7