public function unparse_text($contact, $no_title = false) { global $Conf; $x = "===========================================================================\n"; if (!($this->commentType & COMMENTTYPE_RESPONSE)) { $n = "Comment"; } else { if ($rname = $Conf->resp_round_text($this->commentRound)) { $n = "{$rname} Response"; } else { $n = "Response"; } } if ($contact->can_view_comment_identity($this->prow, $this, false)) { $n .= " by " . Text::user_text($this->user()); } $x .= center_word_wrap($n); if (!$no_title) { $x .= $this->prow->pretty_text_title(); } if ($this->commentTags && $contact->can_view_comment_tags($this->prow, $this, null) && ($tags = $this->viewable_tags($contact))) { $tagger = new Tagger($contact); $x .= center_word_wrap($tagger->unparse_hashed($tags)); } $x .= "---------------------------------------------------------------------------\n"; if ($this->commentOverflow) { $x .= $this->commentOverflow; } else { $x .= $this->comment; } return $x . "\n"; }
function pretty_text($prow, $rrow, $contact, $no_update_review_author_seen = false) { global $Conf; assert($prow !== null && $rrow !== null); $rrow_contactId = @$rrow->reviewContactId ?: (@$rrow->contactId ?: 0); $revViewScore = $contact->view_score_bound($prow, $rrow); self::check_review_author_seen($prow, $rrow, $contact, $no_update_review_author_seen); $x = "===========================================================================\n"; $n = Conf::$gShortName . " Review"; if (@$rrow->reviewOrdinal) { $n .= " #" . $prow->paperId . unparseReviewOrdinal($rrow->reviewOrdinal); } $x .= center_word_wrap($n); if ($rrow->reviewModified && $contact->can_view_review_time($prow, $rrow)) { $n = "Updated " . $Conf->printableTime($rrow->reviewModified); $x .= center_word_wrap($n); } $x .= "---------------------------------------------------------------------------\n"; $x .= $prow->pretty_text_title(); if ($contact->can_view_review_identity($prow, $rrow, false)) { if (isset($rrow->reviewFirstName)) { $n = Text::user_text($rrow->reviewFirstName, $rrow->reviewLastName, $rrow->reviewEmail); } else { if (isset($rrow->lastName)) { $n = Text::user_text($rrow); } else { $n = null; } } if ($n) { $x .= prefix_word_wrap("Reviewer: ", $n, $prow->pretty_text_title_indent()); } } $x .= "---------------------------------------------------------------------------\n\n"; $i = 0; $lastNumeric = null; foreach ($this->forder as $field => $f) { $i++; if ($f->view_score <= $revViewScore || $f->round_mask && !$f->is_round_visible($rrow)) { continue; } $fval = ""; if (isset($rrow->{$field})) { if ($f->has_options) { $fval = $f->unparse_value($rrow->{$field}); } else { $fval = rtrim(str_replace("\r\n", "\n", $rrow->{$field})); } } if ($fval == "") { continue; } if ($f->has_options) { $y = defval($f->options, $fval, ""); $sn = $f->name . ":"; /* "(1-" . count($f->options) . "):"; */ if ($lastNumeric === false) { $x .= "\n"; } if (strlen($sn) > 38 + strlen($fval)) { $x .= $sn . "\n" . prefix_word_wrap($fval . ". ", $y, 39 + strlen($fval)); } else { $x .= prefix_word_wrap($sn . " " . $fval . ". ", $y, 39 + strlen($fval)); } $lastNumeric = true; } else { $n = "===== " . $f->name . " ====="; if ($lastNumeric !== null) { $x .= "\n"; } $x .= center_word_wrap($n); $x .= "\n" . preg_replace("/^==\\+==/m", "\\==+==", $fval) . "\n"; $lastNumeric = false; } } return $x; }