public function content($pl, $row, $rowidx)
 {
     $prefs = $row->reviewer_preferences();
     $ts = array();
     if ($prefs || $this->topics) {
         foreach (pcMembers() as $pcid => $pc) {
             if (($pref = get($prefs, $pcid)) && ($pref[0] !== 0 || $pref[1] !== null)) {
                 $t = "P" . $pref[0];
                 if ($pref[1] !== null) {
                     $t .= unparse_expertise($pref[1]);
                 }
                 $ts[] = $pcid . $t;
             } else {
                 if ($this->topics && ($tscore = $row->topic_interest_score($pc))) {
                     $ts[] = $pcid . "T" . $tscore;
                 }
             }
         }
     }
     $pl->row_attr["data-allpref"] = join(" ", $ts);
     if (!empty($ts)) {
         $t = '<span class="need-allpref">Loading</span>';
         $pl->need_render = true;
         return $t;
     } else {
         return '';
     }
 }
Exemplo n.º 2
0
function unparse_preference_span($preference, $always = false)
{
    if (is_object($preference)) {
        $preference = array(get($preference, "reviewerPreference"), get($preference, "reviewerExpertise"), get($preference, "topicInterestScore"));
    } else {
        if (!is_array($preference)) {
            $preference = array($preference, null, null);
        }
    }
    $pv = (int) get($preference, 0);
    $ev = get($preference, 1);
    $tv = (int) get($preference, 2);
    $type = 1;
    if ($pv < 0 || !$pv && $tv < 0) {
        $type = -1;
    }
    $t = "";
    if ($pv || $ev !== null || $always) {
        $t .= "P" . decorateNumber($pv) . unparse_expertise($ev);
    }
    if ($tv && !$pv) {
        $t .= ($t ? " " : "") . "T" . decorateNumber($tv);
    }
    if ($t !== "") {
        $t = " <span class=\"asspref{$type}\">{$t}</span>";
    }
    return $t;
}
 function run(Contact $user, $qreq, $ssel)
 {
     global $Conf, $Opt;
     $q = $Conf->paperQuery($user, array("paperId" => $ssel->selection(), "allReviewerPreference" => 1, "allConflictType" => 1, "topics" => 1));
     $result = Dbl::qe_raw($q);
     $texts = array();
     $pcm = pcMembers();
     $has_conflict = $has_expertise = $has_topic_score = false;
     while ($prow = PaperInfo::fetch($result, $user)) {
         if (!$user->can_administer($prow, true)) {
             continue;
         }
         $conflicts = $prow->conflicts();
         foreach ($pcm as $cid => $p) {
             $pref = $prow->reviewer_preference($p);
             $conf = get($conflicts, $cid);
             $tv = $prow->topicIds ? $prow->topic_interest_score($p) : 0;
             if ($pref || $conf || $tv) {
                 $texts[$prow->paperId][] = array("paper" => $prow->paperId, "title" => $prow->title, "first" => $p->firstName, "last" => $p->lastName, "email" => $p->email, "preference" => $pref[0] ?: "", "expertise" => unparse_expertise($pref[1]), "topic_score" => $tv ?: "", "conflict" => $conf ? "conflict" : "");
                 $has_conflict = $has_conflict || $conf;
                 $has_expertise = $has_expertise || $pref[1] !== null;
                 $has_topic_score = $has_topic_score || $tv;
             }
         }
     }
     $headers = array("paper", "title", "first", "last", "email", "preference");
     if ($has_expertise) {
         $headers[] = "expertise";
     }
     if ($has_topic_score) {
         $headers[] = "topic_score";
     }
     if ($has_conflict) {
         $headers[] = "conflict";
     }
     downloadCSV($ssel->reorder($texts), $headers, "allprefs", ["selection" => true]);
 }