Пример #1
0
 }
 if ($Conf->deadlinesAfter("rev_open") || $Me->privChair) {
     echo $sep, '<a href="', hoturl("offline"), '">Offline reviewing</a>';
     $sep = $xsep;
 }
 if ($Me->is_requester()) {
     echo $sep, '<a href="', hoturl("mail", "monreq=1"), '">Monitor external reviews</a>';
     $sep = $xsep;
 }
 if ($Conf->setting("rev_tokens")) {
     echo $sep;
     reviewTokenGroup(false);
     $sep = $xsep;
 }
 if ($myrow && $Conf->setting("rev_ratings") != REV_RATINGS_NONE) {
     $badratings = PaperSearch::unusableRatings($Me->privChair, $Me->contactId);
     $qx = count($badratings) ? " and not (PaperReview.reviewId in (" . join(",", $badratings) . "))" : "";
     $result = Dbl::qe_raw("select rating, count(PaperReview.reviewId) from PaperReview join ReviewRating on (PaperReview.contactId={$Me->contactId} and PaperReview.reviewId=ReviewRating.reviewId{$qx}) group by rating order by rating desc");
     if (edb_nrows($result)) {
         $a = array();
         while ($row = edb_row($result)) {
             if (isset(ReviewForm::$rating_types[$row[0]])) {
                 $a[] = "<a href=\"" . hoturl("search", "q=re:me+rate:%22" . urlencode(ReviewForm::$rating_types[$row[0]]) . "%22") . "\" title='List rated reviews'>{$row['1']} &ldquo;" . htmlspecialchars(ReviewForm::$rating_types[$row[0]]) . "&rdquo; " . pluralx($row[1], "rating") . "</a>";
             }
         }
         if (count($a) > 0) {
             echo "<div class='hint g'>\nYour reviews have received ", commajoin($a);
             if (count($a) > 1) {
                 echo " (these sets might overlap)";
             }
             echo ".<a class='help' href='", hoturl("help", "t=revrate"), "' title='About ratings'>?</a></div>\n";
 function _rows($queryOptions)
 {
     global $Conf;
     $aulimit = strlen($this->limit) >= 2 && $this->limit[0] == 'a' && $this->limit[1] == 'u';
     $pq = "select u.contactId,\n        firstName, lastName, email, affiliation, roles, contactTags,\n        voicePhoneNumber,\n        u.collaborators, lastLogin, disabled";
     if (isset($queryOptions['topics'])) {
         $pq .= ",\n topicIds, topicInterest";
     }
     if (isset($queryOptions["reviews"])) {
         $pq .= ",\n        count(if(r.reviewNeedsSubmit<=0,r.reviewSubmitted,r.reviewId)) as numReviews,\n        count(r.reviewSubmitted) as numReviewsSubmitted";
         if (isset($queryOptions["revratings"])) {
             $pq .= ",\n     sum(r.numRatings) as numRatings,\n        sum(r.sumRatings) as sumRatings";
         }
     }
     if (isset($queryOptions["leads"])) {
         $pq .= ",\n leadPaperIds, numLeads";
     }
     if (isset($queryOptions["shepherds"])) {
         $pq .= ",\n shepherdPaperIds, numShepherds";
     }
     if (isset($queryOptions['scores'])) {
         foreach ($queryOptions['scores'] as $score) {
             $pq .= ",\n\tgroup_concat(if(r.reviewSubmitted>0,r.{$score},null)) as {$score}";
         }
     }
     if (isset($queryOptions["repapers"])) {
         $pq .= ",\n\tgroup_concat(r.paperId) as paperIds,\n        group_concat(r.reviewId) as reviewIds,\n        group_concat(coalesce(r.reviewOrdinal,0)) as reviewOrdinals";
     } else {
         if (isset($queryOptions['papers'])) {
             $pq .= ",\n\tgroup_concat(PaperConflict.paperId) as paperIds";
         }
     }
     $pq .= "\n      from ContactInfo u\n";
     if (isset($queryOptions['topics'])) {
         $pq .= "    left join (select contactId, group_concat(topicId) as topicIds, group_concat(interest) as topicInterest\n                from TopicInterest\n                group by contactId) as ti on (ti.contactId=u.contactId)\n";
     }
     if (isset($queryOptions["reviews"])) {
         $j = "left join";
         if ($this->limit == "re" || $this->limit == "req" || $this->limit == "ext" || $this->limit == "resub" || $this->limit == "extsub") {
             $j = "join";
         }
         $pq .= "    {$j} (select r.*";
         if (isset($queryOptions["revratings"])) {
             $pq .= ", count(rating) as numRatings, sum(if(rating>0,1,0)) as sumRatings";
         }
         $pq .= "\n\t\tfrom PaperReview r\n                join Paper p on (p.paperId=r.paperId)";
         if (!$this->contact->privChair) {
             $pq .= "\n\t\tleft join PaperConflict pc on (pc.paperId=p.paperId and pc.contactId=" . $this->contact->contactId . ")";
         }
         if (isset($queryOptions["revratings"])) {
             $badratings = PaperSearch::unusableRatings($this->contact->privChair, $this->contact->contactId);
             $pq .= "\n\t\tleft join ReviewRating rr on (rr.reviewId=r.reviewId";
             if (count($badratings) > 0) {
                 $pq .= " and not (rr.reviewId in (" . join(",", $badratings) . "))";
             }
             $pq .= ")";
         }
         $jwhere = array();
         if ($this->limit == "req" || $this->limit == "ext" || $this->limit == "extsub") {
             $jwhere[] = "r.reviewType=" . REVIEW_EXTERNAL;
         }
         if ($this->limit == "req") {
             $jwhere[] = "r.requestedBy=" . $this->contact->contactId;
         }
         if (!$this->contact->privChair) {
             $jwhere[] = "(pc.conflictType is null or pc.conflictType=0 or r.contactId=" . $this->contact->contactId . ")";
         }
         $jwhere[] = "(p.timeSubmitted>0 or r.reviewSubmitted>0)";
         if (count($jwhere)) {
             $pq .= "\n\t\twhere " . join(" and ", $jwhere);
         }
         if (isset($queryOptions["revratings"])) {
             $pq .= "\n\t\tgroup by r.reviewId";
         }
         $pq .= ") as r on (r.contactId=u.contactId)\n";
     }
     if (isset($queryOptions["leads"])) {
         $pq .= "    left join (select p.leadContactId, group_concat(p.paperId) as leadPaperIds, count(p.paperId) as numLeads\n\t\tfrom Paper p";
         $jwhere = array("leadContactId is not null");
         if (!$this->contact->privChair) {
             $pq .= "\n\t\tleft join PaperConflict pc on (pc.paperId=p.paperId and pc.contactId=" . $this->contact->contactId . ")";
             $jwhere[] = "(conflictType is null or conflictType=0)";
         }
         $pq .= "\n\t\twhere " . join(" and ", $jwhere) . "\n\t\tgroup by p.leadContactId) as lead on (lead.leadContactId=u.contactId)\n";
     }
     if (isset($queryOptions["shepherds"])) {
         $pq .= "    left join (select p.shepherdContactId, group_concat(p.paperId) as shepherdPaperIds, count(p.paperId) as numShepherds\n\t\tfrom Paper p";
         $jwhere = array("shepherdContactId is not null");
         if (!$this->contact->privChair && !$Conf->timePCViewDecision(true)) {
             $pq .= "\n\t\tleft join PaperConflict pc on (pc.paperId=p.paperId and pc.contactId=" . $this->contact->contactId . ")";
             $mywhere = "conflictType is null or conflictType=0";
             if ($Conf->timeAuthorViewDecision()) {
                 $mywhere .= " or conflictType>=" . CONFLICT_AUTHOR;
             }
             $jwhere[] = "({$mywhere})";
         }
         $pq .= "\n\t\twhere " . join(" and ", $jwhere) . "\n\t\tgroup by p.shepherdContactId) as shep on (shep.shepherdContactId=u.contactId)\n";
     }
     if ($aulimit) {
         $pq .= "\tjoin PaperConflict on (PaperConflict.contactId=u.contactId and PaperConflict.conflictType>=" . CONFLICT_AUTHOR . ")\n";
     }
     if ($this->limit == "au") {
         $pq .= "\tjoin Paper on (Paper.paperId=PaperConflict.paperId and Paper.timeSubmitted>0)\n";
     }
     if ($this->limit == "aurej") {
         $pq .= "\tjoin Paper on (Paper.paperId=PaperConflict.paperId and Paper.outcome<0)\n";
     }
     if ($this->limit == "auacc") {
         $pq .= "\tjoin Paper on (Paper.paperId=PaperConflict.paperId and Paper.outcome>0)\n";
     }
     if ($this->limit == "auuns") {
         $pq .= "\tjoin Paper on (Paper.paperId=PaperConflict.paperId and Paper.timeSubmitted<=0)\n";
     }
     if ($this->limit == "all") {
         $pq .= "\tleft join PaperConflict on (PaperConflict.contactId=u.contactId and PaperConflict.conflictType>=" . CONFLICT_AUTHOR . ")\n";
     }
     $mainwhere = array();
     if (isset($queryOptions["where"])) {
         $mainwhere[] = $queryOptions["where"];
     }
     if ($this->limit == "pc") {
         $mainwhere[] = "(u.roles&" . Contact::ROLE_PC . ")!=0";
     }
     if ($this->limit == "admin") {
         $mainwhere[] = "(u.roles&" . (Contact::ROLE_ADMIN | Contact::ROLE_CHAIR) . ")!=0";
     }
     if ($this->limit == "pcadmin" || $this->limit == "pcadminx") {
         $mainwhere[] = "(u.roles&" . Contact::ROLE_PCLIKE . ")!=0";
     }
     if (count($mainwhere)) {
         $pq .= "\twhere " . join(" and ", $mainwhere) . "\n";
     }
     $pq .= "        group by u.contactId\n        order by lastName, firstName, email";
     // make query
     $result = $Conf->qe($pq);
     if (!$result) {
         return NULL;
     }
     // fetch data
     Contact::$allow_nonexistent_properties = true;
     $rows = array();
     while ($row = Contact::fetch($result)) {
         $rows[] = $row;
     }
     Contact::$allow_nonexistent_properties = false;
     return $rows;
 }