$Setup['endDate']) { $err = $Setup['Whet']; } elseif (!$_REQUEST['uid']) { $err = "指定のアドレスは無効です。"; } else { $rs = mysql_query("SELECT * FROM `$client-ans` WHERE `Uid`='". $_REQUEST['uid']. "'"); if ($c = mysql_num_rows($rs)) { $err = "申し訳ありません。
指定のアドレスは既に破棄された可能性があります。
調査が完了するとアドレスは破棄され、内容の変更訂正は行えません。"; } else { $rs = mysql_query("SELECT * FROM `$client` WHERE `ID`='". $_REQUEST['uid']. "'"); if (mysql_num_rows($rs)) { $loginuser = mysql_fetch_object($rs); $ans_cnt = 0; /* 回答者選択時の上限関係は、回答者側から見ると逆になる 1:上司 -> 3:上司 2:同僚 -> 2:同僚 3:部下 -> 1:部下 2015/11/11 評価者をTargetID順に変更 */ $sql = "SELECT `$client-select`.*, $client.Name, CASE WHEN `$client-select`.Relation=1 THEN '部下' WHEN `$client-select`.Relation=2 THEN '同僚' ELSE '上司' END as 'Rel' FROM `$client-select` LEFT JOIN `$client` ON `$client-select`.TargetID=$client.ID WHERE `SelectID`='". $loginuser->ID. "' ORDER BY `TargetID`"; $rs = mysql_query($sql); if ($ans_cnt = mysql_num_rows($rs)) { while ($recode = mysql_fetch_object($rs)) { $Ans_members[] = $recode->TargetID. ":". $recode->Name. ":". $recode->Relation. ":". $recode->Rel; } } $loginuser->Target && $ans_cnt++; if (!$loginuser->Target && !$ans_cnt) { /* 本人が調査対象者で無い場合は、回答者に指名されているかを調べる */ $err = "ありがとうございます。
あなたは、今回の調査の対象外です。"; } } else { $err = "申し訳ありません。
指定のアドレスが見つかりません。既に削除されている可能性があります。"; } } } if ($err) { $text = msgbox("エラー", $err, "戻る|history.back();", "ui-bar-e", "/360/common/images/icon64/alert-stop2.png"); $ready = " $('#logo').css('display', 'none');"; } else { $status = array('回答画面', '回答確認', '送信完了'); $introduction = data_read("./data/introduction.dat"); $intromax = count($introduction); /* 強制的にイントロをクリアしてテスト */ //$intromax = 0; /* 最初からテストする場合はクッキーを破棄 */ //setcookie('introStep', '', time()-1); /* クッキーを破棄 */ if ($intromax) { array_unshift($status, 'はじめに'); } if ($intromax && $_COOKIE['introStep'] < $intromax) { /* 「はじめに」が設定されている場合 */ $_REQUEST['step']++; setcookie('introStep', $_REQUEST['step'], time()+3600); /* 有効期限は一時間です */ $intro = dbfields($introduction[$_REQUEST['step'] - 1]); $text = " "; $text .= "

". $intro['Title']. "

". preg_replace("/( |\r\n|[\r\n])/", "
", $intro['Body']). "

"; if ($_REQUEST['step'] == $intromax) { $text .= " "; } else { $text .= " "; } $text .= "

". $_REQUEST['step']. " / $intromax

"; } else { $tmpfile = $_SERVER['DOCUMENT_ROOT']. current_Dir(). "/data/". $_REQUEST['uid']. ".tmp"; if ($_REQUEST['action'] == "temporary") { /* 一時ファイルに保存 */ backup($tmpfile); $text = msgbox( "一時保存", preg_replace("/(\r\n| |[\r\n])/", "
", $Setup['Temporary']), "戻る|location.href='". $_SERVER['SCRIPT_NAME']. "/". $_REQUEST['uid']. "/';", "ui-bar-b", "/360/common/images/icon64/Info64.png" ); $ready = " $('#logo').css('display', 'none');"; } else { $comment = ""; ($Setup['party'] || !count($Ans_members)) && $comment = "あなた"; ($Setup['party'] && count($Ans_members)) && $comment .= "の"; $i = 1; foreach ($Ans_members as $line) { list($TargetID, $Name, $Relation, $Rel) = split(":", $line); $i > 1 && $comment .= "、"; $Setup['party'] && $comment .= $Rel; $comment .= "「". $Name. "」様"; $i++; $mc = true; } $comment .= "についてお答えください。"; !isset($_REQUEST['status']) && $_REQUEST['status'] = 0; $_REQUEST['status']++; $text = " "; if ($_REQUEST['status'] > 2) { /* 保存して終了 */ $now = date("Y-m-d H:i:s"); foreach ($_REQUEST as $key => $value) { if (preg_match("/^Q(\d+)-(\w+)$/", $key, $m)) { $sql = "REPLACE `$client-ans` SET `Uid`='". $_REQUEST['uid']. "', `TargetID`='". $m[2]. "', `Que`='". $m[1]. "', `Ans`='". $_REQUEST[$key]. "', `Date`='". $now. "'"; mysql_query($sql); } } is_file($tmpfile) && unlink($tmpfile); $text .= "

". msgbox( "送信完了", preg_replace("/(\r\n| |[\r\n])/", "
", $Setup['Complete']), "戻る|location.href='". current_Dir(). "/';", "ui-bar-b", "/360/common/images/icon64/check.png" ); setcookie('introStep', '', time()-1); /* クッキーを破棄 */ $ready = " $('#logo').css('display', 'none');"; } else { if (is_file($tmpfile)) { $buffer = file_get_contents($tmpfile); $data = dbfields($buffer); } $path = $_SERVER['DOCUMENT_ROOT']. current_Dir(). "/data/original.que"; $Que = get_crypt_file($path, $System['cryptkey']); $text .= "

$comment
対象者について、最もあてはまる項目を選択してください。 設問数は、". count($Que). "問、自由記入以外はすべて必須です。

". precedent(). "

". $loginuser->Name. " 様

"; if ($_REQUEST['status'] == 2) { $text .= "まだ送信されていません。"; backup($tmpfile); } $text .= "
"; $i = 1; $g = 0; foreach ($Que as $line) { $Field = dbfields($line); if ($ans_cnt > 5 || $Field['Type'] > 0) { $que_style = "width:90%;"; $box_float = "f-left"; } else { $que_style = ""; $box_float = "f-right"; } $bgclass = ""; if ($Setup['colorseparator']) { $bgclass = "bg-cream"; $i % 2 == 0 && $bgclass = "bg-cyan"; } if ($Field['Group']) { if ($g) { $text .= "
". precedent(). "
"; $_REQUEST['status'] == 1 && $text .= ""; $text .= " TopBottom

"; } $text .= "

". $Field['Group']. "

"; $g++; } else { $text .= "
"; } $uid = $_REQUEST['uid']; $text .= "

". sprintf("Q%02d", $i). ":

". $Field['Que']. "

"; if ($Field['Desc'] || $Field['Level']) { $text .= "

"; $Field['Desc'] && $text .= " ", $Field['Desc']). "'); $('#systemDialog').dialog({ title: '解説', resizable: false, height: 'auto', width: 400, modal: true, buttons: { '閉じる': function() { $( this ).dialog('close'); } } });\" style=\"width:60px;margin:2px;\"/>"; $Field['Level'] && $text .= " ", $Field['Level']). "'); $('#systemDialog').dialog({ title: 'レベル', resizable: false, height: 'auto', width: 400, modal: true, buttons: { '閉じる': function() { $( this ).dialog('close'); } } });\" style=\"width:60px;margin:2px;\"/>"; $text .= "

"; } $text .= "
    "; if ($loginuser->Target) { if ($Field['Type']) { if ($Field['Type'] == 1 || $Field['Type'] == 2) { $text .= "
  • 自己評価

    "; if ($_REQUEST['status'] == 1) { $text .= ""; } else { $text .= " ". preg_replace("/(\r\n| |[\r\n])/", "
    ", $_REQUEST["Q$i-$uid"]). " "; } $text .= "

  • "; } else { $text .= " "; } } else { $text .= "
  • 自己評価

    "; if ($_REQUEST['status'] == 1) { $text .= " "; } else { $text .= "

     ". $_REQUEST["Q$i-$uid"]. " 

    "; } $text .= "
  • "; } } foreach ($Ans_members as $v) { list($id, $name) = split(":", $v); if ($Field['Type']) { if ($Field['Type'] == 1 || $Field['Type'] == 3) { $text .= "
  • $name

    "; if ($_REQUEST['status'] == 1) { $text .= ""; } else { $text .= " ". preg_replace("/(\r\n| |[\r\n])/", "
    ", $_REQUEST["Q$i-$id"]). " "; } $text .= "

  • "; } else { $text .= " "; } } else { $text .= "
  • $name

    "; if ($_REQUEST['status'] == 1) { $text .= " "; } else { $text .= "

     ". $_REQUEST["Q$i-$id"]. " 

    "; } $text .= "
  • "; } } $text .= "
"; if ($Field['Type'] == 1) { $text .= "※最大文字数256文字(日本語)以内でお願いします。"; } $text .= "

"; $i++; } $text .= "
"; if ($_REQUEST['status'] == 1) { $text .= " >\" />"; } else { $text .= " "; } $text .= "

"; } } } } function msgbox ($caption, $msg, $button = "戻る|history.back();", $style = "ui-bar-b", $icon = "/360/common/images/icon64/alert.png") { $text = "

$caption

". preg_replace("/(\r\n| |[\r\n])/", "
", $msg). "

"; $buttons = split(",", $button); foreach ($buttons as $line) { list($val, $action) = split("\|", $line); $text .= " "; } $text .= "
"; return($text); } function backup($tmpfile) { $val = array(); foreach ($_REQUEST as $key => $value) { if (preg_match("/^Q(\d+)-/", $key)) { array_push($val, "$key=$value"); } } file_put_contents($tmpfile, join("\t", $val)); } ?>