<commit_before><?php
// this first php block initializes the variables used by the page

require_once dirname(__FILE__)."/../../API/Utility.php";
require_once dirname(__FILE__)."/../../API/Admin.php";
require_once dirname(__FILE__)."/../../Query/Availability.php";
require_once dirname(__FILE__)."/../../Query/Student.php";
//require_once dirname(__FILE__)."/../../Query_retrieve_availability_for_term.php";
//require_once('process_availability_submission.php');
// require_once('../../Query_retrieve_shift_preference.php');

//  Database connection
if (!($CONNECTION = fido_db_connect())) {
    echo "<p>Connection Failed</p>\n";
    exit();
}

//simulating user session
if(empty($_SERVER['PHP_AUTH_USER'])) {
    $_SERVER['PHP_AUTH_USER'] = "ealkadi";
}

//these arrays will be used for generating the calendar grid
$hours = array(
    '8'  => '8:00AM - 9:00AM',
    '9'  => '9:00AM - 10:00AM',
    '10' => '10:00AM - 11:00AM',
    '11' => '11:00AM - 12:00PM',
    '12' => '12:00PM - 1:00PM',
    '13'  => '1:00PM - 2:00PM',
    '14'  => '2:00PM - 3:00PM',
    '15'  => '3:00PM - 4:00PM',
    '16'  => '4:00PM - 5:00PM',
    '17'  => '5:00PM - 6:00PM'
);
$days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');

?>


<html>
    <head>
        <title>View Availability</title>
    </head>
    <body>
        <div class='container'>
            <a href="../login_home.php">Return Home</a><br>
            <!--<h1>USING Cody's DB</h1>-->
            
<?php

//generate the dropdown form for selecting a term to submit availability for
echo "<form action=\"" . htmlentities($_SERVER['PHP_SELF']) . "\" method=\"post\">\n";
echo "<label>Select which term you would like to view availabilities for</label><br>\n";
$selected_term = dropdown_select_term("termSelect");
echo "<input type=\"submit\" name=\"termSelect\" value=\"Select\" />\n";
echo "</form>\n";

// page wrapper statement, we dont want to load the availability blocks until a term is selected
if (!empty($selected_term)) {

    $term_id = (int)$selected_term['term_id'];
    $info = retrieve_availability_for_term($term_id);
    $db_blocks = array();
    $pref_info = array();
    $students = array();
    //get all the availabilities and shift prefs ready to be echoed
    if ($info) {
        foreach ($info as $data) {
          if(pg_fetch_all($data)){
            foreach(pg_fetch_all($data) as $student_id => $student){
              $id = $student['block_day'] . $student['block_hour'];
              $uname = $student['student_username'];
              $pref = $student['block_preference']; 
              if(!in_array($uname, $students)){
                $res = get_student_id_by_username($uname);
                $arr = pg_fetch_array($res);
                $student_id = $arr['student_id'];<commit_msg>US211: applied bootstrap to term selector<commit_after><?php
// this first php block initializes the variables used by the page

require_once dirname(__FILE__)."/../../API/Utility.php";
require_once dirname(__FILE__)."/../../API/Admin.php";
require_once dirname(__FILE__)."/../../Query/Availability.php";
require_once dirname(__FILE__)."/../../Query/Student.php";
//require_once dirname(__FILE__)."/../../Query_retrieve_availability_for_term.php";
//require_once('process_availability_submission.php');
// require_once('../../Query_retrieve_shift_preference.php');

//  Database connection
if (!($CONNECTION = fido_db_connect())) {
    echo "<p>Connection Failed</p>\n";
    exit();
}

//simulating user session
if(empty($_SERVER['PHP_AUTH_USER'])) {
    $_SERVER['PHP_AUTH_USER'] = "ealkadi";
}

//these arrays will be used for generating the calendar grid
$hours = array(
    '8'  => '8:00AM - 9:00AM',
    '9'  => '9:00AM - 10:00AM',
    '10' => '10:00AM - 11:00AM',
    '11' => '11:00AM - 12:00PM',
    '12' => '12:00PM - 1:00PM',
    '13'  => '1:00PM - 2:00PM',
    '14'  => '2:00PM - 3:00PM',
    '15'  => '3:00PM - 4:00PM',
    '16'  => '4:00PM - 5:00PM',
    '17'  => '5:00PM - 6:00PM'
);
$days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');

?>


<html>
    <head>
        <link href="../../css/bootstrap_current/css/bootstrap.min.css" rel="stylesheet">
        <title>View Availability</title>
    </head>
    <body>
        <div class='container'>
            <br>
            <div class="row">
                <a class="btn btn-primary" href="../login_home.php">Return Home</a><br>
                <h1>View Availability Submissions</h1>
            </div>
            <!--<h1>USING Cody's DB</h1>-->
            <div class="row">
<?php

//generate the dropdown form for selecting a term to submit availability for
echo "<form class=\"form-inline\" action=\"" . htmlentities($_SERVER['PHP_SELF']) . "\" method=\"post\">\n";
$selected_term = dropdown_select_term("termSelect");
echo "<input class=\"btn btn-default\" type=\"submit\" name=\"termSelect\" value=\"Select\" />\n";
echo "</form>\n";
?>

            </div>
            <hr>

<?php
// page wrapper statement, we dont want to load the availability blocks until a term is selected
if (!empty($selected_term)) {

    $term_id = (int)$selected_term['term_id'];
    $info = retrieve_availability_for_term($term_id);
    $db_blocks = array();
    $pref_info = array();
    $students = array();
    //get all the availabilities and shift prefs ready to be echoed
    if ($info) {
        foreach ($info as $data) {
          if(pg_fetch_all($data)){
            foreach(pg_fetch_all($data) as $student_id => $student){
              $id = $student['block_day'] . $student['block_hour'];
              $uname = $student['student_username'];
              $pref = $student['block_preference']; 
              if(!in_array($uname, $students)){
                $res = get_student_id_by_username($uname);
                $arr = pg_fetch_array($res);
                $student_id = $arr['student_id'];
{'fraction_non_alphanumeric': 0.19028202514441048, 'fraction_numerical': 0.030071355759429153, 'mean_word_length': 2.980392156862745, 'pattern_counts': {'":': 0, '<': 56, '<?xml version=': 0, '>': 76, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5537813', 'n_tokens_mistral': 2069, 'n_tokens_neox': 1914, 'n_words': 425}