function getModifyitems(Request $request) { $students = StudentManageLog::where('review', 0)->get(); $r_arr = array(); foreach ($students as $item) { $arr = array(); $before = json_decode($item->before_info, true); $after = json_decode($item->after_info, true); $arr['diff'] = array_diff_assoc($before, $after); $arr['id'] = $after['id']; $r_arr[] = $arr; } return json_encode($r_arr); }
public function getStumanagereview(Request $request) { $id = $request->has("id") ? Input::get("id") : null; $operation = $request->has("operation") ? Input::get("operation") : null; $all = $request->has("all") ? Input::get("all") : null; if ($id != null && $operation != null) { if ($operation == "confirm") { $error = StudentManageLog::confirmLog($id, Auth::user(), $request->ip()); return Redirect::back()->withErrors($error); } else { if ($operation == "rollback") { $error = StudentManageLog::rollbackLog($id, Auth::user(), $request->ip()); return Redirect::back()->withErrors($error); } } } if ($all != null && $operation != null) { if ($operation == "confirm") { StudentManageLog::confirmAllLog(Auth::user(), $request->ip()); return Redirect::back(); } } }
Route::get('/home', function () { return view('home'); }); Route::controllers([ 'changepassword' => 'Auth\ChangePasswordController', 'log' => 'LogController', 'studentview' => 'StudentViewController', ]); }); Route::group(['middleware' => 'admin'], function () { Route::controllers([ 'usermanage' => 'UserManageController', 'studentmanage' => 'StudentManageController', ]); }); */ use App\StudentManageLog; use App\File; Route::get('/', function () { $pages = StudentManageLog::where("review", "0")->orderBy('created_at', 'desc')->paginate(15); $files = File::orderBy('updated_at', 'desc')->take(15)->get(); return view('home')->withPages($pages)->withFiles($files); }); Route::get('/home', function () { $pages = StudentManageLog::where("review", "0")->orderBy('created_at', 'desc')->paginate(15); $files = File::orderBy('updated_at', 'desc')->take(15)->get(); return view('home')->withPages($pages)->withFiles($files); }); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController', 'changepassword' => 'Auth\\ChangePasswordController', 'log' => 'LogController', 'studentview' => 'StudentViewController', 'usermanage' => 'UserManageController', 'studentmanage' => 'StudentManageController', 'countrymanage' => 'CountryManageController', 'excel' => 'PHPExcelController', 'tuition' => 'TuitionController', 'file' => 'FileManageController', 'statistic' => 'StatisticController', 'generate' => 'GenerateTableController', 'graduate' => 'GraduateController']);
public function postForceimport(Request $request) { $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM; PHPExcel_Settings::setCacheStorageMethod($cacheMethod); if ($request->hasFile('excel')) { if ($request->file('excel')->isValid()) { $file = $request->file('excel'); $filename = date("YmdHis", time()) . floor((microtime(true) - time()) * 1000) . ".xls"; $operand = 'update/' . $filename; $file->move(storage_path() . "/app/update/", $filename); $filename = storage_path() . "/app/update/" . $filename; $objReader = new PHPExcel_Reader_Excel5(); if (!$objReader->canRead($filename)) { return Redirect::back()->withInput()->withErrors(['无法读取您上传的excel,请重试!']); } $objPHPExcel = $objReader->load($filename); $before_json = self::exportAllToFile(); StudentManageLog::insertLog("批量修改", $operand, $before_json, null, $request->ip()); $arr = array(); $currentSheet = $objPHPExcel->getSheet(0); $arr[] = self::fetchAllStudentInfo($currentSheet, true); $currentSheet = $objPHPExcel->getSheet(1); $arr[] = self::fetchAllFreshInfo($currentSheet, true); $currentSheet = $objPHPExcel->getSheet(2); $arr[] = self::fetchAllSuspendInfo($currentSheet, true); $currentSheet = $objPHPExcel->getSheet(3); self::fetchAllCountryInfo($currentSheet); $currentSheet = $objPHPExcel->getSheet(4); $arr[] = self::fetchAllGraduateInfo($currentSheet, true); $currentSheet = $objPHPExcel->getSheet(5); $arr[] = self::fetchAllLeaveInfo($currentSheet, true); $currentSheet = $objPHPExcel->getSheet(6); $arr[] = self::fetchAllNoregisterInfo($currentSheet, true); return view('excel.forceimport')->withTips($arr); } else { return Redirect::back()->withInput()->withErrors(['上传失败,请重试!']); } } else { return Redirect::back()->withInput()->withErrors(['请选择已经填好的excel文件!']); } }
public function getDeleteinfo(Request $request) { if ($request->has("id")) { $stu = Student::find(Input::get("id")); if ($stu) { $operand = $stu->name . "(" . $stu->id . ")"; $before_json = $stu->toJson(); $stu->delete(); $after_json = ""; StudentManageLog::insertLog("删除信息", $operand, $before_json, $after_json, $request->ip()); $response = array('status' => ['error' => 0, 'note' => '删除成功'], 'influence' => 1); return json_encode($response); } else { //未找到stu_id $response = array('status' => ['error' => 1, 'note' => '未找到id'], 'influence' => 0); return json_encode($response); } } else { //没有stu_id参数 $response = array('status' => ['error' => -1, 'note' => '需要id'], 'influence' => 0); return json_encode($response); } }
/** * Bootstrap any application services. * * @return void */ public function boot() { $count = StudentManageLog::where('review', 0)->count(); view()->share('logs_count', $count); }