Exemplo n.º 1
0
 function __construct($search, $args = array(), $qreq = null)
 {
     global $Conf;
     $this->search = $search;
     $this->contact = $this->search->contact;
     $this->qreq = $qreq ?: new Qobject();
     $this->sortable = isset($args["sort"]) && $args["sort"];
     if ($this->sortable && is_string($args["sort"])) {
         $this->sorters[] = ListSorter::parse_sorter($args["sort"]);
     } else {
         if ($this->sortable && $this->qreq->sort) {
             $this->sorters[] = ListSorter::parse_sorter($this->qreq->sort);
         } else {
             $this->sorters[] = ListSorter::parse_sorter("");
         }
     }
     $this->foldable = $this->sortable || !!get($args, "foldable") || $this->contact->privChair;
     $this->_paper_link_page = "";
     if (isset($qreq->linkto) && ($qreq->linkto == "paper" || $qreq->linkto == "review" || $qreq->linkto == "assign")) {
         $this->_paper_link_page = $qreq->linkto;
     }
     $this->listNumber = 0;
     if (get($args, "list")) {
         $this->listNumber = SessionList::allocate($search->listId($this->sortdef()));
     }
     if (is_string(get($args, "display"))) {
         $this->display = " " . $args["display"] . " ";
     } else {
         $svar = get($args, "foldtype", "pl") . "display";
         $this->display = $Conf->session($svar, "");
     }
     if (isset($args["reviewer"]) && ($r = $args["reviewer"])) {
         if (!is_object($r)) {
             error_log(caller_landmark() . ": warning: 'reviewer' not an object");
             $r = Contact::find_by_id($r);
         }
         $this->_reviewer = $r;
     }
     $this->atab = $this->qreq->atab;
     $this->_row_id_pattern = get($args, "row_id_pattern");
     $this->tagger = new Tagger($this->contact);
     $this->scoresOk = $this->contact->privChair || $this->contact->is_reviewer() || $Conf->timeAuthorViewReviews();
     $this->qopts = array("scores" => [], "options" => true);
     if ($this->search->complexSearch($this->qopts)) {
         $this->qopts["paperId"] = $this->search->paperList();
     }
     // NB that actually processed the search, setting PaperSearch::viewmap
     $this->viewmap = new Qobject($this->search->viewmap);
     if ($this->viewmap->compact || $this->viewmap->cc || $this->viewmap->compactcolumn || $this->viewmap->ccol || $this->viewmap->compactcolumns) {
         $this->viewmap->compactcolumns = $this->viewmap->columns = true;
     }
     if ($this->viewmap->column || $this->viewmap->col) {
         $this->viewmap->columns = true;
     }
     if ($this->viewmap->stat || $this->viewmap->stats || $this->viewmap->totals) {
         $this->viewmap->statistics = true;
     }
     if ($this->viewmap->authors && $this->viewmap->au === null) {
         $this->viewmap->au = true;
     }
     if ($Conf->submission_blindness() != Conf::BLIND_OPTIONAL && $this->viewmap->au && $this->viewmap->anonau === null) {
         $this->viewmap->anonau = true;
     }
     if ($this->viewmap->anonau && $this->viewmap->au === null) {
         $this->viewmap->au = true;
     }
     if ($this->viewmap->rownumbers) {
         $this->viewmap->rownum = true;
     }
 }
 private function _add_sorters($qe, $thenmap)
 {
     foreach ($qe->get_float("sort", array()) as $s) {
         if ($s = ListSorter::parse_sorter($s)) {
             $s->thenmap = $thenmap;
             $this->sorters[] = $s;
         }
     }
     if (!$qe->get_float("sort") && $qe->type === "pn") {
         $pn = array_diff($qe->value[0], $qe->value[1]);
         $s = ListSorter::make_field(new NumericOrderPaperColumn(array_flip($pn)));
         $s->thenmap = $thenmap;
         $this->sorters[] = $s;
     }
 }