=4 && date("n") <=12){ $nendo = date("Y")+1; } } $gakkou_id_array['gakkou_id'][$gakkou_id] = $gakkou_id; $gakkou_id_array['nendo'][$gakkou_id] = $nendo; $gakkou_id_array['ad_url'][$gakkou_id] = $r_ad_url; } //今年度より-1以上まで if(date("n") <= 3){ $base_nendo = date("Y") -1; } else { $base_nendo = date("Y"); } $today = date("Y-m-d"); //sanpou01に接続 require_once($dir."/lib/common/cnct_sp01.php"); $conn = dbConnect_sanpou01(); //■プレビュー時はプレビューデータのみを検索する。この場合、公開・非公開は条件に入れない。 $sql = "SELECT * FROM gs_gakkou_top_info_nendo ,gs_gakkou_user_mt WHERE (gs_gtop_preview_flag = '0') AND (gs_gtop_gakkou_id = gs_gu_gakkou_id ) AND (gs_gu_mukou_flag = '0') AND (gs_gtop_gakkou_id in (".implode(",",$gakkou_id_array['gakkou_id']).")) AND (gs_gtop_nendo >= '{$base_nendo}' ) AND (gs_gtop_message_date <= '{$today}' ) ORDER BY gs_gtop_message_date DESC,gs_gtop_koushin_timestamp DESC"; $res = mysql_query($sql, $conn) or die("(7).$db_err_message".$sql); //■SQL実行 $html = ""; $i = 0; $type_icon_array = array("01"=>"college","02"=>"junior_college","03"=>"specialty","04"=>"other"); //■変数に格納する。 while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { //学校紹介の年度と同じでテキストに入力されている学校 if($gakkou_id_array['nendo'][$row["gs_gtop_gakkou_id"]] == $row["gs_gtop_nendo"] && $row["gs_gtop_message_text"]){ $gs_gakkou_mei[] = mb_convert_encoding(mb_convert_encoding($row["gs_gu_gakkou_mei"],"sjis-win","EUC-JP"),"UTF-8","sjis-win"); //■学校名 $wk_gakkou_mei = mb_convert_encoding(mb_convert_encoding($row["gs_gu_gakkou_mei"],"sjis-win","EUC-JP"),"UTF-8","sjis-win"); $gs_gtop_gakkou_id[] = $row["gs_gtop_gakkou_id"]; //■学校ID $gs_gtop_message_date[] = $row["gs_gtop_message_date"]; //■メッセージ更新日 $gs_gtop_message_text[] = mb_convert_encoding(mb_convert_encoding($row["gs_gtop_message_text"],"sjis-win","EUC-JP"),"UTF-8","sjis-win"); //■メッセージ文章 $wk_gtop_message_text = mb_convert_encoding(mb_convert_encoding($row["gs_gtop_message_text"],"sjis-win","EUC-JP"),"UTF-8","sjis-win"); $gs_stop_message_nendo[] = $row["gs_gtop_nendo"]; //■年度 $gs_gtop_koushin_timestamp[] = $row["gs_gtop_koushin_timestamp"]; //■更新日時 $gs_gu_gakkou_kubun[] = $gakkou_kubun_array[$row['gs_gu_gakkou_kubun']]; //■学校区分 $koushin_date = sprintf("%d/%d更新",substr($row["gs_gtop_message_date"],5,2),substr($row["gs_gtop_message_date"],-2)); //今日だったらnewアイコン $new_icon = ""; /* if($row['gs_gtop_message_date'] == $today){ $new_icon = " \"new\" "; } else { $new_icon = ""; }*/ //TOPページ if($type != ""){ //学校名のかっこ以降はとる if(strstr($wk_gakkou_mei,"(")){ $short_name = str_replace(strstr($wk_gakkou_mei,"("),"",$wk_gakkou_mei); } else if(strstr($wk_gakkou_mei,"(")){ $short_name = str_replace(strstr($wk_gakkou_mei,"("),"",$wk_gakkou_mei); } else { $short_name = $wk_gakkou_mei; } //$html = "
\"{$row['gs_gu_gakkou_mei']}\""; $wk_gtop_message_text = str_replace(array("
","\r\n","\r","\n"),"",nl2br($wk_gtop_message_text)); $html = "
{$short_name}({$koushin_date}{$new_icon})
"; $html .= "
".str_replace(" ","",mb_substr($wk_gtop_message_text,0,50))."…
"; //一覧ページ } else { /*$html = "
\n
\n"; $html .= "".$row["gs_gu_gakkou_mei"]."".str_replace("-",".",$row['gs_gtop_message_date'])."更新 {$new_icon} \n"; $html .= "\"{$gakkou_kubun_array[$row['gs_gu_gakkou_kubun']]}\"
\n"; $html .= "
\"{$row['gs_gu_gakkou_mei']}\"\n"; $html .= "

".mb_substr(trim($row["gs_gtop_message_text"]),0,150)."…

\n"; $html .= "
\n";*/ $html = "
  • ".str_replace("-",".",$row['gs_gtop_message_date'])."更新 {$new_icon}
    \n"; $html .= $wk_gakkou_mei."
    \n"; $html .= "".str_replace(" ","",mb_substr(trim($wk_gtop_message_text),0,124))."…
  • \n"; //$html = mb_convert_encoding($html,"UTF-8","EUC-JP"); } $date_array[] = $html; $i++; //最新20件まで if($i == 30){ break; } } } //■■■DB切断 mysql_close($conn); return $date_array; } function Geteventup($type=null){ //DB接続 $dir = str_replace(strstr(__FILE__,"/web/"),"",__FILE__); require_once($dir."/lib/common/cnct_sp01.php"); $conn = dbConnect_sanpou01(); if($type == "beauty"){ $bunya_sql = " AND (e.evt_keitou_bunya_list like '%0304%' OR e.evt_keitou_bunya_list like '%0404%') "; //フード系統 }elseif($type == "food"){ //0108-0205-0305-0402 $bunya_sql = " AND (e.evt_keitou_bunya_list like '%0108%' OR e.evt_keitou_bunya_list like '%0205%' OR e.evt_keitou_bunya_list like '%0305%' OR e.evt_keitou_bunya_list like '%0402%' ) "; //美術系統 }elseif($type == "design"){ //0110-0206-0316-0408 $bunya_sql = " AND (e.evt_keitou_bunya_list like '%0110%' OR e.evt_keitou_bunya_list like '%0206%' OR e.evt_keitou_bunya_list like '%0316%' OR e.evt_keitou_bunya_list like '%0408%' ) "; //音楽系統 }elseif($type == "music"){ //0110-0310-0408 $bunya_sql = " AND (e.evt_keitou_bunya_list like '%0110%' OR e.evt_keitou_bunya_list like '%0310%' OR e.evt_keitou_bunya_list like '%0408%' ) "; } else { $bunya_sql = ""; } //最新のイベント10件とPDFがあればPDFリンク $all_sql = " SELECT DISTINCT d.evt_edt_event_id,e.* FROM evt_event_date_mt as d LEFT JOIN evt_event_mt as e ON d.evt_edt_event_id = e.evt_event_id WHERE ( evt_koukai_flag = '1' AND evt_mobile_kubun = 0 AND e.evt_event_shurui_kubun in (1,2) AND (evt_pdf_path) AND (d.evt_edt_kaisai_date >= '".date("Ymd")."' ) {$bunya_sql} ) ORDER BY e.evt_date_list DESC LIMIT 0 , 4 "; $res = mysql_query($all_sql, $conn) or die("(1).error"); while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { if($row["evt_pdf_path"]){ $id = str_replace("_event_pdf.pdf","",$row["evt_pdf_path"]); $link = "".$row["evt_title_gakkou_name"]."\"別窓が開きます\"\"pdfが開きます\""; } $date = ""; if($row["evt_date_list"]){ $date = sprintf("%04d.%d.%d",substr($row["evt_date_list"],0,4),substr($row["evt_date_list"],5,2),substr($row["evt_date_list"],-2)); } $link_array[] = "
  • [イベント]
    {$link} ({$date})
  • "; } $disp_str = implode("",$link_array); return $disp_str; } ?>