コード例 #1
0
ファイル: compact.php プロジェクト: rathervague/phpgedview
function print_td_person($n)
{
    global $treeid, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang;
    global $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $USE_SILHOUETTE, $PGV_IMAGES;
    global $showids, $showthumbs;
    $text = "";
    $pid = $treeid[$n];
    if ($TEXT_DIRECTION == "ltr") {
        $title = $pgv_lang["indi_info"] . ": " . $pid;
    } else {
        $title = $pid . " :" . $pgv_lang["indi_info"];
    }
    if ($pid) {
        $indi = Person::getInstance($pid);
        $name = $indi->getFullName();
        $addname = $indi->getAddName();
        if ($showthumbs && $MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) {
            if (showFact("OBJE", $pid)) {
                $object = find_highlighted_object($pid, PGV_GED_ID, $indi->gedrec);
                if (!empty($object)) {
                    $whichFile = thumb_or_main($object);
                    // Do we send the main image or a thumbnail?
                    $size = findImageSize($whichFile);
                    $class = "pedigree_image_portrait";
                    if ($size[0] > $size[1]) {
                        $class = "pedigree_image_landscape";
                    }
                    if ($TEXT_DIRECTION == "rtl") {
                        $class .= "_rtl";
                    }
                    // NOTE: IMG ID
                    $imgsize = findImageSize($object["file"]);
                    $imgwidth = $imgsize[0] + 50;
                    $imgheight = $imgsize[1] + 150;
                    if (PGV_USE_LIGHTBOX) {
                        $text .= "<a href=\"" . $object["file"] . "\" rel=\"clearbox[general]\" rev=\"" . $object['mid'] . "::" . PGV_GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_QUOTES, 'UTF-8')) . "\">" . "\n";
                    } else {
                        $text .= "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">";
                    }
                    $birth_date = $indi->getBirthDate();
                    $death_date = $indi->getDeathDate();
                    $text .= "<img id=\"box-{$pid}\" src=\"" . $whichFile . "\"vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt =\"\" title=\"" . PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')) . " - " . strip_tags(html_entity_decode($birth_date->Display(false) . " - " . $death_date->Display(false), ENT_QUOTES, 'UTF-8')) . "\"";
                    if ($imgsize) {
                        $text .= " /></a>\n";
                    } else {
                        $text .= " />\n";
                    }
                } else {
                    if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) {
                        $class = "pedigree_image_portrait";
                        if ($TEXT_DIRECTION == "rtl") {
                            $class .= "_rtl";
                        }
                        $sex = $indi->getSex();
                        $text = "<img src=\"";
                        if ($sex == 'F') {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"];
                        } else {
                            if ($sex == 'M') {
                                $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"];
                            } else {
                                $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"];
                            }
                        }
                        $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />";
                    }
                }
            } else {
                if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) {
                    $class = "pedigree_image_portrait";
                    if ($TEXT_DIRECTION == "rtl") {
                        $class .= "_rtl";
                    }
                    $sex = $indi->getSex();
                    $text = "<img src=\"";
                    if ($sex == 'F') {
                        $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"];
                    } else {
                        if ($sex == 'M') {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"];
                        } else {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"];
                        }
                    }
                    $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />";
                }
            }
        }
        $text .= "<a class=\"name1\" href=\"individual.php?pid={$pid}\" title=\"{$title}\"> ";
        $text .= PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8'));
        if ($addname) {
            $text .= "<br />" . PrintReady($addname);
        }
        $text .= "</a>";
        if ($showids) {
            $text .= " <span class='details1' ";
            if ($TEXT_DIRECTION == "ltr") {
                $text .= "dir=\"ltr\">";
            } else {
                $text .= "dir=\"rtl\">";
            }
            $text .= "(" . $pid . ")</span>";
        }
        $text .= "<br />";
        if ($indi->canDisplayDetails()) {
            $text .= "<span class='details1'>";
            $text .= $indi->getBirthYear() . '-' . $indi->getDeathYear();
            $age = GedcomDate::GetAgeYears($indi->getBirthDate(), $indi->getDeathDate());
            if ($age) {
                $text .= " <span class=\"age\">" . PrintReady("({$age})") . "</span>";
            }
            $text .= "</span>";
        }
    }
    //Removed by BH causing problems with nicknames not printing
    //$text = unhtmlentities($text);
    // -- empty box
    if (empty($text)) {
        $text = "&nbsp;<br />&nbsp;<br />";
    }
    // -- box color
    $isF = "";
    if ($n == 1) {
        if ($indi->getSex() == 'F') {
            $isF = "F";
        }
    } elseif ($n % 2) {
        $isF = "F";
    }
    // -- box size
    if ($n == 1) {
        echo "<td";
    } else {
        echo "<td width='15%'";
    }
    // -- print box content
    echo " class=\"person_box", $isF, "\" style=\"text-align:center; vertical-align:top;\" >";
    echo $text;
    echo "</td>";
}