//echo "Exam is Over - Exam Part II: Implementation! Available <br/>";
     examStatus($record,array(5),$exam_length);
 }else{
     // Starttime to + 30 mins
     examStatus($record,array(4),$exam_length);
 }
 
 //echo  "</td></tr>";
 // echo  "<tr><td colspan='2'>";
 //displayExamInfo($record, $exam_length);
 
 echo  "</td></tr>";
 */
 // If 30 minutes after the Exam Started - make Practical Intructions available (disable Exam)
 // add 30 minutes (7000 seconds) (His)
 if ($record->attemptid != null && isAttemptClosed($record->quizid, $USER->id, $record->attemptid) || $now > $starttime + $exam_length * 60) {
     $currentExam .= "<tr><td colspan='2'>";
     // Check if active record
     $currentExam .= checkActiveExam($record, $anchor_record, examStatus($record, array(5), $exam_length, true));
     //$currentExam .= examStatus($record,array(5),$exam_length,true);
     $currentExam .= "</td></tr>";
     $currentExam .= "<tr><td valign='top'>";
     //$currentExam .=  $record->attemptid."<br/>";
     //$currentExam .=  $record->starttime."<br/>";
     //$currentExam .=  $record->endtime."<br/>";
     //$currentExam .=  $record->status."<br/>";
     $opts = array('courseid' => $course->id, 'eid' => $record->id, 'view' => 1);
     $url = "/question/view_instructions.php?courseid={$course->id}&eid={$record->id}&view=1";
     //$currentExam .= print_single_button("$CFG->wwwroot/question/view_instructions.php", $opts, 'Exam Orientation', 'get', '', true, '', false);
     //element_to_popup_window($type=null, $url=null, $name=null, $linkname=null,$height=400, $width=500, $title=null,$options=null, $return=false, $id=null, $class=null)
     $currentExam .= element_to_popup_window("button", $url, "orientation", "Exam Orientation", 900, 800, "Exam Orientation", true, true);

                    <?php 
                    echo "<table border='0' cellpadding='5' cellspacing='5' width='650px'>";
                    echo "<tr><td valign='top'>";
                    echo replace_keywords_view($eqc->contextid, $instructions->text, $course, $qca) . "<br/><br/>";
                    echo "</td></tr>";
                    echo "<tr><td align='right'>";
                    echo "<div id='attemptoption1' style='display: ;'>";
                    //print_single_button('', null, 'Exam Part I: Concepts!', 'get', '', false, '', true);
                    echo "</div>";
                    echo "<div id='attemptoption2' style='display: none;'>";
                    $options = array('courseid' => $param->courseid, 'view' => 2, 'eid' => $param->eid);
                    $practical = print_single_button($url, $options, 'Exam Part II: Implementation!', 'get', '', true, '', false);
                    // Check if Attempt is closed.
                    if ($qca->attemptid != null && isAttemptClosed($eqc->quizid, $USER->id, $qca->attemptid)) {
                        echo "<font color='green'><b>Exam Part I: Concepts</b> has been submitted.</font><br/>";
                        echo $practical;
                    }
                    /*else{
                          if($qca->attemptid != null){
                              $examoptions = array('q'=>$eqc->quizid);
                              print_single_button("$CFG->wwwroot/mod/quiz/attempt.php", $examoptions, 'Exam Part I: Concepts!', 'get', '', false, '', false);
                          }else{
                              $examoptions = array('forcenew'=>1,'q'=>$eqc->quizid);
                              print_single_button("$CFG->wwwroot/mod/quiz/attempt.php", $examoptions, 'Exam Part I: Concepts!', 'get', '', false, '', false);
                          }
                      }
                      */
                    echo "</div>";
                    echo "</td></tr>";