1<?php
2// manualassign.php -- HotCRP chair's paper assignment page
3// Copyright (c) 2006-2018 Eddie Kohler; see LICENSE.
4
5require_once("src/initweb.php");
6require_once("src/papersearch.php");
7if (!$Me->is_manager())
8    $Me->escape();
9$Me->add_overrides(Contact::OVERRIDE_CONFLICT);
10
11$Conf->header("Assignments &nbsp;&#x2215;&nbsp; <strong>Conflicts</strong>", "assignpc");
12echo '<div class="psmode">',
13    '<div class="papmode"><a href="', hoturl("autoassign"), '">Automatic</a></div>',
14    '<div class="papmode"><a href="', hoturl("manualassign"), '">Manual</a></div>',
15    '<div class="papmodex"><a href="', hoturl("conflictassign"), '">Conflicts</a></div>',
16    '<div class="papmode"><a href="', hoturl("bulkassign"), '">Bulk update</a></div>',
17    '</div><hr class="c" />';
18
19echo '<div class="settingstext">';
20
21if ($Qreq->neg) {
22} else {
23    echo '<p>This table lists unconfirmed potential conflicts indicated using reviewer preferences, or detected by fuzzy matching between PC affiliations and collaborator lists and authors. Confirm any true conflicts using the checkboxes.</p>';
24}
25
26echo "</div>\n";
27
28
29$search = new PaperSearch($Me, ["t" => "manager", "q" => "",
30                                "urlbase" => hoturl_site_relative_raw("conflictassign")]);
31
32if ($Qreq->neg) {
33    $filter = function ($pl, $row, $fields) {
34        $user = $pl->reviewer_user();
35        $ct = $row->conflict_type($user);
36        return $ct > 0 && $ct < CONFLICT_AUTHOR
37            && !$fields["potentialconflict"]->nonempty;
38    };
39} else {
40    $filter = function ($pl, $row, $fields) {
41        $user = $pl->reviewer_user();
42        return $row->conflict_type($user) == 0
43            && $fields["potentialconflict"]->nonempty;
44    };
45}
46$args = ["display" => "show:authors show:aufull"];
47
48$any = false;
49foreach ($Conf->full_pc_members() as $pc) {
50    $paperlist = new PaperList($search, $args, $Qreq);
51    $paperlist->set_report("conflictassign");
52    $paperlist->set_reviewer_user($pc);
53    $paperlist->set_row_filter($filter);
54    $paperlist->set_table_id_class(null, "pltable_full pltable-focus-checkbox");
55    $tr = $paperlist->table_render("conflictassign", ["header_links" => false, "nofooter" => true]);
56    if (!isset($args["rowset"]))
57        $args["rowset"] = $paperlist->rowset();
58    if ($paperlist->count > 0) {
59        if (!$any)
60            echo Ht::form(hoturl("conflictassign")),
61                $tr->table_start, ($tr->thead ? : ""), $tr->tbody_start();
62        else
63            echo $tr->heading_separator_row();
64        $t = $Me->reviewer_html_for($pc);
65        if ($pc->affiliation)
66            $t .= " <span class=\"auaff\">(" . htmlspecialchars($pc->affiliation) . ")</span>";
67        echo $tr->heading_row($t, ["no_titlecol" => true]), join("", $tr->body_rows);
68        $any = true;
69    }
70}
71if ($any)
72    echo "  </tbody>\n</table></form>";
73
74echo '<hr class="c" />';
75$Conf->footer();
76