function WT_contest_status_string($c) { $cnt = WT_spawn_new_contest_container(); $cnt->ReNewOneStatus($c); $c = $cnt->ContestById($c['id']); if ($c['status'] == 0) { if ($c['settings']['autostart']) { $date = $c['settings']['autostart.date']; $time = $c['settings']['autostart.time']; $y = preg_replace('/^([0-9]+)\\-([0-9]+)\\-([0-9]+)$/', '\\1', $date); $m = preg_replace('/^([0-9]+)\\-([0-9]+)\\-([0-9]+)$/', '\\2', $date); $d = preg_replace('/^([0-9]+)\\-([0-9]+)\\-([0-9]+)$/', '\\3', $date); $h = preg_replace('/^([0-9]+)\\:([0-9]+)$/', '\\1', $time); $min = preg_replace('/^([0-9]+)\\:([0-9]+)$/', '\\2', $time); $deadline = mktime($h, $min, 0, $m, $d, $y, 0); return 'Ожидание ' . Timer($deadline - time()); } else { return 'Остановлен'; } } if ($c['status'] == 2) { return 'Завершен'; } if ($c['settings']['duration']) { // TODO: Add time formation here return 'Осталось ' . Timer($c['settings']['timestamp'] + $c['settings']['duration'] * 60 - time()); } return ' '; }
function GetSolutionTime($solution) { $contest = WT_contest_by_id($solution['contest_id']); if ($contest['settings']['duration'] == 0) { return format_date_time($solution['timestamp']); } else { return Timer($solution['timestamp'] - $contest['settings']['timestamp']); } }