public function add_tag_info_json($pj, Contact $user)
 {
     if (!property_exists($this, "paperTags")) {
         $this->load_tags();
     }
     $tagger = new Tagger($user);
     $editable = $this->editable_tags($user);
     $viewable = $this->viewable_tags($user);
     $tags_view_html = $tagger->unparse_and_link($viewable, $this->paperTags, false);
     $pj->tags = TagInfo::split($viewable);
     $pj->tags_edit_text = $tagger->unparse($editable);
     $pj->tags_view_html = $tags_view_html;
     $pj->color_classes = TagInfo::color_classes($viewable);
 }
 function user_to_json($user)
 {
     global $Conf, $Me;
     if (!$user) {
         return null;
     }
     $cj = (object) array();
     if ($user->contactId) {
         $cj->id = $user->contactId;
     }
     // keys that might come from user or contactdb
     $cdb_user = $user->contactdb_user();
     foreach (["email", "firstName", "lastName", "affiliation", "collaborators"] as $k) {
         if ($user->{$k} !== null && $user->{$k} !== "") {
             $cj->{$k} = $user->{$k};
         } else {
             if ($cdb_user && $cdb_user->{$k} !== null && $cdb_user->{$k} !== "") {
                 $cj->{$k} = $cdb_user->{$k};
             }
         }
     }
     // keys that come from user
     foreach (["preferredEmail" => "preferred_email", "voicePhoneNumber" => "phone"] as $uk => $jk) {
         if ($user->{$uk} !== null && $user->{$uk} !== "") {
             $cj->{$jk} = $user->{$uk};
         }
     }
     if ($user->disabled) {
         $cj->disabled = true;
     }
     foreach (array("address", "city", "state", "zip", "country") as $k) {
         if ($x = $user->data($k)) {
             $cj->{$k} = $x;
         }
     }
     if ($user->roles) {
         $cj->roles = (object) array();
         if ($user->roles & Contact::ROLE_CHAIR) {
             $cj->roles->chair = $cj->roles->pc = true;
         } else {
             if ($user->roles & Contact::ROLE_PC) {
                 $cj->roles->pc = true;
             }
         }
         if ($user->roles & Contact::ROLE_ADMIN) {
             $cj->roles->sysadmin = true;
         }
     }
     if ($user->defaultWatch) {
         $cj->follow = (object) array();
         if ($user->defaultWatch & (WATCH_COMMENT | WATCH_ALLCOMMENTS)) {
             $cj->follow->reviews = true;
         }
         if ($user->defaultWatch & WATCH_ALLCOMMENTS) {
             $cj->follow->allreviews = true;
         }
         if ($user->defaultWatch & WATCHTYPE_FINAL_SUBMIT << WATCHSHIFT_ALL) {
             $cj->follow->allfinal = true;
         }
     }
     if ($tags = $user->viewable_tags($Me)) {
         $tagger = new Tagger();
         $cj->tags = explode(" ", $tagger->unparse($tags));
     }
     if ($user->roles & Contact::ROLE_PC && $user->contactId && ($tm = $Conf->topic_map()) && count($tm)) {
         $result = $Conf->qe("select topicId, " . $Conf->query_topic_interest() . " from TopicInterest where contactId={$user->contactId}");
         $topics = (object) array();
         while ($row = edb_row($result)) {
             $k = $row[0];
             $topics->{$k} = (int) $row[1];
         }
         if (count(get_object_vars($topics))) {
             $cj->topics = $topics;
         }
     }
     return $cj;
 }