Alex Posted October 16, 2010 Report Posted October 16, 2010 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 Quote
Administrators simpilot Posted October 16, 2010 Administrators Report Posted October 16, 2010 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')); 1 Quote
Alex Posted October 16, 2010 Author Report Posted October 16, 2010 Thanks Dave that did the trick. Quote
Administrators simpilot Posted October 16, 2010 Administrators Report Posted October 16, 2010 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.