function execute($verbose = false) { global $Conf, $Now, $Opt; if (count($this->errors_) || !count($this->assigners)) { if ($verbose && count($this->errors_)) { $this->report_errors(); } else { if ($verbose) { $Conf->warnMsg("Nothing to assign."); } } return count($this->errors_) == 0; // true means no errors } // mark activity now to avoid DB errors later $this->contact->mark_activity(); // create new contacts outside the lock $locks = array("ContactInfo" => "read", "Paper" => "read", "PaperConflict" => "read"); $Conf->save_logs(true); foreach ($this->assigners as $assigner) { if ($assigner->contact && $assigner->contact->contactId < 0) { $assigner->contact = $this->cmap->register_contact($assigner->contact); $assigner->cid = $assigner->contact->contactId; } $assigner->add_locks($locks); } // execute assignments $tables = array(); foreach ($locks as $t => $type) { $tables[] = "{$t} {$type}"; } Dbl::qe("lock tables " . join(", ", $tables)); foreach ($this->assigners as $assigner) { $assigner->execute($this); } Dbl::qe("unlock tables"); $Conf->save_logs(false); // confirmation message if ($verbose) { if ($Conf->setting("pcrev_assigntime") == $Now) { $Conf->confirmMsg("Assignments saved! You may want to <a href=\"" . hoturl("mail", "template=newpcrev") . "\">send mail about the new assignments</a>."); } else { $Conf->confirmMsg("Assignments saved!"); } } // clean up $Conf->update_rev_tokens_setting(false); $Conf->update_paperlead_setting(); $pids = array(); foreach ($this->assigners as $assigner) { $assigner->cleanup($this); if ($assigner->pid > 0 && $assigner->notify_tracker()) { $pids[$assigner->pid] = true; } } if (count($pids) && opt("trackerCometSite")) { MeetingTracker::contact_tracker_comet(array_keys($pids)); } return true; }
function my_deadlines($prows = null) { // Return cleaned deadline-relevant settings that this user can see. global $Conf, $Opt, $Now; $dl = (object) array("now" => $Now, "sub" => (object) array(), "rev" => (object) array()); if ($this->privChair) { $dl->is_admin = true; } if ($this->is_author()) { $dl->is_author = true; } $graces = []; // submissions $sub_reg = setting("sub_reg"); $sub_update = setting("sub_update"); $sub_sub = setting("sub_sub"); $dl->sub->open = +setting("sub_open") > 0; $dl->sub->sub = +$sub_sub; if ($dl->sub->open) { $graces[] = [$dl->sub, "sub_grace"]; } if ($sub_reg && $sub_reg != $sub_update) { $dl->sub->reg = $sub_reg; } if ($sub_update && $sub_update != $sub_sub) { $dl->sub->update = $sub_update; } $sb = $Conf->submission_blindness(); if ($sb === Conf::BLIND_ALWAYS) { $dl->sub->blind = true; } else { if ($sb === Conf::BLIND_OPTIONAL) { $dl->sub->blind = "optional"; } else { if ($sb === Conf::BLIND_UNTILREVIEW) { $dl->sub->blind = "until-review"; } } } // responses if (+setting("resp_active") > 0) { $dlresps = []; foreach ($Conf->resp_round_list() as $i => $rname) { $isuf = $i ? "_{$i}" : ""; $dlresps[$rname] = $dlresp = (object) ["open" => +setting("resp_open{$isuf}"), "done" => +setting("resp_done{$isuf}")]; if ($dlresp->open) { $graces[] = [$dlresp, "resp_grace{$isuf}"]; } } if (count($dlresps)) { $dl->resps = $dlresps; } } // final copy deadlines if (+setting("final_open") > 0) { $dl->final = (object) array("open" => true); $final_soft = +setting("final_soft"); if ($final_soft > $Now) { $dl->final->done = $final_soft; } else { $dl->final->done = +setting("final_done"); $dl->final->ishard = true; } $graces[] = [$dl->final, "final_grace"]; } // reviewer deadlines $revtypes = array(); if ($this->is_reviewer() && ($rev_open = +setting("rev_open")) > 0 && $rev_open <= $Now) { $dl->rev->open = true; } if (get($dl->rev, "open")) { $dl->revs = []; $k = $this->isPC ? "pcrev" : "extrev"; foreach ($Conf->defined_round_list() as $i => $round_name) { $isuf = $i ? "_{$i}" : ""; $s = +setting("{$k}_soft{$isuf}"); $h = +setting("{$k}_hard{$isuf}"); $dl->revs[$round_name] = $dlround = (object) ["open" => true]; if ($h && ($h < $Now || $s < $Now)) { $dlround->done = $h; $dlround->ishard = true; } else { if ($s) { $dlround->done = $s; } } } // blindness $rb = $Conf->review_blindness(); if ($rb === Conf::BLIND_ALWAYS) { $dl->rev->blind = true; } else { if ($rb === Conf::BLIND_OPTIONAL) { $dl->rev->blind = "optional"; } } } // grace periods: give a minute's notice of an impending grace // period foreach ($graces as $g) { if ($grace = setting($g[1])) { foreach (array("reg", "update", "sub", "done") as $k) { if (get($g[0], $k) && $g[0]->{$k} + 60 < $Now && $g[0]->{$k} + $grace >= $Now) { $kgrace = "{$k}_ingrace"; $g[0]->{$kgrace} = true; } } } } // add meeting tracker if (($this->isPC || $this->tracker_kiosk_state) && $this->can_view_tracker()) { $tracker = MeetingTracker::lookup(); if ($tracker->trackerid && ($tinfo = MeetingTracker::info_for($this))) { $dl->tracker = $tinfo; $dl->tracker_status = MeetingTracker::tracker_status($tracker); if (get($Opt, "trackerHidden")) { $dl->tracker_hidden = true; } $dl->now = microtime(true); } if ($tracker->position_at) { $dl->tracker_status_at = $tracker->position_at; } if (get($Opt, "trackerCometSite")) { $dl->tracker_site = $Opt["trackerCometSite"]; } } // permissions if ($prows) { if (is_object($prows)) { $prows = array($prows); } $dl->perm = array(); foreach ($prows as $prow) { if (!$this->can_view_paper($prow)) { continue; } $perm = $dl->perm[$prow->paperId] = (object) array(); $rights = $this->rights($prow); $admin = $rights->allow_administer; if ($admin) { $perm->allow_administer = true; } if ($rights->act_author) { $perm->act_author = true; } if ($rights->act_author_view) { $perm->act_author_view = true; } if ($this->can_review($prow, null, false)) { $perm->can_review = true; } if ($this->can_comment($prow, null, true)) { $perm->can_comment = true; } else { if ($admin && $this->can_comment($prow, null, false)) { $perm->can_comment = "override"; } } if (get($dl, "resps")) { foreach ($Conf->resp_round_list() as $i => $rname) { $crow = (object) array("commentType" => COMMENTTYPE_RESPONSE, "commentRound" => $i); $v = false; if ($this->can_respond($prow, $crow, true)) { $v = true; } else { if ($admin && $this->can_respond($prow, $crow, false)) { $v = "override"; } } if ($v && !isset($perm->can_respond)) { $perm->can_responds = []; } if ($v) { $perm->can_responds[$rname] = $v; } } } if (self::can_some_author_view_submitted_review($prow)) { $perm->some_author_can_view_review = true; } } } return $dl; }
$when = $xr->reviewSubmitted; } } json_exit(["ok" => true, "from" => (int) $from, "to" => (int) $when - 1, "rows" => $rows]); } else { if ($qreq->fn === "events") { json_exit(["ok" => false]); } } if ($qreq->fn === "searchcompletion") { $s = new PaperSearch($Me, ""); $Conf->ajaxExit(array("ok" => true, "searchcompletion" => $s->search_completion())); } // from here on: `status` and `track` requests if ($qreq->fn === "track") { MeetingTracker::track_api($qreq, $Me); } // may fall through to act like `status` $j = $Me->my_deadlines($Conf->paper); if ($qreq->conflist && $Me->has_email() && ($cdb = Contact::contactdb())) { $j->conflist = array(); $result = Dbl::ql($cdb, "select c.confid, siteclass, shortName, url\n from Roles r join Conferences c on (c.confid=r.confid)\n join ContactInfo u on (u.contactDbId=r.contactDbId)\n where u.email=? order by r.updated_at desc", $Me->email); while ($row = edb_orow($result)) { $row->confid = (int) $row->confid; $j->conflist[] = $row; } } $pj = (object) array(); if ($Conf->paper && $Me->can_view_tags($Conf->paper)) { $Conf->paper->add_tag_info_json($pj, $Me); }