Project

General

Profile

« Previous | Next » 

Revision 1043

Added by Matthias almost 15 years ago

Codechanges to get rid of the empty display(style) declaration "style='display: ;'", and to avoid to generate (hidden) elements if the user isn't alowed to edit one.

View differences:

index.php
30 30
// Setup template object
31 31
$template = new Template(THEME_PATH.'/templates');
32 32
$template->set_file('page', 'access.htt');
33

  
33 34
$template->set_block('page', 'main_block', 'main');
35
$template->set_block('main_block', 'users_block', 'user');
36
$template->set_block('main_block', 'groups_block', 'group');
34 37

  
35 38
// Insert values into the template object
36 39
$template->set_var(array(
37
								'ADMIN_URL' => ADMIN_URL,
38
								'THEME_URL' => THEME_URL,
39
								'WB_URL' => WB_URL
40
								)
41
						);
40
		'ADMIN_URL' => ADMIN_URL,
41
		'THEME_URL' => THEME_URL,
42
		'WB_URL' => WB_URL
43
	)
44
);
42 45

  
43
// Insert permission values into the template object
44
if($admin->get_permission('users') != true) {
45
	$template->set_var('DISPLAY_USERS', 'none');
46
}
47
if($admin->get_permission('groups') != true) {
48
	$template->set_var('DISPLAY_GROUPS', 'none');
49
}
46
/**
47
 *	Insert permission values into the template object
48
 *	Deprecated - as we are using blocks.
49
 */
50
$display_none = "style=\"display: none;\"";
51
if($admin->get_permission('users') != true)	$template->set_var('DISPLAY_USERS', $display_none);
52
if($admin->get_permission('groups') != true) $template->set_var('DISPLAY_GROUPS', $display_none);
50 53

  
51 54
// Insert section names and descriptions
52 55
$template->set_var(array(
53
								'USERS' => $MENU['USERS'],
54
								'GROUPS' => $MENU['GROUPS'],
55
								'ACCESS' => $MENU['ACCESS'],
56
								'USERS_OVERVIEW' => $OVERVIEW['USERS'],
57
								'GROUPS_OVERVIEW' => $OVERVIEW['GROUPS'],
58
								)
59
						);
56
		'USERS' => $MENU['USERS'],
57
		'GROUPS' => $MENU['GROUPS'],
58
		'ACCESS' => $MENU['ACCESS'],
59
		'USERS_OVERVIEW' => $OVERVIEW['USERS'],
60
		'GROUPS_OVERVIEW' => $OVERVIEW['GROUPS'],
61
	)
62
);
60 63

  
64
if ( $admin->get_permission('users') == true )	$template->parse('main_block', "users_block", true);
65
if ( $admin->get_permission('groups') == true )	$template->parse('main_block', "groups_block", true);
66

  
61 67
// Parse template object
62 68
$template->parse('main', 'main_block', false);
63 69
$template->pparse('output', 'page');

Also available in: Unified diff