Commit f81a3685 authored by Côme Chilliet's avatar Côme Chilliet

Merge branch...

Merge branch '5816-audit-plugin-should-have-a-way-to-select-a-range-of-date-to-show-entries' into '1.3-dev'

Resolve "audit plugin should have a way to select a range of date to show entries"

See merge request fusiondirectory/fd-plugins!223
parents c7d6282f 23e88f18
<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);
......
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