mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
ActivityLog: add rudimentary table
This commit is contained in:
parent
a2502037fd
commit
01b44eb14c
@ -36,4 +36,11 @@ class Director_ListController extends ActionController
|
||||
$this->view->table = $this->loadTable('icingaZone')->setConnection($this->db());
|
||||
$this->render('table');
|
||||
}
|
||||
|
||||
public function activitylogAction()
|
||||
{
|
||||
$this->view->title = $this->translate('Activity Log');
|
||||
$this->view->table = $this->loadTable('activityLog')->setConnection($this->db());
|
||||
$this->render('table');
|
||||
}
|
||||
}
|
||||
|
45
application/tables/ActivityLogTable.php
Normal file
45
application/tables/ActivityLogTable.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||
|
||||
class ActivityLogTable extends QuickTable
|
||||
{
|
||||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'id' => 'l.id',
|
||||
'change_time' => 'l.change_time',
|
||||
'author' => 'l.author',
|
||||
'action' => "CONCAT(l.action_name || ' ' || REPLACE(l.object_type, 'icinga_', '') || ' \"' || l.object_name || '\"')"
|
||||
);
|
||||
}
|
||||
|
||||
protected function getActionLinks($id)
|
||||
{
|
||||
return $this->view()->qlink('Show', 'director/show/activitylog', array('id' => $id));
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
{
|
||||
$view = $this->view();
|
||||
return array(
|
||||
'change_time' => $view->translate('Timestamp'),
|
||||
'author' => $view->translate('Author'),
|
||||
'action' => $view->translate('Action'),
|
||||
);
|
||||
}
|
||||
|
||||
public function fetchData()
|
||||
{
|
||||
$db = $this->connection()->getConnection();
|
||||
|
||||
$query = $db->select()->from(
|
||||
array('l' => 'director_activity_log'),
|
||||
$this->getColumns()
|
||||
)->order('change_time DESC');
|
||||
|
||||
return $db->fetchAll($query);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user