diff --git a/app/Http/Controllers/NodejsController.php b/app/Http/Controllers/NodejsController.php deleted file mode 100644 index 0195d3c..0000000 --- a/app/Http/Controllers/NodejsController.php +++ /dev/null @@ -1,249 +0,0 @@ -roleid=='student/nodejscourse') { - $check=\App\User::find(Auth::user()->id); - if ($check->status!='active') return view('student/nodejscourse/home')->with(['status'=>$check->status]); - } - $topiclist=\App\NodejsTopic::where('status','=','1') - ->orderBy('name','asc')->get(); - - $items = \App\NodejsTopic::where('status','=','1') - ->orderBy('status','desc') - ->orderBy('name','asc') - ->pluck('name', 'id'); - - $itemslearning = \App\NodejsTopic::where('status','=','1') - ->orderBy('status','desc') - ->orderBy('name','asc') - ->where('level','=','1') - ->pluck('name', 'id'); - - $filter = $request->input('topicList',$topiclist[0]['id']); - - if ($filter=='0') { - $entities=\App\NodejsTask::all(); - } else { - - $entities = \App\NodejsTask::where('topic','=',$filter) - ->select( - 'tasks.id', - 'tasks.taskno', - 'tasks.desc', - 'tasks.topic', - 'topics.name' - ) - ->join( - 'topics', - 'topics.id','=','tasks.topic' - ) - ->orderBy('tasks.taskno','asc') - ->get(); - } - - if (Auth::user()->roleid=='admin') { - return view('admin/tasks/index') - ->with(compact('entities')) - ->with(compact('items')) - ->with(compact('filter')); - } else { - $topic = \App\NodejsTopic::where('topics.id','=',$filter) - ->select( - 'topics.id', - 'topics.name', - 'topics.desc', - 'learning_files.guide', - 'learning_files.testfile', - 'learning_files.supplement', - 'learning_files.other' - ) - ->leftJoin('learning_files', 'learning_files.topic', '=', 'topics.id') - ->first(); - return view('student/nodejscourse/tasks/index') - ->with(compact('entities')) - ->with(compact('items')) - ->with(compact('itemslearning')) - ->with(compact('filter')) - ->with(compact('topic')); - } -} - - -public function getTopic($id){ - $items = \App\NodejsTopic::find($id); - - return $items['name']; -} - - -public function filterTask() { - $filters = \App\NodejsTopic::get(); - $filter = \App\NodejsTopic::findOrFail(Input::get('filter_id')); - - $data= \App\NodejsTask::with('topic')->where('topic', '=' , $filter->id )->latest()->get(); - - return View::make('admin.tasks.index',compact('filters'))->withProfiles($data)->with('title', 'filter'); -} - -/** - * Show the form for creating a new resource. - * - * @return Response - */ -public function create() -{ - // - $items = \App\NodejsTopic::pluck('name', 'id'); -//echo "kljasd;lkasdl"; - return view('admin/tasks/create')->with(compact('items')); -} -/** - * Store a newly created resource in storage. - * - * @return Response - */ -public function store(Request $request) -{ -//echo "YAAANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"; - // - $rules =[ - 'taskno'=>'required', - 'desc'=>'required' - ]; - - $msg=[ - 'taskno.required'=>'Task number must not empty', - 'desc.required'=>'Description must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - - //refresh halaman - return Redirect::to('admin/tasks/create') - ->withErrors($validator); - - }else{ - - $entity=new \App\NodejsTask; - - $entity->desc=$request->get('desc'); - $entity->taskno=$request->get('taskno'); - $entity->topic=$request->get('topic'); - $entity->save(); - - Session::flash('message','A New Task Stored'); - - //return "Add new topic is success"; - return Redirect::to('admin/tasks'); - } -} - -/** - * Display the specified resource. - * - * @param int $id - * @return Response - */ -public function show(Request $request, $id) -{ - $entity = \App\NodejsTask::find($id); - $topic = \App\NodejsTopic::find($entity->topic); - $x=['data'=>$entity, 'topic'=>$topic]; - - if ($request->is('admin/*')) { - return view('admin/tasks/show')->with($x); - } else { - return view('student/nodejscourse/tasks/show')->with($x); - } -} - -/** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Response - */ -public function edit($id) -{ - // - $entity = \App\NodejsTask::find($id); - $x=['data'=>$entity]; - $items = \App\NodejsTopic::pluck('name', 'id'); - return view('admin/tasks/edit')->with($x)->with(compact('items')); -} - -/** - * Update the specified resource in storage. - * - * @param int $id - * @return Response - */ -public function update(Request $request, $id) -{ - // - $rules =[ - 'taskno'=>'required', - 'desc'=>'required' - ]; - - $msg=[ - 'taskno.required'=>'Task number must not empty', - 'desc.required'=>'Description must not empty' - ]; - - - $validator=Validator::make($request->all(),$rules,$msg); - - if ($validator->fails()) { - return Redirect::to('admin/topics/'.$id.'/edit') - ->withErrors($validator); - - }else{ - $entity=\App\NodejsTask::find($id); - - $entity->desc=$request->get('desc'); - $entity->taskno=$request->get('taskno'); - $entity->topic=$request->get('topic'); - $entity->save(); - - Session::flash('message','Task with Id='.$id.' is changed'); - - return Redirect::to('admin/tasks'); - } -} - -/** - * Remove the specified resource from storage. - * - * @param int $id - * @return Response - */ -public function destroy($id) -{ - // - $entity = \App\NodejsTask::find($id); - $entity->delete(); - Session::flash('message','Task with Id='.$id.' is deleted'); - return Redirect::to('admin/tasks'); -} -} diff --git a/app/Http/Controllers/NodejsFileResultController.php b/app/Http/Controllers/NodejsFileResultController.php deleted file mode 100644 index 6e7aabc..0000000 --- a/app/Http/Controllers/NodejsFileResultController.php +++ /dev/null @@ -1,131 +0,0 @@ -get(); - - return view('student/nodejscourse/lfiles/create') - ->with(compact('files')) - ->with(compact('topic')); - } - - public function store(Request $request) - { - // - $rules =[ - 'rscfile'=>'required' - ]; - - $msg=[ - 'rscfile.required'=>'Resource File must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - return Redirect::to('student/nodejscourse/lfiles/create/'.$request->get('topic')) - ->withErrors($validator); - } else { - $file = $request->file('rscfile'); - $filename = $file->getClientOriginalName(); - - $fileinfo = \App\NodejsTopicFiles::find($request->get('fileid')); - if ($fileinfo['fileName']!=$filename) { - return Redirect::to('student/nodejscourse/lfiles/create/'.$request->get('topic')) - ->withErrors("File name should be ".$fileinfo['fileName']); - } else { - $result = \App\NodejsFileResult::where('userid','=',Auth::user()->id) - ->where('fileid','=',$request->get('fileid')) - ->get(); - if (count($result)>0) { - return Redirect::to('student/nodejscourse/lfiles/create/'.$request->get('topic')) - ->withErrors('File '.$fileinfo['fileName'].' was already submitted'); - } else { - $rsc=$file->store('resource','public'); - $entity=new \App\NodejsFileResult; - - $entity->userid=Auth::user()->id; - $entity->fileid=$request->get('fileid'); - $entity->rscfile=$rsc; - $entity->save(); - - Session::flash('message','A New File Result Stored'); - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$fileinfo['topic'])->with( [ 'topic' => $request->get('topic') ] ); - } - } - } - } - - public function destroy(Request $request,$id) - { - // - $entity = \App\NodejsFileResult::find($id); - - $path = storage_path('app\\public\\').$entity['rscfile']; - //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - - //$dirpath = storage_path('app\\public\\\'); - File::delete(getPath($path)); - - $entity->delete(); - Session::flash('File Result with Id='.$id.' is deleted'); - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic')); - } - - - public function delete($id,$topic) - { - // - $entity = \App\NodejsFileResult::find($id); - - $path = storage_path('app\\public\\').$entity['rscfile']; - //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - - //$dirpath = storage_path('app\\public\\\'); - File::delete($path); - - $entity->delete(); - Session::flash('File Result with Id='.$id.' is deleted'); - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=files'); - } - - - public function submit($id) { - // - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=Auth::user()->id; - $entity->topic=$id; - $entity->validstat="valid"; - $entity->save(); - - $topic = \App\NodejsTopic::find($id); - Session::flash('message','Topic '.$topic['name'].' Validation is Success'); - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$id); - - } - - public function getPath($path) { - $res = str_replace('\\',DIRECTORY_SEPARATOR,$path); - return str_replace('/',DIRECTORY_SEPARATOR,$res); - } -} diff --git a/app/Http/Controllers/NodejsResultController.php b/app/Http/Controllers/NodejsResultController.php deleted file mode 100644 index 0002cbf..0000000 --- a/app/Http/Controllers/NodejsResultController.php +++ /dev/null @@ -1,404 +0,0 @@ -id); - //if ($check->count()==0) return view('student/home')->with(['count'=>$check->count()]); -$check=\App\User::find(Auth::user()->id); -if ($check->status!='active') return view('student/nodejscourse/home')->with(['status'=>$check->status]); - - $filter = $request->input('topicList','6'); - if ($filter=='0') { - $entities=\App\NodejsTaskResult::where('userid','=',Auth::user()->id); - } else { - $entities = \App\NodejsTask::where('tasks.topic','=',$filter) - ->select( - 'task_results.id', - 'task_results.taskid', - 'task_results.userid', - 'task_results.status', - 'task_results.duration', - 'task_results.comment', - 'task_results.imgFile', - 'tasks.taskno', - 'tasks.desc', - 'tasks.topic' - ) - ->leftJoin('task_results', function($join) - { - $join->on('tasks.id','=','task_results.taskid') - ->where('task_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('tasks.taskno', 'asc') - ->get(); - } - - $lfiles = \App\NodejsTopicFiles::where('topic_files.topic','=',$filter) - ->select( - 'file_results.id', - 'file_results.userid', - 'file_results.rscfile', - 'file_results.fileid', - 'topic_files.fileName', - 'topic_files.path', - 'topic_files.desc' - ) - ->leftJoin('file_results', function($join) - { - $join->on('topic_files.id','=','file_results.fileid') - ->where('file_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('topic_files.fileName', 'asc') - ->get(); - - $items = \App\NodejsTopic:: - where('status','>=','0') - ->where('androidclass','=','AndroidX') - ->orderBy('name','asc') - ->orderBy('level','asc') - ->pluck('name', 'id'); - - $valid = \App\NodejsStudentSubmit::where('userid','=',Auth::user()->id) - ->where('topic','=',$filter) - ->get()->count(); - - $option = $request->input('option','github'); - - $currtopic = \App\NodejsTopic::find($filter); - - return view('student/nodejscourse/results/index') - ->with(compact('entities')) - ->with(compact('lfiles')) - ->with(compact('items')) - ->with(compact('filter')) - ->with(compact('option')) - ->with(compact('currtopic')) - ->with(compact('valid')); - - } - - - - public function getTaskData($topic) { - $items = \App\NodejsTask::where('tasks.topic','=',$topic) - ->select( - 'tasks.id', - 'tasks.taskno', - 'tasks.desc', - 'topics.name' - ) - ->join( - 'topics', - 'topics.id','=','tasks.topic' - ) - ->orderBy('topics.name', 'asc') - ->orderBy('tasks.taskno', 'asc') - ->get(); - - return $items; - } - public function create($id) - { - $items = \App\NodejsTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\NodejsTopic::find($id); - return view('student/nodejscourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - -private function validateByFiles($userid, $topic) { - // - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation is Success'); - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=files'); -} - -private function validateZipFile($userid, $topic, $file, $path) { - // - //$file = $request->file('zipfile'); - if ($path!='' ) { - //$array = explode('.', $path); - //$ext = strtolower(end($array)); - $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); - if ($ext=="zip") { - $zipFile=$file->store('results','public'); - - if ($zipFile!='') { - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->projectfile=$zipFile; - - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by Uploading Zip Project is Success'); - } else { - Session::flash('message','Storing file '.$request->file('zipfile').' was FAILED'); - } - } else { - Session::flash('message','File extension is not zip -> '.$path.' is wrong .'.$ext); - } - } else { - Session::flash('message','Zip File is empty'); - } - - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=zipfile'); -} - - -private function validateGithubLink($userid, $topic, $link, $projname) { - // - $trimmedlink = trim($link); - if ($this->validateUrl($trimmedlink,$projname)) { - /* - $zipFile=$file->store('results','public'); - - if ($zipFile!='') { - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->projectfile=$zipFile; - - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation is Success'); - } else { - Session::flash('message','Storing file '.$request->file('zipfile').' was FAILED'); - } - */ - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->githublink=$trimmedlink; - - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by submitting GitHub link is Success'); - - //Session::flash('message','URL valid '.$link); - - } else { - Session::flash('message','URL is not VALID '.$link); - } - - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=github'); -} - -private function validateUrl($url,$projname) { - $path = parse_url($url, PHP_URL_PATH); - $encoded_path = array_map('urlencode', explode('/', $path)); - $url = str_replace($path, implode('/', $encoded_path), $url); - - if (filter_var($url, FILTER_VALIDATE_URL)) { - $result = parse_url($url); - if ( ($result['scheme']=='https') && ($this->endsWith($result['host'],'github.com')) - && (strpos($result['path'],$projname)) ) { - return true; - } else { - return false; - } - } else { - return false; - } -} - -private function endsWith($haystack, $needle) { - return substr_compare($haystack, $needle, -strlen($needle)) === 0; -} - - - private function saveTaskResult(Request $request) - { - // - $rules =[ - 'duration'=>'required', - 'image'=>'required', - 'comment'=>'required' - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - 'image.required'=>'Evidence image file must not empty', - 'comment.required'=>'Comment must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - - //refresh halaman - return Redirect::to('student/nodejscourse/results/create/'.$request->get('topic')) - ->withErrors($validator); - - } else { - $check = \App\NodejsTaskResult::where('userid','=',Auth::user()->id) - ->where('taskid','=',$request->get('taskid')) - ->get(); - - if (sizeof($check)>0) { - $task = \App\NodejsTask::find($request->get('taskid')); - $message = 'Result of Task '.$task['desc'].' is already submitted!!'; - //Session::flash('message',); - return Redirect::to('student/nodejscourse/results/create'.$request->get('topic'))->withErrors($message); - - } else { - $file = $request->file('image'); - $imgFile=$file->store('results','public'); - - $entity=new \App\NodejsTaskResult; - - $comment = ($request->get('comment')==null)?'-':$request->get('comment'); - - $entity->userid=Auth::user()->id; - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$comment; - $entity->imgFile=$imgFile; - $entity->save(); - - Session::flash('message','A New Task Result Stored'); - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic'))->with( [ 'topic' => $request->get('topic') ] ); - } - } - } - - - public function store(Request $request) - { - if (strlen($request->get('option'))>3) { - if (($request->get('action')=='validate') && (strlen($request->submitbutton)>5)) { - if ($request->get('option')=='files') { - return $this->validateByFiles(Auth::user()->id, $request->get('topic')); - } else if ($request->get('option')=='zipfile') { - $file = $request->file('zipfile'); - $filename = $file->getClientOriginalName(); - return $this->validateZipFile(Auth::user()->id, $request->get('topic'), $file, $filename); - } else if ($request->get('option')=='github') { - return $this->validateGithubLink(Auth::user()->id, $request->get('topic'), $request->get('githublink'), - $request->get('projname')); - } else { - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic').'&option='.$request->get('option'). - '&submit='.$request->submitbutton); - } - } else { //clicking radio button - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic').'&option='.$request->get('option')); - //'&submit='.$request->submitbutton); - } - - } else { //echo $request; - return $this->saveTaskResult($request); - } - } - - - public function destroy(Request $request, $id) - { - // - $entity = \App\NodejsTaskResult::find($id); - $entity->delete(); - Session::flash('message','Task Result with Id='.$id.' is deleted'); - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic')); - } - - public function edit($id) - { - // - $entity = \App\NodejsTaskResult::where('id','=',$id)->first(); - $task = \App\NodejsTask::where('id','=',$entity['taskid'])->first(); - return view('student/nodejscourse/results/edit')->with(compact('entity')) - ->with(compact('task')); - } - - public function valsub(Request $request) - { - $items = \App\NodejsTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\NodejsTopic::find($id); - return view('student/nodejscourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - - - public function update(Request $request, $id) { - // - $rules =[ - 'duration'=>'required', - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - ]; - - - $validator=Validator::make($request->all(),$rules,$msg); - - if ($validator->fails()) { - return Redirect::to('student/nodejscourse/results/'.$id.'/edit') - ->withErrors($validator); - - }else{ - $file = $request->file('image'); - - $entity=\App\NodejsTaskResult::find($id); - - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$request->get('comment'); - - if ($file!='') { - $imgFile=$file->store('results','public'); - $entity->imgFile=$imgFile; - } - $entity->save(); - - Session::flash('message','Task Result with Id='.$id.' is changed'); - - $task = \App\NodejsTask::find($request->get('taskid')); - return Redirect::to('student/nodejscourse/results?topicList='.$task['topic']); - } - } -} - diff --git a/app/Http/Controllers/NodejsTaskResultController.php b/app/Http/Controllers/NodejsTaskResultController.php deleted file mode 100644 index 7d6392b..0000000 --- a/app/Http/Controllers/NodejsTaskResultController.php +++ /dev/null @@ -1,379 +0,0 @@ -id); -if ($check->status!='active') return view('student/nodejscourse/home')->with(['status'=>$check->status]); - - $filter = $request->input('topicList','6'); - if ($filter=='0') { - $entities=\App\NodejsTaskResult::where('userid','=',Auth::user()->id); - } else { - $entities = \App\NodejsTask::where('tasks.topic','=',$filter) - ->select( - 'task_results.id', - 'task_results.taskid', - 'task_results.userid', - 'task_results.status', - 'task_results.duration', - 'task_results.comment', - 'task_results.imgFile', - 'tasks.taskno', - 'tasks.desc', - 'tasks.topic' - ) - ->leftJoin('task_results', function($join) - { - $join->on('tasks.id','=','task_results.taskid') - ->where('task_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('tasks.taskno', 'asc') - ->get(); - } - - $lfiles = \App\NodejsTopicFiles::where('topic_files.topic','=',$filter) - ->select( - 'file_results.id', - 'file_results.userid', - 'file_results.rscfile', - 'file_results.fileid', - 'topic_files.fileName', - 'topic_files.path', - 'topic_files.desc' - ) - ->leftJoin('file_results', function($join) - { - $join->on('topic_files.id','=','file_results.fileid') - ->where('file_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('topic_files.fileName', 'asc') - ->get(); - - $items = \App\NodejsTopic:: - where('status','>=','0') - ->where('androidclass','=','AndroidX') - ->orderBy('name','asc') - ->orderBy('level','asc') - ->pluck('name', 'id'); - - $valid = \App\NodejsStudentSubmit::where('userid','=',Auth::user()->id) - ->where('topic','=',$filter) - ->get()->count(); - - $option = $request->input('option','github'); - - $currtopic = \App\NodejsTopic::find($filter); - - return view('student/nodejscourse/results/index') - ->with(compact('entities')) - ->with(compact('lfiles')) - ->with(compact('items')) - ->with(compact('filter')) - ->with(compact('option')) - ->with(compact('currtopic')) - ->with(compact('valid')); - - } - - - - public function getTaskData($topic) { - $items = \App\NodejsTask::where('tasks.topic','=',$topic) - ->select( - 'tasks.id', - 'tasks.taskno', - 'tasks.desc', - 'topics.name' - ) - ->join( - 'topics', - 'topics.id','=','tasks.topic' - ) - ->orderBy('topics.name', 'asc') - ->orderBy('tasks.taskno', 'asc') - ->get(); - - return $items; - } - public function create($id) - { - $items = \App\NodejsTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\NodejsTopic::find($id); - return view('student/nodejscourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - -private function validateByFiles($userid, $topic) { - // - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation is Success'); - - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=files'); -} - -private function validateZipFile($userid, $topic, $file, $path) { - - if ($path!='' ) { - $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); - if ($ext=="zip") { - $zipFile=$file->store('results','public'); - - if ($zipFile!='') { - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->projectfile=$zipFile; - - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by Uploading Zip Project is Success'); - } else { - Session::flash('message','Storing file '.$request->file('zipfile').' was FAILED'); - } - } else { - Session::flash('message','File extension is not zip -> '.$path.' is wrong .'.$ext); - } - } else { - Session::flash('message','Zip File is empty'); - } - - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=zipfile'); -} - -private function validateGithubLink($userid, $topic, $link, $projname) { - // - $trimmedlink = trim($link); - if ($this->validateUrl($trimmedlink,$projname)) { - - $entity=new \App\NodejsStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->githublink=$trimmedlink; - - $entity->save(); - - $data = \App\NodejsTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by submitting GitHub link is Success'); - - //Session::flash('message','URL valid '.$link); - - } else { - Session::flash('message','URL is not VALID '.$link); - } - - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$topic.'&option=github'); -} - -private function validateUrl($url,$projname) { - $path = parse_url($url, PHP_URL_PATH); - $encoded_path = array_map('urlencode', explode('/', $path)); - $url = str_replace($path, implode('/', $encoded_path), $url); - - if (filter_var($url, FILTER_VALIDATE_URL)) { - $result = parse_url($url); - if ( ($result['scheme']=='https') && ($this->endsWith($result['host'],'github.com')) - && (strpos($result['path'],$projname)) ) { - return true; - } else { - return false; - } - } else { - return false; - } -} - -private function endsWith($haystack, $needle) { - return substr_compare($haystack, $needle, -strlen($needle)) === 0; -} - - - private function saveTaskResult(Request $request) - { - // - $rules =[ - 'duration'=>'required', - 'image'=>'required', - 'comment'=>'required' - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - 'image.required'=>'Evidence image file must not empty', - 'comment.required'=>'Comment must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - - //refresh halaman - return Redirect::to('student/nodejscourse/results/create/'.$request->get('topic')) - ->withErrors($validator); - - } else { - $check = \App\NodejsTaskResult::where('userid','=',Auth::user()->id) - ->where('taskid','=',$request->get('taskid')) - ->get(); - - if (sizeof($check)>0) { - $task = \App\NodejsTask::find($request->get('taskid')); - $message = 'Result of Task '.$task['desc'].' is already submitted!!'; - //Session::flash('message',); - return Redirect::to('student/nodejscourse/results/create'.$request->get('topic'))->withErrors($message); - - } else { - $file = $request->file('image'); - $imgFile=$file->store('result','public'); - - $entity=new \App\NodejsTaskResult; - - $comment = ($request->get('comment')==null)?'-':$request->get('comment'); - - $entity->userid=Auth::user()->id; - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$comment; - $entity->imgFile=$imgFile; - $entity->save(); - - Session::flash('message','A New Task Result Stored'); - - //return "Add new topic is success"; - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic'))->with( [ 'topic' => $request->get('topic') ] ); - } - } - } - - - public function store(Request $request) - { - if (strlen($request->get('option'))>3) { - if (($request->get('action')=='validate') && (strlen($request->submitbutton)>5)) { - if ($request->get('option')=='files') { - return $this->validateByFiles(Auth::user()->id, $request->get('topic')); - } else if ($request->get('option')=='zipfile') { - $file = $request->file('zipfile'); - $filename = $file->getClientOriginalName(); - return $this->validateZipFile(Auth::user()->id, $request->get('topic'), $file, $filename); - } else if ($request->get('option')=='github') { - return $this->validateGithubLink(Auth::user()->id, $request->get('topic'), $request->get('githublink'), - $request->get('projname')); - } else { - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic').'&option='.$request->get('option'). - '&submit='.$request->submitbutton); - } - } else { //clicking radio button - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic').'&option='.$request->get('option')); - //'&submit='.$request->submitbutton); - } - - } else { //echo $request; - return $this->saveTaskResult($request); - } - } - - - public function destroy(Request $request, $id) - { - // - $entity = \App\NodejsTaskResult::find($id); - $entity->delete(); - Session::flash('message','Task Result with Id='.$id.' is deleted'); - return Redirect::to('student/nodejscourse/results?topicList='.$request->get('topic')); - } - - public function edit($id) - { - // - $entity = \App\NodejsTaskResult::where('id','=',$id)->first(); - $task = \App\NodejsTask::where('id','=',$entity['taskid'])->first(); - return view('student/nodejscourse/results/edit')->with(compact('entity')) - ->with(compact('task')); - } - - public function valsub(Request $request) - { - $items = \App\NodejsTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\NodejsTopic::find($id); - return view('student/nodejscourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - - - public function update(Request $request, $id) { - // - $rules =[ - 'duration'=>'required', - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - ]; - - - $validator=Validator::make($request->all(),$rules,$msg); - - if ($validator->fails()) { - return Redirect::to('student/nodejscourse/results/'.$id.'/edit') - ->withErrors($validator); - - }else{ - $file = $request->file('image'); - - $entity=\App\NodejsTaskResult::find($id); - - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$request->get('comment'); - - if ($file!='') { - $imgFile=$file->store('results','public'); - $entity->imgFile=$imgFile; - } - $entity->save(); - - Session::flash('message','Task Result with Id='.$id.' is changed'); - - $task = \App\NodejsTask::find($request->get('taskid')); - return Redirect::to('student/nodejscourse/results?topicList='.$task['topic']); - } - } -} - diff --git a/app/Http/Controllers/SQLController.php b/app/Http/Controllers/SQLController.php index 2811029..d89163c 100644 --- a/app/Http/Controllers/SQLController.php +++ b/app/Http/Controllers/SQLController.php @@ -26,7 +26,7 @@ class SQLController extends Controller { public function learning() { - return view(Auth::user()->roleid . '.sql.learning'); + return view(Auth::user()->roleid . '.sqlcourse.learning'); } public function learningRead($id = null) { @@ -138,7 +138,7 @@ class SQLController extends Controller $data['next'] = SqlLearning::where('id', '>', $id)->min('id'); // return $data; - return view('student.sql.learning_do', ['data' => $data]); + return view('student.sqlcourse.learning_do', ['data' => $data]); } public function learningDoReset() { @@ -258,7 +258,7 @@ class SQLController extends Controller public function practice() { - return view(Auth::user()->roleid . '.sql.practice'); + return view(Auth::user()->roleid . '.sqlcourse.practice'); } public function practiceRead($id = null) { @@ -397,7 +397,7 @@ class SQLController extends Controller $data['next'] = SqlPracticeQuestion::where('sql_practice_id', $id)->where('id', '>', $question)->min('id'); // return $data; - return view('student.sql.practice_do', ['data' => $data]); + return view('student.sqlcourse.practice_do', ['data' => $data]); } else { throw new Exception("Error Processing Request", 1); } @@ -504,7 +504,7 @@ class SQLController extends Controller public function exercise() { - return view(Auth::user()->roleid . '.sql.exercise'); + return view(Auth::user()->roleid . '.sqlcourse.exercise'); } public function exerciseRead($id = null) { @@ -606,7 +606,7 @@ class SQLController extends Controller $data['jawaban'] = $jawaban; - return view('student.sql.exercise_do', ['data' => $data]); + return view('student.sqlcourse.exercise_do', ['data' => $data]); } return redirect()->route('student sql exercise'); @@ -776,7 +776,7 @@ class SQLController extends Controller public function exam() { - return view(Auth::user()->roleid . '.sql.exam'); + return view(Auth::user()->roleid . '.sqlcourse.exam'); } public function examRead($id = null) { @@ -878,7 +878,7 @@ class SQLController extends Controller $data['jawaban'] = $jawaban; - return view('student.sql.exam_do', ['data' => $data]); + return view('student.sqlcourse.exam_do', ['data' => $data]); } return redirect()->route('student sql exam'); diff --git a/app/Http/Controllers/StudentController.php b/app/Http/Controllers/StudentController.php index 8394be6..2f188a8 100644 --- a/app/Http/Controllers/StudentController.php +++ b/app/Http/Controllers/StudentController.php @@ -36,8 +36,8 @@ class StudentController extends Controller public function pythoncourse() { return view('student/pythoncourse/main'); } - public function sql() { - return view('student/sql/main'); + public function sqlcourse() { + return view('student/sqlcourse/main'); } // public function asynctask() { diff --git a/app/Http/Controllers/UnityController.php b/app/Http/Controllers/UnityController.php deleted file mode 100644 index 945e386..0000000 --- a/app/Http/Controllers/UnityController.php +++ /dev/null @@ -1,249 +0,0 @@ -roleid=='student/unitycourse') { - $check=\App\User::find(Auth::user()->id); - if ($check->status!='active') return view('student/unitycourse/home')->with(['status'=>$check->status]); - } - $topiclist=\App\UnityTopic::where('status','=','1') - ->orderBy('name','asc')->get(); - - $items = \App\UnityTopic::where('status','=','1') - ->orderBy('status','desc') - ->orderBy('name','asc') - ->pluck('name', 'id'); - - $itemslearning = \App\UnityTopic::where('status','=','1') - ->orderBy('status','desc') - ->orderBy('name','asc') - ->where('level','=','1') - ->pluck('name', 'id'); - - $filter = $request->input('topicList',$topiclist[0]['id']); - - if ($filter=='0') { - $entities=\App\UnityTask::all(); - } else { - - $entities = \App\UnityTask::where('topic','=',$filter) - ->select( - 'tasks.id', - 'tasks.taskno', - 'tasks.desc', - 'tasks.topic', - 'topics.name' - ) - ->join( - 'topics', - 'topics.id','=','tasks.topic' - ) - ->orderBy('tasks.taskno','asc') - ->get(); - } - - if (Auth::user()->roleid=='admin') { - return view('admin/tasks/index') - ->with(compact('entities')) - ->with(compact('items')) - ->with(compact('filter')); - } else { - $topic = \App\UnityTopic::where('topics.id','=',$filter) - ->select( - 'topics.id', - 'topics.name', - 'topics.desc', - 'learning_files.guide', - 'learning_files.testfile', - 'learning_files.supplement', - 'learning_files.other' - ) - ->leftJoin('learning_files', 'learning_files.topic', '=', 'topics.id') - ->first(); - return view('student/unitycourse/tasks/index') - ->with(compact('entities')) - ->with(compact('items')) - ->with(compact('itemslearning')) - ->with(compact('filter')) - ->with(compact('topic')); - } -} - - -public function getTopic($id){ - $items = \App\UnityTopic::find($id); - - return $items['name']; -} - - -public function filterTask() { - $filters = \App\UnityTopic::get(); - $filter = \App\UnityTopic::findOrFail(Input::get('filter_id')); - - $data= \App\UnityTask::with('topic')->where('topic', '=' , $filter->id )->latest()->get(); - - return View::make('admin.tasks.index',compact('filters'))->withProfiles($data)->with('title', 'filter'); -} - -/** - * Show the form for creating a new resource. - * - * @return Response - */ -public function create() -{ - // - $items = \App\UnityTopic::pluck('name', 'id'); -//echo "kljasd;lkasdl"; - return view('admin/tasks/create')->with(compact('items')); -} -/** - * Store a newly created resource in storage. - * - * @return Response - */ -public function store(Request $request) -{ -//echo "YAAANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"; - // - $rules =[ - 'taskno'=>'required', - 'desc'=>'required' - ]; - - $msg=[ - 'taskno.required'=>'Task number must not empty', - 'desc.required'=>'Description must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - - //refresh halaman - return Redirect::to('admin/tasks/create') - ->withErrors($validator); - - }else{ - - $entity=new \App\UnityTask; - - $entity->desc=$request->get('desc'); - $entity->taskno=$request->get('taskno'); - $entity->topic=$request->get('topic'); - $entity->save(); - - Session::flash('message','A New Task Stored'); - - //return "Add new topic is success"; - return Redirect::to('admin/tasks'); - } -} - -/** - * Display the specified resource. - * - * @param int $id - * @return Response - */ -public function show(Request $request, $id) -{ - $entity = \App\UnityTask::find($id); - $topic = \App\UnityTopic::find($entity->topic); - $x=['data'=>$entity, 'topic'=>$topic]; - - if ($request->is('admin/*')) { - return view('admin/tasks/show')->with($x); - } else { - return view('student/unitycourse/tasks/show')->with($x); - } -} - -/** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Response - */ -public function edit($id) -{ - // - $entity = \App\UnityTask::find($id); - $x=['data'=>$entity]; - $items = \App\UnityTopic::pluck('name', 'id'); - return view('admin/tasks/edit')->with($x)->with(compact('items')); -} - -/** - * Update the specified resource in storage. - * - * @param int $id - * @return Response - */ -public function update(Request $request, $id) -{ - // - $rules =[ - 'taskno'=>'required', - 'desc'=>'required' - ]; - - $msg=[ - 'taskno.required'=>'Task number must not empty', - 'desc.required'=>'Description must not empty' - ]; - - - $validator=Validator::make($request->all(),$rules,$msg); - - if ($validator->fails()) { - return Redirect::to('admin/topics/'.$id.'/edit') - ->withErrors($validator); - - }else{ - $entity=\App\UnityTask::find($id); - - $entity->desc=$request->get('desc'); - $entity->taskno=$request->get('taskno'); - $entity->topic=$request->get('topic'); - $entity->save(); - - Session::flash('message','Task with Id='.$id.' is changed'); - - return Redirect::to('admin/tasks'); - } -} - -/** - * Remove the specified resource from storage. - * - * @param int $id - * @return Response - */ -public function destroy($id) -{ - // - $entity = \App\UnityTask::find($id); - $entity->delete(); - Session::flash('message','Task with Id='.$id.' is deleted'); - return Redirect::to('admin/tasks'); -} -} diff --git a/app/Http/Controllers/UnityFileResultController.php b/app/Http/Controllers/UnityFileResultController.php deleted file mode 100644 index 7c7700f..0000000 --- a/app/Http/Controllers/UnityFileResultController.php +++ /dev/null @@ -1,131 +0,0 @@ -get(); - - return view('student/unitycourse/lfiles/create') - ->with(compact('files')) - ->with(compact('topic')); - } - - public function store(Request $request) - { - // - $rules =[ - 'rscfile'=>'required' - ]; - - $msg=[ - 'rscfile.required'=>'Resource File must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - return Redirect::to('student/unitycourse/lfiles/create/'.$request->get('topic')) - ->withErrors($validator); - } else { - $file = $request->file('rscfile'); - $filename = $file->getClientOriginalName(); - - $fileinfo = \App\UnityTopicFiles::find($request->get('fileid')); - if ($fileinfo['fileName']!=$filename) { - return Redirect::to('student/unitycourse/lfiles/create/'.$request->get('topic')) - ->withErrors("File name should be ".$fileinfo['fileName']); - } else { - $result = \App\UnityFileResult::where('userid','=',Auth::user()->id) - ->where('fileid','=',$request->get('fileid')) - ->get(); - if (count($result)>0) { - return Redirect::to('student/unitycourse/lfiles/create/'.$request->get('topic')) - ->withErrors('File '.$fileinfo['fileName'].' was already submitted'); - } else { - $rsc=$file->store('resource','public'); - $entity=new \App\UnityFileResult; - - $entity->userid=Auth::user()->id; - $entity->fileid=$request->get('fileid'); - $entity->rscfile=$rsc; - $entity->save(); - - Session::flash('message','A New File Result Stored'); - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$fileinfo['topic'])->with( [ 'topic' => $request->get('topic') ] ); - } - } - } - } - - public function destroy(Request $request,$id) - { - // - $entity = \App\UnityFileResult::find($id); - - $path = storage_path('app\\public\\').$entity['rscfile']; - //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - - //$dirpath = storage_path('app\\public\\\'); - File::delete(getPath($path)); - - $entity->delete(); - Session::flash('File Result with Id='.$id.' is deleted'); - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic')); - } - - - public function delete($id,$topic) - { - // - $entity = \App\UnityFileResult::find($id); - - $path = storage_path('app\\public\\').$entity['rscfile']; - //$path = str_replace('\\',DIRECTORY_SEPARATOR,$path); - - //$dirpath = storage_path('app\\public\\\'); - File::delete($path); - - $entity->delete(); - Session::flash('File Result with Id='.$id.' is deleted'); - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=files'); - } - - - public function submit($id) { - // - $entity=new \App\UnityStudentSubmit; - - $entity->userid=Auth::user()->id; - $entity->topic=$id; - $entity->validstat="valid"; - $entity->save(); - - $topic = \App\UnityTopic::find($id); - Session::flash('message','Topic '.$topic['name'].' Validation is Success'); - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$id); - - } - - public function getPath($path) { - $res = str_replace('\\',DIRECTORY_SEPARATOR,$path); - return str_replace('/',DIRECTORY_SEPARATOR,$res); - } -} diff --git a/app/Http/Controllers/UnityResultController.php b/app/Http/Controllers/UnityResultController.php deleted file mode 100644 index a58b3a7..0000000 --- a/app/Http/Controllers/UnityResultController.php +++ /dev/null @@ -1,385 +0,0 @@ -id); - //if ($check->count()==0) return view('student/home')->with(['count'=>$check->count()]); -$check=\App\User::find(Auth::user()->id); -if ($check->status!='active') return view('student/unitycourse/home')->with(['status'=>$check->status]); - - $filter = $request->input('topicList','6'); - if ($filter=='0') { - $entities=\App\UnityTaskResult::where('userid','=',Auth::user()->id); - } else { - $entities = \App\UnityTask::where('tasks.topic','=',$filter) - ->select( - 'task_results.id', - 'task_results.taskid', - 'task_results.userid', - 'task_results.status', - 'task_results.duration', - 'task_results.comment', - 'task_results.imgFile', - 'tasks.taskno', - 'tasks.desc', - 'tasks.topic' - ) - ->leftJoin('task_results', function($join) - { - $join->on('tasks.id','=','task_results.taskid') - ->where('task_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('tasks.taskno', 'asc') - ->get(); - } - - $lfiles = \App\UnityTopicFiles::where('topic_files.topic','=',$filter) - ->select( - 'file_results.id', - 'file_results.userid', - 'file_results.rscfile', - 'file_results.fileid', - 'topic_files.fileName', - 'topic_files.path', - 'topic_files.desc' - ) - ->leftJoin('file_results', function($join) - { - $join->on('topic_files.id','=','file_results.fileid') - ->where('file_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('topic_files.fileName', 'asc') - ->get(); - - $items = \App\UnityTopic:: - where('status','>=','0') - ->where('androidclass','=','AndroidX') - ->orderBy('name','asc') - ->orderBy('level','asc') - ->pluck('name', 'id'); - - $valid = \App\UnityStudentSubmit::where('userid','=',Auth::user()->id) - ->where('topic','=',$filter) - ->get()->count(); - - $option = $request->input('option','github'); - - $currtopic = \App\UnityTopic::find($filter); - - return view('student/unitycourse/results/index') - ->with(compact('entities')) - ->with(compact('lfiles')) - ->with(compact('items')) - ->with(compact('filter')) - ->with(compact('option')) - ->with(compact('currtopic')) - ->with(compact('valid')); - - } - - - - public function getTaskData($topic) { - $items = \App\UnityTask::where('tasks.topic','=',$topic) - ->select( - 'tasks.id', - 'tasks.taskno', - 'tasks.desc', - 'topics.name' - ) - ->join( - 'topics', - 'topics.id','=','tasks.topic' - ) - ->orderBy('topics.name', 'asc') - ->orderBy('tasks.taskno', 'asc') - ->get(); - - return $items; - } - public function create($id) - { - $items = \App\UnityTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\UnityTopic::find($id); - return view('student/unitycourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - -private function validateByFiles($userid, $topic) { - // - $entity=new \App\UnityStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->save(); - - $data = \App\UnityTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation is Success'); - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=files'); -} - -private function validateZipFile($userid, $topic, $file, $path) { - // - //$file = $request->file('zipfile'); - if ($path!='' ) { - //$array = explode('.', $path); - //$ext = strtolower(end($array)); - $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); - if ($ext=="zip") { - $zipFile=$file->store('results','public'); - - if ($zipFile!='') { - $entity=new \App\UnityStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->projectfile=$zipFile; - - $entity->save(); - - $data = \App\UnityTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by Uploading Zip Project is Success'); - } else { - Session::flash('message','Storing file '.$request->file('zipfile').' was FAILED'); - } - } else { - Session::flash('message','File extension is not zip -> '.$path.' is wrong .'.$ext); - } - } else { - Session::flash('message','Zip File is empty'); - } - - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=zipfile'); -} - - -private function validateGithubLink($userid, $topic, $link, $projname) { - // - $trimmedlink = trim($link); - if ($this->validateUrl($trimmedlink,$projname)) { - $entity=new \App\UnityStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->githublink=$trimmedlink; - - $entity->save(); - - $data = \App\UnityTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by submitting GitHub link is Success'); - - //Session::flash('message','URL valid '.$link); - - } else { - Session::flash('message','URL is not VALID '.$link); - } - - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=github'); -} - -private function validateUrl($url,$projname) { - $path = parse_url($url, PHP_URL_PATH); - $encoded_path = array_map('urlencode', explode('/', $path)); - $url = str_replace($path, implode('/', $encoded_path), $url); - - if (filter_var($url, FILTER_VALIDATE_URL)) { - $result = parse_url($url); - if ( ($result['scheme']=='https') && ($this->endsWith($result['host'],'github.com')) - && (strpos($result['path'],$projname)) ) { - return true; - } else { - return false; - } - } else { - return false; - } -} - -private function endsWith($haystack, $needle) { - return substr_compare($haystack, $needle, -strlen($needle)) === 0; -} - - - private function saveTaskResult(Request $request) - { - // - $rules =[ - 'duration'=>'required', - 'image'=>'required', - 'comment'=>'required' - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - 'image.required'=>'Evidence image file must not empty', - 'comment.required'=>'Comment must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - - //refresh halaman - return Redirect::to('student/unitycourse/results/create/'.$request->get('topic')) - ->withErrors($validator); - - } else { - $check = \App\UnityTaskResult::where('userid','=',Auth::user()->id) - ->where('taskid','=',$request->get('taskid')) - ->get(); - - if (sizeof($check)>0) { - $task = \App\UnityTask::find($request->get('taskid')); - $message = 'Result of Task '.$task['desc'].' is already submitted!!'; - //Session::flash('message',); - return Redirect::to('student/unitycourse/results/create'.$request->get('topic'))->withErrors($message); - - } else { - $file = $request->file('image'); - $imgFile=$file->store('results','public'); - - $entity=new \App\UnityTaskResult; - - $comment = ($request->get('comment')==null)?'-':$request->get('comment'); - - $entity->userid=Auth::user()->id; - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$comment; - $entity->imgFile=$imgFile; - $entity->save(); - - Session::flash('message','A New Task Result Stored'); - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic'))->with( [ 'topic' => $request->get('topic') ] ); - } - } - } - - - public function store(Request $request) - { - if (strlen($request->get('option'))>3) { - if (($request->get('action')=='validate') && (strlen($request->submitbutton)>5)) { - if ($request->get('option')=='files') { - return $this->validateByFiles(Auth::user()->id, $request->get('topic')); - } else if ($request->get('option')=='zipfile') { - $file = $request->file('zipfile'); - $filename = $file->getClientOriginalName(); - return $this->validateZipFile(Auth::user()->id, $request->get('topic'), $file, $filename); - } else if ($request->get('option')=='github') { - return $this->validateGithubLink(Auth::user()->id, $request->get('topic'), $request->get('githublink'), - $request->get('projname')); - } else { - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic').'&option='.$request->get('option'). - '&submit='.$request->submitbutton); - } - } else { //clicking radio button - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic').'&option='.$request->get('option')); - //'&submit='.$request->submitbutton); - } - - } else { //echo $request; - return $this->saveTaskResult($request); - } - } - - - public function destroy(Request $request, $id) - { - // - $entity = \App\UnityTaskResult::find($id); - $entity->delete(); - Session::flash('message','Task Result with Id='.$id.' is deleted'); - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic')); - } - - public function edit($id) - { - // - $entity = \App\UnityTaskResult::where('id','=',$id)->first(); - $task = \App\UnityTask::where('id','=',$entity['taskid'])->first(); - return view('student/unitycourse/results/edit')->with(compact('entity')) - ->with(compact('task')); - } - - public function valsub(Request $request) - { - $items = \App\UnityTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\UnityTopic::find($id); - return view('student/unitycourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - - - public function update(Request $request, $id) { - // - $rules =[ - 'duration'=>'required', - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - ]; - - - $validator=Validator::make($request->all(),$rules,$msg); - - if ($validator->fails()) { - return Redirect::to('student/unitycourse/results/'.$id.'/edit') - ->withErrors($validator); - - }else{ - $file = $request->file('image'); - - $entity=\App\UnityTaskResult::find($id); - - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$request->get('comment'); - - if ($file!='') { - $imgFile=$file->store('results','public'); - $entity->imgFile=$imgFile; - } - $entity->save(); - - Session::flash('message','Task Result with Id='.$id.' is changed'); - - $task = \App\UnityTask::find($request->get('taskid')); - return Redirect::to('student/unitycourse/results?topicList='.$task['topic']); - } - } -} - diff --git a/app/Http/Controllers/UnityTaskResultController.php b/app/Http/Controllers/UnityTaskResultController.php deleted file mode 100644 index 213481d..0000000 --- a/app/Http/Controllers/UnityTaskResultController.php +++ /dev/null @@ -1,379 +0,0 @@ -id); -if ($check->status!='active') return view('student/unitycourse/home')->with(['status'=>$check->status]); - - $filter = $request->input('topicList','6'); - if ($filter=='0') { - $entities=\App\UnityTaskResult::where('userid','=',Auth::user()->id); - } else { - $entities = \App\UnityTask::where('tasks.topic','=',$filter) - ->select( - 'task_results.id', - 'task_results.taskid', - 'task_results.userid', - 'task_results.status', - 'task_results.duration', - 'task_results.comment', - 'task_results.imgFile', - 'tasks.taskno', - 'tasks.desc', - 'tasks.topic' - ) - ->leftJoin('task_results', function($join) - { - $join->on('tasks.id','=','task_results.taskid') - ->where('task_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('tasks.taskno', 'asc') - ->get(); - } - - $lfiles = \App\UnityTopicFiles::where('topic_files.topic','=',$filter) - ->select( - 'file_results.id', - 'file_results.userid', - 'file_results.rscfile', - 'file_results.fileid', - 'topic_files.fileName', - 'topic_files.path', - 'topic_files.desc' - ) - ->leftJoin('file_results', function($join) - { - $join->on('topic_files.id','=','file_results.fileid') - ->where('file_results.userid', '=', Auth::user()->id); - } - ) - ->orderBy('topic_files.fileName', 'asc') - ->get(); - - $items = \App\UnityTopic:: - where('status','>=','0') - ->where('androidclass','=','AndroidX') - ->orderBy('name','asc') - ->orderBy('level','asc') - ->pluck('name', 'id'); - - $valid = \App\UnityStudentSubmit::where('userid','=',Auth::user()->id) - ->where('topic','=',$filter) - ->get()->count(); - - $option = $request->input('option','github'); - - $currtopic = \App\UnityTopic::find($filter); - - return view('student/unitycourse/results/index') - ->with(compact('entities')) - ->with(compact('lfiles')) - ->with(compact('items')) - ->with(compact('filter')) - ->with(compact('option')) - ->with(compact('currtopic')) - ->with(compact('valid')); - - } - - - - public function getTaskData($topic) { - $items = \App\UnityTask::where('tasks.topic','=',$topic) - ->select( - 'tasks.id', - 'tasks.taskno', - 'tasks.desc', - 'topics.name' - ) - ->join( - 'topics', - 'topics.id','=','tasks.topic' - ) - ->orderBy('topics.name', 'asc') - ->orderBy('tasks.taskno', 'asc') - ->get(); - - return $items; - } - public function create($id) - { - $items = \App\UnityTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\UnityTopic::find($id); - return view('student/unitycourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - -private function validateByFiles($userid, $topic) { - // - $entity=new \App\UnityStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->save(); - - $data = \App\UnityTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation is Success'); - - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=files'); -} - -private function validateZipFile($userid, $topic, $file, $path) { - - if ($path!='' ) { - $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); - if ($ext=="zip") { - $zipFile=$file->store('results','public'); - - if ($zipFile!='') { - $entity=new \App\UnityStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->projectfile=$zipFile; - - $entity->save(); - - $data = \App\UnityTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by Uploading Zip Project is Success'); - } else { - Session::flash('message','Storing file '.$request->file('zipfile').' was FAILED'); - } - } else { - Session::flash('message','File extension is not zip -> '.$path.' is wrong .'.$ext); - } - } else { - Session::flash('message','Zip File is empty'); - } - - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=zipfile'); -} - -private function validateGithubLink($userid, $topic, $link, $projname) { - // - $trimmedlink = trim($link); - if ($this->validateUrl($trimmedlink,$projname)) { - - $entity=new \App\UnityStudentSubmit; - - $entity->userid=$userid; - $entity->topic=$topic; - $entity->validstat="valid"; - $entity->githublink=$trimmedlink; - - $entity->save(); - - $data = \App\UnityTopic::find($topic); - Session::flash('message','Topic '.$data['name'].' Validation by submitting GitHub link is Success'); - - //Session::flash('message','URL valid '.$link); - - } else { - Session::flash('message','URL is not VALID '.$link); - } - - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$topic.'&option=github'); -} - -private function validateUrl($url,$projname) { - $path = parse_url($url, PHP_URL_PATH); - $encoded_path = array_map('urlencode', explode('/', $path)); - $url = str_replace($path, implode('/', $encoded_path), $url); - - if (filter_var($url, FILTER_VALIDATE_URL)) { - $result = parse_url($url); - if ( ($result['scheme']=='https') && ($this->endsWith($result['host'],'github.com')) - && (strpos($result['path'],$projname)) ) { - return true; - } else { - return false; - } - } else { - return false; - } -} - -private function endsWith($haystack, $needle) { - return substr_compare($haystack, $needle, -strlen($needle)) === 0; -} - - - private function saveTaskResult(Request $request) - { - // - $rules =[ - 'duration'=>'required', - 'image'=>'required', - 'comment'=>'required' - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - 'image.required'=>'Evidence image file must not empty', - 'comment.required'=>'Comment must not empty' - ]; - - $validator=Validator::make($request->all(),$rules,$msg); - - //jika data ada yang kosong - if ($validator->fails()) { - - //refresh halaman - return Redirect::to('student/unitycourse/results/create/'.$request->get('topic')) - ->withErrors($validator); - - } else { - $check = \App\UnityTaskResult::where('userid','=',Auth::user()->id) - ->where('taskid','=',$request->get('taskid')) - ->get(); - - if (sizeof($check)>0) { - $task = \App\UnityTask::find($request->get('taskid')); - $message = 'Result of Task '.$task['desc'].' is already submitted!!'; - //Session::flash('message',); - return Redirect::to('student/unitycourse/results/create'.$request->get('topic'))->withErrors($message); - - } else { - $file = $request->file('image'); - $imgFile=$file->store('result','public'); - - $entity=new \App\UnityTaskResult; - - $comment = ($request->get('comment')==null)?'-':$request->get('comment'); - - $entity->userid=Auth::user()->id; - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$comment; - $entity->imgFile=$imgFile; - $entity->save(); - - Session::flash('message','A New Task Result Stored'); - - //return "Add new topic is success"; - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic'))->with( [ 'topic' => $request->get('topic') ] ); - } - } - } - - - public function store(Request $request) - { - if (strlen($request->get('option'))>3) { - if (($request->get('action')=='validate') && (strlen($request->submitbutton)>5)) { - if ($request->get('option')=='files') { - return $this->validateByFiles(Auth::user()->id, $request->get('topic')); - } else if ($request->get('option')=='zipfile') { - $file = $request->file('zipfile'); - $filename = $file->getClientOriginalName(); - return $this->validateZipFile(Auth::user()->id, $request->get('topic'), $file, $filename); - } else if ($request->get('option')=='github') { - return $this->validateGithubLink(Auth::user()->id, $request->get('topic'), $request->get('githublink'), - $request->get('projname')); - } else { - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic').'&option='.$request->get('option'). - '&submit='.$request->submitbutton); - } - } else { //clicking radio button - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic').'&option='.$request->get('option')); - //'&submit='.$request->submitbutton); - } - - } else { //echo $request; - return $this->saveTaskResult($request); - } - } - - - public function destroy(Request $request, $id) - { - // - $entity = \App\UnityTaskResult::find($id); - $entity->delete(); - Session::flash('message','Task Result with Id='.$id.' is deleted'); - return Redirect::to('student/unitycourse/results?topicList='.$request->get('topic')); - } - - public function edit($id) - { - // - $entity = \App\UnityTaskResult::where('id','=',$id)->first(); - $task = \App\UnityTask::where('id','=',$entity['taskid'])->first(); - return view('student/unitycourse/results/edit')->with(compact('entity')) - ->with(compact('task')); - } - - public function valsub(Request $request) - { - $items = \App\UnityTask::where('topic','=',$id) - ->orderBy('taskno', 'asc') - ->get(); - $topic = \App\UnityTopic::find($id); - return view('student/unitycourse/results/create') - ->with(compact('topic')) - ->with(compact('items')); - } - - - public function update(Request $request, $id) { - // - $rules =[ - 'duration'=>'required', - ]; - - $msg=[ - 'duration.required'=>'Duration time must not empty', - ]; - - - $validator=Validator::make($request->all(),$rules,$msg); - - if ($validator->fails()) { - return Redirect::to('student/unitycourse/results/'.$id.'/edit') - ->withErrors($validator); - - }else{ - $file = $request->file('image'); - - $entity=\App\UnityTaskResult::find($id); - - $entity->taskid=$request->get('taskid'); - $entity->status=$request->get('status'); - $entity->duration=$request->get('duration'); - $entity->comment=$request->get('comment'); - - if ($file!='') { - $imgFile=$file->store('results','public'); - $entity->imgFile=$imgFile; - } - $entity->save(); - - Session::flash('message','Task Result with Id='.$id.' is changed'); - - $task = \App\UnityTask::find($request->get('taskid')); - return Redirect::to('student/unitycourse/results?topicList='.$task['topic']); - } - } -} - diff --git a/app/NodejsStudentSubmit.php b/app/NodejsStudentSubmit.php deleted file mode 100644 index 1d52852..0000000 --- a/app/NodejsStudentSubmit.php +++ /dev/null @@ -1,12 +0,0 @@ -belongsTo(App\NodejsTopic::class); - } - - public function getTopic($id) { - return \App\NodejsTopic::find($id)->name; - } - - public function getListTopic() { - return \App\NodejsTopic::pluck('name', 'id'); - } -} diff --git a/app/NodejsTaskResult.php b/app/NodejsTaskResult.php deleted file mode 100644 index 409ad2c..0000000 --- a/app/NodejsTaskResult.php +++ /dev/null @@ -1,11 +0,0 @@ -hasMany('App\NodejsTask'); - } - - public function topic_files() { - return $this->hasMany('App\NodejsTopicFiles'); - } - - public function test_files() { - return $this->hasMany('App\NodejsTestFiles'); - } -} diff --git a/app/NodejsTopicFiles.php b/app/NodejsTopicFiles.php deleted file mode 100644 index 2b691c1..0000000 --- a/app/NodejsTopicFiles.php +++ /dev/null @@ -1,15 +0,0 @@ -belongsTo(App\NodejsTopic::class); - } -} diff --git a/app/NodejsUser.php b/app/NodejsUser.php deleted file mode 100644 index c625ab7..0000000 --- a/app/NodejsUser.php +++ /dev/null @@ -1,52 +0,0 @@ - 'datetime', - ]; - - public function checkRoleId($roleid) { - if ($roleid=='student') { - return Redirect::to('student/Nodejscourse/home'); - } elseif ($roleid=='teacher') { - return Redirect::to('teacher/home'); - } elseif ($roleid=='admin') { - return Redirect::to('admin/admin'); - } else { - return Redirect::to('/home'); - } - } -} diff --git a/app/UnityStudentSubmit.php b/app/UnityStudentSubmit.php deleted file mode 100644 index de33156..0000000 --- a/app/UnityStudentSubmit.php +++ /dev/null @@ -1,12 +0,0 @@ -belongsTo(App\UnityTopic::class); - } - - public function getTopic($id) { - return \App\UnityTopic::find($id)->name; - } - - public function getListTopic() { - return \App\UnityTopic::pluck('name', 'id'); - } -} diff --git a/app/UnityTaskResult.php b/app/UnityTaskResult.php deleted file mode 100644 index 6ed6e04..0000000 --- a/app/UnityTaskResult.php +++ /dev/null @@ -1,11 +0,0 @@ -hasMany('App\UnityTask'); - } - - public function topic_files() { - return $this->hasMany('App\UnityTopicFiles'); - } - - public function test_files() { - return $this->hasMany('App\UnityTestFiles'); - } -} diff --git a/app/UnityTopicFiles.php b/app/UnityTopicFiles.php deleted file mode 100644 index f72ce1b..0000000 --- a/app/UnityTopicFiles.php +++ /dev/null @@ -1,15 +0,0 @@ -belongsTo(App\UnityTopic::class); - } -} diff --git a/app/UnityUser.php b/app/UnityUser.php deleted file mode 100644 index b6e56a1..0000000 --- a/app/UnityUser.php +++ /dev/null @@ -1,52 +0,0 @@ - 'datetime', - ]; - - public function checkRoleId($roleid) { - if ($roleid=='student') { - return Redirect::to('student/unitycourse/home'); - } elseif ($roleid=='teacher') { - return Redirect::to('teacher/home'); - } elseif ($roleid=='admin') { - return Redirect::to('admin/admin'); - } else { - return Redirect::to('/home'); - } - } -} diff --git a/resources/views/student/home.blade.php b/resources/views/student/home.blade.php index 98af5cd..1c16057 100644 --- a/resources/views/student/home.blade.php +++ b/resources/views/student/home.blade.php @@ -15,7 +15,7 @@ scratch. This page gets rid of all links and provides the needed markup only. - + @yield('script') diff --git a/resources/views/student/sql/footer.blade.php b/resources/views/student/sqlcourse/footer.blade.php similarity index 100% rename from resources/views/student/sql/footer.blade.php rename to resources/views/student/sqlcourse/footer.blade.php diff --git a/resources/views/student/sql/header.blade.php b/resources/views/student/sqlcourse/header.blade.php similarity index 100% rename from resources/views/student/sql/header.blade.php rename to resources/views/student/sqlcourse/header.blade.php diff --git a/resources/views/student/sql/home.blade.php b/resources/views/student/sqlcourse/home.blade.php similarity index 95% rename from resources/views/student/sql/home.blade.php rename to resources/views/student/sqlcourse/home.blade.php index 1f4a8ec..62c6b9b 100644 --- a/resources/views/student/sql/home.blade.php +++ b/resources/views/student/sqlcourse/home.blade.php @@ -28,11 +28,11 @@ scratch. This page gets rid of all links and provides the needed markup only.
- @include('student/sql/header') + @include('student/sqlcourse/header') - @include('student/sql/sidebar') + @include('student/sqlcourse/sidebar')
@@ -72,7 +72,7 @@ scratch. This page gets rid of all links and provides the needed markup only. - @include('student/sql/footer') + @include('student/sqlcourse/footer')
diff --git a/resources/views/student/sql/main.blade.php b/resources/views/student/sqlcourse/main.blade.php similarity index 100% rename from resources/views/student/sql/main.blade.php rename to resources/views/student/sqlcourse/main.blade.php diff --git a/resources/views/student/sql/sidebar.blade.php b/resources/views/student/sqlcourse/sidebar.blade.php similarity index 100% rename from resources/views/student/sql/sidebar.blade.php rename to resources/views/student/sqlcourse/sidebar.blade.php diff --git a/resources/views/student/sql/exam.blade.php b/resources/views/student/sqlcourse/sql/exam.blade.php similarity index 100% rename from resources/views/student/sql/exam.blade.php rename to resources/views/student/sqlcourse/sql/exam.blade.php diff --git a/resources/views/student/sql/exam_do.blade.php b/resources/views/student/sqlcourse/sql/exam_do.blade.php similarity index 100% rename from resources/views/student/sql/exam_do.blade.php rename to resources/views/student/sqlcourse/sql/exam_do.blade.php diff --git a/resources/views/student/sql/exercise.blade.php b/resources/views/student/sqlcourse/sql/exercise.blade.php similarity index 100% rename from resources/views/student/sql/exercise.blade.php rename to resources/views/student/sqlcourse/sql/exercise.blade.php diff --git a/resources/views/student/sql/exercise_do.blade.php b/resources/views/student/sqlcourse/sql/exercise_do.blade.php similarity index 100% rename from resources/views/student/sql/exercise_do.blade.php rename to resources/views/student/sqlcourse/sql/exercise_do.blade.php diff --git a/resources/views/student/sql/learning.blade.php b/resources/views/student/sqlcourse/sql/learning.blade.php similarity index 100% rename from resources/views/student/sql/learning.blade.php rename to resources/views/student/sqlcourse/sql/learning.blade.php diff --git a/resources/views/student/sql/learning_do.blade copy.php b/resources/views/student/sqlcourse/sql/learning_do.blade copy.php similarity index 100% rename from resources/views/student/sql/learning_do.blade copy.php rename to resources/views/student/sqlcourse/sql/learning_do.blade copy.php diff --git a/resources/views/student/sql/learning_do.blade.php b/resources/views/student/sqlcourse/sql/learning_do.blade.php similarity index 100% rename from resources/views/student/sql/learning_do.blade.php rename to resources/views/student/sqlcourse/sql/learning_do.blade.php diff --git a/resources/views/student/sql/practice.blade.php b/resources/views/student/sqlcourse/sql/practice.blade.php similarity index 100% rename from resources/views/student/sql/practice.blade.php rename to resources/views/student/sqlcourse/sql/practice.blade.php diff --git a/resources/views/student/sql/practice_do.blade.php b/resources/views/student/sqlcourse/sql/practice_do.blade.php similarity index 100% rename from resources/views/student/sql/practice_do.blade.php rename to resources/views/student/sqlcourse/sql/practice_do.blade.php diff --git a/routes/web.php b/routes/web.php index 69d15e5..97bd998 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,7 +7,7 @@ | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which -| contains the "web" middleware group. Now create something great! +| contains the "web" middleware group. Now create so mething great! | */ // Python @@ -185,29 +185,6 @@ Route::group(['middleware' => ['auth', 'student']], function () { Route::resource('/student/flutterexercise', 'FlutterExerciseStdController'); Route::resource('/student/flutterexercisesubmission', 'FlutterExerciseSubmissionController'); Route::resource('/student/flutterexercisevalid', 'FlutterExerciseStdValidController'); - //NodeJs// - Route::patch('/student/nodejscourse/results/valsub', ['as' => 'results.valsub', 'uses' => 'NodejsTaskResultController@valsub']); - Route::get('/student/nodejscourse/results/create/{topic}', 'NodejsTaskResultController@create'); - Route::get('/student/nodejscourse', 'StudentController@Nodejscourse'); - Route::get('/student/nodejscourse/topic', 'StudentController@Nodejscoursetopic'); - Route::resource('/student/nodejscourse/tasks', 'NodejsController'); - Route::resource('/student/nodejscourse/results', 'NodejsResultController'); - Route::resource('/student/nodejscourse/lfiles', 'NodejsFileResultController'); - Route::get('/student/lfiles/nodejscourse/create/{topic}', 'NodejsFileResultController@create'); - Route::get('/student/lfiles/nodejscourse/valid/{topic}', 'NodejsFileResultController@submit'); - Route::get('/student/lfiles/nodejscourse/delete/{id}/{topic}', 'NodejsFileResultController@delete'); - //Unity// - Route::patch('/student/unitycourse/results/valsub', ['as' => 'results.valsub', 'uses' => 'UnityTaskResultController@valsub']); - Route::get('/student/unitycourse/results/create/{topic}', 'UnityTaskResultController@create'); - Route::get('/student/unitycourse', 'StudentController@unitycourse'); - Route::get('/student/unitycourse/topic', 'StudentController@unitycoursetopic'); - Route::resource('/student/unitycourse/tasks', 'UnityController'); - Route::resource('/student/unitycourse/results', 'UnityResultController'); - Route::resource('/student/unitycourse/lfiles', 'UnityFileResultController'); - Route::get('/student/lfiles/unitycourse/create/{topic}', 'UnityFileResultController@create'); - Route::get('/student/lfiles/unitycourse/valid/{topic}', 'UnityFileResultController@submit'); - Route::get('/student/lfiles/unitycourse/delete/{id}/{topic}', 'UnityFileResultController@delete'); - /** Python */ //Tampilan topik @@ -230,22 +207,10 @@ Route::group(['middleware' => ['auth', 'student']], function () { Route::get("/student/pythoncourse/python-history/{id_topik}/{id_percobaan}", [ExercisePythonController::class, 'submit_history']); - Route::get('/student/androidcourse/asynctask', 'StudentController@asynctask'); - Route::get('/student/androidcourse/firebase', 'StudentController@firebase'); Route::get('/student', 'StudentController@index'); Route::resource('/student/tasks', 'TaskStdController'); Route::resource('/student/results', 'TaskResultController'); - - Route::patch('/student/androidcourse/results/valsub', ['as' => 'results.valsub', 'uses' => 'TaskResultController@valsub']); - Route::get('/student/androidcourse/results/create/{topic}', 'TaskResultController@create'); - Route::resource('/student/androidcourse/lfiles', 'FileResultController'); - Route::get('/student/lfiles/androidcourse/create/{topic}', 'FileResultController@create'); - Route::get('/student/lfiles/androidcourse/valid/{topic}', 'FileResultController@submit'); - Route::get('/student/lfiles/androidcourse/delete/{id}/{topic}', 'FileResultController@delete'); - Route::resource('/student/androidcourse/rankview', 'StudentResultRankController'); - Route::resource('/student/androidcourse/valid', 'StudentValidController'); - Route::resource('/student/androidcourse/rankview', 'StudentResultRankController'); Route::patch('/student/results/valsub', ['as' => 'results.valsub', 'uses' => 'TaskResultController@valsub']); Route::get('student/results/create/{topic}', 'TaskResultController@create'); Route::resource('/student/lfiles', 'FileResultController'); @@ -269,9 +234,8 @@ Route::group(['middleware' => ['auth', 'student']], function () { Route::resource('/student/exercisevalid', 'ExerciseStdValidController'); /* ----------------------------------- SQL ---------------------------------- */ - Route::group(['prefix' => 'student/sqlcourse'], function () { Route::group(['prefix' => 'pembelajaran'], function () { - Route::get('/student/sql', 'StudentController@sqlcourse'); + Route::get('/student/sqlcourse', 'StudentController@sqlcourse'); Route::get('', 'SQLController@learning')->name('student sqlcourse learning'); Route::get('/read', 'SQLController@learningRead')->name('student sqlcourse learning read'); Route::get('/detail/{id}', 'SQLController@learningRead')->name('student sqlcourse learning detail'); @@ -297,7 +261,7 @@ Route::group(['middleware' => ['auth', 'student']], function () { }); Route::group(['prefix' => 'latihan'], function () { - Route::get('', 'SQLController@exercise')->name('student sql exercise'); + Route::get('', 'SQLController@exercise')->name('student sqlcourse exercise'); Route::get('/read', 'SQLController@exerciseRead')->name('student sqlcourse exercise read'); Route::get('/detail/{id}', 'SQLController@exerciseRead')->name('student sqlcourse exercise detail'); Route::post('/create', 'SQLController@exerciseStore')->name('student sqlcourse exercise create'); @@ -325,7 +289,6 @@ Route::group(['middleware' => ['auth', 'student']], function () { Route::post('/kerjakan/{id}', 'SQLController@examAnswer')->name('student sqlcourse exam answer'); Route::get('/complete', 'SQLController@examComplete')->name('student sqlcourse exam complete'); }); - }); /* ----------------------------------- SQL ---------------------------------- */ });