Exemple #1
0
        }
    }
    return false;
}
?>
	
	<table id="studentTable">
		<tr><th>EXAM TYPE</th><th>ROOM</th><th>STUDENT COUNT</th><th>DATE</th><th>TIME</th></tr>
		<?php 
if ($this->examOptions) {
    foreach ($this->examOptions as $key => $value) {
        echo '<tr>';
        echo '<td>' . htmlentities($value->exam_type) . '</td>';
        echo '<td>' . htmlentities($value->location) . '</td>';
        echo '<td>' . htmlentities($value->student_count) . '</td>';
        echo '<td>' . htmlentities($value->date) . '</td>';
        echo '<td>' . htmlentities($value->time) . '</td>';
        if (isEnrolled($value->student_exam_id, $this->pastExams)) {
            echo '<td><input type="button" onClick="handleUnregister(' . $value->student_exam_id . ')" value="Unregister"/></td>';
        } else {
            echo '<td><input type="button" onClick="handleEnrollment(' . $value->id . ')" value="Enroll" /></td>';
        }
        echo '</tr>';
    }
} else {
    echo 'No exams have been scheduled yet.';
}
?>
	</table>	
			
</body>
Exemple #2
0
	
	
	<ul id="availableExamTypes">
		<?php 
function isEnrolled($exam_type, $pastExams)
{
    foreach ($pastExams as $key => $value) {
        if ($value->exam_type == $exam_type) {
            return true;
        }
    }
    return false;
}
if ($this->examTypes) {
    foreach ($this->examTypes as $key => $value) {
        if (isEnrolled($value->id, $this->pastExams)) {
            echo '<li class="enrolled">';
        } else {
            echo '<li>';
        }
        echo htmlentities($value->type) . '</li>';
    }
}
?>
	</ul>
	
	<br><br>
		
	<input id="buttonEnroll" type="button" value='Enroll'  />
	
	</div>