function _review_table_actas($rr) { global $Me; if (!get($rr, "contactId") || $rr->contactId == $Me->contactId) { return ""; } return ' <a href="' . selfHref(array("actas" => $rr->email)) . '">' . Ht::img("viewas.png", "[Act as]", array("title" => "Act as " . Text::name_text($rr))) . "</a>"; }
function pcMembers() { global $Conf, $Opt, $PcMembersCache; if (!@$PcMembersCache || $Conf->setting("pc") <= 0 || $PcMembersCache[0] < $Conf->setting("pc") || $PcMembersCache[1] != @$Opt["sortByLastName"]) { $pc = array(); $result = Dbl::q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where (roles&" . Contact::ROLE_PC . ")!=0"); $by_name_text = array(); $pctags = array("pc" => "pc"); while ($result && ($row = Contact::fetch($result))) { $pc[$row->contactId] = $row; if ($row->firstName || $row->lastName) { $name_text = Text::name_text($row); if (isset($by_name_text[$name_text])) { $row->nameAmbiguous = $by_name_text[$name_text]->nameAmbiguous = true; } $by_name_text[$name_text] = $row; } if ($row->contactTags) { foreach (explode(" ", $row->contactTags) as $t) { list($tag, $value) = TagInfo::split_index($t); if ($tag) { $pctags[strtolower($tag)] = $tag; } } } } uasort($pc, "Contact::compare"); ksort($pctags); $order = 0; foreach ($pc as $row) { $row->sort_position = $order; ++$order; } $PcMembersCache = array($Conf->setting("pc"), @$Opt["sortByLastName"], $pc, $pctags); } return $PcMembersCache[2]; }
public function json() { // find out who is light and who is heavy // (light => less than 0.66 * (80th percentile)) $nass = array(); foreach ($this->r as $cid => $x) { $nass[] = count($x); } sort($nass); $heavy_boundary = 0; if (count($nass)) { $heavy_boundary = 0.66 * $nass[(int) (0.8 * count($nass))]; } $contacts = pcMembers(); $need_contacts = []; foreach ($this->r as $cid => $x) { if (!isset($contacts[$cid]) && ctype_digit($cid)) { $need_contacts[] = $cid; } } if (count($need_contacts)) { $result = Dbl::q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where contactId ?a", $need_contacts); while ($result && ($row = Contact::fetch($result))) { $contacts[$row->contactId] = $row; } } $users = array(); $tags = $this->contact->can_view_reviewer_tags(); foreach ($this->r as $cid => $x) { if ($cid != "conflicts") { $users[$cid] = $u = (object) array(); $p = get($contacts, $cid); if ($p) { $u->name = Text::name_text($p); } if (count($x) < $heavy_boundary) { $u->light = true; } if ($p && $tags && ($t = $p->viewable_color_classes($this->contact))) { $u->color_classes = $t; } } } return (object) array("reviews" => $this->r, "deadlines" => $this->dl, "users" => $users); }
private function name_for($pfx, $x) { $cid = is_object($x) ? $x->contactId : $x; $key = $pfx . $cid; if (isset($this->name_for_map_[$key])) { return $this->name_for_map_[$key]; } $pcm = pcMembers(); if (isset($pcm[$cid])) { $x = $pcm[$cid]; } else { if (!is_object($x) || !isset($x->email) || !isset($x->firstName) || !isset($x->lastName)) { $x = self::find_by_id($cid); $this->contact_sorter_map_[$cid] = $x->sorter; } } if ($pfx !== "t") { $n = Text::name_html($x); } else { $n = Text::name_text($x); } if ($pfx === "r" && ($colors = $this->reviewer_color_classes_for($x))) { $n = '<span class="' . $colors . '">' . $n . '</span>'; } return $this->name_for_map_[$key] = $n; }
function render_pset_row(Pset $pset, $students, Contact $s, $row, $pcmembers, $anonymous) { global $Conf, $Me, $Now, $Profile; $row->sortprefix = ""; $ncol = 0; $t0 = $Profile ? microtime(true) : 0; $j = []; $j["username"] = $s->github_username ?: $s->seascode_username ?: ($s->email ?: $s->huid); if ($anonymous) { $j["anon_username"] = $s->anon_username; } $j["sorter"] = $s->sorter; ++$ncol; $j["name"] = Text::name_text($s); if ($s->extension) { $j["x"] = true; } if (!$anonymous) { ++$ncol; } if ($s->gradercid) { $j["gradercid"] = $s->gradercid; } ++$ncol; // are any commits committed? if (!$pset->gitless_grades) { if (($s->placeholder || $s->gradehash === null) && $s->repoid && ($s->placeholder_at < $Now - 3600 && rand(0, 2) == 0 || $s->placeholder_at < $Now - 600 && rand(0, 10) == 0) && (!$s->repoviewable || !$s->gradehash)) { // XXX this is slow given that most info is already loaded $info = ContactView::user_pset_info($s, $pset); $info->set_commit(null); $s->gradehash = $info->commit_hash() ?: null; $s->placeholder = 1; Dbl::qe("insert into RepositoryGrade (repoid, pset, gradehash, placeholder, placeholder_at) values (?, ?, ?, 1, ?) on duplicate key update gradehash=(if(placeholder=1,values(gradehash),gradehash)), placeholder_at=values(placeholder_at)", $s->repoid, $pset->id, $s->gradehash, $Now); if (!$s->repoviewable) { $s->repoviewable = $s->can_view_repo_contents($info->repo); } } if (!$s->gradehash || $s->dropped) { $row->sortprefix = "~1 "; } } if (count($pset->grades)) { $gi = null; if ($pset->gitless_grades) { $gi = $pset->contact_grade_for($s); } else { if ($s->gradehash && !$s->placeholder) { $gi = $pset->commit_notes($s->gradehash); } } $gi = $gi ? $gi->notes : null; if (!$pset->gitless_grades) { if ($gi && get($gi, "linenotes")) { $j["has_notes"] = true; } else { if ($Me->contactId == $s->gradercid) { $s->incomplete = true; } } if ($gi && $s->gradercid != get($gi, "gradercid") && $Me->privChair) { $j["has_nongrader_notes"] = true; } ++$ncol; } $garr = render_grades($pset, $gi, $s); $ncol += count($garr->all); $j["grades"] = $garr->allv; $j["total"] = $garr->totalv; if ($garr->differentk) { $j["highlight_grades"] = $garr->differentk; } } //echo "<td><a href=\"mailto:", htmlspecialchars($s->email), "\">", //htmlspecialchars($s->email), "</a></td>"; if (!$pset->gitless && $s->url) { $j["repo"] = RepositorySite::make_web_url($s->url, $Conf); if (!$s->working) { $j["repo_broken"] = true; } else { if (!$s->repoviewable) { $j["repo_unconfirmed"] = true; } } if ($s->open) { $j["repo_too_open"] = true; } if ($s->pcid != $s->rpcid || $s->pcid && (!isset($students[$s->pcid]) || $students[$s->pcid]->repoid != $s->repoid)) { $j["repo_partner_error"] = true; } } ++$ncol; if (!get($row, "ncol") || $ncol > $row->ncol) { $row->ncol = $ncol; } $s->visited = true; return $j; }
public static function site_contact() { global $Opt; if (!get($Opt, "contactEmail") || $Opt["contactEmail"] == "*****@*****.**") { $result = Dbl::ql("select firstName, lastName, email from ContactInfo where (roles&" . (self::ROLE_CHAIR | self::ROLE_ADMIN) . ")!=0 order by (roles&" . self::ROLE_CHAIR . ") desc limit 1"); if ($result && ($row = $result->fetch_object())) { $Opt["defaultSiteContact"] = true; $Opt["contactName"] = Text::name_text($row); $Opt["contactEmail"] = $row->email; } } return new Contact((object) array("fullName" => $Opt["contactName"], "email" => $Opt["contactEmail"], "isChair" => true, "isPC" => true, "is_site_contact" => true, "contactTags" => null)); }
function echo_linenote($file, $lineid, $note, LinenotesOrder $lnorder = null) { $note_object = null; if (is_object($note)) { // How the f**k did this shit get in the DB, why does PHP suck $note_object = $note; $note = []; for ($i = 0; property_exists($note_object, $i); ++$i) { $note[] = $note_object->{$i}; } } if (!is_array($note)) { $note = array(false, $note); } if ($this->can_see_grades || $note[0]) { echo '<tr class="diffl61 gw">', '<td colspan="2" class="difflnoteborder61"></td>', '<td class="difflnote61">'; if ($lnorder) { $links = array(); //list($pfile, $plineid) = $lnorder->get_prev($file, $lineid); //if ($pfile) // $links[] = '<a href="#L' . $plineid . '_' // . html_id_encode($pfile) . '">← Prev</a>'; list($nfile, $nlineid) = $lnorder->get_next($file, $lineid); if ($nfile) { $links[] = '<a href="#L' . $nlineid . '_' . html_id_encode($nfile) . '">Next ></a>'; } else { $links[] = '<a href="#">Top</a>'; } if (!empty($links)) { echo '<div class="difflnoteptr61">', join(" ", $links), '</div>'; } } if ($this->pc_view && get($note, 2)) { global $Conf; $pcmembers = $Conf->pc_members_and_admins(); if (isset($pcmembers[$note[2]])) { $p = $pcmembers[$note[2]]; echo '<div class="difflnoteauthor61">[', htmlspecialchars($p->firstNameAmbiguous ? Text::name_text($p) : $p->firstName), ']</div>'; } } if (!is_string($note[1])) { error_log("fudge {$this->user->github_username} error: " . json_encode($note)); } echo '<div class="note61', $note[0] ? ' commentnote' : ' gradenote', '">', htmlspecialchars($note[1]), '</div>', '<div class="clear"></div></td></tr>'; } }
private static function status_papers($status, $tracker, $acct) { global $Conf; $pids = array_slice($tracker->ids, $tracker->position, 3); $pc_conflicts = $acct->privChair || $acct->tracker_kiosk_state; $col = $j = ""; if ($pc_conflicts) { $col = ", allconfs.conflictIds"; $j = "left join (select paperId, group_concat(contactId) conflictIds from PaperConflict where paperId in (" . join(",", $pids) . ") group by paperId) allconfs on (allconfs.paperId=p.paperId)\n\t\t"; $pcm = pcMembers(); } $result = $Conf->qe("select p.paperId, p.title, p.paperFormat, p.leadContactId, p.managerContactId, r.reviewType, conf.conflictType{$col}\n from Paper p\n left join PaperReview r on (r.paperId=p.paperId and " . ($acct->contactId ? "r.contactId={$acct->contactId}" : "false") . ")\n left join PaperConflict conf on (conf.paperId=p.paperId and " . ($acct->contactId ? "conf.contactId={$acct->contactId}" : "false") . ")\n {$j}where p.paperId in (" . join(",", $pids) . ")"); $papers = array(); while ($row = PaperInfo::fetch($result, $acct)) { $papers[$row->paperId] = $p = (object) array(); if (($acct->privChair || !$row->conflictType || !get($status, "hide_conflicts")) && $acct->tracker_kiosk_state != 1) { $p->pid = (int) $row->paperId; $p->title = $row->title; if ($format = $row->title_format()) { $p->format = $format; } } if ($acct->contactId > 0 && $row->managerContactId == $acct->contactId) { $p->is_manager = true; } if ($row->reviewType) { $p->is_reviewer = true; } if ($row->conflictType) { $p->is_conflict = true; } if ($acct->contactId > 0 && $row->leadContactId == $acct->contactId) { $p->is_lead = true; } if ($pc_conflicts) { $p->pc_conflicts = array(); foreach (explode(",", (string) $row->conflictIds) as $cid) { if ($pc = get($pcm, $cid)) { $p->pc_conflicts[$pc->sort_position] = (object) array("email" => $pc->email, "name" => Text::name_text($pc)); } } ksort($p->pc_conflicts); $p->pc_conflicts = array_values($p->pc_conflicts); } } Dbl::free($result); $status->papers = array(); foreach ($pids as $pid) { $status->papers[] = $papers[$pid]; } }
function pcMembers() { global $Conf; $version = 2; if (!isset($_SESSION["pcmembers"]) || !is_array($_SESSION["pcmembers"]) || count($_SESSION["pcmembers"]) < 3 || $Conf->setting("pc") <= 0 || $_SESSION["pcmembers"][0] < $Conf->setting("pc") || $_SESSION["pcmembers"][1] != $version || count($_SESSION["pcmembers"][2]) == 0) { $pc = array(); $qa = ($Conf->sversion >= 35 ? ", contactTags" : "") . ($Conf->sversion >= 47 ? ", disabled" : ""); $result = $Conf->q("select firstName, lastName, affiliation, email, u.contactId contactId, roles{$qa} from ContactInfo u where (roles&" . Contact::ROLE_PC . ")!=0"); $by_name_text = array(); while ($row = edb_orow($result)) { $pc[$row->contactId] = $row = Contact::make($row); if ($row->firstName || $row->lastName) { $name_text = Text::name_text($row); if (isset($by_name_text[$name_text])) { $row->nameAmbiguous = $by_name_text[$name_text]->nameAmbiguous = true; } $by_name_text[$name_text] = $row; } } uasort($pc, "Contact::compare"); $_SESSION["pcmembers"] = array($Conf->setting("pc"), $version, $pc); } return $_SESSION["pcmembers"][2]; }
private function same_authors($pj, $opj) { $pj_ct = count(get($pj, "authors")); $opj_ct = count(get($opj, "authors")); if ($pj_ct != $opj_ct) { return false; } for ($i = 0; $i != $pj_ct; ++$i) { if (get($pj->authors[$i], "email") !== get($opj->authors[$i], "email") || get_s($pj->authors[$i], "affiliation") !== get_s($opj->authors[$i], "affiliation") || Text::name_text($pj->authors[$i]) !== Text::name_text($opj->authors[$i])) { return false; } } return true; }
function expandvar_recipient($what, $isbool) { global $Conf; // rest is only there if we have a pset if (!$this->pset) { return self::EXPANDVAR_CONTINUE; } if ($what == "%PSET%" || $what == "%TITLE%") { return $this->pset->title; } if ($what == "%REPO%") { if ($this->pset->gitless) { return $isbool ? false : self::EXPANDVAR_CONTINUE; } $info = $this->get_pset_info(); if (!$info || !$info->repo) { return $isbool ? false : "(no repo)"; } return $info->repo->web_url(); } if ($what == "%PARTNER%") { if (!$this->pset->partner) { return $isbool ? false : self::EXPANDVAR_CONTINUE; } $info = $this->get_pset_info(); if (!$info || !$info->partner) { return $isbool ? false : "N/A"; } return Text::name_text($info->partner); } if (preg_match(',\\A%(?:COMMIT(?:|HASH|ABBREV|TITLE|DATE)|LATEHOURS)%\\z,', $what)) { if ($this->pset->gitless) { return $isbool ? false : self::EXPANDVAR_CONTINUE; } $info = $this->get_pset_info(); $recent = null; if ($info && $info->has_commit_set()) { $recent = $info->commit(); } if (!$recent) { if ($isbool) { return false; } else { if ($what == "%COMMITABBREV%" || $what == "%COMMITDATE%") { return "N/A"; } else { return "(no commit)"; } } } if ($what == "%COMMITHASH%") { return $recent->hash; } if ($what == "%COMMITABBREV%") { return substr($recent->hash, 0, 7); } if ($what == "%COMMIT%" && !$recent) { return substr($recent->hash, 0, 7); } else { if (!$recent) { return $isbool ? false : "(unknown)"; } else { if ($what == "%COMMITTITLE%") { return $recent->subject ?: "(empty)"; } else { if ($what == "%COMMIT%") { $subject = UnicodeHelper::utf8_prefix($recent->subject, 72); if (strlen($subject) != strlen($recent->subject)) { $subject .= "..."; } return substr($recent->hash, 0, 7) . ($subject === "" ? "" : " {$subject}"); } else { if ($what == "%COMMITDATE%") { return date("Y/m/d H:i:s", $recent->commitat); } else { if ($what == "%LATEHOURS%") { // XXX should use PsetView::late_hours if ($this->pset->deadline_extension && ($this->recipient->extension || $info->partner && $info->partner->extension)) { $deadline = $this->pset->deadline_extension; } else { if ($this->pset->deadline_college) { $deadline = $this->pset->deadline_college; } else { $deadline = $this->pset->deadline; } } if (!$deadline || $recent->commitat <= $deadline) { return $isbool ? false : "0"; } else { return (string) (int) (($recent->commitat - $deadline + 3599) / 3600); } } } } } } } } if ($what == "%GRADEENTRIES%") { $info = $this->get_pset_info(); if (!$info->can_see_grades) { return $isbool ? false : ""; } $t = ""; $total = $maxtotal = 0; // XXX better computation foreach ($this->pset->grades as $ge) { $g = $info->current_grade_entry($ge->name); if ($ge->is_extra ? $g : $g !== null) { $t .= (isset($ge->title) ? $ge->title : $ge->name) . ": " . ($g ?: 0); if ($ge->max && !$ge->hide_max) { $t .= " / " . $ge->max; } $t .= "\n"; } if ($g && !$ge->no_total) { $total += $g; } if (!$ge->is_extra && !$ge->no_total && !$ge->hide_max) { $maxtotal += $ge->max; } } if ($total || $maxtotal) { $t .= "TOTAL: " . $total; if ($maxtotal) { $t .= " / " . $maxtotal; } $t .= "\n"; } return $t; } return self::EXPANDVAR_CONTINUE; }
function content($fieldId, $row) { global $Conf; switch ($fieldId) { case self::FIELD_NAME: $t = Text::name_html($row); if (trim($t) == "") { $t = "[No name]"; } $t = '<span class="taghl">' . $t . '</span>'; if ($this->contact->privChair) { $t = "<a href=\"" . hoturl("profile", "u=" . urlencode($row->email) . $this->contactLinkArgs) . "\"" . ($row->disabled ? " class='uu'" : "") . ">{$t}</a>"; } if ($row->roles & Contact::ROLE_CHAIR) { $t .= ' <span class="pcrole">(chair)</span>'; } else { if (($row->roles & (Contact::ROLE_ADMIN | Contact::ROLE_PC)) == (Contact::ROLE_ADMIN | Contact::ROLE_PC)) { $t .= ' <span class="pcrole">(PC, sysadmin)</span>'; } else { if ($row->roles & Contact::ROLE_ADMIN) { $t .= ' <span class="pcrole">(sysadmin)</span>'; } else { if ($row->roles & Contact::ROLE_PC && $this->limit != "pc") { $t .= ' <span class="pcrole">(PC)</span>'; } } } } if ($this->contact->privChair && $row->email != $this->contact->email) { $t .= " <a href=\"" . hoturl("index", "actas=" . urlencode($row->email)) . "\">" . Ht::img("viewas.png", "[Act as]", array("title" => "Act as " . Text::name_text($row))) . "</a>"; } if ($row->disabled && $this->contact->isPC) { $t .= ' <span class="hint">(disabled)</span>'; } return $t; case self::FIELD_EMAIL: if (!$this->contact->isPC) { return ""; } $e = htmlspecialchars($row->email); if (strpos($row->email, "@") === false) { return $e; } else { return "<a href=\"mailto:{$e}\">{$e}</a>"; } case self::FIELD_AFFILIATION: case self::FIELD_AFFILIATION_ROW: return htmlspecialchars($row->affiliation); case self::FIELD_LASTVISIT: if (!$row->lastLogin) { return "Never"; } return $Conf->printableTimeShort($row->lastLogin); case self::FIELD_SELECTOR: case self::FIELD_SELECTOR_ON: $this->any->sel = true; $c = ""; if ($fieldId == self::FIELD_SELECTOR_ON) { $c = " checked='checked'"; } return "<input type='checkbox' class='cb' name='pap[]' value='{$row->contactId}' tabindex='1' id='psel{$this->count}' onclick='rangeclick(event,this)' {$c}/>"; case self::FIELD_HIGHTOPICS: case self::FIELD_LOWTOPICS: if (!defval($row, "topicIds")) { return ""; } $wanthigh = $fieldId == self::FIELD_HIGHTOPICS; $topics = array_combine(explode(",", $row->topicIds), explode(",", $row->topicInterest)); $nt = $nti = array(); foreach ($topics as $k => $v) { if ($wanthigh ? $v > 0 : $v < 0) { $nt[] = $k; $nti[] = $v; } } if (count($nt)) { return PaperInfo::unparse_topic_list_html($nt, $nti, true); } else { return ""; } case self::FIELD_REVIEWS: if (!$row->numReviews && !$row->numReviewsSubmitted) { return ""; } $a1 = "<a href=\"" . hoturl("search", "t=s&q=re:" . urlencode($row->email)) . "\">"; if ($row->numReviews == $row->numReviewsSubmitted) { return "{$a1}<b>{$row->numReviewsSubmitted}</b></a>"; } else { return "{$a1}<b>{$row->numReviewsSubmitted}</b>/{$row->numReviews}</a>"; } case self::FIELD_LEADS: if (!$row->numLeads) { return ""; } return "<a href=\"" . hoturl("search", "t=s&q=lead:" . urlencode($row->email)) . "\">{$row->numLeads}</a>"; case self::FIELD_SHEPHERDS: if (!$row->numShepherds) { return ""; } return "<a href=\"" . hoturl("search", "t=s&q=shepherd:" . urlencode($row->email)) . "\">{$row->numShepherds}</a>"; case self::FIELD_REVIEW_RATINGS: if (!$row->numReviews && !$row->numReviewsSubmitted || !$row->numRatings) { return ""; } $a = array(); $b = array(); if ($row->sumRatings > 0) { $a[] = $row->sumRatings . " positive"; $b[] = "<a href=\"" . hoturl("search", "q=re:" . urlencode($row->email) . "+rate:%2B") . "\">+" . $row->sumRatings . "</a>"; } if ($row->sumRatings < $row->numRatings) { $a[] = $row->numRatings - $row->sumRatings . " negative"; $b[] = "<a href=\"" . hoturl("search", "q=re:" . urlencode($row->email) . "+rate:-") . "\">−" . ($row->numRatings - $row->sumRatings) . "</a>"; } return "<span class='hastitle' title='" . join(", ", $a) . "'>" . join(" ", $b) . "</span>"; case self::FIELD_PAPERS: if (!$row->paperIds) { return ""; } $x = explode(",", $row->paperIds); sort($x, SORT_NUMERIC); foreach ($x as &$v) { $v = '<a href="' . hoturl("paper", "p={$v}") . '">' . $v . '</a>'; } $ls = "p/s/"; if ($this->limit == "auuns" || $this->limit == "all") { $ls = "p/all/"; } $ls = htmlspecialchars($ls . urlencode("au:" . $row->email)); return '<div class="has_hotcrp_list" data-hotcrp-list="' . $ls . '">' . join(", ", $x) . '</div>'; case self::FIELD_REVIEW_PAPERS: if (!$row->paperIds) { return ""; } $pids = explode(",", $row->paperIds); $rids = explode(",", $row->reviewIds); $ords = explode(",", $row->reviewOrdinals); $spids = $pids; sort($spids, SORT_NUMERIC); $m = array(); for ($i = 0; $i != count($pids); ++$i) { if ($ords[$i]) { $url = hoturl("paper", "p=" . $pids[$i] . "#r" . $pids[$i] . unparseReviewOrdinal($ords[$i])); } else { $url = hoturl("review", "p=" . $pids[$i] . "&r=" . $rids[$i]); } $m[$pids[$i]] = "<a href=\"{$url}\">" . $pids[$i] . "</a>"; } ksort($m, SORT_NUMERIC); $ls = htmlspecialchars("p/s/" . urlencode("re:" . $row->email)); return '<div class="has_hotcrp_list" data-hotcrp-list="' . $ls . '">' . join(", ", $m) . '</div>'; case self::FIELD_TAGS: if ($this->contact->isPC && ($tags = $row->viewable_tags($this->contact))) { $x = []; foreach (TagInfo::split($tags) as $t) { $x[] = '<a class="qq nw" href="' . hoturl("users", "t=%23" . TagInfo::base($t)) . '">' . $this->tagger->unparse_hashed($t) . '</a>'; } return join(" ", $x); } return ""; case self::FIELD_COLLABORATORS: if (!$this->contact->isPC || !($row->roles & Contact::ROLE_PC)) { return ""; } $t = array(); foreach (explode("\n", $row->collaborators) as $collab) { if (preg_match(',\\A(.*?)\\s*(\\(.*\\))\\s*\\z,', $collab, $m)) { $t[] = '<span class="nw">' . htmlspecialchars($m[1]) . ' <span class="auaff">' . htmlspecialchars($m[2]) . '</span></span>'; } else { if (($collab = trim($collab)) !== "" && strcasecmp($collab, "None")) { $t[] = '<span class="nw">' . htmlspecialchars($collab) . '</span>'; } } } return join("; ", $t); default: $f = ReviewForm::field($fieldId); if (!$f) { return ""; } if (!($row->roles & Contact::ROLE_PC) && !$this->contact->privChair && $this->limit != "req") { return ""; } $v = scoreCounts($row->{$fieldId}, $this->scoreMax[$fieldId]); $m = ""; if ($v->n > 0) { $m = $f->unparse_graph($v, 2, 0); } return $m; } }
function pc_members() { if ($this->_pc_members_cache === null) { $pc = $pca = array(); $result = $this->q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where roles!=0 and (roles&" . Contact::ROLE_PCLIKE . ")!=0"); $by_name_text = $by_first_text = []; $this->_pc_tags_cache = ["pc" => "pc"]; while ($result && ($row = Contact::fetch($result, $this))) { $pca[$row->contactId] = $row; if ($row->roles & Contact::ROLE_PC) { $pc[$row->contactId] = $row; } if ($row->firstName || $row->lastName) { $name_text = Text::name_text($row); if (isset($by_name_text[$name_text])) { $row->nameAmbiguous = $by_name_text[$name_text]->nameAmbiguous = true; } $by_name_text[$name_text] = $row; } if ($row->firstName) { if (isset($by_first_text[$row->firstName])) { $row->firstNameAmbiguous = $by_first_text[$row->firstName]->firstNameAmbiguous = true; } $by_first_text[$row->firstName] = $row; } if ($row->contactTags) { foreach (explode(" ", $row->contactTags) as $t) { list($tag, $value) = TagInfo::split_index($t); if ($tag) { $this->_pc_tags_cache[strtolower($tag)] = $tag; } } } } Dbl::free($result); uasort($pc, "Contact::compare"); $order = 0; foreach ($pc as $row) { $row->sort_position = $order; ++$order; } $this->_pc_members_cache = $pc; uasort($pca, "Contact::compare"); $this->_pc_members_and_admins_cache = $pca; ksort($this->_pc_tags_cache); } return $this->_pc_members_cache; }
function expandvar_recipient($what, $isbool) { global $Conf; // rest is only there if we have a pset if (!$this->pset) { return self::EXPANDVAR_CONTINUE; } if ($what == "%PSET%" || $what == "%TITLE%") { return $this->pset->title; } if ($what == "%REPO%") { if ($this->pset->gitless) { return $isbool ? false : self::EXPANDVAR_CONTINUE; } $info = $this->get_pset_info(); if (!$info || !$info->repo) { return $isbool ? false : "(no repo)"; } return Contact::repo_https_url($info->repo->url); } if ($what == "%PARTNER%") { if (!$this->pset->partner) { return $isbool ? false : self::EXPANDVAR_CONTINUE; } $info = $this->get_pset_info(); if (!$info || !$info->partner) { return $isbool ? false : "N/A"; } return Text::name_text($info->partner); } if (preg_match(',\\A%(?:COMMIT(?:|HASH|ABBREV|TITLE|DATE)|LATEHOURS)%\\z,', $what)) { if ($this->pset->gitless) { return $isbool ? false : self::EXPANDVAR_CONTINUE; } $info = $this->get_pset_info(); $recent = $info ? @$info->commit() : null; if (!$recent) { if ($isbool) { return false; } else { if ($what == "%COMMITABBREV%" || $what == "%COMMITDATE%") { return "N/A"; } else { return "(no commit)"; } } } if ($what == "%COMMITHASH%") { return $recent->hash; } if ($what == "%COMMITABBREV%") { return substr($recent->hash, 0, 7); } if ($what == "%COMMIT%" && !$recent) { return substr($recent->hash, 0, 7); } else { if (!$recent) { return $isbool ? false : "(unknown)"; } else { if ($what == "%COMMITTITLE%") { return $recent->subject ?: "(empty)"; } else { if ($what == "%COMMIT%") { $subject = utf8_substr($recent->subject, 0, 72); if (strlen($subject) != strlen($recent->subject)) { $subject .= "..."; } return substr($recent->hash, 0, 7) . ($subject === "" ? "" : " {$subject}"); } else { if ($what == "%COMMITDATE%") { return date("Y/m/d H:i:s", $recent->commitat); } else { if ($what == "%LATEHOURS%") { // XXX should use PsetView::late_hours if ($this->pset->deadline_extension && ($this->recipient->extension || $info->partner && $info->partner->extension)) { $deadline = $this->pset->deadline_extension; } else { if ($this->pset->deadline_college) { $deadline = $this->pset->deadline_college; } else { $deadline = $this->pset->deadline; } } if (!$deadline || $recent->commitat <= $deadline) { return $isbool ? false : "0"; } else { return (string) (int) (($recent->commitat - $deadline + 3599) / 3600); } } } } } } } } return self::EXPANDVAR_CONTINUE; }