A few minor cleanups. Also, changed what I could to use ExecMethod(). This is much cleaner when calling a single function from a class than creating an instantiation of the class and calling a single method.

This commit is contained in:
skeeter 2001-12-27 15:14:02 +00:00
parent ab9fffff05
commit 40ee06a1d1
3 changed files with 30 additions and 44 deletions

View File

@ -78,8 +78,7 @@
{
if (!@isset($GLOBALS['HTTP_POST_VARS']['account_id']) || !@$GLOBALS['HTTP_POST_VARS']['account_id'] || $GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_groups();
ExecMethod('admin.uiaccounts.list_groups');
return False;
}
@ -115,17 +114,15 @@
$GLOBALS['phpgw']->db->unlock();
$ui = createobject('admin.uiaccounts');
$ui->list_accounts();
return False;
Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
$GLOBALS['phpgw']->common->phpgw_exit();
}
function delete_user()
{
if (isset($GLOBALS['HTTP_POST_VARS']['cancel']) || $GLOBALS['phpgw']->acl->check('account_access',32,'admin'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
elseif($GLOBALS['HTTP_POST_VARS']['delete_account'])
@ -163,8 +160,7 @@
$cd = 29;
}
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
}
@ -173,8 +169,7 @@
{
if ($GLOBALS['phpgw']->acl->check('group_access',4,'admin'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_groups();
ExecMethod('admin.uiaccounts.list_groups');
return False;
}
@ -288,8 +283,7 @@
$GLOBALS['phpgw']->db->unlock();
$ui = createobject('admin.uiaccounts');
$ui->list_groups();
ExecMethod('admin.uiaccounts.list_groups');
return False;
}
@ -297,8 +291,7 @@
{
if ($GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
@ -329,8 +322,7 @@
if (!$errors = $this->validate_user($userData))
{
$this->so->add_user($userData);
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
else
@ -341,8 +333,7 @@
}
else
{
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
}
@ -351,8 +342,7 @@
{
if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_groups();
ExecMethod('admin.uiaccounts.list_groups');
return False;
}
@ -512,8 +502,7 @@
$GLOBALS['phpgw']->db->unlock();
$ui = createobject('admin.uiaccounts');
$ui->list_groups();
ExecMethod('admin.uiaccounts.list_groups');
return False;
}
@ -521,8 +510,7 @@
{
if ($GLOBALS['phpgw']->acl->check('account_access',16,'admin'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
@ -555,17 +543,14 @@
// check if would create a menu
// if we do, we can't return to the users list, because
// there are also some other plugins
$menuClass = CreateObject('admin.uimenuclass');
if (!$menuClass->createHTMLCode('edit_user'))
if (!ExecMethod('admin.uimenuclass.createHTMLCode','edit_user'))
{
$ui = createobject('admin.uiaccounts');
$ui->list_users();
ExecMethod('admin.uiaccounts.list_users');
return False;
}
else
{
$ui = createobject('admin.uiaccounts');
$ui->edit_user($GLOBALS['HTTP_GET_VARS']['account_id']);
ExecMethod('admin.uiaccountsiedit_user',$GLOBALS['HTTP_GET_VARS']['account_id']);
return False;
}
}

View File

@ -663,8 +663,9 @@
$var['permissions_list'] = $appRightsOutput;
// create the menu on the left, if needed
$menuClass = CreateObject('admin.uimenuclass');
$var['rows'] = $menuClass->createHTMLCode('view_user');
// $menuClass = CreateObject('admin.uimenuclass');
// This is now using ExecMethod()
$var['rows'] = ExecMethod('admin.uimenuclass.createHTMLCode','view_user');
$t->set_var($var);
$t->pfp('out','form');
}
@ -1038,8 +1039,9 @@
$t->set_var($var);
// create the menu on the left, if needed
$menuClass = CreateObject('admin.uimenuclass');
$t->set_var('rows',$menuClass->createHTMLCode('edit_user'));
// $menuClass = CreateObject('admin.uimenuclass');
// This is now using ExecMethod()
$t->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','edit_user'));
echo $t->fp('out','form');
}

View File

@ -13,6 +13,9 @@
class uimenuclass
{
var $t;
var $rowColor = Array();
function uimenuclass()
{
$this->t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('admin'));
@ -21,14 +24,12 @@
$this->t->set_block('menurow','menu_links','menu_links');
$this->t->set_block('menurow','link_row','link_row');
$this->rowColor[0] = $GLOBALS['phpgw_info']["theme"]["row_on"];
$this->rowColor[1] = $GLOBALS['phpgw_info']["theme"]["row_off"];
$this->rowColor[0] = $GLOBALS['phpgw_info']['theme']['row_on'];
$this->rowColor[1] = $GLOBALS['phpgw_info']['theme']['row_off'];
}
function section_item($pref_link='',$pref_text='', $bgcolor)
{
global $t;
$this->t->set_var('row_link',$pref_link);
$this->t->set_var('row_text',$pref_text);
$this->t->set_var('tr_color',$bgcolor);
@ -42,21 +43,19 @@
// This allows extra data to be sent along
function display_section($_menuData)
{
global $account_id;
$i=0;
while(list($key,$value) = each($_menuData))
{
if (!empty($value['extradata']))
{
$link = $GLOBALS['phpgw']->link($value['url'],'account_id=' . $account_id . '&' . $value['extradata']);
$link = $GLOBALS['phpgw']->link($value['url'],'account_id=' . $GLOBALS['account_id'] . '&' . $value['extradata']);
}
else
{
$link = $GLOBALS['phpgw']->link($value['url'],'account_id=' . $account_id);
$link = $GLOBALS['phpgw']->link($value['url'],'account_id=' . $GLOBALS['account_id']);
}
$this->section_item($link,lang($value['description']),$this->rowColor[$i%2]);
$this->section_item($link,lang($value['description']),$this->rowColor[($i % 2)]);
$i++;
}