fake
This commit is contained in:
parent
68adf3bf36
commit
db803b6501
|
|
@ -1,249 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class NodejsController extends Controller
|
|
||||||
{
|
|
||||||
//
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function index(Request $request) {
|
|
||||||
if (Auth::user()->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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\File;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class NodejsFileResultController extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
public function create($id) {
|
|
||||||
//
|
|
||||||
$topic = \App\NodejsTopic::find($id);
|
|
||||||
$files = \App\NodejsTopicFiles::where('topic','=',$id)->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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,404 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class NodejsResultController extends Controller
|
|
||||||
{
|
|
||||||
public function index(Request $request) {
|
|
||||||
//$check=\App\StudentTeacher::where('student','=',Auth::user()->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']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,379 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class NodejsTaskResultController extends Controller
|
|
||||||
{
|
|
||||||
public function index(Request $request) {
|
|
||||||
$check=\App\NodejsUser::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 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']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ class SQLController extends Controller
|
||||||
{
|
{
|
||||||
public function learning()
|
public function learning()
|
||||||
{
|
{
|
||||||
return view(Auth::user()->roleid . '.sql.learning');
|
return view(Auth::user()->roleid . '.sqlcourse.learning');
|
||||||
}
|
}
|
||||||
public function learningRead($id = null)
|
public function learningRead($id = null)
|
||||||
{
|
{
|
||||||
|
|
@ -138,7 +138,7 @@ class SQLController extends Controller
|
||||||
$data['next'] = SqlLearning::where('id', '>', $id)->min('id');
|
$data['next'] = SqlLearning::where('id', '>', $id)->min('id');
|
||||||
|
|
||||||
// return $data;
|
// return $data;
|
||||||
return view('student.sql.learning_do', ['data' => $data]);
|
return view('student.sqlcourse.learning_do', ['data' => $data]);
|
||||||
}
|
}
|
||||||
public function learningDoReset()
|
public function learningDoReset()
|
||||||
{
|
{
|
||||||
|
|
@ -258,7 +258,7 @@ class SQLController extends Controller
|
||||||
|
|
||||||
public function practice()
|
public function practice()
|
||||||
{
|
{
|
||||||
return view(Auth::user()->roleid . '.sql.practice');
|
return view(Auth::user()->roleid . '.sqlcourse.practice');
|
||||||
}
|
}
|
||||||
public function practiceRead($id = null)
|
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');
|
$data['next'] = SqlPracticeQuestion::where('sql_practice_id', $id)->where('id', '>', $question)->min('id');
|
||||||
|
|
||||||
// return $data;
|
// return $data;
|
||||||
return view('student.sql.practice_do', ['data' => $data]);
|
return view('student.sqlcourse.practice_do', ['data' => $data]);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Error Processing Request", 1);
|
throw new Exception("Error Processing Request", 1);
|
||||||
}
|
}
|
||||||
|
|
@ -504,7 +504,7 @@ class SQLController extends Controller
|
||||||
|
|
||||||
public function exercise()
|
public function exercise()
|
||||||
{
|
{
|
||||||
return view(Auth::user()->roleid . '.sql.exercise');
|
return view(Auth::user()->roleid . '.sqlcourse.exercise');
|
||||||
}
|
}
|
||||||
public function exerciseRead($id = null)
|
public function exerciseRead($id = null)
|
||||||
{
|
{
|
||||||
|
|
@ -606,7 +606,7 @@ class SQLController extends Controller
|
||||||
|
|
||||||
$data['jawaban'] = $jawaban;
|
$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');
|
return redirect()->route('student sql exercise');
|
||||||
|
|
@ -776,7 +776,7 @@ class SQLController extends Controller
|
||||||
|
|
||||||
public function exam()
|
public function exam()
|
||||||
{
|
{
|
||||||
return view(Auth::user()->roleid . '.sql.exam');
|
return view(Auth::user()->roleid . '.sqlcourse.exam');
|
||||||
}
|
}
|
||||||
public function examRead($id = null)
|
public function examRead($id = null)
|
||||||
{
|
{
|
||||||
|
|
@ -878,7 +878,7 @@ class SQLController extends Controller
|
||||||
|
|
||||||
$data['jawaban'] = $jawaban;
|
$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');
|
return redirect()->route('student sql exam');
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ class StudentController extends Controller
|
||||||
public function pythoncourse() {
|
public function pythoncourse() {
|
||||||
return view('student/pythoncourse/main');
|
return view('student/pythoncourse/main');
|
||||||
}
|
}
|
||||||
public function sql() {
|
public function sqlcourse() {
|
||||||
return view('student/sql/main');
|
return view('student/sqlcourse/main');
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function asynctask() {
|
// public function asynctask() {
|
||||||
|
|
|
||||||
|
|
@ -1,249 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class UnityController extends Controller
|
|
||||||
{
|
|
||||||
//
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function index(Request $request) {
|
|
||||||
if (Auth::user()->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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\File;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class UnityFileResultController extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
public function create($id) {
|
|
||||||
//
|
|
||||||
$topic = \App\UnityTopic::find($id);
|
|
||||||
$files = \App\UnityTopicFiles::where('topic','=',$id)->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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,385 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class UnityResultController extends Controller
|
|
||||||
{
|
|
||||||
public function index(Request $request) {
|
|
||||||
//$check=\App\StudentTeacher::where('student','=',Auth::user()->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']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,379 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
use Redirect;
|
|
||||||
use Session;
|
|
||||||
|
|
||||||
class UnityTaskResultController extends Controller
|
|
||||||
{
|
|
||||||
public function index(Request $request) {
|
|
||||||
$check=\App\UnityUser::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 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']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class NodejsStudentSubmit extends Model
|
|
||||||
{
|
|
||||||
protected $table='student_submits';
|
|
||||||
|
|
||||||
public $primaryKey='id';
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class NodejsTask extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
protected $table='tasks';
|
|
||||||
|
|
||||||
public $primaryKey='id';
|
|
||||||
|
|
||||||
public function topic() {
|
|
||||||
return $this->belongsTo(App\NodejsTopic::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTopic($id) {
|
|
||||||
return \App\NodejsTopic::find($id)->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getListTopic() {
|
|
||||||
return \App\NodejsTopic::pluck('name', 'id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class NodejsTaskResult extends Model
|
|
||||||
{
|
|
||||||
protected $table='task_results';
|
|
||||||
public $primaryKey='id';
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class NodejsTestFiles extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class NodejsTopic extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
protected $table='topics';
|
|
||||||
public function tasks() {
|
|
||||||
return $this->hasMany('App\NodejsTask');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function topic_files() {
|
|
||||||
return $this->hasMany('App\NodejsTopicFiles');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_files() {
|
|
||||||
return $this->hasMany('App\NodejsTestFiles');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class NodejsTopicFiles extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
protected $table='topic_files';
|
|
||||||
public $primaryKey='id';
|
|
||||||
public function topic() {
|
|
||||||
return $this->belongsTo(App\NodejsTopic::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
||||||
use Illuminate\Notifications\Notifiable;
|
|
||||||
|
|
||||||
|
|
||||||
class NodejsUser extends Authenticatable
|
|
||||||
{
|
|
||||||
use Notifiable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that are mass assignable.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $fillable = [
|
|
||||||
'name', 'roleid', 'email', 'password','uplink','status'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be hidden for arrays.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $hidden = [
|
|
||||||
'password', 'remember_token',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be cast to native types.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'email_verified_at' => '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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class UnityStudentSubmit extends Model
|
|
||||||
{
|
|
||||||
protected $table='student_submits';
|
|
||||||
|
|
||||||
public $primaryKey='id';
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class UnityTask extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
protected $table='tasks';
|
|
||||||
|
|
||||||
public $primaryKey='id';
|
|
||||||
|
|
||||||
public function topic() {
|
|
||||||
return $this->belongsTo(App\UnityTopic::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTopic($id) {
|
|
||||||
return \App\UnityTopic::find($id)->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getListTopic() {
|
|
||||||
return \App\UnityTopic::pluck('name', 'id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class UnityTaskResult extends Model
|
|
||||||
{
|
|
||||||
protected $table='task_results';
|
|
||||||
public $primaryKey='id';
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class UnityTestFiles extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class UnityTopic extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
protected $table='topics';
|
|
||||||
public function tasks() {
|
|
||||||
return $this->hasMany('App\UnityTask');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function topic_files() {
|
|
||||||
return $this->hasMany('App\UnityTopicFiles');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_files() {
|
|
||||||
return $this->hasMany('App\UnityTestFiles');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class UnityTopicFiles extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
protected $table='topic_files';
|
|
||||||
public $primaryKey='id';
|
|
||||||
public function topic() {
|
|
||||||
return $this->belongsTo(App\UnityTopic::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
||||||
use Illuminate\Notifications\Notifiable;
|
|
||||||
|
|
||||||
|
|
||||||
class UnityUser extends Authenticatable
|
|
||||||
{
|
|
||||||
use Notifiable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that are mass assignable.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $fillable = [
|
|
||||||
'name', 'roleid', 'email', 'password','uplink','status'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be hidden for arrays.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $hidden = [
|
|
||||||
'password', 'remember_token',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be cast to native types.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'email_verified_at' => '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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -15,7 +15,7 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||||
<link rel="stylesheet" href="{{asset('lte/plugins/fontawesome-free/css/all.min.css')}}">
|
<link rel="stylesheet" href="{{asset('lte/plugins/fontawesome-free/css/all.min.css')}}">
|
||||||
<!-- Theme style -->
|
<!-- Theme style -->
|
||||||
<link rel="stylesheet" href="{{asset('lte/dist/css/adminlte.min.css')}}">
|
<link rel="stylesheet" href="{{asset('lte/dist/css/adminlte.min.css')}}">
|
||||||
<!-- Google Font: Source Sans Pro -->
|
<!-- Google Font: Source Sans Pro -->
|
||||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
|
||||||
<!-- yield for script -->
|
<!-- yield for script -->
|
||||||
@yield('script')
|
@yield('script')
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
<!-- Navbar -->
|
<!-- Navbar -->
|
||||||
@include('student/sql/header')
|
@include('student/sqlcourse/header')
|
||||||
<!-- /.navbar -->
|
<!-- /.navbar -->
|
||||||
|
|
||||||
<!-- Main Sidebar Container -->
|
<!-- Main Sidebar Container -->
|
||||||
@include('student/sql/sidebar')
|
@include('student/sqlcourse/sidebar')
|
||||||
|
|
||||||
<!-- Content Wrapper. Contains page content -->
|
<!-- Content Wrapper. Contains page content -->
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
|
|
@ -72,7 +72,7 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||||
<!-- /.control-sidebar -->
|
<!-- /.control-sidebar -->
|
||||||
|
|
||||||
<!-- Main Footer -->
|
<!-- Main Footer -->
|
||||||
@include('student/sql/footer')
|
@include('student/sqlcourse/footer')
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- ./wrapper -->
|
<!-- ./wrapper -->
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
|
|
||||||
| Here is where you can register web routes for your application. These
|
| Here is where you can register web routes for your application. These
|
||||||
| routes are loaded by the RouteServiceProvider within a group which
|
| 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
|
// Python
|
||||||
|
|
@ -185,29 +185,6 @@ Route::group(['middleware' => ['auth', 'student']], function () {
|
||||||
Route::resource('/student/flutterexercise', 'FlutterExerciseStdController');
|
Route::resource('/student/flutterexercise', 'FlutterExerciseStdController');
|
||||||
Route::resource('/student/flutterexercisesubmission', 'FlutterExerciseSubmissionController');
|
Route::resource('/student/flutterexercisesubmission', 'FlutterExerciseSubmissionController');
|
||||||
Route::resource('/student/flutterexercisevalid', 'FlutterExerciseStdValidController');
|
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 */
|
/** Python */
|
||||||
//Tampilan topik
|
//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/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::get('/student', 'StudentController@index');
|
||||||
Route::resource('/student/tasks', 'TaskStdController');
|
Route::resource('/student/tasks', 'TaskStdController');
|
||||||
Route::resource('/student/results', 'TaskResultController');
|
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::patch('/student/results/valsub', ['as' => 'results.valsub', 'uses' => 'TaskResultController@valsub']);
|
||||||
Route::get('student/results/create/{topic}', 'TaskResultController@create');
|
Route::get('student/results/create/{topic}', 'TaskResultController@create');
|
||||||
Route::resource('/student/lfiles', 'FileResultController');
|
Route::resource('/student/lfiles', 'FileResultController');
|
||||||
|
|
@ -269,9 +234,8 @@ Route::group(['middleware' => ['auth', 'student']], function () {
|
||||||
Route::resource('/student/exercisevalid', 'ExerciseStdValidController');
|
Route::resource('/student/exercisevalid', 'ExerciseStdValidController');
|
||||||
|
|
||||||
/* ----------------------------------- SQL ---------------------------------- */
|
/* ----------------------------------- SQL ---------------------------------- */
|
||||||
Route::group(['prefix' => 'student/sqlcourse'], function () {
|
|
||||||
Route::group(['prefix' => 'pembelajaran'], 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('', 'SQLController@learning')->name('student sqlcourse learning');
|
||||||
Route::get('/read', 'SQLController@learningRead')->name('student sqlcourse learning read');
|
Route::get('/read', 'SQLController@learningRead')->name('student sqlcourse learning read');
|
||||||
Route::get('/detail/{id}', 'SQLController@learningRead')->name('student sqlcourse learning detail');
|
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::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('/read', 'SQLController@exerciseRead')->name('student sqlcourse exercise read');
|
||||||
Route::get('/detail/{id}', 'SQLController@exerciseRead')->name('student sqlcourse exercise detail');
|
Route::get('/detail/{id}', 'SQLController@exerciseRead')->name('student sqlcourse exercise detail');
|
||||||
Route::post('/create', 'SQLController@exerciseStore')->name('student sqlcourse exercise create');
|
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::post('/kerjakan/{id}', 'SQLController@examAnswer')->name('student sqlcourse exam answer');
|
||||||
Route::get('/complete', 'SQLController@examComplete')->name('student sqlcourse exam complete');
|
Route::get('/complete', 'SQLController@examComplete')->name('student sqlcourse exam complete');
|
||||||
});
|
});
|
||||||
});
|
|
||||||
/* ----------------------------------- SQL ---------------------------------- */
|
/* ----------------------------------- SQL ---------------------------------- */
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user