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

        $shpgrads = "";
    while (($line = fgetcsv($f)) !== false) {
        $fn = $line[1];
        $ln = $line[3];
        $pac = $line[6];
        $plandesc = $line[9];
        $honorestimate = $line[5];
        $degreelevel = $line[10];
		
        if ($pac == "HTM") {
            if ($degreelevel == "BA" ||  $degreelevel == "BS" ||  $degreelevel == "BE" || $degreelevel == "BFA") {
                $shpgrads .= "<div class='grad'><p>".$fn." ".$ln;
                    if ($honorestimate != '') {
                        if ($honorestimate == "MAGNA") {
                            $shpgrads .= "<span class='honorestimate m-c'>M</span></p></div>";
                        }
                        if ($honorestimate == "SUMMA") {
                            $shpgrads .= "<span class='honorestimate s-c'>S</span></p></div>";
                        }
                        if ($honorestimate == "LAUDE") {
                            $shpgrads .= "<span class='honorestimate l-c'>L</span></p></div>";
                        }
            } else {
                $shpgrads .= "</p></div>";
            }
            }
			
        }
	}
	echo "<section class='gradsection'><h4>School of Health Professions</h4>". $shpgrads . "</section>";
    echo "</section>";
    fclose($f);
    ?>