function entry() { echo "<div class=\"section\">\n"; echo "<h2>쇼앤텔 일정</h2>\n"; $snts = get_schedule(); echo "<ul>\n"; foreach ($snts as $key => $snt) { $t = time_of_when($snt["when"]); echo "<li>" . date('Y-m-d H:i', $t) . " @ " . $snt["where"] . "\n"; echo "<ul>\n"; $date = date('Y-m-d', $t); foreach ($snt["who"] as $id) { echo "<li><a href=\"reg_comment?id={$id}&date={$date}\">" . get_member_name($id) . "</a> "; $filename = gen_talk_data_filename($t, $id); if (file_exists($filename)) { $talk_data = get_talk_data($t, $id); $commenters = $talk_data["commenters"]; if (count($commenters) !== 0) { $commenters = array_map(function ($commenter) { return get_member_name($commenter); }, $commenters); echo "(" . implode(", ", $commenters) . ")"; } } echo "</li>\n"; } echo "</ul>\n"; echo "</li>\n"; } echo "</ul>\n"; echo "</div>\n"; }
function gen_total_msg($snt) { $t = time_of_when($snt["when"]); $msg = ""; foreach ($snt["who"] as $id) { $msg .= gen_comment_msg($t, $id); } return $msg; }
function run_snt($snt) { $t = time_of_when($snt["when"]); $n = 1; foreach ($snt["who"] as $id) { run_talk($snt, $n, $t, $id); $n = $n + 1; $t = strtotime('+1 hour', $t); } }
function set_data($snt, $commenter_info) { $t = time_of_when($snt["when"]); foreach ($commenter_info as $speaker => $commenters) { $contents = get_talk_data_or_gen($t, $speaker); $contents["commenters"] = $commenters; if (!put_talk_data($t, $speaker, $contents)) { exit(1); } } }
function gen_msg($snt) { $names = array_map(function ($id) { return get_member_name($id); }, $snt["who"]); $talk_time = time_of_when($snt["when"]); $abs_time = mktime(23, 59, 0, $snt["when"]["month"], $snt["when"]["day"] - 7, $snt["when"]["year"]); $memo_time = mktime(9, 0, 0, $snt["when"]["month"], $snt["when"]["day"] - 2, $snt["when"]["year"]); $msg = replace(__ROOT__ . "/template/remind.temp", array("names" => implode(', ', $names), "talk_time" => date('Y-m-d', $talk_time), "abs_time" => date('Y-m-d H:i', $abs_time), "memo_time" => date('Y-m-d H:i', $memo_time))); return $msg; }
function gen_snt_msg($is_fst, $snt) { $msg_arr = array(); $start_t = time_of_when($snt["when"]); $t = $start_t; foreach ($snt["who"] as $who) { array_push($msg_arr, gen_talk_msg($is_fst, $t, $snt["where"], $who)); $t = strtotime('+1 hour', $t); } $hr = "======================================================================\n\n"; $msg = implode($hr, $msg_arr); if (!$is_fst) { $msg .= $hr; $msg .= "Please leave comments by " . date('Y-m-d', strtotime('-1 day', $start_t)) . " 18:00.\n"; $msg .= "http://ropas.snu.ac.kr/snt_system2/reg_comment" . "\n"; } return $msg; }
function entry() { echo "<div class=\"section\">\n"; echo "<h2>쇼앤텔 일정</h2>\n"; $snts = get_schedule(); echo "<ul>\n"; foreach ($snts as $key => $snt) { $t = time_of_when($snt["when"]); echo "<li>" . date('Y-m-d H:i', $t) . " @ " . $snt["where"] . "\n"; echo "<ul>\n"; $date = date('Y-m-d', $t); foreach ($snt["who"] as $id) { echo "<li><a href=\"reg_abstract?id={$id}&date={$date}\">" . get_member_name($id) . "</a></li>\n"; } echo "</ul>\n"; echo "</li>\n"; } echo "</ul>\n"; echo "</div>\n"; }
function str_of_when($when) { return date('Y-m-d H:i', time_of_when($when)); }
function select_snt() { $snts = get_schedule(); foreach ($snts as $key => $snt) { echo "{$key}) " . date('Y-m-d H:i', time_of_when($snt["when"])) . "\n"; } echo "\n"; echo "Select a S&T (x to exit): "; $input_str = my_fgets(); echo "\n"; if ($input_str === "x") { echo "Exit\n"; exit(0); } else { if (my_key_exists($input_str, $snts)) { $snt = $snts[(int) $input_str]; echo "The S&T on " . date('Y-m-d H:i', time_of_when($snt["when"])) . " is selected.\n\n"; return $snt; } else { echo "Your input is invalid.\n"; exit(1); } } }