<?php
        $f = fopen("https://stonybrook.edu/__admin-units/commencement/data/commencement_data_2026_05_11.csv", "r");
        echo "<section class='graduates' id='graduates'>";

        $amsgrads = "";
        $amskoreagrads = "";
        $biomedenggrads = "";
        $chemmolecenggrads = "";
        $civilenggrads = "";
        $compenggrads = "";
        $compscigrads = "";
        $compscikoreagrads = "";
        $elecenggrads = "";
        $engscigrads = "";
        $infosysgrads = "";
        $mechenggrads = "";
        $mechengkoreagrads = "";
        $techsysmgmtgrads = "";
        $techsysmgmtkoreagrads = "";

        while (($line = fgetcsv($f)) !== false) {
            $fn = $line[1];
            $ln = $line[3];
            $pac = $line[6];
            $plandesc = $line[9];
            $honorestimate = $line[5];
            $degreelevel = $line[10];

            if ($plandesc == "Applied Mathematics and Statistics") {
                if ($degreelevel == "BS" ||  $degreelevel == "BA") {
                    $amsgrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $amsgrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $amsgrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $amsgrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $amsgrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Applied Mathematics and Statistics SUNY Korea") {
                if ($degreelevel == "BS" ||  $degreelevel == "BA") {
                    $amskoreagrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $amskoreagrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $amskoreagrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $amskoreagrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $amskoreagrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Biomedical Engineering") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $biomedenggrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $biomedenggrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $biomedenggrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $biomedenggrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $biomedenggrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Chemical and Molecular Engineering") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $chemmolecenggrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $chemmolecenggrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $chemmolecenggrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $chemmolecenggrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $chemmolecenggrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Civil Engineering") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $civilenggrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $civilenggrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $civilenggrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $civilenggrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $civilenggrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Computer Engineering") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $compenggrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $compenggrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $compenggrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $compenggrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $compenggrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Computer Science") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $compscigrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $compscigrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $compscigrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $compscigrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $compscigrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Computer Science SUNY Korea") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $compscikoreagrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $compscikoreagrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $compscikoreagrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $compscikoreagrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $compscikoreagrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Electrical Engineering") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $elecenggrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $elecenggrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $elecenggrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $elecenggrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $elecenggrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Engineering Science") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $engscigrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $engscigrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $engscigrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $engscigrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $engscigrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Information Systems") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $infosysgrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $infosysgrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $infosysgrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $infosysgrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $infosysgrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Mechanical Engineering") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $mechenggrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $mechenggrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $mechenggrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $mechenggrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $mechenggrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Mechanical Engineering SUNY Korea") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $mechengkoreagrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $mechengkoreagrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $mechengkoreagrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $mechengkoreagrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $mechengkoreagrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Technological Systems Management") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $techsysmgmtgrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $techsysmgmtgrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $techsysmgmtgrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $techsysmgmtgrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $techsysmgmtgrads .= "</p></div>";
                    }
                }
            }
            if ($plandesc == "Technological Systems Management SUNY Korea") {
                if ($degreelevel == "BS" ||  $degreelevel == "BE") {
                    $techsysmgmtkoreagrads .= "<div class='grad'><p>" . $fn . " " . $ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $techsysmgmtkoreagrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $techsysmgmtkoreagrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $techsysmgmtkoreagrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
                    } else {
                        $techsysmgmtkoreagrads .= "</p></div>";
                    }
                }
            }
        }
        echo "<section class='gradsection'><h4>Applied Mathematics and Statistics</h4>" . $amsgrads . "</section>";
        echo "<section class='gradsection'><h4>Applied Mathematics and Statistics SUNY Korea</h4>" . $amskoreagrads . "</section>";
        echo "<section class='gradsection'><h4>Biomedical Engineering</h4>" . $biomedenggrads . "</section>";
        echo "<section class='gradsection'><h4>Chemical and Molecular Engineering</h4>" . $chemmolecenggrads . "</section>";
        echo "<section class='gradsection'><h4>Civil Engineering</h4>" . $civilenggrads . "</section>";
        echo "<section class='gradsection'><h4>Computer Engineering</h4>" . $compenggrads . "</section>";
        echo "<section class='gradsection'><h4>Computer Science</h4>" . $compscigrads . "</section>";
        echo "<section class='gradsection'><h4>Computer Science SUNY Korea</h4>" . $compscikoreagrads . "</section>";
        echo "<section class='gradsection'><h4>Electrical Engineering</h4>" . $elecenggrads . "</section>";
        echo "<section class='gradsection'><h4>Engineering Science</h4>" . $engscigrads . "</section>";
        echo "<section class='gradsection'><h4>Information Systems</h4>" . $infosysgrads . "</section>";
        echo "<section class='gradsection'><h4>Mechanical Engineering</h4>" . $mechenggrads . "</section>";
        echo "<section class='gradsection'><h4>Mechanical Engineering SUNY Korea</h4>" . $mechengkoreagrads . "</section>";
        echo "<section class='gradsection'><h4>Technological Systems Management</h4>" . $techsysmgmtgrads . "</section>";
        echo "<section class='gradsection'><h4>Technological Systems Management SUNY Korea</h4>" . $techsysmgmtkoreagrads . "</section>";
        echo "</section>";
        fclose($f);
        ?>