Commit f7915f98 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #5547 Adapted dashboard users code to ease ppolicy tab enhancement

parent 5b559a84
......@@ -57,6 +57,19 @@ class dashboardUsers extends simplePlugin
{
parent::__construct($dn, $object, $parent, $mainTab);
$this->expiredAccountsColumns = array(
'user' => array(
'uid' => _('Login'),
'cn' => _('Name'),
'telephoneNumber' => _('Phone number'),
'expirationDate' => _('Expiration date'),
),
'manager' => array(
'manager_cn' => _('Name'),
'manager_mail' => _('Email'),
'manager_phone' => _('Phone number'),
)
);
$this->users_stats = $this->computeUsersStats();
$this->groups_stats = $this->computeGroupsStats();
$this->expired = $this->expired_accounts_info();
......@@ -155,6 +168,7 @@ class dashboardUsers extends simplePlugin
}
return array(
'columns' => $this->expiredAccountsColumns,
'accounts' => $expired_accounts,
'accounts_next_days' => $next_expired_accounts,
'next_days' => $next_expired_days,
......@@ -176,8 +190,12 @@ class dashboardUsers extends simplePlugin
$manager_phone = '';
}
/* 24 * 60 * 60 = 86400 */
$human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400);
if (isset($attrs['shadowExpire'][0])) {
/* 24 * 60 * 60 = 86400 */
$human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400);
} else {
$human_shadowExpire = '';
}
return array(
'uid' => $attrs['uid'][0],
......@@ -187,7 +205,7 @@ class dashboardUsers extends simplePlugin
'manager_cn' => $manager_cn,
'manager_mail' => $manager_mail,
'manager_phone' => $manager_phone,
'shadowExpire' => $human_shadowExpire,
'expirationDate' => $human_shadowExpire,
);
}
}
......
......@@ -12,41 +12,39 @@
</h1>
{if $attributes.expired.accounts|@count > 0}
<table style="width: 100%;" class="listingTable">
<colgroup>
<col width="10%"/>
<col width="15%"/>
<col width="15%"/>
<col width="15%"/>
<col width="15%"/>
<col width="10%"/>
</colgroup>
<thead>
<tr style="background-color: white; text-align:center;">
<th colspan="4" style="background-color: white; padding:5px;">
<th colspan="{$attributes.expired.columns.user|@count}" style="background-color: white; padding:5px;">
{t}Expired accounts{/t}
</th>
<th colspan="3" style="background-color: white; padding:5px;">
<th colspan="{$attributes.expired.columns.manager|@count}" style="background-color: white; padding:5px;">
{t}Manager concerned{/t}
</th>
</tr>
<tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
<!-- uid/cn/telephonNumber/mail/shadowExpire/sambaKickoffTime -->
<th>{t}uid{/t}</th><th>{t}cn{/t}</th><th>{t}telephoneNumber{/t}</th><th>{t}shadowExpire{/t}</th>
<th>{t}manager{/t}</th><th>{t}mail{/t}</th><th>{t}telephoneNumber{/t}</th>
<tr>
{foreach from=$attributes.expired.columns.user item=colname}
<th>{$colname}</th>
{/foreach}
{foreach from=$attributes.expired.columns.manager item=colname}
<th>{$colname}</th>
{/foreach}
</tr>
</thead>
<tbody>
{foreach from=$attributes.expired.accounts item=account}
<tr>
<td>&nbsp;{$account.uid}</td>
<td>&nbsp;{$account.cn}</td>
<td>&nbsp;{$account.telephoneNumber}</td>
<td>&nbsp;{$account.shadowExpire}</td>
<td>&nbsp;{$account.manager_cn}</td>
<td><a href="mailto:{$account.manager_mail}">{$account.manager_mail}</a></td>
<td>&nbsp;{$account.manager_phone}</td>
{foreach from=$attributes.expired.columns.user key=colkey item=colname}
<td>&nbsp;{$account.$colkey}</td>
{/foreach}
{foreach from=$attributes.expired.columns.manager key=colkey item=colname}
{if $colkey==manager_mail}
<td><a href="mailto:{$account.$colkey}">{$account.$colkey}</a></td>
{else}
<td>&nbsp;{$account.$colkey}</td>
{/if}
{/foreach}
</tr>
{/foreach}
</tbody>
......@@ -62,39 +60,39 @@
</h1>
{if $attributes.expired.accounts_next_days|@count > 0}
<table style="width: 100%;" class="listingTable">
<colgroup>
<col width="10%"/>
<col width="15%"/>
<col width="15%"/>
<col width="15%"/>
<col width="15%"/>
<col width="10%"/>
</colgroup>
<thead>
<tr style="background-color: white; text-align:center;">
<th colspan="4" style="background-color: white; padding:5px;">
<th colspan="{$attributes.expired.columns.user|@count}" style="background-color: white; padding:5px;">
{t}Next expired accounts{/t}
</th>
<th colspan="3" style="background-color: white; padding:5px;">
<th colspan="{$attributes.expired.columns.manager|@count}" style="background-color: white; padding:5px;">
{t}Manager concerned{/t}
</th>
</tr>
<tr>
<!-- uid/cn/telephonNumber/mail/shadowExpire/sambaKickoffTime -->
<th>{t}uid{/t}</th><th>{t}cn{/t}</th><th>{t}telephoneNumber{/t}</th><th>{t}shadowExpire{/t}</th>
<th>{t}manager{/t}</th><th>{t}mail{/t}</th><th>{t}telephoneNumber{/t}</th>
{foreach from=$attributes.expired.columns.user item=colname}
<th>{$colname}</th>
{/foreach}
{foreach from=$attributes.expired.columns.manager item=colname}
<th>{$colname}</th>
{/foreach}
</tr>
</thead>
<tbody>
{foreach from=$attributes.expired.accounts_next_days item=account}
<tr>
<td>&nbsp;{$account.uid}</td>
<td>&nbsp;{$account.cn}</td>
<td>&nbsp;{$account.telephoneNumber}</td>
<td>&nbsp;{$account.shadowExpire}</td>
<td>&nbsp;{$account.manager_cn}</td>
<td><a href="mailto:{$account.manager_mail}">{$account.manager_mail}</a></td>
<td>&nbsp;{$account.manager_phone}</td>
{foreach from=$attributes.expired.columns.user key=colkey item=colname}
<td>&nbsp;{$account.$colkey}</td>
{/foreach}
{foreach from=$attributes.expired.columns.manager key=colkey item=colname}
{if $colkey==manager_mail}
<td><a href="mailto:{$account.$colkey}">{$account.$colkey}</a></td>
{else}
<td>&nbsp;{$account.$colkey}</td>
{/if}
{/foreach}
</tr>
{/foreach}
</tbody>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment