public function actionList() { $where = '1'; //comment here if (isset($_POST['tarikh'])) { $tarikh = $_POST['tarikh']; $module = $_POST['module']; if (!empty($module)) { $where .= " AND module = '{$module}'"; } if (!empty($tarikh)) { $where .= " AND event_dt LIKE '" . MyDate::dateFormat('dmy', 'ymd', $tarikh, '-') . "%'"; } } else { $module = '0'; $event_dt = ''; } $count = Audit::find()->where($where)->count(); $pages = new Pagination(['totalCount' => $count]); $pages->pageSize = 10; $data['pages'] = $pages; $data['module'] = $module; $data['event_dt'] = $event_dt; $audits = Audit::find()->where($where)->offset($pages->offset)->limit($pages->limit)->all(); $data['audits'] = $audits; $data['mod'] = Ref::getList('mod'); return $this->render('list', $data); }
public static function ParseUpdateAuditLog($id) { $permsObj = []; $permsNoFound = []; $rolesObj = []; $rolesNotFound = []; $audit = \App\Models\Audit::find($id); $dataAtt = json_decode($audit->data, true); // Lookup and load the perms that we can still find, otherwise add to an separate array. if ($dataAtt['perms']) { foreach ($dataAtt['perms'] as $id) { $perm = \App\Models\Permission::find($id); if ($perm) { $permsObj[] = $perm; } else { $permsNoFound[] = trans('admin/users/general.error.perm_not_found', ['id' => $id]); } } } $dataAtt['permsObj'] = $permsObj; $dataAtt['permsNotFound'] = $permsNoFound; // Lookup and load the roles that we can still find, otherwise add to an separate array. if ($dataAtt['selected_roles']) { $aRolesIDs = explode(",", $dataAtt['selected_roles']); foreach ($aRolesIDs as $id) { $role = \App\Models\Role::find($id); if ($role) { $rolesObj[] = $role; } else { $rolesNotFound[] = trans('admin/users/general.error.perm_not_found', ['id' => $id]); } } } $dataAtt['rolesObj'] = $rolesObj; $dataAtt['rolesNotFound'] = $rolesNotFound; // Add the file name of the partial (blade) that will render this data. $dataAtt['show_partial'] = 'admin/users/_audit_log_data_viewer_update'; return $dataAtt; }