Ejemplo n.º 1
0
 public static function lookup_all(Contact $user)
 {
     $reg = array();
     foreach (PaperOption::user_option_list($user) as $opt) {
         if ($opt->display() >= 0) {
             $reg[] = self::_make_column($opt);
         }
     }
     return $reg;
 }
Ejemplo n.º 2
0
 function search_completion($category = "")
 {
     global $Conf, $Me;
     $res = array();
     if ($this->amPC && (!$category || $category === "ss")) {
         foreach ($Conf->settingTexts as $k => $v) {
             if (substr($k, 0, 3) == "ss:" && ($v = json_decode($v))) {
                 $res[] = $k;
             }
         }
     }
     array_push($res, "has:submission", "has:abstract", "has:finalcopy");
     if ($this->amPC && $Conf->has_any_manager()) {
         $res[] = "has:admin";
     }
     if ($this->amPC && $Conf->has_any_lead_or_shepherd()) {
         $res[] = "has:lead";
     }
     if ($this->contact->can_view_some_decision()) {
         $res[] = "has:decision";
         if (!$category || $category === "dec") {
             $res[] = array("pri" => -1, "nosort" => true, "i" => array("dec:any", "dec:none", "dec:yes", "dec:no"));
             $dm = $Conf->decision_map();
             unset($dm[0]);
             $res = array_merge($res, self::simple_search_completion("dec:", $dm, Text::SEARCH_UNPRIVILEGE_EXACT));
         }
     }
     if ($this->amPC || $this->contact->can_view_some_decision()) {
         $res[] = "has:shepherd";
     }
     if ($this->contact->can_view_some_review()) {
         array_push($res, "has:re", "has:cre", "has:ire", "has:pre", "has:comment", "has:aucomment");
     }
     if ($this->contact->is_reviewer()) {
         array_push($res, "has:primary", "has:secondary", "has:external");
     }
     foreach ($Conf->resp_round_list() as $i => $rname) {
         if (!in_array("has:response", $res)) {
             $res[] = "has:response";
         }
         if ($i) {
             $res[] = "has:{$rname}response";
         }
     }
     if ($this->contact->can_view_some_draft_response()) {
         foreach ($Conf->resp_round_list() as $i => $rname) {
             if (!in_array("has:draftresponse", $res)) {
                 $res[] = "has:draftresponse";
             }
             if ($i) {
                 $res[] = "has:draft{$rname}response";
             }
         }
     }
     foreach (PaperOption::user_option_list($this->contact) as $o) {
         if ($this->contact->can_view_some_paper_option($o)) {
             array_push($res, "has:{$o->abbr}", "opt:{$o->abbr}");
         }
     }
     if ($this->contact->is_reviewer() && $Conf->has_rounds() && (!$category || $category === "round")) {
         $res[] = array("pri" => -1, "nosort" => true, "i" => array("round:any", "round:none"));
         $rlist = array();
         foreach ($Conf->round_list() as $rnum => $round) {
             if ($rnum && $round !== ";") {
                 $rlist[$rnum] = $round;
             }
         }
         $res = array_merge($res, self::simple_search_completion("round:", $rlist));
     }
     if ($Conf->has_topics() && (!$category || $category === "topic")) {
         foreach ($Conf->topic_map() as $tname) {
             $res[] = "topic:\"{$tname}\"";
         }
     }
     if (!$category || $category === "style") {
         $res[] = array("pri" => -1, "nosort" => true, "i" => array("style:any", "style:none", "color:any", "color:none"));
         foreach (explode("|", TagInfo::BASIC_COLORS) as $t) {
             array_push($res, "style:{$t}", "color:{$t}");
         }
     }
     if (!$category || $category === "show" || $category === "hide") {
         $cats = array();
         $pl = new PaperList(new PaperSearch($Me, ""));
         foreach (PaperColumn::$by_name as $c) {
             if (($cat = $c->completion_name()) && $c->prepare($pl, PaperColumn::PREP_COMPLETION)) {
                 $cats[$cat] = true;
             }
         }
         foreach (PaperColumn::$factories as $f) {
             foreach ($f[1]->completion_instances($this->contact) as $c) {
                 if (($cat = $c->completion_name()) && $c->prepare($pl, PaperColumn::PREP_COMPLETION)) {
                     $cats[$cat] = true;
                 }
             }
         }
         foreach (array_keys($cats) as $cat) {
             array_push($res, "show:{$cat}", "hide:{$cat}");
         }
         array_push($res, "show:compact", "show:statistics", "show:rownumbers");
     }
     return $res;
 }