return (substr($string, 0, $len) === $startString);
}
+// ttEndsWith functions checks if a string ends with a given substring.
+function ttEndsWith($string, $endString)
+{
+ $len = strlen($endString);
+ if ($len == 0) return true;
+ return (substr($string, -$len) === $endString);
+}
+
// ttDateToUserFormat converts a date from database format to user format.
function ttDateToUserFormat($date)
{
$includeSelf = isset($options['include_self']);
$select_part = 'select u.id, u.group_id, u.name';
- if (isset($options['include_login'])) $select_part .= ', u.login';
+ if (isset($options['include_login'])) {
+ $select_part .= ', u.login';
+ // Piggy-back on include_login to see if we must also include quota_percent.
+ $include_quota = $this->isPluginEnabled('mq');
+ if ($include_quota) {
+ $decimal_mark = $this->getDecimalMark();
+ $replaceDecimalMark = ('.' != $decimal_mark);
+ $select_part .= ', u.quota_percent';
+ }
+ }
if (!isset($options['include_clients'])) $select_part .= ', r.rights';
if (isset($options['include_role'])) $select_part .= ', r.name as role_name, r.rank';
if ($isClient)
continue; // Skip adding clients.
}
+ if ($include_quota) {
+ $quota = $val['quota_percent'];
+ if (null == $quota)
+ $quota = '100'; // Null means 100%. Perhaps enforce not NULLs in db and eliminate this check.
+ elseif (ttEndsWith($quota, '.00'))
+ $quota = substr($quota, 0, strlen($quota)-3); // Trim trailing ".00";
+ elseif ($replaceDecimalMark)
+ $quota = str_replace('.', $decimal_mark, $quota);
+ $val['quota_percent'] = $quota.'%';
+ }
$user_list[] = $val;
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.34.4678 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.34.4679 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
<td width="30%" class="tableHeader">{$i18n.label.person_name}</td>
<td width="30%" class="tableHeader">{$i18n.label.login}</td>
<td width="20%" class="tableHeader">{$i18n.form.users.role}</td>
- <td width="10%" class="tableHeader">{$i18n.label.edit}</td>
- <td width="10%" class="tableHeader">{$i18n.label.delete}</td>
+ {if $show_quota}
+ <td class="tableHeader">{$i18n.label.quota}</td>
+ {/if}
+ <td class="tableHeader">{$i18n.label.edit}</td>
+ <td class="tableHeader">{$i18n.label.delete}</td>
</tr>
{if $active_users}
{foreach $active_users as $u}
</td>
<td>{$u.login|escape}</td>
<td>{$u.role_name|escape}</td>
+ {if $show_quota}
+ <td class="cellRightAligned">{$u.quota_percent}</td>
+ {/if}
{if $u.group_id != $user->group_id || $u.rank < $user->rank || ($u.rank == $user->rank && $u.id == $user->id)}
<td><a href="user_edit.php?id={$u.id}">{$i18n.label.edit}</a></td>
{if $u.id != $user->id}<td><a href="user_delete.php?id={$u.id}">{$i18n.label.delete}</a></td>{else}<td></td>{/if}
<td width="30%" class="tableHeader">{$i18n.label.person_name}</td>
<td width="30%" class="tableHeader">{$i18n.label.login}</td>
<td width="20%" class="tableHeader">{$i18n.form.users.role}</td>
- <td width="10%" class="tableHeader">{$i18n.label.edit}</td>
- <td width="10%" class="tableHeader">{$i18n.label.delete}</td>
+ {if $show_quota}
+ <td class="tableHeader">{$i18n.label.quota}</td>
+ {/if}
+ <td class="tableHeader">{$i18n.label.edit}</td>
+ <td class="tableHeader">{$i18n.label.delete}</td>
</tr>
{foreach $inactive_users as $u}
<tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
<td>{$u.name|escape}</td>
<td>{$u.login|escape}</td>
<td>{$u.role_name|escape}</td>
+ {if $show_quota}
+ <td class="cellRightAligned">{$u.quota_percent}</td>
+ {/if}
{if $u.group_id != $user->group_id || $u.rank < $user->rank}
<td><a href="user_edit.php?id={$u.id}">{$i18n.label.edit}</a></td>
<td><a href="user_delete.php?id={$u.id}">{$i18n.label.delete}</a></td>
$smarty->assign('active_users', $active_users);
$smarty->assign('inactive_users', $inactive_users);
+$smarty->assign('show_quota', $user->isPluginEnabled('mq'));
$smarty->assign('title', $i18n->get('title.users'));
$smarty->assign('content_page_name', 'users.tpl');
$smarty->display('index.tpl');