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_talk_msg($is_fst, $t, $where, $who) { $talk = get_talk_data($t, $who); if ($is_fst) { $pdf = ""; } else { $date = date('ymd', $t); $pdf = "http://ropas.snu.ac.kr/snt_memo2/{$date}_{$who}.pdf"; } $src = array("TITLE" => $talk["title"], "SPEAKER" => get_member_name($who), "TIME" => date('M j (D)', $t) . " at " . date('H:i', $t), "WHERE" => $where, "ABSTRACT" => $talk["abstract"], "PDF" => $pdf); return replace(__ROOT__ . "/template/notice.temp", $src); }
function run_talk($snt, $n, $t, $id) { $talk_data = get_talk_data($t, $id); if (get_member_lab($id) === "ropas") { $who = "<r:who member=\"" . $id . "\"/>"; } else { $who = "<r:who>" . get_member_name($id) . "</r:who>"; } $src = array("TITLE" => htmlspecialchars($talk_data["title"]), "WHO" => $who, "WHEN" => date(DATE_ATOM, $t), "WHERE" => $snt["where"], "ABSTRACT" => htmlspecialchars($talk_data["abstract"]), "SLIDES_FILENAME" => date('md', $t) . "_" . $n . ".pdf", "MEMO_FILENAME" => date('ymd', $t) . "_" . $id . ".pdf", "ID" => $id, "DATE" => date('Y-m-d', $t)); $temp_filename = __ROOT__ . "/template/xml.temp"; $msg = replace($temp_filename, $src); $filename = __ROOT__ . "/talk_root/" . date('Y', $t) . "/" . date('md', $t) . "_" . $n . ".xml"; if (!my_file_put_contents($filename, $msg)) { exit(1); } }
function get_commenters_today() { $cmtrs_all = array(); $t = time(); $filename = __ROOT__ . "/data/" . date('ymd', $t) . "_speaker.json"; if (file_exists($filename)) { $talks = json_get_contents($filename); foreach ($talks as $talk) { $cmtrs_of_talk = array(); foreach ($talk["speakers"] as $id) { $talk_data = get_talk_data($t, $id); $cmtrs_of_talk[get_member_name($id)] = array_map("get_member_name", $talk_data["commenters"]); } $chair_cmtrs = array("chair" => get_member_name($talk["chair"]), "commenters" => $cmtrs_of_talk); array_push($cmtrs_all, $chair_cmtrs); } } return $cmtrs_all; }
function get_comments($t, $id) { $talk_data = get_talk_data($t, $id); return $talk_data["comments"]; }