"; print ".wrap {"; print " width: 100%;"; print "}.table {"; print " width: 100%;"; print " table-layout: fixed;"; print "}"; print ".table td,"; print ".table th {"; print " border: 1px solid #DFDFDF;"; print " padding: 1rem;"; print "}"; print ".table tr > td:first-child,"; print ".table tr > th:first-child{"; print " width: 30%; ";// 最初のカラムだけ30%のwidthを確保 print "}"; print "div.content {"; print " width: 100%;"; print "}"; print "div.content pre {"; print " display: block;"; print " width: 100%;"; print " overflow-x: auto;"; print " overflow-y: hidden;"; print " height: auto;"; print "}"; print ".txt3{"; print " font-size: 160%;"; print "}"; print ".txt4{"; print " font-size: 120%;"; print "}"; print ""; } ?> "; $value_ct = count($value_); for($j= 1 ;$j < $value_ct;$j++) { if($type_ == 0) { $sel = ($value_[$j] == $selected) ? "selected" : ""; print ""; } else { $split = explode("_",$value_[$j]); $sel = ($split[0] == $selected) ? "selected" : ""; print ""; } } if ($selected == 999) $sel = "selected"; print ""; print ""; } //●会社名プルダウン function Pulldown_create_campany($width,$cm_ct_ ,$name_,$data_ ,$selected) { print ""; } //●ユーザー名プルダウン function Pulldown_create_user($width ,$cm_ct_,$data_,$selected) { $value_ct = count($data_); for($i= 0 ;$i < $cm_ct_;$i++) { $ii = $i+1; print ""; $value_ct = count($data_); for($j= 0 ;$j < $value_ct;$j++) { $sel_data = explode(",",$data_[$j]); if( $ii == $sel_data[1]) { $sel = ($sel_data[0] == $selected) ? "selected" : ""; print ""; } } print ""; } } function Pulldown_create_user2($width ,$cp_id,$data_,$selected) { $value_ct = count($data_); print ""; print ""; $value_ct = count($data_); for($j= 0 ;$j < $value_ct;$j++) { $sel_data = explode(",",$data_[$j]); if( $cp_id == $sel_data[1]) { $sel = ($sel_data[0] == $selected) ? "selected" : ""; print ""; } } print ""; } //●ラジオボタン作成 function Radio_create($type_ ,$name_,$value_,$selected) { print "
"; $value_ct = count($value_); for($j= 1 ;$j < $value_ct;$j++) { if($type_ == 0) { $sel = ($value_[$j] == $selected) ? "checked='checked'" : ""; print "" .$value_[$j] ."   "; } else { $split = explode("_",$value_[$j]); $sel = ($split[0] == $selected) ? "checked='checked'" : ""; print "" .$split[1] ."   "; } } print "
"; } ///////////////////////////////////////////////////////////////////////// EXTRACT($_GET); //print_r($_GET); //●定数設定 //会社名・ユーザー名一覧CSV $user_csv= "../setting/user.csv"; //プルダウンCSV $list_csv = "../setting/list.csv"; //CSVデータ出力フォルダ $csv_data_folder = "../data/"; //●プルダウンリストの読み込み $fp = fopen($list_csv,"r"); $pull_list = array(); $list = array(); // ファイルを1行ずつ取得する while ($line = fgets($fp)) { $pull_list[] = "$line"; } $ct = count($pull_list); //各リストを,で分割 for($i = 0;$i < $ct;$i++) { $list[] = explode(",",$pull_list[$i]); } //プルダウンリスト(ユーザー名)読み込み $fp2 = fopen($user_csv,"r"); $cp_id= 5; $cp_list =array(); $user_list = array(); while ($line = fgets($fp2)) { $explode_tmp = explode(",",$line); $cp_id_tmp = $explode_tmp[1]; //if(($cp_id_tmp != null) && $cp_id_tmp <= 8) //{ if(($cp_id_tmp != null) && ($cp_id_tmp == $cp_id)) { $cp_list[0] = $cp_id_tmp ."," .$explode_tmp[2] ."," .$explode_tmp[3]; // $cp_id = $cp_id + 1; } $user_list[] = $line; //} } /* $fp2 = fopen($user_csv,"r"); $cp_id= 0; $cp_list =array(); $user_list = array(); while ($line = fgets($fp2)) { $explode_tmp = explode(",",$line); $cp_id_tmp = $explode_tmp[1]; if(($cp_id_tmp != null) && $cp_id_tmp <= 8) { if(($cp_id_tmp != null) && ($cp_id != $cp_id_tmp)) { $cp_list[$cp_id] = $cp_id_tmp ."," .$explode_tmp[2] ."," .$explode_tmp[3]; $cp_id = $cp_id + 1; } $user_list[] = $line; } } */ //●会社数 $cm_ct = count($cp_list); fclose($fp); //日付 デフォルト $now_date = date("Y-m-d",time()); //登録処理 function ascToHex($string) { $hex = dechex(ord($string)); if (strlen($hex) == 1) $hex = '0' . $hex; $string = '\\' . $hex; return $string; } if($_POST['data_input']) { //会社ID,ユーザーID,日付を取得 $company_id = $_POST['campany']; $user_id = $_POST["user_" .$company_id]; $date_ = $_POST['date_']; if($user_id) { $now_date = $date_; //●ユーザーデータが存在するかチェック //日付・ユーザー名 $csv_file_name = $date_ ."-" .str_pad($company_id,2,0,STR_PAD_LEFT) ."-" .str_pad($user_id,3,0,STR_PAD_LEFT) .".csv"; //print $csv_file_name ."
"; $csv_data = $csv_data_folder .$csv_file_name; //ユーザーマスタからユーザーを検索 $fp2 = fopen($user_csv,"r"); while ($line = fgets($fp2)) { $split = explode(",",$line); if($split[0] == $user_id) { $user_data = $line; break; } } fclose($fp2); //取得したユーザーデータを分割 $user_data_ = explode(",",$user_data); $file_csv = fopen($csv_data, "w"); //出力するデータの準備 $bt_asa = ($_POST[asa] == 999) ? "":$_POST[asa]; $bt_hiru = ($_POST[hiru] == 999) ? "":$_POST[hiru]; $bt_yuu = ($_POST[yuu] == 999) ? "":$_POST[yuu]; $pc_seki= ($_POST[seki] == 0) ? "なし" : "有"; $pc_iki= ($_POST[iki] == 0) ? "なし" : "有"; $pc_hana= ($_POST[hana] == 0) ? "なし" : "有"; $pc_nodo= ($_POST[nodo] == 0) ? "なし" : "有"; $pc_zutsu= ($_POST[zutsu] == 0) ? "なし" : "有"; $pc_geri= ($_POST[geri] == 0) ? "なし" : "有"; $pc_mikaku= ($_POST[mikaku] == 0) ? "なし" : "有"; $pc_kyukaku= ($_POST[kyukaku] == 0) ? "なし" : "有"; $pc_kentai= ($_POST[kentai] == 0) ? "なし" : "有"; print $user_data_[4] ." 様 のデータを登録しました" ."
"; $output_title = "会社名,氏名,日付,体温(朝),体温(昼),体温(夕),せき,息苦しさ,鼻水・鼻づまり,のどの痛み,頭痛,腹痛・下痢,味覚異常,嗅覚異常,倦怠感,その他"; $output_data = $user_data_[3] ."," .$user_data_[4] ."," .$date_ ."," .$bt_asa ."," .$bt_hiru ."," .$bt_yuu ."," .$pc_seki ."," .$pc_iki ."," .$pc_hana ."," .$pc_nodo ."," .$pc_zutsu ."," .$pc_geri ."," .$pc_mikaku ."," .$pc_kyukaku ."," .$pc_kentai ."," .$_POST[etc]; //出力するデータのエンコードを変更 $output_title_conv = mb_convert_encoding($output_title , "Shift-JIS", "UTF-8"); $output_data_conv = mb_convert_encoding($output_data , "Shift-JIS", "UTF-8"); //csvへ出力 fwrite($file_csv,$output_title_conv ."\r\n"); fwrite($file_csv, $output_data_conv ."\r\n"); fclose($file_csv); } } else if($_GET[cid]) { $company_id = $_GET[cid]; $user_id = $_GET[uid]; $date_ = $_GET[date]; $now_date = $date_; //日付・ユーザー名 $csv_file_name = $date_ ."-" .str_pad($company_id,2,0,STR_PAD_LEFT) ."-" .str_pad($user_id,3,0,STR_PAD_LEFT) .".csv"; //print $csv_file_name ."
"; $csv_data = $csv_data_folder .$csv_file_name; //ユーザーデータが存在するかチェック if (file_exists($csv_data)) { //ユーザーのステータス取得 $fp3 = fopen($csv_data,"r"); while ($line = fgets($fp3)) { $user_satatus = $line; } fclose($fp3); $user_st = explode(",",$user_satatus); //文字コード変換 $user_st[6] = mb_convert_encoding($user_st[6] , "UTF-8", "Shift-JIS"); $user_st[7] = mb_convert_encoding($user_st[7] , "UTF-8", "Shift-JIS"); $user_st[8] = mb_convert_encoding($user_st[8] , "UTF-8", "Shift-JIS"); $user_st[9] = mb_convert_encoding($user_st[9] , "UTF-8", "Shift-JIS"); $user_st[10] = mb_convert_encoding($user_st[10] , "UTF-8", "Shift-JIS"); $user_st[11] = mb_convert_encoding($user_st[11] , "UTF-8", "Shift-JIS"); $user_st[12] = mb_convert_encoding($user_st[12] , "UTF-8", "Shift-JIS"); $user_st[13] = mb_convert_encoding($user_st[13] , "UTF-8", "Shift-JIS"); $user_st[14] = mb_convert_encoding($user_st[14] , "UTF-8", "Shift-JIS"); $user_st[15] = mb_convert_encoding($user_st[15] , "UTF-8", "Shift-JIS"); $bt_asa = ($_POST[asa] == 999) ? "":$_POST[asa]; $bt_hiru = ($_POST[hiru] == 999) ? "":$_POST[hiru]; $bt_yuu = ($_POST[yuu] == 999) ? "":$_POST[yuu]; $_POST[asa] = ($user_st[3]) ? $user_st[3]:999; $_POST[hiru] = ($user_st[4]) ? $user_st[4]:999; $_POST[yuu] = ($user_st[5]) ? $user_st[5]:999; $_POST[seki] = (!strcmp($user_st[6],"なし")) ? 0 : 1; $_POST[iki] = (!strcmp($user_st[7],"なし")) ? 0 : 1; $_POST[hana] = (!strcmp($user_st[8],"なし")) ? 0 : 1; $_POST[nodo] = (!strcmp($user_st[9],"なし")) ? 0 : 1; $_POST[zutsu] = (!strcmp($user_st[10],"なし")) ? 0 : 1; $_POST[geri] = (!strcmp($user_st[11],"なし")) ? 0 : 1; $_POST[mikaku] = (!strcmp($user_st[12],"なし")) ? 0 : 1; $_POST[kyukaku] = (!strcmp($user_st[13],"なし")) ? 0 : 1; $_POST[kentai] = (!strcmp($user_st[14],"なし")) ? 0 : 1; $_POST[etc] = $user_st[15]; } else { $_POST[asa] = 999; $_POST[hiru] = 999; $_POST[yuu] = 999; $_POST[seki] = 0; $_POST[iki] = 0; $_POST[hana] = 0; $_POST[nodo] = 0; $_POST[zutsu] = 0; $_POST[geri] = 0; $_POST[mikaku] = 0; $_POST[kyukaku] = 0; $_POST[kentai] = 0; } } else { $_POST[asa] = 999; $_POST[hiru] = 999; $_POST[yuu] = 999; $_POST[seki] = 0; $_POST[iki] = 0; $_POST[hana] = 0; $_POST[nodo] = 0; $_POST[zutsu] = 0; $_POST[geri] = 0; $_POST[mikaku] = 0; $_POST[kyukaku] = 0; $_POST[kentai] = 0; } //print ""; print ""; print "
"; print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; //print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; if($_POST[etc]) $etc_value = " value = '" .$_POST[etc] ."'"; print ""; print ""; print ""; print ""; print ""; print "
" ."会社名" .""; print Pulldown_create_campany(250,$cm_ct,"campany",$cp_list,$company_id); print "
" ."氏名" .""; //print Pulldown_create_user(250,$cm_ct,$user_list,$user_id); print Pulldown_create_user2(250,$cp_id,$user_list,$user_id); print "
" ."日付" .""; print ""; print "
" ."体温" ."" ."朝" .""; print Pulldown_create(150,0,"asa",$list[2],$_POST[asa]); print "℃" ."
" ."昼" .""; print Pulldown_create(150,0,"hiru",$list[3],$_POST[hiru]); print "℃" ."
" ."夕" .""; print Pulldown_create(150,0,"yuu",$list[4],$_POST[yuu]); print "℃" ."
" ."体調" ."" ."せき" .""; print Radio_create(1,'seki',$list[5],$_POST[seki]); print "
" ."息苦しさ" .""; print Radio_create(1,'iki',$list[6],$_POST[iki]); print "
" ."鼻水・鼻づまり" .""; print Radio_create(1,'hana',$list[7],$_POST[hana]); print "
" ."のどの痛み" .""; print Radio_create(1,'nodo',$list[8],$_POST[nodo]); print "
" ."頭痛" .""; print Radio_create(1,'zutsu',$list[9],$_POST[zutsu]); print "
" ."腹痛・下痢" .""; print Radio_create(1,'geri',$list[10],$_POST[geri]); print "
" ."味覚異常" .""; print Radio_create(1,'mikaku',$list[11],$_POST[mikaku]); print "
" ."嗅覚異常" .""; print Radio_create(1,'kyukaku',$list[12],$_POST[kyukaku]); print "
" ."倦怠感" .""; print Radio_create(1,'kentai',$list[13],$_POST[kentai]); print "
" ."その他" ."" ."" ."
"; print ""; print "
"; print "
"; print ""; print "
"; ?>