<?php ini_set("allow_url_fopen", 1); include "header.php"; $jsonlang = json_decode(file_get_contents($url."/API/request.php?type=string&subtype=school"), true); ?>

<section class="content">
    <div class="container-fluid">
        <div class="block-header">
            <h2>ISKOLÁK</h2>
        </div>
        <div class="row clearfix">
            <div class="alert alert-warning text-center"><span class="font-bold" style="color: rgb(57, 57, 57);">Az itt található adatok az intézmények beleegyezése nélkül lettek feltöltve, tesztelés céljából.</span></div>
            <div class="list-group">
                <?php
                    $json = json_decode(file_get_contents($url."/API/request.php?type=schools"), true);
                    for($i = 0; $i<count($json); $i++) {
                        if($json[$i]["name"] != ""){
                            for($j = 0; $j<count($jsonlang); $j++) {
                                if($jsonlang[$j]["abbr"] == $json[$i]["type"]){
                                    $fulltype = $jsonlang[$j]["hun"];
                                    break;
                                }
                            }
                            echo '
                                <a class="listitem list-group-item waves-effect" href="'.$curdir.'school.php?id='.$json[$i]["id"].'">
                                    <table>
                                        <td><img class="listitemimg squircle" src="'.$url.'/API/request.php?type=image&subtype=school&id='.$json[$i]["id"].'"></td>
                                        <td><b>'.$json[$i]["name"].'</b><br>'.$json[$i]["location"].'<br>'.$fulltype.'</b></td>
                                    </table>
                                 </a>';
                        }
                    }
                ?>
            </div>
        </div>
    </div>
</section>

<?php include "footer.php"; ?>