function edit($staff_id) { $app = get_app(); $staff = Staff::find_by_id($staff_id); //GET if ($app->request()->isGet()) { render_with_layout('misc.php', 'Staffs/edit.php', compact('staff')); } //POST if ($app->request()->isPost()) { $post = $app->request()->post(); // $staff->identifier = $post['identifier']; $staff->name = $post['name']; $staff->short = $post['short']; $staff->group_id = $post['group_id']; if (!$staff->is_valid()) { $app->flashNow('errors', $staff->errors); render_with_layout('misc.php', 'Staffs/add.php', compact('staff')); } else { $staff->save(); $app->flash('success', '员工信息更新成功!'); redirect('/staffs'); } } }
function stat_staff_unsubmitted_work($staff_id) { $staff = Staff::find_by_id($staff_id); $results = Work::get_staff_unsubmitted_works($staff); $table_title = '操作者未交验工时明细'; render_with_layout('misc.php', 'Statistics/work/stat_staff_unsubmitted_work.php', compact('results', 'table_title')); }