private function printResult($result, $includeProofs) { $output = ""; switch ($result["type"]) { case "item": $parent = getEnclosingTag($result["position"]); $section = getEnclosingSection($result["position"]); // enumeration can live in sections, hence we should take care of this sidecase if ($parent["tag"] == $section["tag"]) { $output .= "<li><p><a href='" . href("tag/" . $result["tag"]) . "'>" . ucfirst($result["type"]) . " " . $result["book_id"] . "</a> of the enumeration in <a href='" . href("tag/" . $section["tag"]) . "'>" . ucfirst($section["type"]) . " " . $section["book_id"] . "</a></p>"; } else { $output .= "<li><p><a href='" . href("tag/" . $result["tag"]) . "'>" . ucfirst($result["type"]) . " " . $result["book_id"] . "</a> of the enumeration in <a href='" . href("tag/" . $parent["tag"]) . "'>" . ucfirst($parent["type"]) . " " . $parent["book_id"] . "</a> in <a href='" . href("tag/" . $section["tag"]) . "'>" . "Section " . $section["book_id"] . ": " . parseAccents($section["name"]) . "</a></p>"; } break; case "section": $output .= "<li><p><a href='" . href("tag/" . $result["tag"]) . "'>" . ucfirst($result["type"]) . " " . $result["book_id"] . ((!empty($result["name"]) and $result["type"] != "equation") ? ": " . parseAccents($result["name"]) . "</a>" : "</a>") . "</p>"; break; default: $section = getEnclosingSection($result["position"]); $output .= "<li><p><a href='" . href("tag/" . $result["tag"]) . "'>" . ucfirst($result["type"]) . " " . $result["book_id"] . ((!empty($result["name"]) and $result["type"] != "equation") ? ": " . parseAccents($result["name"]) . "</a>" : "</a>") . " in <a href='" . href("tag/" . $section["tag"]) . "'>" . "Section " . $section["book_id"] . ": " . parseAccents($section["name"]) . "</a></p>"; break; } if (!in_array($result["type"], array("section", "subsection"))) { if ($includeProofs) { $output .= "<pre class='preview' id='text-" . $result["tag"] . "'>" . parsePreview($result["text"]) . "</pre>"; } else { $output .= "<pre class='preview' id='text-" . $result["tag"] . "'>" . parsePreview($result["text_without_proofs"]) . "</pre>"; } } return $output; }
private function printBreadcrumb() { $output = ""; $chapter = getEnclosingChapter($this->tag["position"]); $section = getEnclosingSection($this->tag["position"]); $output .= "<p style='font-size: .9em'><a href='" . href("tag/" . $chapter["tag"]) . "'>Chapter " . $chapter["book_id"] . ": " . parseAccents($chapter["name"]) . "</a> > "; $output .= "<a href='" . href("tag/" . $section["tag"]) . "'>Section " . $section["book_id"] . ": " . parseAccents($section["name"]) . "</a>"; if ($this->tag["type"] == "item" or $this->tag["type"] == "equation") { $enclosingTag = getEnclosingTag($this->tag["position"]); $output .= " > <a href='" . href("tag/" . $enclosingTag["tag"]) . "'>" . ucfirst($enclosingTag["type"]) . " " . $enclosingTag["book_id"] . "</a>"; } return $output; }