Jump to content

admin activity page to only display last 20


Recommended Posts

Posted

Hi,

On my admin activity template i would like it only to display the last 20 instead of all activity.

currently the template is the admin/templates/log_index.tpl.

<h3>Admin Activity Logs</h3>

<?php
if(!$all_logs)
{
echo 'There is no activity';
return;
}
?>

<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Date</th>
<th>Name</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<?php

foreach($all_logs as $log)
{
echo "<tr>
		<td width=\"5%\" nowrap>{$log->datestamp}</td>
		<td width=\"5%\" nowrap>".PilotData::getPilotCode($log->code, $log->pilotid)." - {$log->firstname} {$log->lastname}</td>
		<td>{$log->message}</td>
	  </tr>";
}
?>
</tbody>
</table>

i'm thinking i need to add something like a getrecentreports, but am lost as to where to start?

Anyone help?

Thanks

  • Administrators
Posted

There is a limit variable built into the function calling the data that is unused in the default install.

On line 26 of Logs.php you will find

$this->set('all_logs', LogData::findLogs($params));

If you look in LogsData.class.php on line 22 you will find

public static function findLogs($params,  $count = '', $start = '')

the $count and $start variables are there to add pagination if you would like or you can use just the $count variable to limit the number of lines returned from the database.

To achieve a limit of data returned you could add the $count variable to your data call in Logs.php line 26 like

$this->set('all_logs', LogData::findLogs($params, '20'));

  • Like 1
  • Administrators
Posted

Cool - Just remember that it will get overwritten in an update. I keep all the core changes I make in a seperate list so I can remember what they were when I update.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...