<?php 

function _tf_mock_exam_gradebook_score($items, $key, $table_obj) {
	$html = "<input onclick=\"$(this).select()\" data-student-id=".$items['id']." name=\"result[".$items['id']."]\" class=\"form-control numbers-onlyx gradebook-input text-center input-".$items['id']."\" value=\"";
	if(isset($table_obj->results)) {
		if(isset($table_obj->results[$items['id']])) {
			$html .= $table_obj->results[$items['id']];
		} else $html .= "x";
	} else $html .= "x";
	$html .= "\" type=\"text\">";
	return $html;
}

function _tf_mock_exam_gradebook_grade($items, $key, $table_obj) {
	$html = "<div id=\"grade-".$items['id']."\" class=\"text-center\" data-grades='".json_encode($table_obj->grades)."'>";
	foreach ($table_obj->grades as $grade) {
		if($table_obj->results[$items['id']] >= $grade['min'] && $table_obj->results[$items['id']] <= $grade['max']) {
			$html .= $grade['grade'];
		}
	}
	$html .= "</div>";
	return $html;
}