<?php

$optres['css'][] = $module_css_path . 'amodules/pharm_module/css/pharm_module.css';
//$s = implode("", @file($path."/acrons/pharmacy/pharmacy.php"));

$s = file_get_contents(dirname(__FILE__) . "/../../acrons/pharmacy/pharmacy.php");
$file_timestamp = filemtime(dirname(__FILE__)."/../../acrons/pharmacy/pharmacy.php");
$data = unserialize($s);


foreach($data as $d) {
    ?>
    <div class="text-right"><small>Last updated on: <?= date("d/m/Y H:i:s", $file_timestamp);?></small></div>

    <section class="pharmacy-mod box box-primary box-solid">
        <header class="box-header">
            <h2><?= ucfirst($d['city']); ?> Night Pharmacies</h2>
        </header>
        <div class="box-body no-padding">
            <div class="pharmacy-box list-group">
            <?php
            $num = count($d['name']);
            for ($i = 0; $i < $num; $i++) {
                ?>

                    <div class="list-group-item">
                        <div class="list-group-item-heading">
                            <b><?= $d['name'][$i]; ?></b>
                        </div>
                        <div class="list-group-item-text">
                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="pharmacy-phones">
                                        <i class="fa fa-plus-square fa-fw text-primary"></i>
                                        <?php
                                        $pharmacy_phone = $d['phwork'][$i];
                                        echo substr($pharmacy_phone, 0, 2)." ".substr($pharmacy_phone, 2, 3)." ".substr($pharmacy_phone,5);
                                        ?>
                                        <br><i class="fa fa-home fa-fw"></i>
                                        <?php
                                        $pharmacy_phone = $d['phhome'][$i];
                                        echo substr($pharmacy_phone, 0, 2)." ".substr($pharmacy_phone, 2, 3)." ".substr($pharmacy_phone,5);
                                        ?>
                                    </div>
                                </div>
                                <div class="col-sm-7">
                                    <div class="pharmacy-address">
                                        <b><i class="fa fa-map-marker fa-fw"></i>  Address:</b> <br><?= $d['addr'][$i]; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>



                <?php
            }
            ?>
            </div>
        </div>
    </section>
    <br>
    <?php
}