Пример #1
0
<?php

set_time_limit(0);
include 'func/db.php';
include 'func/generator.php';
include 'coursematch.php';
$courselist = array("BUAD-306", "BUAD-302", "PHYS-151Lg", "BISC-220Lg");
$coursematch = coursematch($courselist, $conn);
$colorarr = array("EF5350", "AB47BC", "5C6BC0", "039BE5", "009688", "689F38", "EF6C00", "795548", "EC407A");
$golden = $coursematch[5][0];
//print_r($golden);
$queue = array("U" => array(), "M" => array(), "T" => array(), "W" => array(), "H" => array(), "F" => array(), "S" => array(), "A" => array());
$listq = array();
foreach ($golden as $key) {
    foreach (str_split($key->days) as $jack) {
        if ($jack == "" || $key->time_start == "") {
            $jack = "A";
        }
        $top = $key->time_start == "" ? 0 : (convertToMin($key->time_start) / 60 - 6) * 50;
        $size = (strtotime($key->time_end) - strtotime($key->time_start)) / 60 / 60 * 50;
        $html = "<li class=\"event\" data-class=\"" . $key->class_id . "\" style=\"top:" . $top . "px;background-color:#" . $colorarr[array_search($key->class_id, $courselist)] . ";min-height:" . $size . "px\"><span><i>" . $key->type . "</i><br><b>" . $key->class_id . "</b></span><p>" . ($key->instructor != "" ? $key->instructor . "<br>" : "") . ($key->room != "" ? $key->room . "<br>" : "") . $key->section . ($key->time_start != "" ? "<br>" . $key->time_start . "-" . $key->time_end : "") . "</p></li>";
        $queue[$jack][] = $html;
    }
    $listq[$key->class_id][] = "<tr><td>" . $key->section . "</td><td>" . $key->type . "</td><td>" . $key->units . "</td><td>" . $key->time_start . "-" . $key->time_end . "</td><td>" . $key->days . "</td><td>" . $key->instructor . "</td><td>" . $key->room . "</td></tr>";
}
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
Пример #2
0
<?php

set_time_limit(0);
header('Content-Type: application/json');
include 'func/db.php';
include 'func/generator.php';
include 'coursematch.php';
$num = $_GET["time"];
//$num = 0;
$darr = $_GET["days"];
//$darr = "";
/*$num = 8;
$darr = "";*/
//$courselist = array("CSCI-103L","CSCI-109");
$courselist = $_GET["courselist"];
$coursematch = coursematch($courselist, $num, $darr, $conn);
$colorarr = array("EF5350", "AB47BC", "5C6BC0", "039BE5", "009688", "689F38", "EF6C00", "795548", "EC407A");
$queue = array();
foreach ($coursematch as $key => $possibility) {
    foreach ($possibility as $h => $s) {
        foreach ($s as $k) {
            if (count($courselist) > 1) {
                $z = $key;
            } else {
                if (count($courselist) == 1) {
                    $z = $h;
                }
            }
            $queue[$z][] = array("id" => $k->id, "class_id" => $k->class_id, "title" => $k->title, "type" => $k->type, "section" => $k->section, "time_start" => $k->time_start, "time_end" => $k->time_end, "days" => $k->days, "instructor" => $k->instructor, "room" => $k->room, "units" => $k->units, "top" => $k->time_start == "" ? 0 : (convertToMin($k->time_start) / 60 - 6) * 50, "size" => (strtotime($k->time_end) - strtotime($k->time_start)) / 60 / 60 * 50, "color" => $colorarr[array_search($k->class_id, $courselist)]);
        }
    }