<?php
$city = $weather_current[$adv_city_location];
$fin_wnd_dir = mb_strtoupper($city['wind_dir'], 'UTF-8');
$wnd_dir = str_split(mb_strtolower($city['wind_dir'], 'UTF-8'));
if(is_array($wnd_dir) && count($wnd_dir)>0) {
    $co_card = array("n" => tx("NORTH"), "e" => tx("EAST"), "s" => tx("SOUTH"), "w" => tx("WEST"));
    $fin_wnd_dir = "";
    foreach ($wnd_dir as $dir_letter) {
        if (array_key_exists($dir_letter, $co_card)) {
            $fin_wnd_dir .= mb_substr(tx($co_card[$dir_letter]), 0, 1);
        }
    }

    $fin_wnd_dir = mb_strtoupper($fin_wnd_dir, 'UTF-8');
}

//echo '<pre>', var_export($weather_fiveday[$city['ws_city_id']], true), '</pre>';

?>
<div class="weather_container_adv">
    <div class="wa-box">
        <div class="wa-header">
            <?php
            if(is_array($cities_list_link_title) && isset($cities_list_link_title[$city['location']])) {
                echo '<h2>' . tx("Weather in " . stripslashes($city['ws_city_name'])) . '</h2>';
            }
            else {
                echo tx($city['ws_city_name']);
            }
            ?>
        </div>

        <div class="wa-body container-fluid">
            <div class="row wa-row">
                <div class="col-sm-2 col-xs-5 no-padding">
                    <div class="wa-c1">
                        <span class="wa-current-text n-hidden-xs"><?php echo tx("CURRENT");?></span>

                        <div class="wa-current-t"><span><?php echo convert_temp($city['temp'], $c_to_f) . '&deg; ' . show_scale($city['temp_units'], $c_to_f);?></span></div>
                    </div>
                </div>
                <div class="col-sm-2 col-xs-5 no-padding">
                    <div class="wa-c2">
                        <span class="wa-current-phrase n-hidden-xs"><?php echo mb_strtoupper ( tx($city['phrase']), 'UTF-8');?></span>
                        <div class="m_icon"><img src="<?php echo $path;?>images/weather_icons/<?php echo $city['icon'];?>.png" alt="<?php echo $city['phrase'];?>" title="<?php echo $city['phrase'];?>" border="0"/></div>
                    </div>
                </div>
                <div class="col-sm-6 col-xs-10 wa-current-specs no-padding">
                    <div class="wa-c3">
                        <div class="row">
                            <div class="col-sm-5 no-padding">
                                <div class="col-xs-10">
                                    <span class="para_name pull-left"><?php echo tx("Visibility");?>:</span>
                                    <span class="para_value pull-right"><?php echo $city['vis'] . " " . $city['vis_unit'];?></span>
                                </div>
                            </div>
                            <div class="col-sm-5 no-padding">
                                <div class="col-xs-10">
                                    <span class="para_name pull-left"><?php echo tx("Wind speed");?>:</span>
                                    <span class="para_value pull-right"><?php echo $city['windspeed'] . " " . $city['windspeed_unit'];?></span>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-sm-5 no-padding">
                                <div class="col-xs-10">
                                    <span class="para_name pull-left"><?php echo tx("Pressure");?>:</span>
                                    <span class="para_value pull-right"><?php echo $city['pres'] . " " . $city['pres_unit'];?></span>
                                </div>
                            </div>
                            <div class="col-sm-5 no-padding">
                                <div class="col-xs-10">
                                    <span class="para_name pull-left"><?php echo tx("Wind direction");?>:</span>
                                    <span class="para_value pull-right"><?php echo $fin_wnd_dir ;?></span>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-5 no-padding">
                                <div class="col-xs-10">
                                    <span class="para_name pull-left"><?php echo tx("Humidity");?>:</span>
                                    <span class="para_value pull-right"><?php echo $city['rhumid'] . " " . $city['rhumid_unit'];?></span>
                                </div>
                            </div>
                            <div class="col-sm-5 no-padding">
                                <div class="col-xs-10">
                                    <span class="para_name pull-left"><?php echo tx("Wind Chill");?>:</span>
                                    <span class="para_value pull-right"><?php echo convert_temp($city['wndchl'], $c_to_f) . "&deg; " . show_scale($city['wndchl_unit'], $c_to_f);?></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>
</div>
