From dc86674841b62f82ddd76ef4d45bca209c25f4c4 Mon Sep 17 00:00:00 2001 From: rianbtk Date: Sat, 20 Aug 2022 20:29:14 +0700 Subject: [PATCH] python --- app/Http/Controllers/DownloadController.php | 12 +- .../Controllers/ExerciseFilesController.php | 2 +- app/Http/Controllers/FileResultController.php | 7 +- .../FlutterFileResultController.php | 12 +- .../Controllers/LearningFileController.php | 2 +- .../NodejsFileResultController.php | 12 +- .../Controllers/UnityFileResultController.php | 12 +- app/UnityUser.php | 2 +- resources/views/admin/header.blade.php | 2 +- resources/views/admin/sidebar.blade.php | 27 +++- .../python_task/uipengerjaan.blade.php | 4 +- resources/views/teacher/header.blade.php | 2 +- .../python/py_student_result_detail.blade.php | 104 ++++++++++++++++ .../python/py_student_results.blade.php | 116 ++++++++++++++++++ resources/views/teacher/sidebar.blade.php | 49 +++++--- routes/web.php | 4 +- 16 files changed, 303 insertions(+), 66 deletions(-) create mode 100644 resources/views/teacher/python/py_student_result_detail.blade.php create mode 100644 resources/views/teacher/python/py_student_results.blade.php diff --git a/app/Http/Controllers/DownloadController.php b/app/Http/Controllers/DownloadController.php index ab57e57..cda44db 100644 --- a/app/Http/Controllers/DownloadController.php +++ b/app/Http/Controllers/DownloadController.php @@ -21,7 +21,7 @@ class DownloadController extends Controller } public function downFile($file_name, $topic_name, $doctype, $folder) { - $dirname = str_replace('\\',DIRECTORY_SEPARATOR,'app\public\\'.$folder.'\\'); + $dirname = str_replace('\\',DIRECTORY_SEPARATOR,'app\\public\\'.$folder.'\\'); $file_path = storage_path($dirname.$file_name); $ext = pathinfo($file_path, PATHINFO_EXTENSION); $headers = array('Content-Type' => 'application/zip','Content-Type' => 'application/pdf', @@ -34,16 +34,6 @@ class DownloadController extends Controller public function downLearning($file_name, $topic_name, $doctype) { -/* - $dirname = str_replace('\\',DIRECTORY_SEPARATOR,'app\public\learning\\'); - $file_path = storage_path($dirname.$file_name); - $ext = pathinfo($file_path, PATHINFO_EXTENSION); - $headers = array('Content-Type' => 'application/zip','Content-Type' => 'application/pdf','Content-Type' => 'application/rar'); - - $fname=$topic_name.'-'.$doctype.'.'.$ext; - $this->saveHistory($file_path,$topic_name,$doctype,$fname); - return response()->download($file_path, $fname, $headers); -*/ return $this->downFile($file_name, $topic_name, $doctype,'learning'); } diff --git a/app/Http/Controllers/ExerciseFilesController.php b/app/Http/Controllers/ExerciseFilesController.php index d15c975..17a56c0 100644 --- a/app/Http/Controllers/ExerciseFilesController.php +++ b/app/Http/Controllers/ExerciseFilesController.php @@ -179,7 +179,7 @@ class ExerciseFilesController extends Controller // $entity = \App\ExerciseFiles::find($id); /* - $dirpath = storage_path('app\public\\'); + $dirpath = storage_path('app\\public\\\'); File::delete(getPath($dirpath.$entity['guide'])); File::delete(getPath($dirpath.$entity['supplement'])); File::delete(getPath($dirpath.$entity['testfiles'])); diff --git a/app/Http/Controllers/FileResultController.php b/app/Http/Controllers/FileResultController.php index ac3121e..8a211d2 100644 --- a/app/Http/Controllers/FileResultController.php +++ b/app/Http/Controllers/FileResultController.php @@ -78,10 +78,7 @@ class FileResultController extends Controller // $entity = \App\FileResult::find($id); - $path = storage_path('app\\public\\').$entity['rscfile']; - //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - - //$dirpath = storage_path('app\public\\'); + $path = storage_path('app/public/').$entity['rscfile']; File::delete(getPath($path)); $entity->delete(); @@ -98,7 +95,7 @@ class FileResultController extends Controller $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete($path); $entity->delete(); diff --git a/app/Http/Controllers/FlutterFileResultController.php b/app/Http/Controllers/FlutterFileResultController.php index 88ad43f..06aada5 100644 --- a/app/Http/Controllers/FlutterFileResultController.php +++ b/app/Http/Controllers/FlutterFileResultController.php @@ -49,7 +49,7 @@ class FlutterFileResultController extends Controller return Redirect::to('student/fluttercourse/lfiles/create/'.$request->get('topic')) ->withErrors("File name should be ".$fileinfo['fileName']); } else { - $result = \App\FileResult::where('userid','=',Auth::user()->id) + $result = \App\FlutterFileResult::where('userid','=',Auth::user()->id) ->where('fileid','=',$request->get('fileid')) ->get(); if (count($result)>0) { @@ -57,7 +57,7 @@ class FlutterFileResultController extends Controller ->withErrors('File '.$fileinfo['fileName'].' was already submitted'); } else { $rsc=$file->store('resource','public'); - $entity=new \App\FileResult; + $entity=new \App\FlutterFileResult; $entity->userid=Auth::user()->id; $entity->fileid=$request->get('fileid'); @@ -76,12 +76,12 @@ class FlutterFileResultController extends Controller public function destroy(Request $request,$id) { // - $entity = \App\FileResult::find($id); + $entity = \App\FlutterFileResult::find($id); $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete(getPath($path)); $entity->delete(); @@ -93,12 +93,12 @@ class FlutterFileResultController extends Controller public function delete($id,$topic) { // - $entity = \App\FileResult::find($id); + $entity = \App\FlutterFileResult::find($id); $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete($path); $entity->delete(); diff --git a/app/Http/Controllers/LearningFileController.php b/app/Http/Controllers/LearningFileController.php index 8f50e19..9b6b3c1 100644 --- a/app/Http/Controllers/LearningFileController.php +++ b/app/Http/Controllers/LearningFileController.php @@ -177,7 +177,7 @@ class LearningFileController extends Controller { // $entity = \App\LearningFile::find($id); /* - $dirpath = storage_path('app\public\\'); + $dirpath = storage_path('app\\public\\\'); File::delete(getPath($dirpath.$entity['guide'])); File::delete(getPath($dirpath.$entity['supplement'])); File::delete(getPath($dirpath.$entity['testfiles'])); diff --git a/app/Http/Controllers/NodejsFileResultController.php b/app/Http/Controllers/NodejsFileResultController.php index 3a630b8..6e7aabc 100644 --- a/app/Http/Controllers/NodejsFileResultController.php +++ b/app/Http/Controllers/NodejsFileResultController.php @@ -49,7 +49,7 @@ class NodejsFileResultController extends Controller return Redirect::to('student/nodejscourse/lfiles/create/'.$request->get('topic')) ->withErrors("File name should be ".$fileinfo['fileName']); } else { - $result = \App\FileResult::where('userid','=',Auth::user()->id) + $result = \App\NodejsFileResult::where('userid','=',Auth::user()->id) ->where('fileid','=',$request->get('fileid')) ->get(); if (count($result)>0) { @@ -57,7 +57,7 @@ class NodejsFileResultController extends Controller ->withErrors('File '.$fileinfo['fileName'].' was already submitted'); } else { $rsc=$file->store('resource','public'); - $entity=new \App\FileResult; + $entity=new \App\NodejsFileResult; $entity->userid=Auth::user()->id; $entity->fileid=$request->get('fileid'); @@ -76,12 +76,12 @@ class NodejsFileResultController extends Controller public function destroy(Request $request,$id) { // - $entity = \App\FileResult::find($id); + $entity = \App\NodejsFileResult::find($id); $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete(getPath($path)); $entity->delete(); @@ -93,12 +93,12 @@ class NodejsFileResultController extends Controller public function delete($id,$topic) { // - $entity = \App\FileResult::find($id); + $entity = \App\NodejsFileResult::find($id); $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete($path); $entity->delete(); diff --git a/app/Http/Controllers/UnityFileResultController.php b/app/Http/Controllers/UnityFileResultController.php index 384f25a..7c7700f 100644 --- a/app/Http/Controllers/UnityFileResultController.php +++ b/app/Http/Controllers/UnityFileResultController.php @@ -49,7 +49,7 @@ class UnityFileResultController extends Controller return Redirect::to('student/unitycourse/lfiles/create/'.$request->get('topic')) ->withErrors("File name should be ".$fileinfo['fileName']); } else { - $result = \App\FileResult::where('userid','=',Auth::user()->id) + $result = \App\UnityFileResult::where('userid','=',Auth::user()->id) ->where('fileid','=',$request->get('fileid')) ->get(); if (count($result)>0) { @@ -57,7 +57,7 @@ class UnityFileResultController extends Controller ->withErrors('File '.$fileinfo['fileName'].' was already submitted'); } else { $rsc=$file->store('resource','public'); - $entity=new \App\FileResult; + $entity=new \App\UnityFileResult; $entity->userid=Auth::user()->id; $entity->fileid=$request->get('fileid'); @@ -76,12 +76,12 @@ class UnityFileResultController extends Controller public function destroy(Request $request,$id) { // - $entity = \App\FileResult::find($id); + $entity = \App\UnityFileResult::find($id); $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete(getPath($path)); $entity->delete(); @@ -93,12 +93,12 @@ class UnityFileResultController extends Controller public function delete($id,$topic) { // - $entity = \App\FileResult::find($id); + $entity = \App\UnityFileResult::find($id); $path = storage_path('app\\public\\').$entity['rscfile']; //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - //$dirpath = storage_path('app\public\\'); + //$dirpath = storage_path('app\\public\\\'); File::delete($path); $entity->delete(); diff --git a/app/UnityUser.php b/app/UnityUser.php index 4c355c1..b6e56a1 100644 --- a/app/UnityUser.php +++ b/app/UnityUser.php @@ -40,7 +40,7 @@ class UnityUser extends Authenticatable public function checkRoleId($roleid) { if ($roleid=='student') { - return Redirect::to('student/Unitycourse/home'); + return Redirect::to('student/unitycourse/home'); } elseif ($roleid=='teacher') { return Redirect::to('teacher/home'); } elseif ($roleid=='admin') { diff --git a/resources/views/admin/header.blade.php b/resources/views/admin/header.blade.php index 36abfb4..7aec2c4 100644 --- a/resources/views/admin/header.blade.php +++ b/resources/views/admin/header.blade.php @@ -1,4 +1,4 @@ -