Conditions | 6 |
Paths | 2 |
Total Lines | 60 |
Code Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
45 | function list_apps() |
||
46 | { |
||
47 | $this->common_header(); |
||
48 | |||
49 | Api\Hooks::process('acl_manager',array('preferences')); |
||
50 | |||
51 | $this->template->set_file(array( |
||
52 | 'app_list' => 'acl_applist.tpl' |
||
53 | )); |
||
54 | $this->template->set_block('app_list','list'); |
||
55 | $this->template->set_block('app_list','app_row'); |
||
56 | $this->template->set_block('app_list','app_row_noicon'); |
||
57 | $this->template->set_block('app_list','link_row'); |
||
58 | $this->template->set_block('app_list','spacer_row'); |
||
59 | |||
60 | if (is_array($GLOBALS['acl_manager'])) |
||
61 | { |
||
62 | foreach($GLOBALS['acl_manager'] as $app => $locations) |
||
63 | { |
||
64 | $icon = Api\Image::find($app,array('navbar.png',$app.'png','navbar.gif',$app.'.gif')); |
||
65 | $this->template->set_var('icon_backcolor',$GLOBALS['egw_info']['theme']['row_off']); |
||
66 | $this->template->set_var('link_backcolor',$GLOBALS['egw_info']['theme']['row_off']); |
||
67 | $this->template->set_var('app_name',$GLOBALS['egw_info']['apps'][$app]['title']); |
||
68 | $this->template->set_var('app_icon',$icon); |
||
69 | |||
70 | if ($icon) |
||
71 | { |
||
72 | $this->template->fp('rows','app_row',True); |
||
73 | } |
||
74 | else |
||
75 | { |
||
76 | $this->template->fp('rows','app_row_noicon',True); |
||
77 | } |
||
78 | |||
79 | if (is_array($locations)) |
||
80 | { |
||
81 | foreach($locations as $loc => $value) |
||
82 | { |
||
83 | $link_values = array( |
||
84 | 'menuaction' => 'admin.admin_denyaccess.access_form', |
||
85 | 'location' => $loc, |
||
86 | 'acl_app' => $app, |
||
87 | 'account_id' => $this->account_id |
||
88 | ); |
||
89 | |||
90 | $this->template->set_var('link_location',$GLOBALS['egw']->link('/index.php',$link_values)); |
||
91 | $this->template->set_var('lang_location',lang($value['name'])); |
||
92 | $this->template->fp('rows','link_row',True); |
||
93 | } |
||
94 | } |
||
95 | |||
96 | $this->template->parse('rows','spacer_row',True); |
||
97 | } |
||
98 | } |
||
99 | $this->template->set_var(array( |
||
100 | 'cancel_action' => $GLOBALS['egw']->link('/admin/index.php'), |
||
101 | 'lang_cancel' => lang('Cancel') |
||
102 | )); |
||
103 | $this->template->pfp('out','list'); |
||
104 | echo $GLOBALS['egw']->framework->footer(); |
||
105 | } |
||
175 |