// If the form submited for choosing a course.
    if ($act == "choosingCourse") {
        $choosencourse = optional_param("courseID", null, PARAM_INT);
    } else {
        if ($act == "assessment") {
            // If the form submited for assessing a course.
            $teacherid = $USER->id;
            $timetaken = time() - optional_param("AssStartTime", null, PARAM_INT);
            $courseid = optional_param("course_id", null, PARAM_INT);
            // Creating a new row for course assessment.
            $assid = G\newassessment($teacherid, time(), $timetaken, $csem, "Teacher", $courseid);
            $rangeinput = optional_param_array("rangeInput", null, PARAM_NUMBER);
            $subattids = optional_param_array("subattID", null, PARAM_INT);
            // Creating a new row for each sub-attributed assessed.
            foreach ($subattids as $subattid) {
                G\newsubattassessment($assid, $subattid, current($rangeinput), "Teacher");
                next($rangeinput);
            }
            $datasaved = true;
        }
    }
    ?>
    <div  style="margin-bottom: 0px; width:1100px;" class='block_course_overview  block'>
        <div class="header">
            <div class="title">
                <h2><i class='fa fa-question-circle'></i>
                    <?php 
    echo " " . get_string('courseAssessment', 'local_gas');
    ?>
 </h2>
            </div>
 echo html_writer::script($initjs);
 $act = optional_param("action", null, PARAM_TEXT);
 $currentsem = G\semofdate(date("d"), date("m"));
 $datasaved = false;
 // If the form submited to save an assessment.
 if ($act == "assessment") {
     $studentid = $USER->id;
     // Variable storing the amount of time user spent on assessment.
     $timetaken = time() - optional_param("AssStartTime", null, PARAM_INT);
     // Creating a row in assessment table.
     $assid = G\newassessment($studentid, time(), $timetaken, $currentsem, "Student");
     $rangeinput = optional_param_array("rangeInput", null, PARAM_NUMBER);
     $subattids = optional_param_array("subattID", null, PARAM_INT);
     foreach ($subattids as $subattid) {
         // Creating a row for each of the sub-attributes of assessment.
         $subattassessmentid = G\newsubattassessment($assid, $subattid, current($rangeinput), "Student");
         next($rangeinput);
         $courseid = optional_param_array("CourseIDFor{$subattid}", null, PARAM_INT);
         if (count($courseid) > 0) {
             foreach ($courseid as $cids) {
                 $ccradio = optional_param("CourseRadio{$subattid}{$cids}", null, PARAM_INT);
                 $ccvalue = 0;
                 if ($ccradio != null) {
                     $ccvalue = $ccradio;
                 }
                 // Creating a row in ContributedCourses table for each of courses having impact on improvement of sub-attribute.
                 G\newcontributedcourse($subattassessmentid, $cids, $ccvalue);
             }
         }
     }
     $datasaved = true;