@extends('dashboard.layouts.default') @if(isset($school_id) && $school_id == '9') @section('content')
@php $next_quiz = ''; $next_chapter_quiz = ''; @endphp @foreach($chapters as $key=>$chapter)

@php $units = App\Models\Unit::join('task_units', 'task_units.unit_id', '=', 'units.id') ->join('task_student', 'task_units.task_id', '=', 'task_student.task_id') ->select('units.name','units.id','units.slug') ->where('task_units.task_id', $quiz_id) ->where('chapter_id',$chapter->id) ->groupBy('units.id') ->get(); @endphp
    @foreach($units as $key=>$unit) @php $attempt = App\Models\UnitTaskCompleted::where('task_id', $quiz_id) ->where('unit_id', $unit->id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first(); if($attempt) { $attempt = $attempt->attempt; }else{ $attempt = App\Models\TaskCompleted::where('task_id', $quiz_id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first()->attempt; } //echo $attempt; $quizCount = App\Models\TaskQuestions::where('task_id',$quiz_id)->where('unit_id',$unit->id)->count(); $answeredCount = App\Models\QuizAnswer::where('task_id',$quiz_id)->where('unit_id',$unit->id)->where('is_correct',1)->where('attempt',$attempt)->where('student_id',STUDENT_ID)->count(); if($quizCount>0){ $task_percentage = ($answeredCount/$quizCount)*100; $percentage = round($task_percentage); } else{ $percentage = 0; } //echo $unit_id; $quiz_pending = App\Models\TaskAttempt::where('task_id',$quiz_id)->where('unit_id',$unit->id)->where('student_id',STUDENT_ID)->where('attempt',$attempt)->first(); $quiz_complete = 0; //echo $unit_id; if($quiz_pending){ if($quiz_pending->completed_at!=null){ $quiz_complete = 1; } } if(($chapter->id != $chapter_id) && $quiz_complete == 0 && $next_chapter_quiz ==''){ $next_chapter_quiz = url('quiz/'.$quiz_id.'/'.$unit->slug); } if( $quiz_complete ==0 && $unit_id!=$unit->id && $next_quiz =='' & $chapter->id == $chapter_id){ $next_quiz = url('quiz/'.$quiz_id.'/'.$unit->slug); } @endphp
  • {{ $answeredCount }} / {{ $quizCount }} ({{$percentage}}%)

    @if($percentage == 100)
    @elseif($percentage < 100 && $percentage>=50)
    @elseif($percentage < 50)
    @endif @if($quiz_complete == 1)

    Completed

    @elseif ($unit_id==$unit->id)

    In Progress

    @else

    Pending

    @endif
  • @endforeach
@endforeach @php if($next_quiz=='' && $next_chapter_quiz == ''){ $next_quiz = ''; } elseif($next_quiz!=''){ $next_quiz = $next_quiz; } elseif($next_chapter_quiz != ''){ $next_quiz = $next_chapter_quiz; } @endphp
@php $attempt = App\Models\UnitTaskCompleted::where('task_id', $quiz_id) ->where('unit_id', $unit_id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first(); if($attempt) { $attempt = $attempt->attempt; }else{ $attempt = App\Models\TaskCompleted::where('task_id', $quiz_id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first()->attempt; } //echo $attempt; $quiz_pending = App\Models\TaskAttempt::where('task_id',$quiz_id)->where('unit_id',$unit_id)->where('student_id',STUDENT_ID)->where('attempt',$attempt)->first(); $quiz_complete = 0; //echo $unit_id; if($quiz_pending){ if($quiz_pending->completed_at!=null){ $quiz_complete = 1; } } @endphp @if($quiz_complete == 1 || $is_attempted==1) @endif {{--@if(@$quizes->enable_video && $video)

      @if($is_videoplayed) The video is locked whilst you attempt the quiz @else To check your answers sign up for free @endif

@endif --}}
@if($video_player) @if( $video)
video_mode) && isset($expiry_status) && isset($studnt_type) && $studnt_type == 'tutor' && $video->video_mode == 'paid' && $expiry_status =='Y')style="pointer-events:none;"@endif >
@if(isset($video->video_mode) && isset($expiry_status) && isset($studnt_type) && $studnt_type == 'tutor' && $video->video_mode == 'paid' && $expiry_status =='Y') @endif @if(isset($video->video_type) && $video->video_type == 'youtube') {{-- --}}
@else @endif
@endif
{{--
--}} @endif
@php $q_count = 1; $answered_fillQuestions = App\Models\QuizFillBlankAttempt::join('questions','quiz_fill_blank_attempt.question_id','questions.id') ->select('questions.id','questions.question') ->where('quiz_fill_blank_attempt.student_id',STUDENT_ID) ->where('quiz_fill_blank_attempt.unit_id',$unit_id) ->where('quiz_fill_blank_attempt.task_id',$quiz_id) ->where('quiz_fill_blank_attempt.attempt',$attempt) ->groupBy('questions.id') ->get(); $display = count($answered_fillQuestions)>0?'block':'none'; @endphp
@foreach($answered_fillQuestions as $key=>$fillquiz) @php $fill_answers = App\Models\QuizFillBlankAttempt::join('quiz_fill_blank_answers','quiz_fill_blank_answers.question_id','quiz_fill_blank_attempt.question_id') ->join("fill_blank_answers",function($join){ $join->on("fill_blank_answers.question_id","=","quiz_fill_blank_answers.question_id") ->on("fill_blank_answers.position_order","=","quiz_fill_blank_answers.position_order"); }) ->select('quiz_fill_blank_answers.position_order','quiz_fill_blank_answers.answer','quiz_fill_blank_answers.is_correct','fill_blank_answers.answers as fillBAns') ->where('quiz_fill_blank_answers.student_id',STUDENT_ID) ->where('quiz_fill_blank_answers.unit_id',$unit_id) ->where('quiz_fill_blank_answers.task_id',$quiz_id) ->where('quiz_fill_blank_answers.attempt',$attempt) ->orderBy('position_order','ASC') ->get()->toArray(); $question = strip_tags(htmlspecialchars_decode($fillquiz['question'])); $questionArray = explode('________', $question); // dd($fill_answers); $newStr = ''; for ($i = 0; $i < count($questionArray); $i++) { $fillAns = isset($fill_answers[$i]['answer'])?$fill_answers[$i]['answer']:''; $color = (@$fill_answers[$i]['is_correct']==1)?'green':'red'; $newStr.= $questionArray[$i]; $correctAns = isset($fill_answers[$i]['fillBAns'])?explode(',',$fill_answers[$i]['fillBAns']):[]; //dd($correctAns[0]); $newStr.= ($fillAns!='')?'':''; } @endphp
{{ $q_count }} . {!! $newStr !!}
@php $q_count++; @endphp @endforeach
@php $answered_questions = App\Models\QuizAnswer::select('questions.id','questions.question','quiz_answers.answer','one_word_answers.answer as correct_answer','quiz_answers.is_correct') ->join('questions','quiz_answers.question_id','questions.id') ->join('one_word_answers','one_word_answers.question_id','questions.id') ->where('quiz_answers.student_id',STUDENT_ID) ->where('quiz_answers.unit_id',$unit_id) ->where('quiz_answers.task_id',$quiz_id) ->where('quiz_answers.attempt',$attempt) ->groupBy('questions.id') ->get(); @endphp @foreach($answered_questions as $key=>$quizanwers) @php $ans = explode(',',$quizanwers->correct_answer); $color = $quizanwers->is_correct?'green':'red'; @endphp
@if($quizanwers->is_correct == 0)

