<div class="clearfix visible-sm visible-xs"></div> <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <h4>Table of Failed Questions and Answers by Student</h4> <table id="questionfail" class="table table-striped table-bordered bootstrap-datatable datatable"> <thead> <tr> <th>Question No</th> <th>Question</th> <th>Answer(s)</th> </tr> </thead> <tbody> <?php $examdata = unserialize(Tutorials::find($assessment->tutorialid)->exams); $wronganswers = File::get(app_path() . '/files/assessment/' . $assessment->id . '/exam-' . $examdata['id'] . '/questionfailed.json'); $examy = Exams::findOrFail($examdata['id']); $hash = $examy->hash; $wronganswers = json_decode($wronganswers, true); if (isset($wronganswers['questions'])) { foreach ($wronganswers['questions'] as $key => $value) { echo "<tr><td>" . $key . "</td>" . "<td>" . $value . "</td>"; echo "<td>"; $examdata_encoded = File::get(app_path() . '/files/exam-' . $examy->id . '/' . $hash . '.json'); $examdata = json_decode($examdata_encoded, true); foreach ($wronganswers['questions_fail'][$key][0] as $answerr) { if ($answerr != 0) { echo "<b>" . $answerr . "</b>. "; echo $examdata['questiondata']['question'][$key]['checkboxdata'][$answerr] . "<br>"; } } echo "</td>";
Route::get('assessments', array('before' => 'teacher', 'uses' => 'DashboardController@assessments')); Route::get('/', array('as' => 'dashboard', 'before' => 'teacher', 'uses' => 'DashboardController@dash')); Route::get('tutorial/edit/{id?}', 'TutorialsController@index')->where('id', '[0-9]+')->before('teacher'); Route::get('tutorial/{mode}/{id}', array('before' => 'teacher', 'uses' => 'TutorialsController@modder')); Route::get('tutorial/update/{id}/{attachmentname}/{mode}', array('before' => 'teacher', 'uses' => 'TutorialsController@attachmentHandler')); Route::get('assessment/{id}', array('before' => 'teacher', 'uses' => 'HttpController@assessmentupdateget')); Route::get('/assessment-{aid}/exam-{eid}/markup', array('before' => 'teacher', 'uses' => 'ExamController@markExam')); Route::get('/exam/edit/{id}', array('before' => 'teacher', 'uses' => 'HttpController@examupdateget')); Route::get('/exam/view/{id}', array('before' => 'teacher', function ($dash, $id) { if (Exams::find($id)) { return View::make('dashboard.exams.view')->with('id', $id); } return View::make('dashboard.exams.create')->with('id', 0); })); Route::get('/exam/delete/{id}', array('before' => 'admin', function ($dash, $id) { $exam = Exams::findOrFail($id); $examdata = DB::select(DB::raw('SELECT exams FROM tutorials')); $examdata = objectToArray($examdata); $pass = []; foreach ($examdata as $exam) { if ($exam["exams"] != NULL) { $exam = unserialize($exam["exams"]); if ((int) $exam["id"] !== (int) $id) { $pass[] = true; } elseif ((int) $exam["id"] == (int) $id) { $pass[] = false; } } } if (in_array(false, $pass, true)) { } else {
public function exam($id) { $exam = Exams::findOrFail($id); $examdata = File::get(app_path() . '/files/exam-' . $id . '/' . $exam->hash . '.json'); return $examdata; }