Example #1
0
 public static function get_actions($limit = '100', $offset = '0', $action_id = FALSE)
 {
     $actions = Mhi_Log_Model::get_log_actions();
     $users = Mhi_User_Model::get_all_users();
     if ($action_id != FALSE and is_numeric($action_id)) {
         $result = ORM::factory('mhi_log')->where('action_id', $action_id)->find_all($limit, $offset);
     } else {
         $result = ORM::factory('mhi_log')->find_all($limit, $offset);
     }
     $array = array();
     foreach ($result as $res) {
         if ($res->user_id != 0 && isset($users[$res->user_id])) {
             $array[$res->id]['email'] = $users[$res->user_id]['email'];
         } else {
             if (isset($users[$res->user_id])) {
                 $array[$res->id]['email'] = 'unknown';
             } else {
                 $array[$res->id]['email'] = 'deleted id ' . $res->user_id;
             }
         }
         $array[$res->id]['action'] = $actions[$res->action_id];
         $array[$res->id]['notes'] = $res->notes;
         $array[$res->id]['ip'] = Mhi_Log_Model::_int_oct($res->ip);
         $array[$res->id]['time'] = $res->time;
     }
     return $array;
 }