Skip to content

Commit 927aa38

Browse files
committed
Updated the limits dashlet to show the limits for the admin user too.
1 parent c71060d commit 927aa38

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

interface/web/dashboard/dashlets/limits.php

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,34 @@ function show() {
111111
$tpl->setVar($wb);
112112

113113
if($app->auth->is_admin()) {
114-
$user_is_admin = 1;
114+
$user_is_admin = true;
115115
} else {
116-
$user_is_admin = 0;
116+
$user_is_admin = false;
117117
}
118118
$tpl->setVar('is_admin',$user_is_admin);
119119

120-
if($user_is_admin == 0) {
120+
if($user_is_admin == false) {
121121
$client_group_id = $_SESSION["s"]["user"]["default_group"];
122122
$client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
123-
124-
$rows = array();
125-
foreach($limits as $limit) {
126-
$field = $limit['field'];
127-
if($client[$field] != 0) {
128-
$value = ($client[$field] == '-1')?$wb['unlimited_txt']:$client[$field];
129-
$rows[] = array('field' => $field,
130-
'field_txt' => $wb[$field.'_txt'],
131-
'value' => $value,
132-
'usage' => $this->_get_limit_usage($limit));
133-
}
123+
}
124+
125+
$rows = array();
126+
foreach($limits as $limit) {
127+
$field = $limit['field'];
128+
if($user_is_admin) {
129+
$value = $wb['unlimited_txt'];
130+
} else {
131+
$value = $client[$field];
132+
}
133+
if($value != 0 || $value == $wb['unlimited_txt']) {
134+
$value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value;
135+
$rows[] = array('field' => $field,
136+
'field_txt' => $wb[$field.'_txt'],
137+
'value' => $value_formatted,
138+
'usage' => $this->_get_limit_usage($limit));
134139
}
135-
$tpl->setLoop('rows',$rows);
136140
}
141+
$tpl->setLoop('rows',$rows);
137142

138143

139144
return $tpl->grab();

interface/web/dashboard/dashlets/templates/limits.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2>{tmpl_var name='limits_txt'}</h2>
44
<tmpl_loop name='rows'>
55
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
66
<td>{tmpl_var name='field_txt'}</td>
7-
<td>{tmpl_var name='usage'} {tmpl_var name='of_txt'} {tmpl_var name='value'}</td>
7+
<td style="white-space: nowrap">{tmpl_var name='usage'} {tmpl_var name='of_txt'} {tmpl_var name='value'}</td>
88
</tr>
99
</tmpl_loop>
1010
</table>

0 commit comments

Comments
 (0)