first commit
This commit is contained in:
135
application/views/web/comm/weather_column_bar_inc.php
Executable file
135
application/views/web/comm/weather_column_bar_inc.php
Executable file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
$ci=& get_instance();
|
||||
|
||||
# t 날씨 가져오기
|
||||
$ci->load->model('web/m_t_weather');
|
||||
$arr_public_weather = $ci->m_t_weather->t_weather_all_list();
|
||||
|
||||
$weather_date = date("m.d");
|
||||
$arr_week = array("일","월","화","수","목","금","토");
|
||||
$weather_week = $arr_week[date('w')];
|
||||
|
||||
# 테마
|
||||
|
||||
$theme_types = array('8');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
$arr_today_column = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
$arr_today_column[$val['rank']] = array('title' => $val['title'], 'column_name'=> $val['column_name'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div class="cont_box" style="margin-top:10px;">
|
||||
<div id="public_weather" style="width:55%;float:left;display:none">
|
||||
<span class="box_title">오늘의 날씨</span>
|
||||
<span class="date"> <?=$weather_date?>(<?=$weather_week?>)</span>
|
||||
<ul id="public_weather_list" style="left: 140px;">
|
||||
<? foreach ($arr_public_weather as $val) { ?>
|
||||
<li style="height:45px;">
|
||||
<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query=%EB%82%A0%EC%94%A8" target="_blank"><span class="location"> <?=$val['location']?> </span>
|
||||
<span class="weather"><img src="<?=$val['weather_img']?>" width="22"></span>
|
||||
<span><?=$val['weather_status']?> / <?=$val['temperatures']?></span></a>
|
||||
</li>
|
||||
<? }?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="today_column" style="width:45%;display:none">
|
||||
<span class="current">오늘의 칼럼</span>
|
||||
<span style="position: absolute; top: 0; left: 70px;"><img src="/img/web/news_bar.gif" alt="" style="padding: 0 5px;margin-top: 16px;"></span>
|
||||
<ul style="top:0;">
|
||||
<?
|
||||
if(count($arr_today_column) > 0 ){
|
||||
foreach ($arr_today_column as $val) {
|
||||
$title = '['.$val['column_name'].'] '.$val['title'];
|
||||
$title = mb_strimwidth($title, '0', '38', '..', 'utf-8');
|
||||
?>
|
||||
<li style="height:45px; text-align: left;">
|
||||
<span class="related_news fr" style="width:230px;display: block; padding-left: 80px">
|
||||
<span><a href="/web/news/column_view/<?=$val['content_idx']?>"><?=$title?></a></span>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<?
|
||||
}
|
||||
}?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$("#today_column").show();
|
||||
$("#public_weather").show();
|
||||
$('#today_column').vTicker({ speed: 700 });
|
||||
$('#public_weather').vTicker({ speed: 700 });
|
||||
//user_position();
|
||||
});
|
||||
|
||||
function user_position() {
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition (function(position) {
|
||||
if(position) {
|
||||
user_weather(position.coords);
|
||||
}
|
||||
}, function (error) {
|
||||
console.error(error);
|
||||
}, {
|
||||
enableHighAccuracy: false,
|
||||
maximumAge: 0,
|
||||
timeout: Infinity
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function user_weather(position){
|
||||
var latitude = position.latitude;
|
||||
var longitude = position.longitude;
|
||||
if (latitude == undefined) latitude = '';
|
||||
if (longitude == undefined) longitude = '';
|
||||
|
||||
if (latitude != '' && longitude != '') {
|
||||
var form_data = {
|
||||
"latitude": latitude,
|
||||
"longitude": longitude
|
||||
};
|
||||
$.ajax({
|
||||
url: '/web/comm/weather_view',
|
||||
async: true,
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: form_data,
|
||||
success: function (rtnJson) {
|
||||
if (rtnJson.code == "0000") {
|
||||
var result = rtnJson.data;
|
||||
content = '<li style="height:45px;"><a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query=%EB%82%A0%EC%94%A8" target="_blank"><span class="location">' +result.location+ '</span>';
|
||||
content+= '<span class="weather"><img src="'+result.weather_img+'" width="22"></span>';
|
||||
content+= '<span>' + result.weather_status + ' / ' + result.temperatures + '</span></a></li>';
|
||||
|
||||
$("#public_weather_list").prepend(content);
|
||||
|
||||
} else {
|
||||
alert("데이터 로드에 실패했습니다.");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (rtnJson) {
|
||||
alert('데이터 로드에 실패했습니다.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user