]> git.andy128k.dev Git - ipf.git/commitdiff
encapsulate admin log query
authorAndrey Kutejko <andy128k@gmail.com>
Mon, 5 Jan 2015 00:47:02 +0000 (02:47 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Mon, 5 Jan 2015 00:47:02 +0000 (02:47 +0200)
ipf/admin/controllers/components.php
ipf/admin/log.php

index 29b55d27e75fa78be55cf511a24bad26fd3c7b16..399b65c422242d405e0a7bf98b0e013ca94bb7a5 100644 (file)
@@ -6,16 +6,9 @@ class IPF_Admin_Controller extends IPF_Admin_Base_Controller
     {
         $this->ensureUserIsStaff();
 
-        $admin_log = \PFF\Container::databaseQuery()
-            ->from('admin_log')
-            ->orderBy('created_at DESC')
-            ->limit(10)
-            ->asObject(true)
-            ->fetchAll();
-
         $context = array(
             'page_title' => __('Site Administration'),
-            'admin_log' => $admin_log,
+            'admin_log' => IPF_Admin_Log::recent(),
         );
         return $this->render('admin/index.html', $context);
     }
index 510d1d2aee8d37adc76435942f3f4150a8065fd6..9425db46889a0460ab4eb3d0fe68d451dc84c8ee 100644 (file)
@@ -2,6 +2,16 @@
 
 class IPF_Admin_Log
 {
+    public static function recent()
+    {
+        return \PFF\Container::databaseQuery()
+            ->from('admin_log')
+            ->orderBy('created_at DESC')
+            ->limit(10)
+            ->asObject(true)
+            ->fetchAll();
+    }
+
     public static function log($who, $action, $repr, $class, $url=null)
     {
         $data = array(