Answer : {{ $ans[0] }} Report an issue

@endif
@php $q_count++; @endphp @endforeach
@if($is_complete && $is_attempted==0)

Please complete all tasks in this homework to re-attempt any quizzes.

@endif
@include('layout.report_issue') @endsection @push('page-css') @endpush @section('pagescripts') @if(isset($video->video_type) && $video->video_type == 'youtube') @if($video->vcode && strlen($video->vcode) > 0) @endif @endif @endsection @push('page-scripts') @endpush @else @section('content')
@php $next_quiz = ''; $next_chapter_quiz = ''; @endphp @foreach($chapters as $key=>$chapter)

@php $units = App\Models\Unit::join('task_units', 'task_units.unit_id', '=', 'units.id') ->join('task_student', 'task_units.task_id', '=', 'task_student.task_id') ->select('units.name','units.id','units.slug') ->where('task_units.task_id', $quiz_id) ->where('chapter_id',$chapter->id) ->groupBy('units.id') ->get(); @endphp
    @foreach($units as $key=>$unit) @php $attempt = App\Models\UnitTaskCompleted::where('task_id', $quiz_id) ->where('unit_id', $unit->id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first(); if($attempt) { $attempt = $attempt->attempt; }else{ $attempt = App\Models\TaskCompleted::where('task_id', $quiz_id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first()->attempt; } //echo $attempt; $quizCount = App\Models\TaskQuestions::where('task_id',$quiz_id)->where('unit_id',$unit->id)->count(); $answeredCount = App\Models\QuizAnswer::where('task_id',$quiz_id)->where('unit_id',$unit->id)->where('is_correct',1)->where('attempt',$attempt)->where('student_id',STUDENT_ID)->count(); if($quizCount>0){ $task_percentage = ($answeredCount/$quizCount)*100; $percentage = round($task_percentage); } else{ $percentage = 0; } //echo $unit_id; $quiz_pending = App\Models\TaskAttempt::where('task_id',$quiz_id)->where('unit_id',$unit->id)->where('student_id',STUDENT_ID)->where('attempt',$attempt)->first(); $quiz_complete = 0; //echo $unit_id; if($quiz_pending){ if($quiz_pending->completed_at!=null){ $quiz_complete = 1; } } if(($chapter->id != $chapter_id) && $quiz_complete == 0 && $next_chapter_quiz ==''){ $next_chapter_quiz = url('quiz/'.$quiz_id.'/'.$unit->slug); } if( $quiz_complete ==0 && $unit_id!=$unit->id && $next_quiz =='' & $chapter->id == $chapter_id){ $next_quiz = url('quiz/'.$quiz_id.'/'.$unit->slug); } @endphp
  • {{ $answeredCount }} / {{ $quizCount }} ({{$percentage}}%)

    @if($percentage == 100)
    @elseif($percentage < 100 && $percentage>=50)
    @elseif($percentage < 50)
    @endif @if($quiz_complete == 1)

    Completed

    @elseif ($unit_id==$unit->id)

    In Progress

    @else

    Pending

    @endif
  • @endforeach
@endforeach @php if($next_quiz=='' && $next_chapter_quiz == ''){ $next_quiz = ''; } elseif($next_quiz!=''){ $next_quiz = $next_quiz; } elseif($next_chapter_quiz != ''){ $next_quiz = $next_chapter_quiz; } @endphp
@php $attempt = App\Models\UnitTaskCompleted::where('task_id', $quiz_id) ->where('unit_id', $unit_id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first(); if($attempt) { $attempt = $attempt->attempt; }else{ $attempt = App\Models\TaskCompleted::where('task_id', $quiz_id) ->where('student_id', STUDENT_ID) ->orderBy('attempt', 'DESC') //->toSql();exit; ->first()->attempt; } //echo $attempt; $quiz_pending = App\Models\TaskAttempt::where('task_id',$quiz_id)->where('unit_id',$unit_id)->where('student_id',STUDENT_ID)->where('attempt',$attempt)->first(); $quiz_complete = 0; //echo $unit_id; if($quiz_pending){ if($quiz_pending->completed_at!=null){ $quiz_complete = 1; } } @endphp @if($quiz_complete == 1 || $is_attempted==1) @endif {{--@if(@$quizes->enable_video && $video)

      @if($is_videoplayed) The video is locked whilst you attempt the quiz @else To check your answers sign up for free @endif

@endif --}}
@if($video_player) @if( $video)
video_mode) && isset($expiry_status) && isset($studnt_type) && $studnt_type == 'tutor' && $video->video_mode == 'paid' && $expiry_status =='Y')style="pointer-events:none;"@endif >
@if(isset($video->video_mode) && isset($expiry_status) && isset($studnt_type) && $studnt_type == 'tutor' && $video->video_mode == 'paid' && $expiry_status =='Y') @endif @if(isset($video->video_type) && $video->video_type == 'youtube') {{-- --}}
@else @endif
@endif
{{--
--}} @endif
@php $q_count = 1; $answered_fillQuestions = App\Models\QuizFillBlankAttempt::join('questions','quiz_fill_blank_attempt.question_id','questions.id') ->select('questions.id','questions.question') ->where('quiz_fill_blank_attempt.student_id',STUDENT_ID) ->where('quiz_fill_blank_attempt.unit_id',$unit_id) ->where('quiz_fill_blank_attempt.task_id',$quiz_id) ->where('quiz_fill_blank_attempt.attempt',$attempt) ->groupBy('questions.id') ->get(); $display = count($answered_fillQuestions)>0?'block':'none'; @endphp
@foreach($answered_fillQuestions as $key=>$fillquiz) @php $fill_answers = App\Models\QuizFillBlankAttempt::join('quiz_fill_blank_answers','quiz_fill_blank_answers.question_id','quiz_fill_blank_attempt.question_id') ->join("fill_blank_answers",function($join){ $join->on("fill_blank_answers.question_id","=","quiz_fill_blank_answers.question_id") ->on("fill_blank_answers.position_order","=","quiz_fill_blank_answers.position_order"); }) ->select('quiz_fill_blank_answers.position_order','quiz_fill_blank_answers.answer','quiz_fill_blank_answers.is_correct','fill_blank_answers.answers as fillBAns') ->where('quiz_fill_blank_answers.student_id',STUDENT_ID) ->where('quiz_fill_blank_answers.unit_id',$unit_id) ->where('quiz_fill_blank_answers.task_id',$quiz_id) ->where('quiz_fill_blank_answers.attempt',$attempt) ->orderBy('position_order','ASC') ->get()->toArray(); $question = strip_tags(htmlspecialchars_decode($fillquiz['question'])); $questionArray = explode('________', $question); // dd($fill_answers); $newStr = ''; for ($i = 0; $i < count($questionArray); $i++) { $fillAns = isset($fill_answers[$i]['answer'])?$fill_answers[$i]['answer']:''; $color = (@$fill_answers[$i]['is_correct']==1)?'green':'red'; $newStr.= $questionArray[$i]; $correctAns = isset($fill_answers[$i]['fillBAns'])?explode(',',$fill_answers[$i]['fillBAns']):[]; //dd($correctAns[0]); $newStr.= ($fillAns!='')?'':''; } @endphp
{{ $q_count }} . {!! $newStr !!}
@php $q_count++; @endphp @endforeach
@php $answered_questions = App\Models\QuizAnswer::select('questions.id','questions.question','quiz_answers.answer','one_word_answers.answer as correct_answer','quiz_answers.is_correct') ->join('questions','quiz_answers.question_id','questions.id') ->join('one_word_answers','one_word_answers.question_id','questions.id') ->where('quiz_answers.student_id',STUDENT_ID) ->where('quiz_answers.unit_id',$unit_id) ->where('quiz_answers.task_id',$quiz_id) ->where('quiz_answers.attempt',$attempt) ->groupBy('questions.id') ->get(); @endphp @foreach($answered_questions as $key=>$quizanwers) @php $ans = explode(',',$quizanwers->correct_answer); $color = $quizanwers->is_correct?'green':'red'; @endphp
@if($quizanwers->is_correct == 0)

Answer : {{ $ans[0] }} Report an issue

@endif
@php $q_count++; @endphp @endforeach
@if($is_complete && $is_attempted==0)

Please complete all tasks in this homework to re-attempt any quizzes.

@endif
@include('layout.report_issue') @endsection @push('page-css') @endpush @section('pagescripts') @if(isset($video->video_type) && $video->video_type == 'youtube') @if($video->vcode && strlen($video->vcode) > 0) @endif @endif @endsection @push('page-scripts') @endpush @endif