2001-08-28 23:50:10 +02:00
|
|
|
<?php
|
2005-10-14 19:03:16 +02:00
|
|
|
/**************************************************************************\
|
|
|
|
* eGroupWare - Administration *
|
|
|
|
* http://www.egroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* 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. *
|
|
|
|
\**************************************************************************/
|
2013-06-26 21:55:20 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
/* $Id$ */
|
2001-08-28 23:50:10 +02:00
|
|
|
|
|
|
|
class uimenuclass
|
|
|
|
{
|
2001-12-27 16:14:02 +01:00
|
|
|
var $t;
|
|
|
|
var $rowColor = Array();
|
2013-06-26 21:55:20 +02:00
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
function uimenuclass()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('admin'));
|
2001-08-28 23:50:10 +02:00
|
|
|
|
|
|
|
$this->t->set_file(array('menurow' => 'menurow.tpl'));
|
|
|
|
$this->t->set_block('menurow','menu_links','menu_links');
|
|
|
|
$this->t->set_block('menurow','link_row','link_row');
|
2001-12-18 07:00:48 +01:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->rowColor[0] = $GLOBALS['egw_info']['theme']['row_on'];
|
|
|
|
$this->rowColor[1] = $GLOBALS['egw_info']['theme']['row_off'];
|
2001-08-28 23:50:10 +02:00
|
|
|
}
|
2001-12-18 07:00:48 +01:00
|
|
|
|
2006-04-23 16:40:31 +02:00
|
|
|
function section_item($pref_link='',$pref_text='', $class='',$options='')
|
2001-08-28 23:50:10 +02:00
|
|
|
{
|
|
|
|
$this->t->set_var('row_link',$pref_link);
|
|
|
|
$this->t->set_var('row_text',$pref_text);
|
2005-07-06 04:26:44 +02:00
|
|
|
$this->t->set_var('class',$class);
|
2006-04-23 16:40:31 +02:00
|
|
|
$this->t->set_var('row_options',$options);
|
2001-08-28 23:50:10 +02:00
|
|
|
$this->t->parse('all_rows','link_row',True);
|
|
|
|
}
|
2001-12-18 07:00:48 +01:00
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
// $file must be in the following format:
|
2001-09-04 03:12:13 +02:00
|
|
|
// $file = array(
|
2001-12-18 07:00:48 +01:00
|
|
|
// 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list')
|
2001-08-28 23:50:10 +02:00
|
|
|
// );
|
|
|
|
// This allows extra data to be sent along
|
2013-06-26 21:55:20 +02:00
|
|
|
function display_section($_menuData, $_account_id)
|
2001-08-28 23:50:10 +02:00
|
|
|
{
|
|
|
|
$i=0;
|
2001-12-18 07:00:48 +01:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
// reset the value of all_rows
|
|
|
|
$this->t->set_var('all_rows','');
|
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
while(list($key,$value) = each($_menuData))
|
|
|
|
{
|
|
|
|
if (!empty($value['extradata']))
|
|
|
|
{
|
2013-06-26 21:55:20 +02:00
|
|
|
$link = egw::link($value['url'],'account_id=' . $_account_id . '&' . $value['extradata']);
|
2001-08-28 23:50:10 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-26 21:55:20 +02:00
|
|
|
$link = egw::link($value['url'],'account_id=' . get_var('account_id',array('GET','POST')));
|
2001-08-28 23:50:10 +02:00
|
|
|
}
|
2006-04-23 16:40:31 +02:00
|
|
|
$this->section_item($link,lang($value['description']),($i%2) ? "row_on": "row_off",$value['options']);
|
2001-08-28 23:50:10 +02:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
2002-01-11 03:01:29 +01:00
|
|
|
if(strpos($_menuData[0]['extradata'],'user'))
|
2002-01-10 19:18:44 +01:00
|
|
|
{
|
|
|
|
$destination = 'users';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$destination = 'groups';
|
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t->set_var('link_done',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_'.$destination));
|
2001-09-04 03:12:13 +02:00
|
|
|
$this->t->set_var('lang_done',lang('Back'));
|
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
$this->t->set_var('row_on',$this->rowColor[0]);
|
|
|
|
|
2001-09-02 01:40:28 +02:00
|
|
|
$this->t->parse('out','menu_links');
|
2013-06-26 21:55:20 +02:00
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
return $this->t->get('out','menu_links');
|
|
|
|
}
|
|
|
|
|
|
|
|
// create the html code for the menu
|
2013-06-26 21:55:20 +02:00
|
|
|
function createHTMLCode($_hookname, $_account_id=null)
|
2001-08-28 23:50:10 +02:00
|
|
|
{
|
2013-06-26 21:55:20 +02:00
|
|
|
$hook = array('location' => $_hookname);
|
|
|
|
if (!$_account_id) $_account_id = get_var('account_id',array('GET','POST'));
|
|
|
|
if ($_account_id) $hook['account_id'] = $_account_id;
|
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
switch ($_hookname)
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
case 'edit_user':
|
2001-09-04 03:12:13 +02:00
|
|
|
$GLOBALS['menuData'][] = array(
|
|
|
|
'description' => 'User Data',
|
|
|
|
'url' => '/index.php',
|
|
|
|
'extradata' => 'menuaction=admin.uiaccounts.edit_user'
|
2001-08-28 23:50:10 +02:00
|
|
|
);
|
|
|
|
break;
|
2001-09-02 01:40:28 +02:00
|
|
|
case 'view_user':
|
2001-09-04 03:12:13 +02:00
|
|
|
$GLOBALS['menuData'][] = array(
|
|
|
|
'description' => 'User Data',
|
2001-12-18 07:00:48 +01:00
|
|
|
'url' => '/index.php',
|
2001-09-04 03:12:13 +02:00
|
|
|
'extradata' => 'menuaction=admin.uiaccounts.view_user'
|
2001-08-28 23:50:10 +02:00
|
|
|
);
|
|
|
|
break;
|
2002-01-10 19:18:44 +01:00
|
|
|
case 'edit_group':
|
|
|
|
$GLOBALS['menuData'][] = array(
|
|
|
|
'description' => 'Edit Group',
|
|
|
|
'url' => '/index.php',
|
|
|
|
'extradata' => 'menuaction=admin.uiaccounts.edit_group'
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'group_manager':
|
|
|
|
$GLOBALS['menuData'][] = array(
|
|
|
|
'description' => 'Group Manager',
|
|
|
|
'url' => '/index.php',
|
|
|
|
'extradata' => 'menuaction=admin.uiaccounts.group_manager'
|
|
|
|
);
|
|
|
|
break;
|
2001-08-28 23:50:10 +02:00
|
|
|
}
|
2009-12-07 14:12:23 +01:00
|
|
|
//_debug_array($hook);
|
|
|
|
$GLOBALS['egw']->hooks->process($hook);
|
2013-06-26 21:55:20 +02:00
|
|
|
if (count($GLOBALS['menuData']) >= 1)
|
2001-08-28 23:50:10 +02:00
|
|
|
{
|
2013-06-26 21:55:20 +02:00
|
|
|
$result = $this->display_section($GLOBALS['menuData'], $_account_id);
|
2001-08-28 23:50:10 +02:00
|
|
|
//clear $menuData
|
2001-09-02 01:40:28 +02:00
|
|
|
$GLOBALS['menuData'] = '';
|
2001-08-28 23:50:10 +02:00
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// clear $menuData
|
2001-09-02 01:40:28 +02:00
|
|
|
$GLOBALS['menuData'] = '';
|
2001-08-28 23:50:10 +02:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|