1<?php
2// deadlines.php -- HotCRP deadline reporting page
3// Copyright (c) 2006-2018 Eddie Kohler; see LICENSE.
4
5require_once("src/initweb.php");
6
7// *** NB If you change this script, also change the logic in index.php ***
8// *** that hides the link when there are no deadlines to show.         ***
9
10// header and script
11$Conf->header("Deadlines", "deadlines");
12
13if ($Me->privChair)
14    echo "<p>As PC chair, you can <a href='", hoturl("settings"), "'>change the deadlines</a>.</p>\n";
15
16echo "<dl>\n";
17
18
19function printDeadline($time, $phrase, $description) {
20    global $Conf;
21    echo "<dt><strong>", $phrase, "</strong>: ", $Conf->printableTime($time, "span") , "</dt>\n",
22        "<dd>", $description, ($description ? "<br />" : ""), "</dd>";
23}
24
25$dl = $Me->my_deadlines();
26
27// If you change these, also change Contact::has_reportable_deadline().
28if (get($dl->sub, "reg"))
29    printDeadline($dl->sub->reg, $Conf->_("Registration deadline"),
30                  $Conf->_("You can register new submissions until this deadline."));
31
32if (get($dl->sub, "update"))
33    printDeadline($dl->sub->update, $Conf->_("Update deadline"),
34                  $Conf->_("You can update submissions and upload new versions until this deadline."));
35
36if (get($dl->sub, "sub"))
37    printDeadline($dl->sub->sub, $Conf->_("Submission deadline"),
38                  $Conf->_("Papers must be submitted by this deadline to be reviewed."));
39
40if (get($dl, "resps"))
41    foreach ($dl->resps as $rname => $dlr)
42        if (get($dlr, "open") && $dlr->open <= $Now && get($dlr, "done")) {
43            if ($rname == 1)
44                printDeadline($dlr->done, $Conf->_("Response deadline"),
45                              $Conf->_("You can submit responses to the reviews until this deadline."));
46            else
47                printDeadline($dlr->done, $Conf->_("%s response deadline", $rname),
48                              $Conf->_("You can submit %s responses to the reviews until this deadline.", $rname));
49        }
50
51if (get($dl, "rev") && get($dl->rev, "open")) {
52    $dlbyround = array();
53    foreach ($Conf->defined_round_list() as $i => $round_name) {
54        $isuf = $i ? "_$i" : "";
55        $es = +$Conf->setting("extrev_soft$isuf");
56        $eh = +$Conf->setting("extrev_hard$isuf");
57        $ps = $ph = -1;
58
59        $thisdl = [];
60        if ($Me->isPC) {
61            $ps = +$Conf->setting("pcrev_soft$isuf");
62            $ph = +$Conf->setting("pcrev_hard$isuf");
63            if ($ph && ($ph < $Now || $ps < $Now))
64                $thisdl[] = "PH" . $ph;
65            else if ($ps)
66                $thisdl[] = "PS" . $ps;
67        }
68        if ($es != $ps || $eh != $ph) {
69            if ($eh && ($eh < $Now || $es < $Now))
70                $thisdl[] = "EH" . $eh;
71            else if ($es)
72                $thisdl[] = "ES" . $es;
73        }
74        if (count($thisdl))
75            $dlbyround[$round_name] = $last_dlbyround = join(" ", $thisdl);
76    }
77
78    $dlroundunify = true;
79    foreach ($dlbyround as $x)
80        if ($x !== $last_dlbyround)
81            $dlroundunify = false;
82
83    foreach ($dlbyround as $roundname => $dltext) {
84        if ($dltext === "")
85            continue;
86        $suffix = $roundname === "" ? "" : "_$roundname";
87        if ($dlroundunify)
88            $roundname = "";
89        foreach (explode(" ", $dltext) as $dldesc) {
90            list($dt, $dv) = array(substr($dldesc, 0, 2), +substr($dldesc, 2));
91            if ($dt === "PS")
92                printDeadline($dv, $Conf->_("%s review deadline", $roundname),
93                              $Conf->_("%s reviews are requested by this deadline.", $roundname));
94            else if ($dt === "PH")
95                printDeadline($dv, $Conf->_("%s review hard deadline", $roundname),
96                              $Conf->_("%s reviews must be submitted by this deadline.", $roundname));
97            else if ($dt === "ES")
98                printDeadline($dv, $Conf->_("%s external review deadline", $roundname),
99                              $Conf->_("%s reviews are requested by this deadline.", $roundname));
100            else if ($dt === "EH")
101                printDeadline($dv, $Conf->_("%s external review hard deadline", $roundname),
102                              $Conf->_("%s reviews must be submitted by this deadline.", $roundname));
103        }
104        if ($dlroundunify)
105            break;
106    }
107}
108
109echo "</table>\n";
110
111$Conf->footer();
112