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

View File

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

View File

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