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

:sparkles: feat(audit) Add date filters in audit management

This allow to filter a date range in the Audit page

issue #5816
Showing with 87 additions and 0 deletions
+87 -0
<div class="contentboxh">
<p>{t}Filter{/t}</p>
</div>
<div class="contentboxb">
{if isset($dateFilters)}
<table>
{foreach from=$dateFilters item="dfilter"}
<tr>
<td><label for="{$dfilter.id}" style="padding:3px;">{$dfilter.label}&nbsp;</label></td>
<td>{${$dfilter.id}}</td>
</tr>
{/foreach}
</table>
{/if}
<hr/>
{$SCOPE}
<hr/>
<label for="NAME" title="{$NAMEDESC}"><img src="geticon.php?context=actions&amp;icon=system-search&amp;size=16" alt="Search"/></label>{$NAME}
<div>
{$APPLY}
</div>
</div>
......@@ -61,6 +61,47 @@ class auditManagement extends simpleManagement
unset($this->actions['removeConfirmed']);
}
function configureFilter ()
{
$this->filter->xmlData['definition']['template'] = 'audit-filter.tpl';
if ($this->autoFilter) {
$this->configureFilterCategory();
$attributes = $this->autoFilterAttributes;
$filter = '';
$tag = 'STARTDATE';
$filter .= '$'.$tag;
$this->filter->elements[$tag] = array(
'type' => 'date',
'tag' => $tag,
'default' => '',
'unset' => '',
'set' => '(fdAuditDateTime>=$)'
);
$this->filter->elementValues[$tag] = '';
$tag = 'ENDDATE';
$filter .= '$'.$tag;
$this->filter->elements[$tag] = array(
'type' => 'date',
'tag' => $tag,
'default' => '',
'unset' => '',
'set' => '(fdAuditDateTime<=$)'
);
$this->filter->elementValues[$tag] = '';
$attributes = array_values(array_unique($attributes));
$this->filter->query[0]['filter'] = '(&(objectClass=fdAuditEvent)'.$filter.'$NAME)';
$this->filter->query[0]['attribute'] = $attributes;
$this->filter->elements['NAME']['set'] = '(|('.join('=*$*)(', $attributes).'=*$*))';
$this->filter->elements['NAME']['autocomplete']['filter'] = '(&'.$filter.'(|('.join('=*$NAME*)(', $attributes).'=*$NAME*))'.')';
$this->filter->elements['NAME']['autocomplete']['attribute'] = $attributes;
uasort($this->filter->elements, 'strlenSort');
$this->filter->elements = array_reverse($this->filter->elements);
}
}
function parseXML ($file)
{
$data = parent::parseXML($file);
......@@ -106,6 +147,26 @@ class auditManagement extends simpleManagement
return $data;
}
function renderList()
{
global $config;
$smarty = get_smarty();
$filters = array(
array(
'id' => 'STARTDATE',
'label' => _('Newer than')
),
array(
'id' => 'ENDDATE',
'label' => _('Older than')
),
);
$smarty->assign('dateFilters', $filters);
$this->headpage->update();
$display = $this->headpage->render();
return $this->getHeader().$display;
}
static function filterDateTime()
{
$pid = func_get_arg(0);
......
Supports Markdown
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