function printReports() { if (isset($_GET['id'])) { if (isset($_GET['id']) && trim($_GET['id']) !== '') { //if class name is set and not empty $class_id = get_class_id($_GET['id']); echo "<div class=\"row\">"; echo "<div class=\"col-md-4\">"; echo "<h1>Average Memory Easy " . get_average_score($_GET['id'], "memory", "easy") . "</h1>"; echo "<h1>Average Memory medium " . get_average_score($_GET['id'], "memory", "medium") . "</h1>"; echo "<h1>Average Memory hard " . get_average_score($_GET['id'], "memory", "hard") . "</h1>"; echo "<h1>Average maths Easy " . get_average_score($_GET['id'], "maths", "easy") . "</h1>"; echo "<h1>Average maths medium " . get_average_score($_GET['id'], "maths", "medium") . "</h1>"; echo "<h1>Average maths hard " . get_average_score($_GET['id'], "maths", "hard") . "</h1>"; echo "<h1>Average spelling Easy " . get_average_score($_GET['id'], "spelling", "easy") . "</h1>"; echo "<h1>Average spelling medium " . get_average_score($_GET['id'], "spelling", "medium") . "</h1>"; echo "<h1>Average spelling hard " . get_average_score($_GET['id'], "spelling", "hard") . "</h1>"; echo "</div>"; echo "<div class=\"col-md-4\">"; echo "<h1>Class Average Memory Easy " . get_class_average($class_id, "memory", "easy") . "</h1>"; echo "<h1>Class Average Memory medium " . get_class_average($class_id, "memory", "medium") . "</h1>"; echo "<h1>Class Average Memory hard " . get_class_average($class_id, "memory", "hard") . "</h1>"; echo "<h1>Class Average maths Easy " . get_class_average($class_id, "maths", "easy") . "</h1>"; echo "<h1>Class Average maths medium " . get_class_average($class_id, "maths", "medium") . "</h1>"; echo "<h1>Class Average maths hard " . get_class_average($class_id, "maths", "hard") . "</h1>"; echo "<h1>Class Average spelling Easy " . get_class_average($class_id, "spelling", "easy") . "</h1>"; echo "<h1>Class Average spelling medium " . get_class_average($class_id, "spelling", "medium") . "</h1>"; echo "<h1>Class Average spelling hard " . get_class_average($class_id, "spelling", "hard") . "</h1>"; echo "</div>"; echo "<div class=\"col-md-4\">"; echo "<h1>Highest Memory Easy " . get_students_highest_Score($_GET['id'], "memory", "easy") . "</h1>"; echo "<h1>Highest Memory medium " . get_students_highest_Score($_GET['id'], "memory", "medium") . "</h1>"; echo "<h1>Highest Memory hard " . get_students_highest_Score($_GET['id'], "memory", "hard") . "</h1>"; echo "<h1>Highest maths Easy " . get_students_highest_Score($_GET['id'], "maths", "easy") . "</h1>"; echo "<h1>Highest maths medium " . get_students_highest_Score($_GET['id'], "maths", "medium") . "</h1>"; echo "<h1>Highest maths hard " . get_students_highest_Score($_GET['id'], "maths", "hard") . "</h1>"; echo "<h1>Highest spelling Easy " . get_students_highest_Score($_GET['id'], "spelling", "easy") . "</h1>"; echo "<h1>Highest spelling medium " . get_students_highest_Score($_GET['id'], "spelling", "medium") . "</h1>"; echo "<h1>Highest spelling hard " . get_students_highest_Score($_GET['id'], "spelling", "hard") . "</h1>"; echo "</div>"; echo "</div>"; echo "<div class=\"row\">"; echo "<div class=\"col-md-4\">"; $score = get_class_highest_Score($class_id, "memory", "easy"); echo "<h1>Class Highest Memory Easy" . $score['score'] . " " . $score['first_name'] . " " . $score['last_name'] . "</h1>"; echo "</div>"; echo "<div class=\"col-md-4\">"; echo "</div>"; echo "<div class=\"col-md-4\">"; echo "</div>"; echo "</div>"; } } }
function add_product($productArray) { $dbh = new PDOConnection(); $code = $productArray['code']; $description = $productArray['description']; $price = $productArray['price']; $class_id = $productArray['class_id']; if (check_product_exists($dbh, $class_id)) { throw new Exception("Product code already exists"); } $class_id = get_class_id($dbh, $class_id); $query = "INSERT INTO products(description,code,price,class) VALUES(:description,:code,:price,:class_id)"; $sth = $dbh->prepare($query); $parameters = array(':description' => $description, ':code' => $code, ':price' => $price, ':class_id' => $class_id); if (!$sth->execute($parameters)) { throw new Exception($sth->errorInfo()[2]); } return array('id' => $dbh->lastInsertId()); }
?> <tr bgcolor='#F2F2F2'> <th bgcolor='#EDEEFE' font="Arial"><font face='Arial, Helvetica, sans-serif' size='1'><?php echo date('h:i A', strtotime($times[$i])); ?> </th> <?php for ($j = 0; $j < $day_count; $j++) { $loaded_day_ID = $j + 1; $start = $times[$i]; $end = $times[$i + 1]; $schedule_id = student_loaded($reg_no, $start, $end, $loaded_day_ID, 1); //1 is current semester //$schedule_id = block_loaded($block_id, $start, $end, $loaded_day_ID,1); //1 is current semester //$schedule_id = block_loaded($block_id, $start, $end, $loaded_day_ID,1); //1 is current semester $loaded_class_id = get_class_id($schedule_id, 1); //to retrieve from actual table if ($loaded_class_id != "") { $slots = get_slots($schedule_id); if (is_first($schedule_id, $start)) { ?> <th bgcolor="#dadada" class="loaded" rowspan="<?php echo $slots; ?> " onclick="show_ticket(<?php echo $schedule_id; ?> )"> <?php $query_subject = mysql_query("SELECT subject_t.subject_title FROM subject_t, class_t \n WHERE subject_t.subject_code=class_t.subject_code\n AND class_t.class_id={$loaded_class_id}") or die(mysql_error()); $row_subject = mysql_fetch_assoc($query_subject); echo "<small>" . $row_subject['subject_title'] . "</small>";
?> <th class="color<?php echo $class_color[$loaded_class_id]; ?> loaded" rowspan="<?php echo $slots; ?> "> <?php $query_subject = mysql_query("SELECT subject_t.subject_title FROM subject_t, class_t \n\t\t\t\t\t\t\t\t\t\t WHERE subject_t.subject_code=class_t.subject_code\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t AND class_t.class_id={$loaded_class_id}") or die(mysql_error()); $row_subject = mysql_fetch_assoc($query_subject); echo $row_subject['subject_title'] . ""; // $slots ?> <a data-toggle="modal" href="#edit_modal" onClick="toggle_edit('<?php echo $schedule_id . "-" . get_class_id($schedule_id, 0); ?> ')" ><i style="padding:0;margin:0" class="icon-cog"></i></a> </th><?php } ?> <?php } else { ?> <th></th> <?php } } echo "</tr>"; }
window.setTimeout(function() { $(".alert-success").fadeTo(500, 0).slideUp(500, function(){ $(this).remove(); }); }, 2000); $('#gr1').popover(); $('#gr2').popover(); $('#gr3').popover(); $('#low').popover(); }); </script> <!-- page script --> <script> $(function () { <?php $class_id = get_class_id($student_id); ?> var memeasy = <?php echo get_average_score($student_id, "memory", "easy"); ?> ; var memmed = <?php echo get_average_score($student_id, "memory", "medium"); ?> ; var memhard = <?php echo get_average_score($student_id, "memory", "hard"); ?> ; var spelleasy = <?php echo get_average_score($student_id, "spelling", "easy");