コード例 #1
0
/**
 * print family header
 *
 * @param string $famid family gedcom ID
 */
function print_family_header($famid)
{
    $family = Family::getInstance($famid);
    if ($family) {
        echo '<p class="name_head">', PrintReady($family->getFullName()), '</p>';
    }
}
コード例 #2
0
ファイル: user_blog.php プロジェクト: rathervague/phpgedview
/**
 * Prints a user news/journal
 *
 */
function print_user_news($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $TEXT_DIRECTION, $ctype;
    $usernews = getUserNews(PGV_USER_ID);
    $id = "user_news";
    $title = print_help_link("mygedview_myjournal_help", "qm", "", false, true);
    $title .= $pgv_lang["my_journal"];
    $content = "";
    if (count($usernews) == 0) {
        $content .= $pgv_lang["no_journal"] . ' ';
    }
    foreach ($usernews as $key => $news) {
        $day = date("j", $news["date"]);
        $mon = date("M", $news["date"]);
        $year = date("Y", $news["date"]);
        $content .= "<div class=\"person_box\">";
        $ct = preg_match("/#(.+)#/", $news["title"], $match);
        if ($ct > 0) {
            if (isset($pgv_lang[$match[1]])) {
                $news["title"] = str_replace($match[0], $pgv_lang[$match[1]], $news["title"]);
            }
        }
        $content .= "<span class=\"news_title\">" . PrintReady($news["title"]) . "</span><br />";
        $content .= "<span class=\"news_date\">" . format_timestamp($news["date"]) . "</span><br /><br />";
        if (preg_match("/#(.+)#/", $news["text"], $match)) {
            if (isset($pgv_lang[$match[1]])) {
                $news["text"] = str_replace($match[0], $pgv_lang[$match[1]], $news["text"]);
            }
        }
        if (preg_match("/#(.+)#/", $news["text"], $match)) {
            if (isset($pgv_lang[$match[1]])) {
                $news["text"] = str_replace($match[0], $pgv_lang[$match[1]], $news["text"]);
            }
            if (isset(${$match}[1])) {
                $news["text"] = str_replace($match[0], ${$match}[1], $news["text"]);
            }
        }
        $trans = get_html_translation_table(HTML_SPECIALCHARS);
        $trans = array_flip($trans);
        $news["text"] = strtr($news["text"], $trans);
        $news["text"] = nl2br($news["text"]);
        $content .= PrintReady($news["text"]) . "<br /><br />";
        $content .= "<a href=\"javascript:;\" onclick=\"editnews('{$key}'); return false;\">" . $pgv_lang["edit"] . "</a> | ";
        $content .= "<a href=\"" . encode_url("index.php?action=deletenews&news_id={$key}&ctype={$ctype}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_journal_delete"] . "');\">" . $pgv_lang["delete"] . "</a><br />";
        $content .= "</div><br />";
    }
    if (PGV_USER_ID) {
        $content .= "<br /><a href=\"javascript:;\" onclick=\"addnews('" . PGV_USER_ID . "'); return false;\">" . $pgv_lang["add_journal"] . "</a>";
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
コード例 #3
0
function print_gedcom_block($block = true, $config = "", $side, $index)
{
    global $hitCount, $pgv_lang, $SHOW_COUNTER;
    $id = "gedcom_welcome";
    $title = PrintReady(get_gedcom_setting(PGV_GED_ID, 'title'));
    $content = "<div class=\"center\">";
    $content .= "<br />" . format_timestamp(client_time()) . "<br />\n";
    if ($SHOW_COUNTER) {
        $content .= $pgv_lang["hit_count"] . " " . $hitCount . "<br />\n";
    }
    $content .= "\n<br />";
    if (PGV_USER_GEDCOM_ADMIN) {
        $content .= "<a href=\"javascript:;\" onclick=\"window.open('" . encode_url("index_edit.php?name=" . PGV_GEDCOM . "&ctype=gedcom") . "', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1'); return false;\">" . $pgv_lang["customize_gedcom_page"] . "</a><br />\n";
    }
    $content .= "</div>";
    global $THEME_DIR;
    require $THEME_DIR . 'templates/block_main_temp.php';
}
コード例 #4
0
function top10_pageviews($block = true, $config = "", $side, $index)
{
    global $TBLPREFIX, $pgv_lang, $INDEX_DIRECTORY, $PGV_BLOCKS, $ctype, $PGV_IMAGES, $PGV_IMAGE_DIR, $SHOW_COUNTER, $SHOW_SOURCES, $TEXT_DIRECTION;
    if (empty($config)) {
        $config = $PGV_BLOCKS["top10_pageviews"]["config"];
    }
    if (isset($config["count_placement"])) {
        $CountSide = $config["count_placement"];
    } else {
        $CountSide = "left";
    }
    $id = "top10hits";
    $title = print_help_link("index_top10_pageviews_help", "qm", "", false, true);
    if ($PGV_BLOCKS["top10_pageviews"]["canconfig"]) {
        if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) {
            if ($ctype == "gedcom") {
                $name = PGV_GEDCOM;
            } else {
                $name = PGV_USER_NAME;
            }
            $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
            $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>";
        }
    }
    $title .= $pgv_lang["top10_pageviews"];
    $content = "";
    // if the counter file does not exist then don't do anything
    if (!$SHOW_COUNTER) {
        if (PGV_USER_IS_ADMIN) {
            $content .= "<span class=\"error\">" . $pgv_lang["top10_pageviews_msg"] . "</span>";
        }
    } else {
        // load the lines from the file
        $top10 = PGV_DB::prepareLimit("SELECT page_parameter, page_count" . " FROM {$TBLPREFIX}hit_counter" . " WHERE gedcom_id=? AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . " ORDER BY page_count DESC", $config['num'])->execute(array(PGV_GED_ID))->FetchAssoc();
        if ($top10) {
            if ($block) {
                $content .= "<table width=\"90%\">";
            } else {
                $content .= "<table>";
            }
            foreach ($top10 as $id => $count) {
                $record = GedcomRecord::getInstance($id);
                if ($record && $record->canDisplayDetails()) {
                    $content .= '<tr valign="top">';
                    if ($CountSide == 'left') {
                        $content .= '<td dir="ltr" align="right">[' . $count . ']</td>';
                    }
                    $content .= '<td class="name2" ><a href="' . encode_url($record->getLinkUrl()) . '">' . PrintReady($record->getFullName()) . '</a></td>';
                    if ($CountSide == 'right') {
                        $content .= '<td dir="ltr" align="right">[' . $count . ']</td>';
                    }
                    $content .= '</tr>';
                }
            }
            $content .= "</table>";
        } else {
            $content .= "<b>" . $pgv_lang["top10_pageviews_nohits"] . "</b>";
        }
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
コード例 #5
0
    /**
     * print family header
     * @param String family id
     * @param String family label
     * @return html table
     */
    function printFamilyHeader($famid, $label)
    {
        global $pgv_lang;
        global $PGV_IMAGE_DIR, $PGV_IMAGES, $SHOW_ID_NUMBERS, $SEARCH_SPIDER;
        ?>
		<table>
			<tr>
				<td><img src="<?php 
        print $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["cfamily"]["small"];
        ?>
" border="0" class="icon" alt="" /></td>
				<td><span class="subheaders"><?php 
        print PrintReady($label);
        ?>
</span>
				<?php 
        if (!$this->isPrintPreview() && empty($SEARCH_SPIDER)) {
            ?>
					- <a href="family.php?famid=<?php 
            print $famid;
            ?>
">[<?php 
            print $pgv_lang["view_family"];
            if ($SHOW_ID_NUMBERS) {
                print " " . getLRM() . "({$famid})" . getLRM();
            }
            ?>
]</a>
				<?php 
        }
        ?>
				</td>
			</tr>
		</table>
	<?php 
    }
コード例 #6
0
ファイル: bit_print.php プロジェクト: bitweaver/phpgedview
/**
 * Print a new fact box on details pages
 * @param string $id	the id of the person,family,source etc the fact will be added to
 * @param array $usedfacts	an array of facts already used in this record
 * @param string $type	the type of record INDI, FAM, SOUR etc
 */
function print_add_new_fact($id, $usedfacts, $type)
{
    global $factarray, $pgv_lang;
    global $INDI_FACTS_ADD, $FAM_FACTS_ADD, $SOUR_FACTS_ADD, $REPO_FACTS_ADD;
    global $INDI_FACTS_UNIQUE, $FAM_FACTS_UNIQUE, $SOUR_FACTS_UNIQUE, $REPO_FACTS_UNIQUE;
    global $INDI_FACTS_QUICK, $FAM_FACTS_QUICK, $SOUR_FACTS_QUICK, $REPO_FACTS_QUICK;
    switch ($type) {
        case "INDI":
            $addfacts = preg_split("/[, ;:]+/", $INDI_FACTS_ADD, -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", $INDI_FACTS_UNIQUE, -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", $INDI_FACTS_QUICK, -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "FAM":
            $addfacts = preg_split("/[, ;:]+/", $FAM_FACTS_ADD, -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", $FAM_FACTS_UNIQUE, -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", $FAM_FACTS_QUICK, -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "SOUR":
            $addfacts = preg_split("/[, ;:]+/", $SOUR_FACTS_ADD, -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", $SOUR_FACTS_UNIQUE, -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", $SOUR_FACTS_QUICK, -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "REPO":
            $addfacts = preg_split("/[, ;:]+/", $REPO_FACTS_ADD, -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", $REPO_FACTS_UNIQUE, -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", $REPO_FACTS_QUICK, -1, PREG_SPLIT_NO_EMPTY);
            break;
        default:
            return;
    }
    $addfacts = array_merge(CheckFactUnique($uniquefacts, $usedfacts, $type), $addfacts);
    $quickfacts = array_intersect($quickfacts, $addfacts);
    usort($addfacts, "factsort");
    print "<tr><td class=\"descriptionbox\">";
    print_help_link("add_new_facts_help", "qm");
    print $pgv_lang["add_fact"] . "</td>";
    print "<td class=\"optionbox\">";
    print "<form method=\"get\" name=\"newfactform\" action=\"\" onsubmit=\"return false;\">\n";
    print "<select id=\"newfact\" name=\"newfact\">\n";
    foreach ($addfacts as $indexval => $fact) {
        print PrintReady("<option value=\"{$fact}\">" . $factarray[$fact] . " [" . $fact . "]</option>\n");
    }
    if ($type == "INDI" || $type == "FAM") {
        print "<option value=\"EVEN\">" . $pgv_lang["custom_event"] . " [EVEN]</option>\n";
    }
    if (!empty($_SESSION["clipboard"])) {
        foreach ($_SESSION["clipboard"] as $key => $fact) {
            if ($fact["type"] == $type || $fact["type"] == 'all') {
                print "<option value=\"clipboard_{$key}\">" . $pgv_lang["add_from_clipboard"] . " " . $factarray[$fact["fact"]] . "</option>\n";
            }
        }
    }
    print "</select>";
    print "<input type=\"button\" value=\"" . $pgv_lang["add"] . "\" onclick=\"add_record('{$id}', 'newfact');\" />\n";
    foreach ($quickfacts as $k => $v) {
        echo "&nbsp;<small><a href='javascript://{$v}' onclick=\"add_new_record('{$id}', '{$v}');return false;\">" . $factarray["{$v}"] . "</a></small>&nbsp;";
    }
    print "</form>\n";
    print "</td></tr>\n";
}
コード例 #7
0
ファイル: class_event.php プロジェクト: bitweaver/phpgedview
 /**
  * Print a simple fact version of this event
  *
  * @param boolean $return	whether to print or return
  * @param boolean $anchor	whether to add anchor to date and place
  */
 function print_simple_fact($return = false, $anchor = false)
 {
     global $pgv_lang, $SHOW_PEDIGREE_PLACES, $factarray, $ABBREVIATE_CHART_LABELS;
     if (!$this->canShow()) {
         return "";
     }
     $data = "";
     if ($this->gedcomRecord != "1 DEAT") {
         $data .= "<span class=\"details_label\">" . $this->getLabel($ABBREVIATE_CHART_LABELS) . "</span> ";
     }
     if ($this->canShowDetails()) {
         $emptyfacts = array("BIRT", "CHR", "DEAT", "BURI", "CREM", "ADOP", "BAPM", "BARM", "BASM", "BLES", "CHRA", "CONF", "FCOM", "ORDN", "NATU", "EMIG", "IMMI", "CENS", "PROB", "WILL", "GRAD", "RETI", "BAPL", "CONL", "ENDL", "SLGC", "EVEN", "MARR", "SLGS", "MARL", "ANUL", "CENS", "DIV", "DIVF", "ENGA", "MARB", "MARC", "MARS", "OBJE", "CHAN", "_SEPR", "RESI", "DATA", "MAP");
         if (!in_array($this->tag, $emptyfacts)) {
             $data .= PrintReady($this->detail);
         }
         if (!$this->dest) {
             $data .= format_fact_date($this, $anchor, false, true);
         }
         $data .= format_fact_place($this, $anchor, false, false);
     }
     $data .= "<br />\n";
     if (!$return) {
         print $data;
     } else {
         return $data;
     }
 }
コード例 #8
0
ファイル: ancestry.php プロジェクト: rathervague/phpgedview
                    }
                }
            }
        }
        break;
    case 2:
        // Individual list
        $treeid = ancestry_array($controller->rootid, $PEDIGREE_GENERATIONS);
        echo '<div class="center">';
        print_indi_table($treeid, $pgv_lang["ancestry_chart"] . ' : ' . PrintReady($controller->name), 'sosa');
        echo '</div>';
        break;
    case 3:
        // Family list
        $treeid = ancestry_array($controller->rootid, $PEDIGREE_GENERATIONS - 1);
        $famlist = array();
        foreach ($treeid as $pid) {
            $person = Person::getInstance($pid);
            if (is_null($person)) {
                continue;
            }
            foreach ($person->getChildFamilies() as $famc) {
                $famlist[$famc->getXref()] = $famc;
            }
        }
        echo '<div class="center">';
        print_fam_table($famlist, $pgv_lang["ancestry_chart"] . ' : ' . PrintReady($controller->name));
        echo '</div>';
        break;
}
print_footer();
コード例 #9
0
 /**
  * Prints descendency of passed in person
  *
  * @param mixed $pid ID of person to print descendency for
  * @param mixed $count count of generations to print
  * @access public
  * @return void
  */
 function print_descendency($pid, $count, $showNav = true)
 {
     global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang, $bheight, $bwidth, $bhalfheight;
     global $lastGenSecondFam;
     if ($count > $this->dgenerations) {
         return 0;
     }
     $person = Person::getInstance($pid);
     if (is_null($person)) {
         return;
     }
     $tablealign = "right";
     $otablealign = "left";
     if ($TEXT_DIRECTION == "rtl") {
         $tablealign = "left";
         $otablealign = "right";
     }
     //	print $this->dgenerations;
     print "<!-- print_descendency for {$pid} -->";
     //-- put a space between families on the last generation
     if ($count == $this->dgenerations - 1) {
         if (isset($lastGenSecondFam)) {
             print "<br />";
         }
         $lastGenSecondFam = true;
     }
     print "<table id=\"table_{$pid}\" align=\"" . $tablealign . "\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
     print "<tr>";
     print "<td align=\"{$tablealign}\" width=\"100%\">\n";
     $numkids = 0;
     $families = $person->getSpouseFamilies();
     $famcount = count($families);
     $famNum = 0;
     $kidNum = 0;
     $children = array();
     if ($count < $this->dgenerations) {
         //-- put all of the children in a common array
         foreach ($families as $famid => $family) {
             $famNum++;
             $chs = $family->getChildren();
             foreach ($chs as $c => $child) {
                 $children[] = $child;
             }
         }
         $ct = count($children);
         if ($ct > 0) {
             print "<table style=\"position: relative; top: auto; text-align: {$tablealign};\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
             for ($i = 0; $i < $ct; $i++) {
                 if ($i > 0 && $i < $ct - 1) {
                     $rowspan = 1;
                 }
                 /* @var $person2 Person */
                 $person2 = $children[$i];
                 $chil = $person2->getXref();
                 print "<tr>";
                 print "<td id=\"td_{$chil}\" class=\"{$TEXT_DIRECTION}\" align=\"{$tablealign}\">";
                 $kids = $this->print_descendency($chil, $count + 1);
                 $numkids += $kids;
                 print "</td>";
                 //-- print the lines
                 $twidth = 7;
                 if ($ct == 1) {
                     $twidth += 3;
                 }
                 if ($ct > 1) {
                     if ($i == 0) {
                         //-- adjust for the number of kids
                         $h = ($bhalfheight + 3) * $numkids;
                         print "<td valign=\"bottom\"><img name=\"tvertline\" id=\"vline_{$chil}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" width=\"3\" height=\"{$h}\" alt=\"\" /></td>";
                     } else {
                         if ($i == $ct - 1) {
                             $h = ($bhalfheight + 3) * $kids;
                             if ($count < $this->dgenerations - 1) {
                                 if ($this->show_spouse) {
                                     $h -= 15;
                                 } else {
                                     $h += 15;
                                 }
                             }
                             print "<td valign=\"top\"><img name=\"bvertline\" id=\"vline_{$chil}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" width=\"3\" height=\"" . $h . "\" alt=\"\" /></td>";
                         } else {
                             print "<td style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>";
                         }
                     }
                 }
                 print "</tr>";
             }
             print "</table>\n";
         }
         print "</td>\n";
         print "<td width=\"{$bwidth}\">";
     }
     // Print the descendency expansion arrow
     if ($count == $this->dgenerations) {
         $numkids = 1;
         $tbwidth = $bwidth + 16;
         for ($j = $count; $j < $this->dgenerations; $j++) {
             print "<div style=\"width: " . $tbwidth . "px;\"><br /></div>\n</td>\n<td width=\"{$bwidth}\">";
         }
         $kcount = 0;
         foreach ($families as $famid => $family) {
             $kcount += $family->getNumberOfChildren();
         }
         if ($kcount == 0) {
             print "<div style=\"width: " . $this->arrwidth . "px;\"><br /></div>\n</td>\n<td width=\"{$bwidth}\">";
         } else {
             print "<div style=\"width: " . $this->arrwidth . "px;\"><a href=\"{$pid}\" onclick=\"return ChangeDis('td_" . $pid . "','" . $pid . "','" . $this->show_full . "','" . $this->show_spouse . "','" . $this->box_width . "')\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["larrow"]["other"] . "\" border=\"0\" alt=\"\" /></a></div>\n";
             //-- move the arrow up to line up with the correct box
             if ($this->show_spouse) {
                 foreach ($families as $famid => $family) {
                     /* @var $family Family */
                     if (!is_null($family)) {
                         $spouse = $family->getSpouse($person);
                         if ($spouse != null) {
                             print "<br /><br /><br />";
                         }
                     }
                 }
             }
             print "</td>\n<td width=\"{$bwidth}\">";
         }
     }
     print "<table id=\"table2_{$pid}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>";
     print_pedigree_person($pid);
     print "</td><td><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" width=\"7\" height=\"3\" alt=\"\" />";
     //----- Print the spouse
     if ($this->show_spouse) {
         foreach ($families as $famid => $family) {
             /* @var $family Family */
             if (!is_null($family)) {
                 $spouse = $family->getSpouse($person);
                 if ($spouse != null) {
                     print "</td></tr><tr><td align=\"{$otablealign}\">";
                     //-- shrink the box for the spouses
                     $tempw = $bwidth;
                     $temph = $bheight;
                     $bwidth -= 10;
                     $bheight -= 10;
                     print_pedigree_person($spouse->getXref());
                     $bwidth = $tempw;
                     $bheight = $temph;
                     $numkids += 0.95;
                     print "</td><td></td>";
                 }
             }
         }
         //-- add offset divs to make things line up better
         if ($count == $this->dgenerations) {
             print "<tr><td colspan\"2\"><div style=\"height: " . $bhalfheight / 2 . "px; width: " . $bwidth . "px;\"><br /></div>";
         }
     }
     print "</td></tr></table>";
     // For the root person, print a down arrow that allows changing the root of tree
     if ($showNav && $count == 1) {
         // NOTE: If statement OK
         if ($person->canDisplayName()) {
             // -- print left arrow for decendants so that we can move down the tree
             $famids = $person->getSpouseFamilies();
             //-- make sure there is more than 1 child in the family with parents
             $cfamids = $person->getChildFamilies();
             $num = 0;
             foreach ($cfamids as $famid => $family) {
                 if (!is_null($family)) {
                     $num += $family->getNumberOfChildren();
                 }
             }
             // NOTE: If statement OK
             if ($num > 0) {
                 print "\n\t\t<div class=\"center\" id=\"childarrow\" dir=\"" . $TEXT_DIRECTION . "\"";
                 print " style=\"position:absolute; width:" . $bwidth . "px; \">";
                 if ($this->view != "preview") {
                     print "<a href=\"javascript: " . $pgv_lang["show"] . "\" onclick=\"togglechildrenbox(); return false;\" onmouseover=\"swap_image('larrow',3);\" onmouseout=\"swap_image('larrow',3);\">";
                     print "<img id=\"larrow\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["darrow"]["other"] . "\" border=\"0\" alt=\"\" />";
                     print "</a><br />";
                 }
                 print "\n\t\t<div id=\"childbox\" dir=\"" . $TEXT_DIRECTION . "\" style=\"width:" . $bwidth . "px; height:" . $bheight . "px; visibility: hidden;\">";
                 print "\n\t\t\t<table class=\"person_box\"><tr><td>";
                 foreach ($famids as $famid => $family) {
                     if (!is_null($family)) {
                         $spouse = $family->getSpouse($person);
                         if (!empty($spouse)) {
                             $spid = $spouse->getXref();
                             print "\n\t\t\t\t<a href=\"" . encode_url("hourglass.php?pid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span ";
                             $name = $spouse->getFullName();
                             $name = rtrim($name);
                             if (hasRTLText($name)) {
                                 print "class=\"name2\">";
                             } else {
                                 print "class=\"name1\">";
                             }
                             print PrintReady($name);
                             print "<br /></span></a>";
                         }
                         $children = $family->getChildren();
                         foreach ($children as $id => $child) {
                             $cid = $child->getXref();
                             print "\n\t\t\t\t&nbsp;&nbsp;<a href=\"" . encode_url("hourglass.php?pid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span ";
                             $name = $child->getFullName();
                             $name = rtrim($name);
                             if (hasRTLText($name)) {
                                 print "class=\"name2\">&lt; ";
                             } else {
                                 print "class=\"name1\">&lt; ";
                             }
                             print PrintReady($name);
                             print "<br /></span></a>";
                         }
                     }
                 }
                 //-- do we need to print this arrow?
                 print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["rarrow"]["other"] . "\" border=\"0\" alt=\"\" /> ";
                 //-- print the siblings
                 foreach ($cfamids as $famid => $family) {
                     if (!is_null($family)) {
                         if (!is_null($family->getHusband()) || !is_null($family->getWife())) {
                             print "<span class=\"name1\"><br />" . $pgv_lang["parents"] . "<br /></span>";
                             $husb = $family->getHusband();
                             if (!empty($husb)) {
                                 $spid = $husb->getXref();
                                 print "\n\t\t\t\t&nbsp;&nbsp;<a href=\"" . encode_url("hourglass.php?pid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span ";
                                 $name = $husb->getFullName();
                                 $name = rtrim($name);
                                 if (hasRTLText($name)) {
                                     print "class=\"name2\">";
                                 } else {
                                     print "class=\"name1\">";
                                 }
                                 print PrintReady($name);
                                 print "<br /></span></a>";
                             }
                             $husb = $family->getWife();
                             if (!empty($husb)) {
                                 $spid = $husb->getXref();
                                 print "\n\t\t\t\t&nbsp;&nbsp;<a href=\"" . encode_url("hourglass.php?pid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span ";
                                 $name = $husb->getFullName();
                                 $name = rtrim($name);
                                 if (hasRTLText($name)) {
                                     print "class=\"name2\">";
                                 } else {
                                     print "class=\"name1\">";
                                 }
                                 print PrintReady($name);
                                 print "<br /></span></a>";
                             }
                         }
                         $children = $family->getChildren();
                         $num = $family->getNumberOfChildren();
                         if ($num > 2) {
                             print "<span class=\"name1\"><br />" . $pgv_lang["siblings"] . "<br /></span>";
                         }
                         if ($num == 2) {
                             print "<span class=\"name1\"><br />" . $pgv_lang["sibling"] . "<br /></span>";
                         }
                         foreach ($children as $id => $child) {
                             $cid = $child->getXref();
                             if ($cid != $pid) {
                                 print "\n\t\t\t\t&nbsp;&nbsp;<a href=\"" . encode_url("hourglass.php?pid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span ";
                                 $name = $child->getFullName();
                                 $name = rtrim($name);
                                 if (hasRTLText($name)) {
                                     print "class=\"name2\"> ";
                                 } else {
                                     print "class=\"name1\"> ";
                                 }
                                 print PrintReady($name);
                                 print "<br /></span></a>";
                             }
                         }
                     }
                 }
                 print "\n\t\t\t</td></tr></table>";
                 print "\n\t\t</div>";
                 print "\n\t\t</div>";
             }
         }
     }
     print "</td></tr>";
     print "</table>";
     return $numkids;
 }
コード例 #10
0
 function print_time_fact($event)
 {
     global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION;
     global $factarray, $pgv_lang, $lang_short_cut, $LANGUAGE, $PGV_IMAGE_DIR, $PGV_IMAGES, $SHOW_PEDIGREE_PLACES, $placements;
     global $familyfacts, $GEDCOM;
     /* @var $event Event */
     $factrec = $event->getGedComRecord();
     $fact = $event->getTag();
     $desc = $event->getDetail();
     if ($fact == "EVEN" || $fact == "FACT") {
         $fact = $event->getType();
     }
     //-- check if this is a family fact
     $famid = $event->getFamilyId();
     if ($famid != null) {
         //-- if we already showed this family fact then don't print it
         if (isset($familyfacts[$famid . $fact]) && $familyfacts[$famid . $fact] != $event->temp) {
             return;
         }
         $familyfacts[$famid . $fact] = $event->temp;
     }
     $gdate = $event->getDate();
     $date = $gdate->MinDate();
     $date = $date->convert_to_cal('gregorian');
     $year = $date->y;
     $month = max(1, $date->m);
     $day = max(1, $date->d);
     $xoffset = $basexoffset + 22;
     $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
     $yoffset = $yoffset + $month / 12 * $this->scale;
     $yoffset = $yoffset + $day / 30 * ($this->scale / 12);
     $yoffset = floor($yoffset);
     $place = round($yoffset / $this->bheight);
     $i = 1;
     $j = 0;
     $tyoffset = 0;
     while (isset($placements[$place])) {
         if ($i == $j) {
             $tyoffset = $this->bheight * $i;
             $i++;
         } else {
             $tyoffset = -1 * $this->bheight * $j;
             $j++;
         }
         $place = round(($yoffset + $tyoffset) / $this->bheight);
     }
     $yoffset += $tyoffset;
     $xoffset += abs($tyoffset);
     $placements[$place] = $yoffset;
     print "\n\t\t<div id=\"fact{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . $xoffset : "right: " . $xoffset) . "px; top:" . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px; \" onmousedown=\"factMD(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">\n";
     print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>\n";
     print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" hspace=\"0\" width=\"10\" vspace=\"0\" alt=\"\" style=\"padding-";
     if ($TEXT_DIRECTION == "ltr") {
         print "left";
     } else {
         print "right";
     }
     print ": 3px;\" />\n";
     $col = $event->temp % 6;
     print "</td><td valign=\"top\" class=\"person" . $col . "\">\n";
     if (count($this->pids) > 6) {
         print $event->getParentObject()->getFullName() . " - ";
     }
     $indi = $event->getParentObject();
     if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA" || $fact == "_INTE") {
         // Allow special processing for different languages
         $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}";
         if (function_exists($func) && get_class($indi) == "Person") {
             // Localise the facts
             $func($fact, $indi->getXref());
             print $factarray[$fact];
         } else {
             print $event->getLabel();
         }
     } else {
         print $event->getLabel();
     }
     print " -- ";
     if (get_class($indi) == "Person") {
         print format_fact_date($event);
     }
     if (get_class($indi) == "Family") {
         print $gdate->Display(false);
         $family = $indi;
         $husbid = $family->getHusbId();
         $wifeid = $family->getWifeId();
         //-- Retrieve husband and wife age
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $husbid) {
                 $husb = $family->getHusband();
                 if (is_null($husb)) {
                     $husb = new Person('');
                 }
                 $hdate = $husb->getBirthDate();
                 if ($hdate->isOK()) {
                     $ageh = get_age_at_event(GedcomDate::GetAgeGedcom($hdate, $gdate), false);
                 }
             } else {
                 if ($this->pids[$p] == $wifeid) {
                     $wife = $family->getWife();
                     if (is_null($wife)) {
                         $wife = new Person('');
                     }
                     $wdate = $wife->getBirthDate();
                     if ($wdate->isOK()) {
                         $agew = get_age_at_event(GedcomDate::GetAgeGedcom($wdate, $gdate), false);
                     }
                 }
             }
         }
         if (!empty($ageh) && $ageh > 0) {
             if (empty($agew)) {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$ageh})") . '</span>';
             } else {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["husb_age"]} {$ageh},") . ' ';
             }
         }
         if (!empty($agew) && $agew > 0) {
             if (empty($ageh)) {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$agew})") . '</span>';
             } else {
                 print PrintReady("{$pgv_lang["wife_age"]} {$agew})") . '</span>';
             }
         }
     }
     print " " . PrintReady($desc);
     if ($SHOW_PEDIGREE_PLACES > 0) {
         $place = $event->getPlace();
         if ($place != null) {
             if ($desc != null) {
                 print " - ";
             }
             $plevels = explode(',', $place);
             for ($plevel = 0; $plevel < $SHOW_PEDIGREE_PLACES; $plevel++) {
                 if (!empty($plevels[$plevel])) {
                     if ($plevel > 0) {
                         print ", ";
                     }
                     print PrintReady($plevels[$plevel]);
                 }
             }
         }
     }
     //-- print spouse name for marriage events
     $spouse = Person::getInstance($event->getSpouseId());
     if ($spouse) {
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $spouse->getXref()) {
                 break;
             }
         }
         if ($p == count($this->pids)) {
             $p = $event->temp;
         }
         $col = $p % 6;
         if ($spouse->getXref() != $this->pids[$p]) {
             echo ' <a href="', $spouse->getLinkUrl(), '">', $spouse->getFullName(), '</a>';
         } else {
             $ct = preg_match("/2 _PGVFS @(.*)@/", $factrec, $match);
             if ($ct > 0) {
                 print " <a href=\"" . encode_url("family.php?famid={$match[1]}&ged={$GEDCOM}") . "\">";
                 if (displayDetailsById($match[1]) || showLivingNameById($match[1])) {
                     print $event->getParentObject()->getFullName();
                 } else {
                     print $pgv_lang["private"];
                 }
                 print "</a>";
             }
         }
     }
     print "</td></tr></table>\n";
     print "</div>";
     if ($TEXT_DIRECTION == 'ltr') {
         $img = "dline2";
         $ypos = "0%";
     } else {
         $img = "dline";
         $ypos = "100%";
     }
     $dyoffset = $yoffset - $tyoffset + $this->bheight / 3;
     if ($tyoffset < 0) {
         $dyoffset = $yoffset + $this->bheight / 3;
         if ($TEXT_DIRECTION == 'ltr') {
             $img = "dline";
             $ypos = "100%";
         } else {
             $img = "dline2";
             $ypos = "0%";
         }
     }
     //-- print the diagnal line
     print "\n\t\t<div id=\"dbox{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . ($basexoffset + 25) : "right: " . ($basexoffset + 25)) . "px; top:" . $dyoffset . "px; font-size: 8pt; height: " . abs($tyoffset) . "px; width: " . abs($tyoffset) . "px;";
     print " background-image: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES[$img]["other"] . "');";
     print " background-position: 0% {$ypos}; \" >\n";
     print "</div>\n";
 }
コード例 #11
0
    ?>
" onfocus="getHelp('gedcom_path_help');" />
		</td>
	</tr>
	<?php 
}
if ($source != "replace_form") {
    ?>
	<tr>
		<td class="descriptionbox wrap width20"><?php 
    print_help_link("gedcom_title_help", "qm", "gedcom_title", true);
    print print_text("gedcom_title");
    ?>
</td>
		<td class="optionbox"><input type="text" name="gedcom_title" dir="ltr" value="<?php 
    print preg_replace("/\"/", "&quot;", PrintReady($gedcom_title));
    ?>
" size="40" tabindex="<?php 
    $i++;
    print $i;
    ?>
" onfocus="getHelp('gedcom_title_help');" /></td>
	</tr>
	<tr>
		<td class="descriptionbox wrap width20">
		<?php 
    print_help_link("LANGUAGE_help", "qm", "LANGUAGE");
    print $pgv_lang["LANGUAGE"];
    ?>
</td>
		<td class="optionbox"><input type="hidden" name="changelanguage" value="yes" />
コード例 #12
0
ファイル: family_ctrl.php プロジェクト: bitweaver/phpgedview
 function getPageTitle()
 {
     global $pgv_lang;
     if ($this->family) {
         return PrintReady($this->title);
     } else {
         return $pgv_lang["unable_to_find_record"];
     }
 }
コード例 #13
0
ファイル: hourglass.php プロジェクト: rathervague/phpgedview
define('PGV_SCRIPT_NAME', 'hourglass.php');
require './config.php';
require_once PGV_ROOT . 'includes/controllers/hourglass_ctrl.php';
$controller = new HourglassController();
$controller->init();
// -- print html header information
print_header(PrintReady($controller->name) . " " . $pgv_lang["hourglass_chart"]);
if ($ENABLE_AUTOCOMPLETE) {
    require PGV_ROOT . 'js/autocomplete.js.htm';
}
if ($controller->view == "preview") {
    print "<h2 style=\"text-align: center\">" . $pgv_lang["hourglass_chart"] . ":&nbsp;&nbsp;&nbsp;" . PrintReady($controller->name) . "</h2>";
} else {
    print "<!-- // NOTE: Start table header -->";
    print "<table><tr><td valign=\"top\">";
    print "<h2>" . $pgv_lang["hourglass_chart"] . ":<br />" . PrintReady($controller->name) . "</h2>";
}
$controller->setupJavascript();
// LBox =====================================================================================
if (PGV_USE_LIGHTBOX) {
    require PGV_ROOT . 'modules/lightbox/lb_defaultconfig.php';
    require PGV_ROOT . 'modules/lightbox/functions/lb_call_js.php';
}
// ==========================================================================================
$gencount = 0;
if ($view != "preview") {
    ?>
<!--	// NOTE: Start form and table -->
	</td><td width="50px">&nbsp;</td><td><form method="get" name="people" action="?">
	<input type="hidden" name="show_full" value="<?php 
    print $controller->show_full;
コード例 #14
0
<input type="hidden" name="F<?php 
        echo $i;
        ?>
CDEL" value="" /></td>
	</tr>
	<?php 
        foreach ($chil as $c => $child) {
            $person = Person::getInstance($child);
            echo "<tr><td class=\"optionbox\">";
            $name = $person->getFullName();
            if ($SHOW_ID_NUMBERS) {
                $name .= " (" . $child . ")";
            }
            $name .= " [" . $pgv_lang["edit"] . "]";
            echo "<a href=\"#\" onclick=\"return quickEdit('", $child, "', '', '", PGV_GEDCOM, "');\">";
            echo PrintReady(stripLRMRLM($name));
            echo "</a>";
            echo "</td>\n<td class=\"optionbox center\">";
            $sex = $person->getSex();
            if ($sex == 'M') {
                echo Person::sexImage('M', 'small'), $pgv_lang['male'];
            } elseif ($sex == 'F') {
                echo Person::sexImage('F', 'small'), $pgv_lang['female'];
            } else {
                echo Person::sexImage('U', 'small'), $pgv_lang['unknown'];
            }
            echo "</td>\n<td class=\"optionbox\">";
            echo $person->format_first_major_fact(PGV_EVENTS_BIRT, 2);
            echo "</td>\n";
            ?>
			<td class="optionbox center">
コード例 #15
0
ファイル: charts.php プロジェクト: rathervague/phpgedview
function print_charts_block($block = true, $config = "", $side, $index)
{
    global $PGV_BLOCKS, $pgv_lang, $ctype, $PGV_IMAGE_DIR, $PGV_IMAGES, $PEDIGREE_ROOT_ID, $PEDIGREE_FULL_DETAILS;
    global $show_full, $bwidth, $bheight;
    if (empty($config)) {
        $config = $PGV_BLOCKS["print_charts_block"]["config"];
    }
    if (empty($config['details'])) {
        $config['details'] = 'no';
    }
    if (empty($config["pid"])) {
        if (!PGV_USER_ID) {
            $config["pid"] = $PEDIGREE_ROOT_ID;
        } else {
            if (PGV_USER_GEDCOM_ID) {
                $config["pid"] = PGV_USER_GEDCOM_ID;
            } else {
                $config["pid"] = $PEDIGREE_ROOT_ID;
            }
        }
    }
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    if ($config["details"] == "no") {
        $show_full = 0;
        // Here we could adjust the block width & height to accommodate larger displays
    } else {
        $show_full = 1;
        // Here we could adjust the block width & height to accommodate larger displays
    }
    $PEDIGREE_FULL_DETAILS = $show_full;
    if ($config['type'] != 'treenav') {
        $controller = new HourglassController();
        $controller->init($config["pid"], 0, 3);
        $controller->setupJavascript();
    } else {
        $nav = new TreeNav($config['pid'], 'blocknav', -1);
        $nav->generations = 2;
    }
    $person = Person::getInstance($config["pid"]);
    if ($person == null) {
        $config["pid"] = $PEDIGREE_ROOT_ID;
        $person = Person::getInstance($PEDIGREE_ROOT_ID);
    }
    $id = "charts_block";
    $title = print_help_link("index_charts_help", "qm", "", false, true);
    if ($PGV_BLOCKS["print_charts_block"]["canconfig"]) {
        if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) {
            if ($ctype == "gedcom") {
                $name = PGV_GEDCOM;
            } else {
                $name = PGV_USER_NAME;
            }
            $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
            $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>";
        }
    }
    if ($person) {
        $name = PrintReady($person->getFullName());
        switch ($config['type']) {
            case 'pedigree':
                $title .= $name . " " . $pgv_lang["index_header"];
                break;
            case 'descendants':
                $title .= $name . " " . $pgv_lang["descend_chart"];
                break;
            case 'hourglass':
                $title .= $name . " " . $pgv_lang["hourglass_chart"];
                break;
            case 'treenav':
                $title .= $name . " " . $pgv_lang["tree"];
                break;
        }
        $content = "";
        $content .= "<script src=\"js/phpgedview.js\" language=\"JavaScript\" type=\"text/javascript\"></script>";
        if ($show_full == 0) {
            $content .= '<center><span class="details2">' . $pgv_lang['charts_click_box'] . '</span></center><br />';
        }
        $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>';
        if ($config['type'] == 'descendants' || $config['type'] == 'hourglass') {
            $content .= "<td valign=\"middle\">";
            ob_start();
            $controller->print_descendency($person->getXref(), 1, false);
            $content .= ob_get_clean();
            $content .= "</td>";
        }
        if ($config['type'] == 'pedigree' || $config['type'] == 'hourglass') {
            //-- print out the root person
            if ($config['type'] != 'hourglass') {
                $content .= "<td valign=\"middle\">";
                ob_start();
                print_pedigree_person($person->getXref());
                $content .= ob_get_clean();
                $content .= "</td>";
            }
            $content .= "<td valign=\"middle\">";
            ob_start();
            $controller->print_person_pedigree($person->getXref(), 1);
            $content .= ob_get_clean();
            $content .= "</td>";
        }
        if ($config['type'] == 'treenav') {
            $content .= "<td>";
            ob_start();
            $nav->drawViewport('blocknav', "", "240px");
            $content .= ob_get_clean();
            $content .= "</td>";
        }
        $content .= "</tr></table>";
        $content .= '<script language="JavaScript" type="text/javascript">
			<!--
			if (sizeLines) sizeLines();
			-->
			</script>';
    } else {
        $content = $pgv_lang['invalid_id'];
    }
    global $THEME_DIR;
    require $THEME_DIR . 'templates/block_small_temp.php';
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}
コード例 #16
0
function print_gedcom_stats($block = true, $config = '', $side, $index)
{
    global $PGV_BLOCKS, $pgv_lang, $ALLOW_CHANGE_GEDCOM, $ctype, $COMMON_NAMES_THRESHOLD, $PGV_IMAGE_DIR, $PGV_IMAGES, $MULTI_MEDIA;
    global $top10_block_present;
    if (empty($config)) {
        $config = $PGV_BLOCKS['print_gedcom_stats']['config'];
    }
    if (!isset($config['stat_indi'])) {
        $config = $PGV_BLOCKS['print_gedcom_stats']['config'];
    }
    if (!isset($config['stat_first_death'])) {
        $config['stat_first_death'] = $PGV_BLOCKS['print_gedcom_stats']['config']['stat_first_death'];
    }
    if (!isset($config['stat_last_death'])) {
        $config['stat_last_death'] = $PGV_BLOCKS['print_gedcom_stats']['config']['stat_last_death'];
    }
    if (!isset($config['stat_media'])) {
        $config['stat_media'] = $PGV_BLOCKS['print_gedcom_stats']['config']['stat_media'];
    }
    if (!isset($config['stat_link'])) {
        $config['stat_link'] = $PGV_BLOCKS['print_gedcom_stats']['config']['stat_link'];
    }
    $id = 'gedcom_stats';
    $title = print_help_link('index_stats_help', 'qm', '', false, true);
    if ($PGV_BLOCKS['print_gedcom_stats']['canconfig']) {
        if ($ctype == 'gedcom' && PGV_USER_GEDCOM_ADMIN || $ctype == 'user' && PGV_USER_ID) {
            if ($ctype == 'gedcom') {
                $name = PGV_GEDCOM;
            } else {
                $name = PGV_USER_NAME;
            }
            $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
            $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES['admin']['small'] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang['config_block'] . "\" /></a>";
        }
    }
    $title .= $pgv_lang['gedcom_stats'];
    $stats = new stats(PGV_GEDCOM);
    $content = "<b><a href=\"index.php?ctype=gedcom\">" . PrintReady(strip_tags(get_gedcom_setting(PGV_GED_ID, 'title'))) . "</a></b><br />";
    $head = find_other_record('HEAD', PGV_GED_ID);
    $ct = preg_match('/1 SOUR (.*)/', $head, $match);
    if ($ct > 0) {
        $softrec = get_sub_record(1, '1 SOUR', $head);
        $tt = preg_match('/2 NAME (.*)/', $softrec, $tmatch);
        if ($tt > 0) {
            $software = printReady(trim($tmatch[1]));
        } else {
            $software = trim($match[1]);
        }
        if (!empty($software)) {
            $text = str_replace(array('#SOFTWARE#', '#CREATED_SOFTWARE#'), $software, $pgv_lang['gedcom_created_using']);
            $tt = preg_match('/2 VERS (.*)/', $softrec, $tmatch);
            if ($tt > 0) {
                $version = printReady(trim($tmatch[1]));
            } else {
                $version = '';
            }
            $text = str_replace(array('#VERSION#', '#CREATED_VERSION#'), $version, $text);
            $content .= $text;
        }
    }
    if (preg_match('/1 DATE (.+)/', $head, $match)) {
        if (empty($software)) {
            $content .= str_replace(array('#DATE#', '#CREATED_DATE#'), $stats->gedcomDate(), $pgv_lang['gedcom_created_on']);
        } else {
            $content .= str_replace(array('#DATE#', '#CREATED_DATE#'), $stats->gedcomDate(), $pgv_lang['gedcom_created_on2']);
        }
    }
    $content .= '<br /><table><tr><td valign="top" class="width20"><table cellspacing="1" cellpadding="0">';
    if ($config['stat_indi'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_individuals'] . '</td><td class="facts_value"><div dir="rtl"><a href="' . encode_url("indilist.php?surname_sublist=no&ged=" . PGV_GEDCOM) . '">' . $stats->totalIndividuals() . '</a></div></td></tr>';
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_males'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->totalSexMales() . '<br />' . $stats->totalSexMalesPercentage() . '%</div></td></tr>';
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_females'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->totalSexFemales() . '<br />' . $stats->totalSexFemalesPercentage() . '%</div></td></tr>';
    }
    if ($config['stat_surname'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_surnames'] . '</td><td class="facts_value"><div dir="rtl"><a href="' . encode_url("indilist.php?show_all=yes&surname_sublist=yes&ged=" . PGV_GEDCOM) . '">' . $stats->totalSurnames() . '</a></div></td></tr>';
    }
    if ($config['stat_fam'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_families'] . '</td><td class="facts_value"><div dir="rtl"><a href="famlist.php">' . $stats->totalFamilies() . '</a></div></td></tr>';
    }
    if ($config['stat_sour'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_sources'] . '</td><td class="facts_value"><div dir="rtl"><a href="sourcelist.php">' . $stats->totalSources() . '</a></div></td></tr>';
    }
    if ($config['stat_media'] == 'yes' && $MULTI_MEDIA == true) {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_media'] . '</td><td class="facts_value"><div dir="rtl"><a href="medialist.php">' . $stats->totalMedia() . '</a></div></td></tr>';
    }
    if ($config['stat_other'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_other'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->totalOtherRecords() . '</div></td></tr>';
    }
    if ($config['stat_events'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_events'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->totalEvents() . '</div></td></tr>';
    }
    if ($config['stat_users'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_users'] . '</td><td class="facts_value"><div dir="rtl">';
        if (PGV_USER_GEDCOM_ADMIN) {
            $content .= '<a href="useradmin.php">' . $stats->totalUsers() . '</a>';
        } else {
            $content .= $stats->totalUsers();
        }
        $content .= '</div>
</td>
</tr>';
    }
    if (!$block) {
        $content .= '</table></td><td><br /></td><td valign="top"><table cellspacing="1" cellpadding="1" border="0">';
    }
    if ($config['stat_first_birth'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_earliest_birth'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->firstBirthYear() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $stats->firstBirth() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_last_birth'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_latest_birth'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->lastBirthYear() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $stats->lastBirth() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_first_death'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_earliest_death'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->firstDeathYear() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $stats->firstDeath() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_last_death'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_latest_death'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->lastDeathYear() . '</div>
</td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $stats->lastDeath() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_long_life'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_longest_life'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->LongestLifeAge() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $stats->LongestLife() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_avg_life'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_avg_age_at_death'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->averageLifespan() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $pgv_lang['stat_males'] . ':&nbsp;' . $stats->averageLifespanMale();
            $content .= '&nbsp;&nbsp;&nbsp;' . $pgv_lang['stat_females'] . ':&nbsp;' . $stats->averageLifespanFemale() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_most_chil'] == 'yes' && !$block) {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_most_children'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->largestFamilySize() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">' . $stats->largestFamily() . '</td>';
        }
        $content .= '</tr>';
    }
    if ($config['stat_avg_chil'] == 'yes') {
        $content .= '<tr><td class="facts_label">' . $pgv_lang['stat_average_children'] . '</td><td class="facts_value"><div dir="rtl">' . $stats->averageChildren() . '</div></td>';
        if (!$block) {
            $content .= '<td class="facts_value">&nbsp;</td>';
        }
        $content .= '</tr>';
    }
    $content .= '</table></td></tr></table>';
    if ($config['stat_link'] == 'yes') {
        $content .= '<a href="statistics.php"><b>' . $pgv_lang['stat_link'] . '</b></a><br />';
    }
    // NOTE: Print the most common surnames
    if ($config['show_common_surnames'] == 'yes') {
        $surnames = get_common_surnames($COMMON_NAMES_THRESHOLD);
        if (count($surnames) > 0) {
            $content .= '<br />';
            $content .= print_help_link('index_common_names_help', 'qm', '', false, true);
            $content .= '<b>' . $pgv_lang['common_surnames'] . '</b><br />';
            $i = 0;
            foreach ($surnames as $indexval => $surname) {
                if (stristr($surname['name'], '@N.N') === false) {
                    if ($i > 0) {
                        $content .= ', ';
                    }
                    $content .= '<a href="' . encode_url("indilist.php?ged=" . PGV_GEDCOM . "&surname=" . $surname['name']) . '">' . PrintReady($surname['name']) . '</a>';
                    $i++;
                }
            }
        }
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
コード例 #17
0
/**
 * Print Review Changes Block
 *
 * Prints a block allowing the user review all changes pending approval
 */
function review_changes_block($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $ctype, $QUERY_STRING, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES;
    global $pgv_changes, $TEXT_DIRECTION, $SHOW_SOURCES, $PGV_BLOCKS;
    global $PHPGEDVIEW_EMAIL;
    if (empty($config)) {
        $config = $PGV_BLOCKS["review_changes_block"]["config"];
    }
    if ($pgv_changes) {
        //-- if the time difference from the last email is greater than 24 hours then send out another email
        $LAST_CHANGE_EMAIL = get_site_setting('LAST_CHANGE_EMAIL');
        if (time() - $LAST_CHANGE_EMAIL > 60 * 60 * 24 * $config["days"]) {
            $LAST_CHANGE_EMAIL = time();
            set_site_setting('LAST_CHANGE_EMAIL', $LAST_CHANGE_EMAIL);
            write_changes();
            if ($config["sendmail"] == "yes") {
                // Which users have pending changes?
                $users_with_changes = array();
                foreach (get_all_users() as $user_id => $user_name) {
                    foreach (get_all_gedcoms() as $ged_id => $ged_name) {
                        if (exists_pending_change($user_id, $ged_id)) {
                            $users_with_changes[$user_id] = $user_name;
                            break;
                        }
                    }
                }
                foreach ($users_with_changes as $user_id => $user_name) {
                    //-- send message
                    $message = array();
                    $message["to"] = $user_name;
                    $message["from"] = $PHPGEDVIEW_EMAIL;
                    $message["subject"] = $pgv_lang["review_changes_subject"];
                    $message["body"] = $pgv_lang["review_changes_body"];
                    $message["method"] = get_user_setting($user_id, 'contactmethod');
                    $message["url"] = PGV_SCRIPT_NAME . "?" . html_entity_decode($QUERY_STRING);
                    $message["no_from"] = true;
                    addMessage($message);
                }
            }
        }
        if (PGV_USER_CAN_EDIT) {
            $id = "review_changes_block";
            $title = print_help_link("review_changes_help", "qm", "", false, true);
            if ($PGV_BLOCKS["review_changes_block"]["canconfig"]) {
                if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) {
                    if ($ctype == "gedcom") {
                        $name = PGV_GEDCOM;
                    } else {
                        $name = PGV_USER_NAME;
                    }
                    $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
                    $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>";
                }
            }
            $title .= $pgv_lang["review_changes"];
            $content = "";
            if (PGV_USER_CAN_ACCEPT) {
                $content .= "<a href=\"javascript:;\" onclick=\"window.open('edit_changes.php','_blank','width=600,height=500,resizable=1,scrollbars=1'); return false;\">" . $pgv_lang["accept_changes"] . "</a><br />";
            }
            if ($config["sendmail"] == "yes") {
                $content .= $pgv_lang["last_email_sent"] . format_timestamp($LAST_CHANGE_EMAIL) . "<br />";
                $content .= $pgv_lang["next_email_sent"] . format_timestamp($LAST_CHANGE_EMAIL + 60 * 60 * 24 * $config["days"]) . "<br /><br />";
            }
            foreach ($pgv_changes as $cid => $changes) {
                $change = $changes[count($changes) - 1];
                if ($change["gedcom"] == PGV_GEDCOM) {
                    $record = GedcomRecord::getInstance($change['gid']);
                    if ($record->getType() != 'SOUR' || $SHOW_SOURCES >= PGV_USER_ACCESS_LEVEL) {
                        $content .= '<b>' . PrintReady($record->getFullName()) . '</b> ' . getLRM() . '(' . $record->getXref() . ')' . getLRM();
                        switch ($record->getType()) {
                            case 'INDI':
                            case 'FAM':
                            case 'SOUR':
                            case 'OBJE':
                                $content .= $block ? '<br />' : ' ';
                                $content .= '<a href="' . encode_url($record->getLinkUrl() . '&show_changes=yes') . '">' . $pgv_lang['view_change_diff'] . '</a>';
                                break;
                        }
                        $content .= '<br />';
                    }
                }
            }
            global $THEME_DIR;
            if ($block) {
                require $THEME_DIR . 'templates/block_small_temp.php';
            } else {
                require $THEME_DIR . 'templates/block_main_temp.php';
            }
        }
    }
}
コード例 #18
0
ファイル: edit_merge.php プロジェクト: bitweaver/phpgedview
        }
        print ">" . PrintReady(strip_tags(get_gedcom_setting($ged_id, 'title'))) . "</option>\n";
    }
    print "</select>\n";
    print "<a href=\"javascript:iopen_find(document.merge.gid1, document.merge.ged);\" tabindex=\"6\"> " . $pgv_lang["find_individual"] . "</a> |";
    print " <a href=\"javascript:fopen_find(document.merge.gid1, document.merge.ged);\" tabindex=\"8\"> " . $pgv_lang["find_familyid"] . "</a> |";
    print " <a href=\"javascript:sopen_find(document.merge.gid1, document.merge.ged);\" tabindex=\"10\"> " . $pgv_lang["find_sourceid"] . "</a>";
    print_help_link("rootid_help", "qm");
    print "</td></tr><tr><td class=\"list_label\">&nbsp;";
    print $pgv_lang["merge_from"];
    print "&nbsp;</td><td>";
    print "<input type=\"text\" name=\"gid2\" value=\"{$gid2}\" size=\"10\" tabindex=\"2\"/> ";
    print "<select name=\"ged2\" tabindex=\"5\">\n";
    foreach (get_all_gedcoms() as $ged_id => $ged_name) {
        print "<option value=\"{$ged_name}\"";
        if (empty($ged2) && $ged_id == PGV_GED_ID || !empty($ged2) && $ged2 == $ged_name) {
            print " selected=\"selected\"";
        }
        print ">" . PrintReady(strip_tags(get_gedcom_setting($ged_id, 'title'))) . "</option>\n";
    }
    print "</select>\n";
    print "<a href=\"javascript:iopen_find(document.merge.gid2, document.merge.ged2);\" tabindex=\"7\"> " . $pgv_lang["find_individual"] . "</a> |";
    print "<a href=\"javascript:fopen_find(document.merge.gid2, document.merge.ged2);\" tabindex=\"9\"> " . $pgv_lang["find_familyid"] . "</a> |";
    print "<a href=\"javascript:sopen_find(document.merge.gid2, document.merge.ged2);\" tabindex=\"11\"> " . $pgv_lang["find_sourceid"] . "</a>";
    print_help_link("rootid_help", "qm");
    print "</td></tr><tr><td colspan=\"2\">";
    print "<input type=\"submit\" value=\"" . $pgv_lang["merge_records"] . "\"  tabindex=\"3\"/>\n";
    print "</td></tr></table>";
    print "</form>\n";
}
print_footer();
コード例 #19
0
function print_user_favorites($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype;
    global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    $show_full = 1;
    $PEDIGREE_FULL_DETAILS = 1;
    $userfavs = getUserFavorites(PGV_USER_NAME);
    if (!is_array($userfavs)) {
        $userfavs = array();
    }
    $id = "user_favorites";
    $title = print_help_link("mygedview_favorites_help", "qm", "", false, true);
    $title .= $pgv_lang["my_favorites"] . "&nbsp;&nbsp;";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $title .= "(" . count($userfavs) . ")";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    if ($ENABLE_AUTOCOMPLETE) {
        $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
		<script type="text/javascript">
		jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
		jQuery(document).ready(function($){
			$("input[name^=gid]").autocomplete("autocomplete.php", {
				extraParams: {field:"IFSRO"},
				formatItem: function(row, i) {
					return row[0] + " (" + row[1] + ")";
				},
				formatResult: function(row) {
					return row[1];
				},
				width: 400,
				minChars: 2
			});
		});
		</script>';
    } else {
        $content = '';
    }
    if ($block) {
        $style = 2;
        // 1 means "regular box", 2 means "wide box"
        $tableWidth = $BROWSERTYPE == "msie" ? "95%" : "99%";
        // IE needs to have room for vertical scroll bar inside the box
        $cellSpacing = "1px";
    } else {
        $style = 2;
        $tableWidth = "99%";
        $cellSpacing = "3px";
    }
    if (count($userfavs) == 0) {
        $content .= print_text("no_favorites", 0, 1);
    } else {
        $mygedcom = $GEDCOM;
        $current_gedcom = $GEDCOM;
        $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
        foreach ($userfavs as $key => $favorite) {
            if (isset($favorite["id"])) {
                $key = $favorite["id"];
            }
            $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_fav_remove"] . "');\">" . $pgv_lang["remove"] . "</a><br />";
            $current_gedcom = $GEDCOM;
            $GEDCOM = $favorite["file"];
            $content .= "<tr><td>";
            if ($favorite["type"] == "URL") {
                $content .= "<div id=\"boxurl" . $key . ".0\" class=\"person_box\">";
                if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                    $content .= $removeFavourite;
                }
                $content .= "<a href=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]) . "</a>";
                $content .= "<br />" . PrintReady($favorite["note"]);
            } else {
                require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
                $indirec = find_gedcom_record($favorite["gid"], PGV_GED_ID);
                if ($favorite["type"] == "INDI") {
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box";
                    if (strpos($indirec, "\n1 SEX F") !== false) {
                        $content .= "F";
                    } elseif (strpos($indirec, "\n1 SEX M") !== false) {
                        $content .= "";
                    } else {
                        $content .= "NN";
                    }
                    $content .= "\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    ob_start();
                    print_pedigree_person($favorite["gid"], $style, 1, $key);
                    $content .= ob_get_clean();
                    $content .= PrintReady($favorite["note"]);
                } else {
                    $record = GedcomRecord::getInstance($favorite['gid']);
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    if ($record) {
                        $content .= $record->format_list('span');
                    } else {
                        $content .= $pgv_lang['invalid_id'];
                    }
                    $content .= "<br />" . PrintReady($favorite["note"]);
                }
            }
            $content .= "</div>";
            $content .= "</td></tr>";
            $GEDCOM = $mygedcom;
            require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
        }
        $content .= "</table>";
    }
    $content .= '
	<script language="JavaScript" type="text/javascript">
	var pastefield;
	function paste_id(value) {
		pastefield.value=value;
	}
	</script>
	<br />
	';
    $uniqueID = floor(microtime() * 1000000);
    $content .= print_help_link("index_add_favorites_help", "qm", "", false, true);
    $content .= "<b><a href=\"javascript: " . $pgv_lang["add_favorite"] . " \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"\" />&nbsp;" . $pgv_lang["add_favorite"] . "</a></b>";
    $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">";
    $content .= "<form name=\"addufavform\" method=\"post\" action=\"index.php\">";
    $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
    $content .= "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />";
    $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />";
    $content .= "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />";
    $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
    $content .= "<tr><td>" . $pgv_lang["add_fav_enter_id"] . " <br />";
    $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
    $content .= print_findindi_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findfamily_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findsource_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findrepository_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findnote_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findmedia_link("gid{$uniqueID}", '1', '', true) . "\n";
    $content .= "<br />" . $pgv_lang["add_fav_or_enter_url"];
    $content .= "<table><tr><td>" . $pgv_lang["url"] . "</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
    $content .= "<tr><td>" . $pgv_lang["title"] . "</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
    if ($block) {
        $content .= "\n</td></tr><tr><td><br />";
    } else {
        $content .= "\n</td><td>";
    }
    $content .= $pgv_lang["add_fav_enter_note"];
    $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
    $content .= "</td></tr></table>";
    $content .= "<br /><input type=\"submit\" value=\"" . $pgv_lang["add"] . "\" style=\"font-size: 8pt; \" />";
    $content .= "</form></div>";
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}
コード例 #20
0
ファイル: familybook.php プロジェクト: rathervague/phpgedview
function print_family_book($pid, $descent)
{
    global $generations, $dgenerations, $pgv_lang, $firstrun;
    if ($descent == 0) {
        return;
    }
    $famids = find_sfamily_ids($pid);
    if (count($famids) > 0 || empty($firstrun)) {
        $firstrun = true;
        $pid = check_rootid($pid);
        $person = Person::getInstance($pid);
        $name = $person->getFullName();
        print "\n\t<h2 style=\"text-align: center\">" . $pgv_lang["family_of"] . PrintReady($name) . "</h2>";
        print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n";
        //-- descendancy
        print "<td valign=\"middle\">\n";
        $dgenerations = $generations;
        // $dgenerations = max_descendency_generations($pid, 0);
        print_descendency($pid, 1);
        print "</td>\n";
        //-- pedigree
        print "<td valign=\"middle\">\n";
        print_person_pedigree($pid, 1);
        print "</td>\n";
        print "</tr></table>\n";
        print "<br /><br />\n";
        print "<hr style=\"page-break-after:always;\"/>\n";
        print "<br /><br />\n";
        foreach ($famids as $indexval => $famid) {
            $famrec = find_family_record($famid, PGV_GED_ID);
            $ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER);
            for ($i = 0; $i < $ct; $i++) {
                $chil = trim($match[$i][1]);
                if (showLivingNameById($chil) || displayDetailsById($chil)) {
                    print_family_book($chil, $descent - 1);
                }
            }
        }
    }
}
コード例 #21
0
/**
 * print a media row in a table
 * @param string $rtype whether this is a 'new', 'old', or 'normal' media row... this is used to determine if the rows should be printed with an outline color
 * @param array $rowm        An array with the details about this media item
 * @param string $pid        The record id this media item was attached to
 */
function media_reorder_row($rtype, $rowm, $pid)
{
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $view, $MEDIA_DIRECTORY, $TEXT_DIRECTION;
    global $SHOW_ID_NUMBERS, $GEDCOM, $factarray, $pgv_lang, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER;
    global $SEARCH_SPIDER;
    global $t, $n, $item, $items, $p, $edit, $SERVER_URL, $reorder, $LB_AL_THUMB_LINKS, $note, $rowm;
    global $LB_URL_WIDTH, $LB_URL_HEIGHT, $order1, $mediaType;
    if (!isset($rowm)) {
        $rowm = $row;
    }
    print "<li class=\"facts_value\" style=\"list-style:none;cursor:move;margin-bottom:2px;\" id=\"li_" . $rowm['m_media'] . "\" >";
    //print $rtype." ".$rowm["m_media"]." ".$pid;
    if (!displayDetailsById($rowm['m_media'], 'OBJE') || FactViewRestricted($rowm['m_media'], $rowm['m_gedrec'])) {
        //print $rowm['m_media']." no privacy ";
        return false;
    }
    $styleadd = "";
    if ($rtype == 'new') {
        $styleadd = "change_new";
    }
    if ($rtype == 'old') {
        $styleadd = "change_old";
    }
    // NOTE Start printing the media details
    $thumbnail = thumbnail_file($rowm["m_file"], true, false, $pid);
    // $isExternal = stristr($thumbnail,"://");
    $isExternal = isFileExternal($thumbnail);
    $linenum = 0;
    // NOTE Get the title of the media
    if (showFactDetails("OBJE", $pid)) {
        $mediaTitle = $rowm["m_titl"];
        $subtitle = get_gedcom_value("TITL", 2, $rowm["mm_gedrec"]);
        if (!empty($subtitle)) {
            $mediaTitle = $subtitle;
        }
        $mainMedia = check_media_depth($rowm["m_file"], "NOTRUNC");
        if ($mediaTitle == "") {
            $mediaTitle = basename($rowm["m_file"]);
        }
        print "\n" . "<table class=\"pic\"><tr>" . "\n";
        print "<td width=\"80\" valign=\"top\" align=\"center\" >" . "\n";
        // Get info on how to handle this media file
        $mediaInfo = mediaFileInfo($mainMedia, $thumbnail, $rowm["m_media"], $mediaTitle, '');
        //-- Thumbnail field
        print "<img src=\"" . $mediaInfo['thumb'] . "\" height=\"38\" border=\"0\" ";
        if (eregi("1 SOUR", $rowm['m_gedrec'])) {
            print " alt=\"" . PrintReady($mediaTitle) . "\" title=\"" . PrintReady($mediaTitle) . "\nSource info available\" />";
        } else {
            print " alt=\"" . PrintReady($mediaTitle) . "\" title=\"" . PrintReady($mediaTitle) . "\" />";
        }
        //print media info
        $ttype2 = preg_match("/\\d TYPE (.*)/", $rowm["m_gedrec"], $match);
        if ($ttype2 > 0) {
            $mediaType = trim($match[1]);
            $varName = "TYPE__" . strtolower($mediaType);
            if (isset($pgv_lang[$varName])) {
                $mediaType = $pgv_lang[$varName];
            }
            //		print "\n\t\t\t<br /><span class=\"label\">".$pgv_lang["type"].": </span> <span class=\"field\">$mediaType</span>";
        }
        print "\n" . "</td><td>&nbsp;</td>" . "\n";
        print "<td valign=\"top\" align=\"left\">";
        //print "<font color=\"blue\">";
        print $rowm['m_media'];
        //print "</font>";
        print "<b>";
        print "&nbsp;&nbsp;" . $mediaType;
        print "</b>";
        print "<br>" . "\n";
        print $mediaTitle . "\n";
        print "</td>" . "\n";
        print "</tr>";
        print "</table>" . "\n";
    }
    if (!isset($j)) {
        $j = 0;
    } else {
        $j = $j;
    }
    $media_data = $rowm['m_media'];
    print "<input type=\"hidden\" name=\"order1[{$media_data}]\" value=\"{$j}\" />";
    print "</li>";
    print "\n\n";
    return true;
}
コード例 #22
0
ファイル: functions.php プロジェクト: bitweaver/phpgedview
function mediaFileInfo($fileName, $thumbName, $mid, $name = '', $notes = '', $obeyViewerOption = true)
{
    global $THUMBNAIL_WIDTH, $PGV_IMAGE_DIR, $PGV_IMAGES;
    global $LB_URL_WIDTH, $LB_URL_HEIGHT;
    global $SERVER_URL, $GEDCOM, $USE_MEDIA_VIEWER, $USE_MEDIA_FIREWALL, $MEDIA_FIREWALL_THUMBS;
    $result = array();
    // -- Classify the incoming media file
    if (eregi("^https?://", $fileName)) {
        $type = "url_";
    } else {
        $type = "local_";
    }
    if ((eregi("\\.flv\$", $fileName) || eregi("^https?://.*\\.youtube\\..*/watch\\?", $fileName)) && is_dir('modules/JWplayer')) {
        $type .= "flv";
    } else {
        if (eregi("^https?://picasaweb*\\.google\\..*/.*/", $fileName)) {
            $type .= "picasa";
        } else {
            if (eregi("\\.(jpg|jpeg|gif|png)\$", $fileName)) {
                $type .= "image";
            } else {
                if (eregi("\\.(pdf|avi|txt)\$", $fileName)) {
                    $type .= "page";
                } else {
                    if (eregi("\\.mp3\$", $fileName)) {
                        $type .= "audio";
                    } else {
                        if (eregi("\\.wmv\$", $fileName)) {
                            $type .= "wmv";
                        } else {
                            $type .= "other";
                        }
                    }
                }
            }
        }
    }
    // $type is now: (url | local) _ (flv | picasa | image | page | audio | other)
    $result['type'] = $type;
    // -- Determine the correct URL to open this media file
    while (true) {
        if (file_exists("modules/lightbox/album.php")) {
            // Lightbox is installed
            include_once 'modules/lightbox/lb_defaultconfig.php';
            if (file_exists('modules/lightbox/lb_config.php')) {
                include_once 'modules/lightbox/lb_config.php';
            }
            switch ($type) {
                case 'url_flv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'local_flv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($SERVER_URL . $fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'url_wmv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'local_audio':
                case 'local_wmv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($SERVER_URL . $fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'url_image':
                case 'local_image':
                    $url = encode_url($fileName) . "\" rel=\"clearbox[general]\" rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'url_picasa':
                case 'url_page':
                case 'url_other':
                case 'local_page':
                    // case 'local_other':
                    $url = encode_url($fileName) . "\" rel='clearbox({$LB_URL_WIDTH},{$LB_URL_HEIGHT},click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
            }
        }
        // Lightbox is not installed or Lightbox is not appropriate for this media type
        switch ($type) {
            case 'url_flv':
                $url = "javascript:;\" onclick=\" var winflv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($fileName)) . "', 'winflv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winflv.focus();}";
                break 2;
            case 'local_flv':
                $url = "javascript:;\" onclick=\" var winflv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($SERVER_URL . $fileName)) . "', 'winflv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winflv.focus();}";
                break 2;
            case 'url_wmv':
                $url = "javascript:;\" onclick=\" var winwmv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($fileName)) . "', 'winwmv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winwmv.focus();}";
                break 2;
            case 'local_wmv':
            case 'local_audio':
                $url = "javascript:;\" onclick=\" var winwmv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($SERVER_URL . $fileName)) . "', 'winwmv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winwmv.focus();}";
                break 2;
            case 'url_image':
                $imgsize = findImageSize($fileName);
                $imgwidth = $imgsize[0] + 40;
                $imgheight = $imgsize[1] + 150;
                $url = "javascript:;\" onclick=\"var winimg = window.open('" . encode_url($fileName) . "', 'winimg', 'width=" . $imgwidth . ", height=" . $imgheight . ", left=200, top=200'); if (window.focus) {winimg.focus();}";
                break 2;
            case 'url_picasa':
            case 'url_page':
            case 'url_other':
            case 'local_other':
                $url = "javascript:;\" onclick=\"var winurl = window.open('" . encode_url($fileName) . "', 'winurl', 'width=900, height=600, left=200, top=200'); if (window.focus) {winurl.focus();}";
                break 2;
            case 'local_page':
                $url = "javascript:;\" onclick=\"var winurl = window.open('" . encode_url($SERVER_URL . $fileName) . "', 'winurl', 'width=900, height=600, left=200, top=200'); if (window.focus) {winurl.focus();}";
                break 2;
        }
        if ($USE_MEDIA_VIEWER && $obeyViewerOption) {
            $url = encode_url('mediaviewer.php?mid=' . $mid);
        } else {
            $imgsize = findImageSize($fileName);
            $imgwidth = $imgsize[0] + 40;
            $imgheight = $imgsize[1] + 150;
            $url = "javascript:;\" onclick=\"return openImage('" . encode_url(encrypt($fileName)) . "', {$imgwidth}, {$imgheight});";
        }
        break;
    }
    // At this point, $url describes how to handle the image when its thumbnail is clicked
    $result['url'] = $url;
    // -- Determine the correct thumbnail or pseudo-thumbnail
    $width = '';
    switch ($type) {
        case 'url_flv':
            $thumb = isset($PGV_IMAGES["media"]["flashrem"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["flashrem"] : 'images/media/flashrem.png';
            break;
        case 'local_flv':
            $thumb = isset($PGV_IMAGES["media"]["flash"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["flash"] : 'images/media/flash.png';
            break;
        case 'url_wmv':
            $thumb = isset($PGV_IMAGES["media"]["wmvrem"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["wmvrem"] : 'images/media/wmvrem.png';
            break;
        case 'local_wmv':
            $thumb = isset($PGV_IMAGES["media"]["wmv"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["wmv"] : 'images/media/wmv.png';
            break;
        case 'url_picasa':
            $thumb = isset($PGV_IMAGES["media"]["picasa"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["picasa"] : 'images/media/picasa.png';
            break;
        case 'url_page':
        case 'url_other':
            $thumb = isset($PGV_IMAGES["media"]["globe"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["globe"] : 'images/media/globe.png';
            break;
        case 'local_page':
            $thumb = $PGV_IMAGES["media"]["doc"] ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["doc"] : 'images/media/doc.gif';
            break;
        case 'url_audio':
        case 'local_audio':
            $thumb = isset($PGV_IMAGES["media"]["audio"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["audio"] : 'images/media/audio.png';
            break;
        default:
            $thumb = $thumbName;
            if (substr($type, 0, 4) == 'url_') {
                $width = ' width="' . $THUMBNAIL_WIDTH . '"';
            }
    }
    // -- Use an overriding thumbnail if one has been provided
    // Don't accept any overriding thumbnails that are in the "images" or "themes" directories
    if (substr($thumbName, 0, 7) != 'images/' && substr($thumbName, 0, 7) != 'themes/') {
        if ($USE_MEDIA_FIREWALL && $MEDIA_FIREWALL_THUMBS) {
            $tempThumbName = get_media_firewall_path($thumbName);
        } else {
            $tempThumbName = $thumbName;
        }
        if (file_exists($tempThumbName)) {
            $thumb = $thumbName;
        }
    }
    // -- Use the theme-specific media icon if nothing else works
    $realThumb = $thumb;
    if (substr($type, 0, 6) == 'local_' && !file_exists($thumb)) {
        if (!$USE_MEDIA_FIREWALL || !$MEDIA_FIREWALL_THUMBS) {
            $thumb = $PGV_IMAGE_DIR . '/' . $PGV_IMAGES['media']['large'];
            $realThumb = $thumb;
        } else {
            $realThumb = get_media_firewall_path($thumb);
            if (!file_exists($realThumb)) {
                $thumb = $PGV_IMAGE_DIR . '/' . $PGV_IMAGES['media']['large'];
                $realThumb = $thumb;
            }
        }
        $width = '';
    }
    // At this point, $width, $realThumb, and $thumb describe the thumbnail to be displayed
    $result['thumb'] = $thumb;
    $result['realThumb'] = $realThumb;
    $result['width'] = $width;
    return $result;
}
コード例 #23
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>";
}
コード例 #24
0
ファイル: yahrzeit.php プロジェクト: rathervague/phpgedview
function print_yahrzeit($block = true, $config = '', $side, $index)
{
    global $pgv_lang, $factarray, $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $PGV_BLOCKS;
    global $DAYS_TO_SHOW_LIMIT, $SHOW_MARRIED_NAMES, $SERVER_URL;
    $block = true;
    // Always restrict this block's height
    if (empty($config)) {
        $config = $PGV_BLOCKS['print_yahrzeit']['config'];
    }
    if (empty($config['infoStyle'])) {
        $config['infoStyle'] = 'style2';
    }
    if (empty($config['allowDownload'])) {
        $config['allowDownload'] = 'yes';
    }
    if (empty($config['days'])) {
        $config['days'] = $DAYS_TO_SHOW_LIMIT;
    }
    if ($config['days'] < 1) {
        $config['days'] = 1;
    }
    if ($config['days'] > $DAYS_TO_SHOW_LIMIT) {
        $config['days'] = $DAYS_TO_SHOW_LIMIT;
    }
    $startjd = server_jd();
    $endjd = $startjd + max(min($config['days'], 1), $DAYS_TO_SHOW_LIMIT) - 1;
    if (!PGV_USER_ID) {
        $allowDownload = "no";
    }
    $id = "yahrzeit";
    $title = print_help_link('yahrzeit_help', 'qm', '', false, true);
    if ($PGV_BLOCKS['print_yahrzeit']['canconfig']) {
        if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) {
            if ($ctype == "gedcom") {
                $name = PGV_GEDCOM;
            } else {
                $name = PGV_USER_NAME;
            }
            $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
            $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"{$pgv_lang['config_block']}\" /></a>";
        }
    }
    $title .= $pgv_lang['yahrzeit_block'];
    $content = "";
    // The standard anniversary rules cover most of the Yahrzeit rules, we just
    // need to handle a few special cases.
    // Fetch normal anniversaries...
    $yahrzeits = array();
    $hidden = 0;
    for ($jd = $startjd - 1; $jd <= $endjd + 30; ++$jd) {
        foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) {
            // Extract hebrew dates only
            if ($fact['date']->date1->CALENDAR_ESCAPE() == '@#DHEBREW@' && $fact['date']->MinJD() == $fact['date']->MaxJD()) {
                // Apply privacy
                if (displayDetailsById($fact['id']) && showFactDetails($fact['fact'], $fact['id']) && !FactViewRestricted($fact['id'], $fact['factrec'])) {
                    $yahrzeits[] = $fact;
                } else {
                    ++$hidden;
                }
            }
        }
    }
    // ...then adjust dates
    foreach ($yahrzeits as $key => $yahrzeit) {
        if (strpos('1 DEAT', $yahrzeit['factrec']) !== false) {
            // Just DEAT, not _YART
            $today = new JewishDate($yahrzeit['jd']);
            $hd = $yahrzeit['date']->MinDate();
            $hd1 = new JewishDate($hd);
            $hd1->y += 1;
            $hd1->SetJDFromYMD();
            // Special rules.  See http://www.hebcal.com/help/anniv.html
            // Everything else is taken care of by our standard anniversary rules.
            if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->DaysInMonth() < 30) {
                // 30 CSH
                // Last day in CSH
                $yahrzeit[$key]['jd'] = JewishDate::YMDtoJD($today->y, 3, 1) - 1;
            }
            if ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->DaysInMonth() < 30) {
                // 30 KSL
                // Last day in KSL
                $yahrzeit[$key]['jd'] = JewishDate::YMDtoJD($today->y, 4, 1) - 1;
            }
            if ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->DaysInMonth() < 30 && !$today->IsLeapYear()) {
                // 30 ADR
                // Last day in SHV
                $yahrzeit[$key]['jd'] = JewishDate::YMDtoJD($today->y, 6, 1) - 1;
            }
        }
    }
    switch ($config['infoStyle']) {
        case "style1":
            // List style
            foreach ($yahrzeits as $yahrzeit) {
                if ($yahrzeit['jd'] >= $startjd && $yahrzeit['jd'] < $startjd + $config['days']) {
                    $ind = person::GetInstance($yahrzeit['id']);
                    //@@			$content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\">".$ind->getFullName()."</a>".$ind->getSexImage();
                    $content .= "<a href=\"" . encode_url($ind->getLinkUrl()) . "\" class=\"list_item name2\">" . PrintReady($ind->getFullName()) . "</a>" . $ind->getSexImage();
                    $content .= "<div class=\"indent\">";
                    $content .= $yahrzeit['date']->Display(true);
                    $content .= ', ' . str_replace("#year_var#", $yahrzeit['anniv'], $pgv_lang["year_anniversary"]);
                    $content .= "</div>";
                }
            }
            break;
        case "style2":
            // Table style
            require_once PGV_ROOT . 'js/sorttable.js.htm';
            require_once PGV_ROOT . 'includes/classes/class_gedcomrecord.php';
            $table_id = "ID" . floor(microtime() * 1000000);
            // sorttable requires a unique ID
            $content .= "<table id=\"{$table_id}\" class=\"sortable list_table center\">";
            $content .= "<tr>";
            $content .= "<th class=\"list_label\">{$factarray['NAME']}</th>";
            $content .= "<th style=\"display:none\">GIVN</th>";
            $content .= "<th class=\"list_label\">{$factarray['DATE']}</th>";
            $content .= "<th class=\"list_label\"><img src=\"./images/reminder.gif\" alt=\"{$pgv_lang['anniversary']}\" title=\"{$pgv_lang['anniversary']}\" border=\"0\" /></th>";
            $content .= "<th class=\"list_label\">{$factarray['_YART']}</th>";
            $content .= "</tr>";
            $count = 0;
            foreach ($yahrzeits as $yahrzeit) {
                if ($yahrzeit['jd'] >= $startjd && $yahrzeit['jd'] < $startjd + $config['days']) {
                    ++$count;
                    $ind = person::GetInstance($yahrzeit['id']);
                    $content .= "<tr class=\"vevent\">";
                    // hCalendar:vevent
                    // Record name(s)
                    $name = $ind->getFullName();
                    $url = $ind->getLinkUrl();
                    $content .= "<td class=\"list_value_wrap\" align=\"" . get_align($name) . "\">";
                    $content .= "<a href=\"" . encode_url($ind->getLinkUrl()) . "\" class=\"list_item name2\" dir=\"" . $TEXT_DIRECTION . "\">" . PrintReady($name) . "</a>";
                    $content .= $ind->getSexImage();
                    $addname = $ind->getAddName();
                    if ($addname) {
                        $content .= "<br /><a href=\"" . encode_url($url) . "\" class=\"list_item\">" . PrintReady($addname) . "</a>";
                    }
                    $content .= "</td>";
                    // GIVN for sorting
                    $content .= "<td style=\"display:none\">";
                    $exp = explode(",", str_replace('<', ',', $name) . ",");
                    $content .= $exp[1];
                    $content .= "</td>";
                    $today = new JewishDate($yahrzeit['jd']);
                    $td = new GedcomDate($today->Format('@ A O E'));
                    // death/yahrzeit event date
                    $content .= "<td class=\"list_value_wrap\">";
                    $content .= "<a name='{$yahrzeit['jd']}'>" . $yahrzeit['date']->Display(true, NULL, array()) . "</a>";
                    $content .= "</td>";
                    // Anniversary
                    $content .= "<td class=\"list_value_wrap rela\">";
                    $anniv = $yahrzeit['anniv'];
                    if ($anniv == 0) {
                        $content .= '<a name="0">&nbsp;</a>';
                    } else {
                        $content .= "<a name=\"{$anniv}\">{$anniv}</a>";
                    }
                    if ($config['allowDownload'] == 'yes') {
                        // hCalendar:dtstart and hCalendar:summary
                        //TODO does this work??
                        $content .= "<abbr class=\"dtstart\" title=\"" . strip_tags($yahrzeit['date']->Display(false, 'Ymd', array())) . "\"></abbr>";
                        $content .= "<abbr class=\"summary\" title=\"" . $pgv_lang["anniversary"] . " #{$anniv} " . $factarray[$yahrzeit['fact']] . " : " . PrintReady(strip_tags($ind->getFullName())) . "\"></abbr>";
                    }
                    // upcomming yahrzeit dates
                    $content .= "<td class=\"list_value_wrap\">";
                    $content .= "<a href=\"" . $url . "\" class=\"list_item url\">" . $td->Display(true, NULL, array('gregorian')) . "</a>";
                    // hCalendar:url
                    $content .= "&nbsp;</td>";
                    $content .= "</tr>";
                }
            }
            // table footer
            $content .= "<tr class=\"sortbottom\">";
            $content .= "<td class=\"list_label\">";
            $content .= '<a href="javascript:;" onclick="sortByOtherCol(this,1)"><img src="images/topdown.gif" alt="" border="0" /> ' . $factarray["GIVN"] . '</a><br />';
            $content .= $pgv_lang["total_names"] . ": " . $count;
            if ($hidden) {
                $content .= "<br /><span class=\"warning\">{$pgv_lang['hidden']} : {$hidden}</span>";
            }
            $content .= "</td>";
            $content .= "<td style=\"display:none\">GIVN</td>";
            $content .= "<td>";
            if ($config['allowDownload'] == 'yes') {
                $uri = $SERVER_URL . basename($_SERVER['REQUEST_URI']);
                global $whichFile;
                $whichFile = 'hCal-events.ics';
                $alt = print_text('download_file', 0, 1);
                if (count($yahrzeits)) {
                    $content .= "<a href=\"http://feeds.technorati.com/events/{$uri}\"><img src=\"images/hcal.png\" border=\"0\" alt=\"{$alt}\" title=\"{$alt}\" /></a>";
                }
            }
            $content .= '</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
            $content .= '</table>';
            break;
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
コード例 #25
0
ファイル: fanchart.php プロジェクト: bitweaver/phpgedview
/**
 * print ancestors on a fan chart
 *
 * @param array $treeid ancestry pid
 * @param int $fanw fan width in px (default=640)
 * @param int $fandeg fan size in deg (default=270)
 */
function print_fan_chart($treeid, $fanw = 640, $fandeg = 270)
{
    global $PEDIGREE_GENERATIONS, $fan_width, $fan_style;
    global $name, $pgv_lang, $SHOW_ID_NUMBERS, $view, $TEXT_DIRECTION;
    global $stylesheet, $print_stylesheet;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $LINK_ICONS, $GEDCOM;
    // check for GD 2.x library
    if (!defined("IMG_ARC_PIE")) {
        print "<span class=\"error\">" . $pgv_lang["gd_library"] . "</span>";
        print " <a href=\"" . $pgv_lang["gd_helplink"] . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["small"] . "\" class=\"icon\" alt=\"\" /></a><br /><br />";
        return false;
    }
    if (!function_exists("ImageTtfBbox")) {
        print "<span class=\"error\">" . $pgv_lang["gd_freetype"] . "</span>";
        print " <a href=\"" . $pgv_lang["gd_helplink"] . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["small"] . "\" class=\"icon\" alt=\"\" /></a><br /><br />";
        return false;
    }
    // parse CSS file
    include "includes/cssparser.inc.php";
    $css = new cssparser(false);
    if ($view == "preview") {
        $css->Parse($print_stylesheet);
    } else {
        $css->Parse($stylesheet);
    }
    // check for fontfile
    $fontfile = $css->Get(".fan_chart", "font-family");
    $fontsize = $css->Get(".fan_chart", "font-size");
    $fontfile = str_replace("url(", "", $fontfile);
    $fontfile = str_replace(")", "", $fontfile);
    if (!file_exists($fontfile)) {
        if (!empty($fontfile)) {
            print "<span class=\"error\">" . $pgv_lang["fontfile_error"] . " : {$fontfile}</span>";
        }
        $fontfile = "./includes/fonts/DejaVuSans.ttf";
    }
    if ($fontfile[0] != '/') {
        $fontfile = dirname(__FILE__) . "/" . $fontfile;
    }
    if (!file_exists($fontfile)) {
        print "<span class=\"error\">" . $pgv_lang["fontfile_error"] . " : {$fontfile}</span>";
        return false;
    }
    if (intval($fontsize) < 2) {
        $fontsize = 7;
    }
    $treesize = count($treeid);
    if ($treesize < 1) {
        return;
    }
    // generations count
    $gen = log($treesize) / log(2) - 1;
    $sosa = $treesize - 1;
    // fan size
    if ($fandeg == 0) {
        $fandeg = 360;
    }
    $fandeg = min($fandeg, 360);
    $fandeg = max($fandeg, 90);
    $cx = $fanw / 2 - 1;
    // center x
    $cy = $cx;
    // center y
    $rx = $fanw - 1;
    $rw = $fanw / ($gen + 1);
    $fanh = $fanw;
    // fan height
    if ($fandeg == 180) {
        $fanh = round($fanh * ($gen + 1) / ($gen * 2));
    }
    if ($fandeg == 270) {
        $fanh = round($fanh * 0.86);
    }
    $scale = $fanw / 640;
    // image init
    $image = ImageCreate($fanw, $fanh);
    $black = ImageColorAllocate($image, 0, 0, 0);
    $white = ImageColorAllocate($image, 0xff, 0xff, 0xff);
    ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white);
    ImageColorTransparent($image, $white);
    $rgb = $css->Get(".fan_chart", "color");
    if (empty($rgb)) {
        $rgb = "#000000";
    }
    $color = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    $rgb = $css->Get(".fan_chart", "background-color");
    if (empty($rgb)) {
        $rgb = "#EEEEEE";
    }
    $bgcolor = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    $rgb = $css->Get(".fan_chart_box", "background-color");
    if (empty($rgb)) {
        $rgb = "#D0D0AC";
    }
    $bgcolorM = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    $rgb = $css->Get(".fan_chart_boxF", "background-color");
    if (empty($rgb)) {
        $rgb = "#D0ACD0";
    }
    $bgcolorF = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    // imagemap
    $imagemap = "<map id=\"fanmap\" name=\"fanmap\">";
    // loop to create fan cells
    while ($gen >= 0) {
        // clean current generation area
        $deg2 = 360 + ($fandeg - 180) / 2;
        $deg1 = $deg2 - $fandeg;
        ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE);
        $rx -= 3;
        // calculate new angle
        $p2 = pow(2, $gen);
        $angle = $fandeg / $p2;
        $deg2 = 360 + ($fandeg - 180) / 2;
        $deg1 = $deg2 - $angle;
        // special case for rootid cell
        if ($gen == 0) {
            $deg1 = 90;
            $deg2 = 360 + $deg1;
        }
        // draw each cell
        while ($sosa >= $p2) {
            $pid = $treeid[$sosa];
            if (!empty($pid)) {
                $indirec = find_person_record($pid);
                if (!$indirec) {
                    $indirec = find_updated_record($pid);
                }
                if ($sosa % 2) {
                    $bg = $bgcolorF;
                } else {
                    $bg = $bgcolorM;
                }
                if ($sosa == 1) {
                    $bg = $bgcolor;
                    // sex unknown
                    if (preg_match("/1 SEX F/", $indirec) > 0) {
                        $bg = $bgcolorF;
                    } else {
                        if (preg_match("/1 SEX M/", $indirec) > 0) {
                            $bg = $bgcolorM;
                        }
                    }
                }
                ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
                $person = Person::getInstance($pid);
                $name = $person->getFullName();
                $addname = $person->getAddName();
                //$name = str_replace(array('<span class="starredname">', '</span>'), '', $name);
                //$addname = str_replace(array('<span class="starredname">', '</span>'), '', $addname);
                //$name = str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $name); //@@
                //$addname = str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $addname); //@@
                // ToDo - print starred names underlined - 1985154
                // Todo - print Arabic letters combined - 1360209
                $text = reverseText($name) . "\n";
                if (!empty($addname)) {
                    $text .= reverseText($addname) . "\n";
                }
                if (displayDetailsById($pid)) {
                    $birthrec = get_sub_record(1, "1 BIRT", $indirec);
                    $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $birthrec, $match);
                    if ($ct > 0) {
                        $text .= trim($match[1]);
                    }
                    $deathrec = get_sub_record(1, "1 DEAT", $indirec);
                    $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $deathrec, $match);
                    if ($ct > 0) {
                        $text .= "-" . trim($match[1]);
                    }
                }
                $text = unhtmlentitiesrtl($text);
                $text = strip_tags($text);
                //Do we still need?
                // split and center text by lines
                $wmax = floor($angle * 7 / $fontsize * $scale);
                $wmax = min($wmax, 35 * $scale);
                if ($gen == 0) {
                    $wmax = min($wmax, 17 * $scale);
                }
                $text = split_align_text($text, $wmax);
                // text angle
                $tangle = 270 - ($deg1 + $angle / 2);
                if ($gen == 0) {
                    $tangle = 0;
                }
                // calculate text position
                $bbox = ImageTtfBbox((double) $fontsize, 0, $fontfile, $text);
                $textwidth = $bbox[4];
                $deg = $deg1 + 0.44;
                if ($deg2 - $deg1 > 40) {
                    $deg = $deg1 + ($deg2 - $deg1) / 11;
                }
                if ($deg2 - $deg1 > 80) {
                    $deg = $deg1 + ($deg2 - $deg1) / 7;
                }
                if ($deg2 - $deg1 > 140) {
                    $deg = $deg1 + ($deg2 - $deg1) / 4;
                }
                if ($gen == 0) {
                    $deg = 180;
                }
                $rad = deg2rad($deg);
                $mr = ($rx - $rw / 4) / 2;
                if ($gen > 0 and $deg2 - $deg1 > 80) {
                    $mr = $rx / 2;
                }
                $tx = $cx + $mr * cos($rad);
                $ty = $cy - $mr * -sin($rad);
                if ($sosa == 1) {
                    $ty -= $mr / 2;
                }
                // print text
                ImageTtfText($image, (double) $fontsize, $tangle, $tx, $ty, $color, $fontfile, $text);
                $imagemap .= "<area shape=\"poly\" coords=\"";
                // plot upper points
                $mr = $rx / 2;
                $deg = $deg1;
                while ($deg <= $deg2) {
                    $rad = deg2rad($deg);
                    $tx = round($cx + $mr * cos($rad));
                    $ty = round($cy - $mr * -sin($rad));
                    $imagemap .= "{$tx}, {$ty}, ";
                    $deg += ($deg2 - $deg1) / 6;
                }
                // plot lower points
                $mr = ($rx - $rw) / 2;
                $deg = $deg2;
                while ($deg >= $deg1) {
                    $rad = deg2rad($deg);
                    $tx = round($cx + $mr * cos($rad));
                    $ty = round($cy - $mr * -sin($rad));
                    $imagemap .= "{$tx}, {$ty}, ";
                    $deg -= ($deg2 - $deg1) / 6;
                }
                // join first point
                $mr = $rx / 2;
                $deg = $deg1;
                $rad = deg2rad($deg);
                $tx = round($cx + $mr * cos($rad));
                $ty = round($cy - $mr * -sin($rad));
                $imagemap .= "{$tx}, {$ty}";
                // add action url
                $tempURL = "javascript://" . htmlspecialchars(strip_tags($name));
                if ($SHOW_ID_NUMBERS) {
                    $tempURL .= " (" . $pid . ")";
                }
                $imagemap .= "\" href=\"{$tempURL}\" ";
                $tempURL = "fanchart.php?rootid={$pid}&PEDIGREE_GENERATIONS={$PEDIGREE_GENERATIONS}&fan_width={$fan_width}&fan_style={$fan_style}";
                if (!empty($view)) {
                    $tempURL .= "&view={$view}";
                }
                $count = 0;
                $lbwidth = 200;
                print "<div id=\"I" . $pid . "." . $count . "links\" style=\"position:absolute; >";
                print "left:" . $tx . "px; top:" . $ty . "px; width: " . $lbwidth . "px; visibility:hidden; z-index:'100';\">";
                print "<table class=\"person_box\"><tr><td class=\"details1\">";
                print "<a href=\"individual.php?pid={$pid}\" class=\"name1\">" . PrintReady($name);
                if (!empty($addname)) {
                    print "<br />" . PrintReady($addname);
                }
                print "</a>";
                print "<br /><a href=\"pedigree.php?rootid={$pid}\" >" . $pgv_lang["index_header"] . "</a>";
                print "<br /><a href=\"descendancy.php?pid={$pid}\" >" . $pgv_lang["descend_chart"] . "</a>";
                if (PGV_USER_GEDCOM_ID) {
                    print "<br /><a href=\"" . encode_url("relationship.php?pid1=" . PGV_USER_GEDCOM_ID . "&pid2={$pid}&ged={$GEDCOM}") . "\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["relationship_to_me"] . "</a>";
                }
                print "<br /><a href=\"ancestry.php?rootid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["ancestry_chart"] . "</a>";
                print "<br /><a href=\"compact.php?rootid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["compact_chart"] . "</a>";
                print "<br /><a href=\"" . encode_url($tempURL) . "\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["fan_chart"] . "</a>";
                print "<br /><a href=\"hourglass.php?pid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["hourglass_chart"] . "</a>";
                if ($sosa >= 1) {
                    $famids = find_sfamily_ids($pid);
                    //-- make sure there is more than 1 child in the family with parents
                    $cfamids = find_family_ids($pid);
                    $num = 0;
                    for ($f = 0; $f < count($cfamids); $f++) {
                        $famrec = find_family_record($cfamids[$f]);
                        if ($famrec) {
                            $num += preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                        }
                    }
                    if ($famids || $num > 1) {
                        //-- spouse(s) and children
                        for ($f = 0; $f < count($famids); $f++) {
                            $famrec = find_family_record(trim($famids[$f]));
                            if ($famrec) {
                                $parents = find_parents($famids[$f]);
                                if ($parents) {
                                    if ($pid != $parents["HUSB"]) {
                                        $spid = $parents["HUSB"];
                                    } else {
                                        $spid = $parents["WIFE"];
                                    }
                                    $person = Person::getInstance($spid);
                                    if ($person) {
                                        echo '<br /><a href="', $person->getLinkUrl(), '" class="name1">', $person->getFullName(), '</a>';
                                    }
                                }
                                $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                                for ($i = 0; $i < $num; $i++) {
                                    $person = Person::getInstance($smatch[$i][1]);
                                    if ($person) {
                                        echo '<br />&nbsp;&nbsp;<a href="', $person->getLinkUrl(), '" class="name1">&lt; ', $person->getFullName(), '</a>';
                                    }
                                }
                            }
                        }
                        //-- siblings
                        for ($f = 0; $f < count($cfamids); $f++) {
                            $famrec = find_family_record($cfamids[$f]);
                            if ($famrec) {
                                $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                                if ($num > 2) {
                                    print "<br /><span class=\"name1\">" . $pgv_lang["siblings"] . "</span>";
                                }
                                if ($num == 2) {
                                    print "<br /><span class=\"name1\">" . $pgv_lang["sibling"] . "</span>";
                                }
                                for ($i = 0; $i < $num; $i++) {
                                    $cpid = $smatch[$i][1];
                                    if ($cpid != $pid) {
                                        $person = Person::getInstance($cpid);
                                        if ($person) {
                                            echo '<br />&nbsp;&nbsp;<a href="', $person->getLinkUrl(), '" class="name1"> ', $person->getFullName(), '</a>';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                print "</td></tr></table>";
                print "</div>";
                $imagemap .= " onclick=\"show_family_box('" . $pid . "." . $count . "', 'relatives'); return false;\"";
                $imagemap .= " onmouseout=\"family_box_timeout('" . $pid . "." . $count . "'); return false;\"";
                $imagemap .= " alt=\"" . PrintReady(strip_tags($name)) . "\" title=\"" . PrintReady(strip_tags($name)) . "\" />";
            }
            $deg1 -= $angle;
            $deg2 -= $angle;
            $sosa--;
        }
        $rx -= $rw;
        $gen--;
    }
    $imagemap .= "</map>";
    echo $imagemap;
    // PGV banner ;-)
    ImageStringUp($image, 1, $fanw - 10, $fanh / 3, PGV_PHPGEDVIEW_URL, $color);
    // here we cannot send image to browser ('header already sent')
    // and we dont want to use a tmp file
    // step 1. save image data in a session variable
    ob_start();
    ImagePng($image);
    $image_data = ob_get_contents();
    ob_end_clean();
    $image_data = serialize($image_data);
    unset($_SESSION['image_data']);
    $_SESSION['image_data'] = $image_data;
    // step 2. call imageflush.php to read this session variable and display image
    // note: arg "image_name=" is to avoid image miscaching
    $image_name = "V" . time();
    unset($_SESSION[$image_name]);
    // statisticsplot.php uses this to hold a file name to send to browser
    $image_title = preg_replace("~<.*>~", "", $name) . " " . $pgv_lang["fan_chart"];
    echo "<p align=\"center\" >";
    echo "<img src=\"imageflush.php?image_type=png&amp;image_name={$image_name}&amp;height={$fanh}&amp;width={$fanw}\" width=\"{$fanw}\" height=\"{$fanh}\" border=\"0\" alt=\"{$image_title}\" title=\"{$image_title}\" usemap=\"#fanmap\" />";
    echo "</p>";
    ImageDestroy($image);
}
コード例 #26
0
ファイル: branches.php プロジェクト: rathervague/phpgedview
function print_fams($person, $famid = null)
{
    global $pgv_lang, $surn, $surn_lang, $TEXT_DIRECTION;
    // select person name according to searched surname
    $person_name = "";
    foreach ($person->getAllNames() as $n => $name) {
        list($surn1) = explode(", ", $name['list']);
        if (stripos($surn1, $surn) === false && stripos($surn, $surn1) === false && soundex_std($surn1) !== soundex_std($surn) && soundex_dm($surn1) !== soundex_dm($surn)) {
            continue;
        }
        if (whatLanguage($surn1) !== $surn_lang) {
            continue;
        }
        $person_name = $name['full'];
        break;
    }
    if (empty($person_name)) {
        echo "<span title=\"", PrintReady(strip_tags($person->getFullName())), "\">", $person->getSexImage(), "...</span>";
        return;
    }
    $person_lang = whatLanguage($person_name);
    // current indi
    echo "<li>";
    $class = "";
    $sosa = @array_search($person->getXref(), $_SESSION['user_ancestors']);
    if ($sosa) {
        $class = "search_hit";
        $sosa = "<a dir={$TEXT_DIRECTION} target=\"_blank\" class=\"details1 {$person->getBoxStyle()}\" title=\"Sosa\" href=\"relationship.php?pid2=" . PGV_USER_ROOT_ID . "&pid1=" . $person->getXref() . "\">&nbsp;{$sosa}&nbsp;</a>" . sosa_gen($sosa);
    }
    $current = $person->getSexImage() . "<a target=\"_blank\" class=\"{$class}\" title=\"" . $person->getXref() . "\" href=\"{$person->getLinkUrl()}\">" . PrintReady($person_name) . "</a> " . $person->getBirthDeathYears() . " {$sosa}";
    if ($famid && $person->getChildFamilyPedigree($famid)) {
        $current = "<span class='red'>" . $pgv_lang[$person->getChildFamilyPedigree($famid)] . "</span> " . $current;
    }
    // spouses and children
    if (count($person->getSpouseFamilies()) < 1) {
        echo $current;
    }
    foreach ($person->getSpouseFamilies() as $f => $family) {
        $txt = $current;
        $spouse = $family->getSpouse($person);
        if ($spouse) {
            $class = "";
            $sosa2 = @array_search($spouse->getXref(), $_SESSION['user_ancestors']);
            if ($sosa2) {
                $class = "search_hit";
                $sosa2 = "<a dir={$TEXT_DIRECTION} target=\"_blank\" class=\"details1 {$spouse->getBoxStyle()}\" title=\"Sosa\" href=\"relationship.php?pid2=" . PGV_USER_ROOT_ID . "&pid1=" . $spouse->getXref() . "\">&nbsp;{$sosa2}&nbsp;</a>" . sosa_gen($sosa2);
            }
            if ($family->getMarriageYear()) {
                $txt .= "&nbsp;<span dir={$TEXT_DIRECTION} class='details1' title=\"" . strip_tags($family->getMarriageDate()->Display()) . "\">" . PGV_ICON_RINGS . $family->getMarriageYear() . "</span>&nbsp;";
            } else {
                if ($family->getMarriage()) {
                    $txt .= "&nbsp;<span dir={$TEXT_DIRECTION} class='details1' title=\"" . $pgv_lang["yes"] . "\">" . PGV_ICON_RINGS . "</span>&nbsp;";
                }
            }
            $spouse_name = $spouse->getListName();
            foreach ($spouse->getAllNames() as $n => $name) {
                if (whatLanguage($name['list']) == $person_lang) {
                    $spouse_name = $name['list'];
                    break;
                } else {
                    if ($name['fullNN'] == "@P.N. @N.N.") {
                        $spouse_name = $pgv_lang["NN" . $person_lang] . ", " . $pgv_lang["NN" . $person_lang];
                        break;
                    }
                }
            }
            list($surn2, $givn2) = explode(", ", $spouse_name . ", x");
            $txt .= $spouse->getSexImage() . "<a target=\"_blank\" class=\"{$class}\" title=\"" . $family->getXref() . "\" href=\"{$family->getLinkUrl()}\">" . PrintReady($givn2) . "</a> " . "<a class=\"{$class}\" title=\"{$surn2}\" href=\"javascript:document.surnlist.surn.value='{$surn2}';document.surnlist.submit();\">" . PrintReady($surn2) . "</a> " . $spouse->getBirthDeathYears() . " {$sosa2}";
        }
        echo $txt;
        echo "<ol>";
        foreach ($family->getChildren() as $c => $child) {
            print_fams($child, $family->getXref());
        }
        echo "</ol>";
    }
    echo "</li>";
}
コード例 #27
0
             $output .= '<td class="list_label">' . $pgv_lang['date'] . '</td>';
             $output .= '<td class="list_label">GEDCOM</td>';
             $output .= '<td class="list_label">' . $pgv_lang['undo'] . '</td>';
             $output .= '</tr>';
         }
         if ($i == count($changes) - 1) {
             $output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><a href=\"" . encode_url("edit_changes.php?action=accept&cid={$cid}") . "\">" . $pgv_lang['accept'] . "</a></td>";
         } else {
             $output .= "<td class=\"list_value {$TEXT_DIRECTION}\">&nbsp;</td>";
         }
         $output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><b>" . $pgv_lang[$change['type']] . "</b></td>";
         $output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><a href=\"javascript:;\" onclick=\"return reply('" . $change['user'] . "', '" . $pgv_lang['review_changes'] . "')\" alt=\"" . $pgv_lang['message'] . "\">";
         if ($user_id = get_user_id($change['user'])) {
             $output .= PrintReady(getUserFullName($user_id));
         }
         $output .= PrintReady("&nbsp;(" . $change['user'] . ")") . "</a></td>";
         $output .= "<td class=\"list_value {$TEXT_DIRECTION}\">" . format_timestamp($change['time']) . "</td>";
         $output .= "<td class=\"list_value {$TEXT_DIRECTION}\">" . $change['gedcom'] . "</td>";
         if ($i == count($changes) - 1) {
             $output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><a href=\"" . encode_url("edit_changes.php?action=undo&cid={$cid}&index={$i}") . "\">" . $pgv_lang['undo'] . "</a></td>";
         } else {
             $output .= "<td class=\"list_value {$TEXT_DIRECTION}\">&nbsp;</td>";
         }
         $output .= '</tr>';
         if ($i == count($changes) - 1) {
             $output .= '</table></div><br />';
         }
     }
 }
 $output .= "</td></tr></table>";
 //-- Now for the global Action bar:
コード例 #28
0
/**
* add a new tag input field
*
* called for each fact to be edited on a form.
* Fact level=0 means a new empty form : data are POSTed by name
* else data are POSTed using arrays :
* glevels[] : tag level
*  islink[] : tag is a link
*     tag[] : tag name
*    text[] : tag value
*
* @param string $tag fact record to edit (eg 2 DATE xxxxx)
* @param string $upperlevel optional upper level tag (eg BIRT)
* @param string $label An optional label to echo instead of the default from the $factarray
* @param string $readOnly optional, when "READONLY", fact data can't be changed
* @param string $noClose optional, when "NOCLOSE", final "</td></tr>" won't be printed
* (so that additional text can be printed in the box)
* @param boolean $rowDisplay True to have the row displayed by default, false to hide it by default
*/
function add_simple_tag($tag, $upperlevel = "", $label = "", $readOnly = "", $noClose = "", $rowDisplay = true)
{
    global $factarray, $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $MEDIA_DIRECTORY, $TEMPLE_CODES;
    global $assorela, $tags, $emptyfacts, $main_fact, $TEXT_DIRECTION, $pgv_changes, $GEDCOM;
    global $NPFX_accept, $SPFX_accept, $NSFX_accept, $FILE_FORM_accept, $upload_count;
    global $tabkey, $STATUS_CODES, $SPLIT_PLACES, $pid, $linkToID;
    global $bdm, $PRIVACY_BY_RESN;
    global $lang_short_cut, $LANGUAGE;
    global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES;
    if (substr($tag, 0, strpos($tag, "PLAC"))) {
        ?>
<script type="text/javascript">
		<!--
		function valid_lati_long(field, pos, neg) {
			// valid LATI or LONG according to Gedcom standard
			// pos (+) : N or E
			// neg (-) : S or W
			txt=field.value.toUpperCase();
			txt=txt.replace(/(^\s*)|(\s*$)/g,''); // trim
			txt=txt.replace(/ /g,':'); // N12 34 ==> N12.34
			txt=txt.replace(/\+/g,''); // +17.1234 ==> 17.1234
			txt=txt.replace(/-/g,neg); // -0.5698 ==> W0.5698
			txt=txt.replace(/,/g,'.'); // 0,5698 ==> 0.5698
			// 0�34'11 ==> 0:34:11
			txt=txt.replace(/\uB0/g,':'); // �
			txt=txt.replace(/\u27/g,':'); // '
			// 0:34:11.2W ==> W0.5698
			txt=txt.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g, function($0, $1, $2, $3, $4) { var n=parseFloat($1); n+=($2/60); n+=($3/3600); n=Math.round(n*1E4)/1E4; return $4+n; });
			// 0:34W ==> W0.5667
			txt=txt.replace(/^([0-9]+):([0-9]+)(.*)/g, function($0, $1, $2, $3) { var n=parseFloat($1); n+=($2/60); n=Math.round(n*1E4)/1E4; return $3+n; });
			// 0.5698W ==> W0.5698
			txt=txt.replace(/(.*)([N|S|E|W]+)$/g,'$2$1');
			// 17.1234 ==> N17.1234
			if (txt!='' && txt.charAt(0)!=neg && txt.charAt(0)!=pos) txt=pos+txt;
			field.value = txt;
		}

		function toggle_lati_long() {
			tr = document.getElementsByTagName('tr');
			for (var i=0; i<tr.length; i++) {
				if (tr[i].id.indexOf("LATI")>=0 || tr[i].id.indexOf("LONG")>=0) {
					var disp = tr[i].style.display;
					if (disp=="none") {
						disp="table-row";
						if (document.all && !window.opera) disp = "inline"; // IE
					}
					else disp="none";
					tr[i].style.display=disp;
				}
			}
		}
		//-->
		</script>
		<?php 
    }
    if (!isset($noClose) && isset($readOnly) && $readOnly == "NOCLOSE") {
        $noClose = "NOCLOSE";
        $readOnly = "";
    }
    if (!isset($noClose) || $noClose != "NOCLOSE") {
        $noClose = "";
    }
    if (!isset($readOnly) || $readOnly != "READONLY") {
        $readOnly = "";
    }
    if (!isset($tabkey)) {
        $tabkey = 1;
    }
    if (empty($linkToID)) {
        $linkToID = $pid;
    }
    $subnamefacts = array("NPFX", "GIVN", "SPFX", "SURN", "NSFX", "_MARNM_SURN");
    @(list($level, $fact, $value) = explode(" ", $tag));
    // element name : used to POST data
    if ($level == 0) {
        if ($upperlevel) {
            $element_name = $upperlevel . "_" . $fact;
        } else {
            $element_name = $fact;
        }
        // ex: OCCU
    } else {
        $element_name = "text[]";
    }
    if ($level == 1) {
        $main_fact = $fact;
    }
    // element id : used by javascript functions
    if ($level == 0) {
        $element_id = $fact;
    } else {
        $element_id = $fact . floor(microtime() * 1000000);
    }
    // ex: SOUR56402
    if ($upperlevel) {
        $element_id = $upperlevel . "_" . $fact;
    }
    // ex: BIRT_DATE | DEAT_DATE ...
    // field value
    $islink = (substr($value, 0, 1) == "@" and substr($value, 0, 2) != "@#");
    if ($islink) {
        $value = trim(trim(substr($tag, strlen($fact) + 3)), " @\r");
    } else {
        $value = trim(substr($tag, strlen($fact) + 3));
    }
    if ($fact == 'REPO' || $fact == 'SOUR' || $fact == 'OBJE' || $fact == 'FAMC') {
        $islink = true;
    }
    // rows & cols
    switch ($fact) {
        case 'FORM':
            $rows = 1;
            $cols = 5;
            break;
        case 'LATI':
        case 'LONG':
        case 'NPFX':
        case 'SPFX':
        case 'NSFX':
            $rows = 1;
            $cols = 12;
            break;
        case 'DATE':
        case 'TIME':
        case 'TYPE':
            $rows = 1;
            $cols = 20;
            break;
        case 'GIVN':
        case 'SURN':
        case '_MARNM':
            $rows = 1;
            $cols = 25;
            break;
        case '_UID':
            $rows = 1;
            $cols = 50;
            break;
        case 'TEXT':
        case 'PUBL':
            $rows = 10;
            $cols = 70;
            break;
        case 'SHARED_NOTE_EDIT':
            $islink = 1;
            $fact = "NOTE";
            $rows = 15;
            $cols = 88;
            break;
        case 'SHARED_NOTE':
            $islink = 1;
            $fact = "NOTE";
            $rows = 1;
            $cols = $islink ? 8 : 40;
            break;
        case 'NOTE':
            if ($islink) {
                $rows = 1;
                $cols = $islink ? 8 : 40;
                break;
            } else {
                $rows = 10;
                $cols = 70;
                break;
            }
        case 'ADDR':
            $rows = 4;
            $cols = 40;
            break;
        case 'PAGE':
            $rows = 1;
            $cols = 50;
            break;
        default:
            $rows = 1;
            $cols = $islink ? 8 : 40;
            break;
    }
    // label
    $style = "";
    echo "<tr id=\"" . $element_id . "_tr\" ";
    if ($fact == "MAP" || $fact == "LATI" || $fact == "LONG") {
        echo " style=\"display:none;\"";
    }
    echo " >\n";
    if (in_array($fact, $subnamefacts) || $fact == "LATI" || $fact == "LONG") {
        echo "<td class=\"optionbox {$TEXT_DIRECTION} wrap width25\">";
    } else {
        echo "<td class=\"descriptionbox {$TEXT_DIRECTION} wrap width25\">";
    }
    // help link
    if (!in_array($fact, $emptyfacts)) {
        if ($fact == "DATE") {
            print_help_link("def_gedcom_date_help", "qm", "date");
        } else {
            if ($fact == "RESN") {
                print_help_link($fact . "_help", "qm");
            } else {
                if ($fact == "NOTE" && $islink) {
                    print_help_link("edit_add_SHARED_NOTE_help", "qm");
                } else {
                    print_help_link("edit_" . $fact . "_help", "qm");
                }
            }
        }
    }
    if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA") {
        // Allow special processing for different languages
        $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}";
        if (function_exists($func)) {
            // Localise the AKA fact
            $func($fact, $pid);
        }
    } else {
        if ($fact == "AGNC" && !empty($main_fact)) {
            // Allow special processing for different languages
            $func = "fact_AGNC_localisation_{$lang_short_cut[$LANGUAGE]}";
            if (function_exists($func)) {
                // Localise the AGNC fact
                $func($fact, $main_fact);
            }
        }
    }
    if (PGV_DEBUG) {
        echo $element_name . "<br />\n";
    }
    // tag name
    if (!empty($label)) {
        if ($label == "Note" && $islink) {
            echo $pgv_lang["shared_note"];
        } else {
            echo $label;
        }
    } else {
        if ($fact == "NOTE" && $islink) {
            echo $pgv_lang["shared_note"];
        } else {
            if (isset($pgv_lang[$fact])) {
                echo $pgv_lang[$fact];
            } else {
                if (isset($factarray[$fact])) {
                    echo $factarray[$fact];
                } else {
                    echo $fact;
                }
            }
        }
    }
    echo "\n";
    // tag level
    if ($level > 0) {
        if ($fact == "TEXT" and $level > 1) {
            echo "<input type=\"hidden\" name=\"glevels[]\" value=\"" . ($level - 1) . "\" />";
            echo "<input type=\"hidden\" name=\"islink[]\" value=\"0\" />";
            echo "<input type=\"hidden\" name=\"tag[]\" value=\"DATA\" />";
            //-- leave data text[] value empty because the following TEXT line will
            //--- cause the DATA to be added
            echo "<input type=\"hidden\" name=\"text[]\" value=\"\" />";
        }
        echo "<input type=\"hidden\" name=\"glevels[]\" value=\"" . $level . "\" />\n";
        echo "<input type=\"hidden\" name=\"islink[]\" value=\"" . $islink . "\" />\n";
        echo "<input type=\"hidden\" name=\"tag[]\" value=\"" . $fact . "\" />\n";
        // Shared Notes Debug --------------------
        // echo "<br />Label = ".$label;
        // echo "<br />Level = ".$level;
        // echo "<br />Link = ".$islink;
        // echo "<br />Fact = ".$fact;
        // echo "<br />Value = ".$value;
        // End Debug -------------------
    }
    echo "\n</td>";
    // value
    echo "<td class=\"optionbox wrap\">\n";
    if (PGV_DEBUG) {
        echo $tag . "<br />\n";
    }
    // retrieve linked NOTE
    if ($fact == "NOTE" && $islink) {
        $noteid = $value;
    }
    if (in_array($fact, $emptyfacts) && (empty($value) || $value == "y" || $value == "Y")) {
        $value = strtoupper($value);
        //-- don't default anything to Y when adding events through people
        //-- default to Y when specifically adding one of these events
        if ($level == 1) {
            $value = "Y";
        }
        // default YES
        echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . $value . "\" />";
        if ($level <= 1) {
            echo "<input type=\"checkbox\" ";
            if ($value == "Y") {
                echo " checked=\"checked\"";
            }
            echo " onclick=\"if (this.checked) " . $element_id . ".value='Y'; else " . $element_id . ".value=''; \" />";
            echo $pgv_lang["yes"];
        }
    } else {
        if ($fact == "TEMP") {
            echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >\n";
            echo "<option value=''>" . $pgv_lang["no_temple"] . "</option>\n";
            foreach ($TEMPLE_CODES as $code => $temple) {
                echo "<option value=\"{$code}\"";
                if ($code == $value) {
                    echo " selected=\"selected\"";
                }
                echo ">{$temple} ({$code})</option>\n";
            }
            echo "</select>\n";
        } else {
            if ($fact == "ADOP") {
                echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >";
                foreach (array("BOTH" => $factarray["HUSB"] . "+" . $factarray["WIFE"], "HUSB" => $factarray["HUSB"], "WIFE" => $factarray["WIFE"]) as $k => $v) {
                    echo "<option value='{$k}'";
                    if ($value == $k) {
                        echo " selected=\"selected\"";
                    }
                    echo ">{$v}</option>";
                }
                echo "</select>\n";
            } else {
                if ($fact == "PEDI") {
                    echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >";
                    foreach (array("" => $pgv_lang["unknown"], "birth" => $factarray["BIRT"], "adopted" => $pgv_lang["adopted"], "foster" => $pgv_lang["foster"], "sealing" => $pgv_lang["sealing"]) as $k => $v) {
                        echo "<option value='{$k}'";
                        if (UTF8_strtolower($value) == $k) {
                            echo " selected=\"selected\"";
                        }
                        echo ">{$v}</option>";
                    }
                    echo "</select>\n";
                } else {
                    if ($fact == "STAT") {
                        echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >\n";
                        echo "<option value=''>No special status</option>\n";
                        foreach ($STATUS_CODES as $code => $status) {
                            echo "<option value=\"{$code}\"";
                            if ($code == $value) {
                                echo " selected=\"selected\"";
                            }
                            echo ">{$status}</option>\n";
                        }
                        echo "</select>\n";
                    } else {
                        if ($fact == "RELA") {
                            $text = strtolower($value);
                            // add current relationship if not found in default list
                            if (!array_key_exists($text, $assorela)) {
                                $assorela[$text] = $text;
                            }
                            echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                            foreach ($assorela as $key => $value) {
                                echo "<option value=\"" . $key . "\"";
                                if ($key == $text) {
                                    echo " selected=\"selected\"";
                                }
                                echo ">" . $assorela["{$key}"] . "</option>\n";
                            }
                            echo "</select>\n";
                        } else {
                            if ($fact == "_PGVU") {
                                $text = strtolower($value);
                                echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                                echo '<option value=""';
                                if ('' == $text) {
                                    echo ' selected="selected"';
                                }
                                echo ">-</option>\n";
                                foreach (get_all_users('asc', 'username') as $user_id => $user_name) {
                                    echo "<option value=\"" . $user_id . "\"";
                                    if ($user_id == $text) {
                                        echo " selected=\"selected\"";
                                    }
                                    echo ">" . $user_name . "</option>\n";
                                }
                                echo "</select>\n";
                            } else {
                                if ($fact == "RESN") {
                                    ?>
		<script type="text/javascript">
		<!--
		function update_RESN_img(resn_val) {
			document.getElementById("RESN_none").style.display="none";
			document.getElementById("RESN_locked").style.display="none";
			document.getElementById("RESN_privacy").style.display="none";
			document.getElementById("RESN_confidential").style.display="none";
			document.getElementById("RESN_"+resn_val).style.display="inline";
			if (resn_val=='none') resn_val='';
			document.getElementById("<?php 
                                    echo $element_id;
                                    ?>
").value=resn_val;
		}
		//-->
		</script>
		<?php 
                                    if (!$PRIVACY_BY_RESN && $level == 1) {
                                        // warn user that level 1 RESN tags have no effect when PRIVACY_BY_RESN is false
                                        echo "<small>" . $pgv_lang["resn_disabled"] . "</small>";
                                    }
                                    echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . $value . "\" />\n";
                                    echo "<table><tr valign=\"top\">\n";
                                    foreach (array("none", "locked", "privacy", "confidential") as $resn_index => $resn_val) {
                                        if ($resn_val == "none") {
                                            $resnv = "";
                                        } else {
                                            $resnv = $resn_val;
                                        }
                                        echo "<td><input tabindex=\"" . $tabkey . "\" type=\"radio\" name=\"RESN_radio\" onclick=\"update_RESN_img('" . $resn_val . "')\"";
                                        echo " value=\"" . $resnv . "\"";
                                        if ($value == $resnv) {
                                            echo " checked=\"checked\"";
                                        }
                                        echo " /><small>" . $pgv_lang[$resn_val] . "</small>";
                                        echo "<br />&nbsp;<img id=\"RESN_" . $resn_val . "\" src=\"images/RESN_" . $resn_val . ".gif\"  alt=\"" . $pgv_lang[$resn_val] . "\" title=\"" . $pgv_lang[$resn_val] . "\" border=\"0\"";
                                        if ($value == $resnv) {
                                            echo " style=\"display:inline\"";
                                        } else {
                                            echo " style=\"display:none\"";
                                        }
                                        echo " /></td>\n";
                                    }
                                    echo "</tr></table>\n";
                                } else {
                                    if ($fact == "_PRIM" or $fact == "_THUM") {
                                        echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                                        echo "<option value=\"\"></option>\n";
                                        echo "<option value=\"Y\"";
                                        if ($value == "Y") {
                                            echo " selected=\"selected\"";
                                        }
                                        echo ">" . $pgv_lang["yes"] . "</option>\n";
                                        echo "<option value=\"N\"";
                                        if ($value == "N") {
                                            echo " selected=\"selected\"";
                                        }
                                        echo ">" . $pgv_lang["no"] . "</option>\n";
                                        echo "</select>\n";
                                    } else {
                                        if ($fact == "SEX") {
                                            echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\">\n<option value=\"M\"";
                                            if ($value == "M") {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["male"] . "</option>\n<option value=\"F\"";
                                            if ($value == "F") {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["female"] . "</option>\n<option value=\"U\"";
                                            if ($value == "U" || empty($value)) {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["unknown"] . "</option>\n</select>\n";
                                        } else {
                                            if ($fact == "TYPE" && $level == '3') {
                                                //-- Build array of currently defined values for this Media Fact
                                                foreach ($pgv_lang as $varname => $typeValue) {
                                                    if (substr($varname, 0, 6) == "TYPE__") {
                                                        if ($varname != "TYPE__other") {
                                                            $type[strtolower(substr($varname, 6))] = $typeValue;
                                                        }
                                                    }
                                                }
                                                //-- Sort the array into a meaningful order
                                                array_flip($type);
                                                asort($type);
                                                array_flip($type);
                                                //-- Add "Other" at the end of the list
                                                $type["other"] = $pgv_lang["TYPE__other"];
                                                //-- Build the selector for the Media "TYPE" Fact
                                                echo "<select tabindex=\"" . $tabkey . "\" name=\"text[]\">";
                                                if ($value == "") {
                                                    echo "<option selected=\"selected\" value=\"\" > " . $pgv_lang["choose"] . " </option>";
                                                }
                                                $selectedValue = strtolower($value);
                                                foreach ($type as $typeName => $typeValue) {
                                                    echo "<option value=\"" . $typeName . "\" ";
                                                    if ($selectedValue == $typeName) {
                                                        echo "selected=\"selected\" ";
                                                    }
                                                    echo "> " . $typeValue . " </option>";
                                                }
                                                echo "</select>";
                                            } else {
                                                if ($fact == "NAME" && $upperlevel != 'REPO' || $fact == "_MARNM") {
                                                    // Populated in javascript from sub-tags
                                                    echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" onchange=\"updateTextName('" . $element_id . "');\" value=\"" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "\" />";
                                                    echo "<span id=\"" . $element_id . "_display\">" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "</span>";
                                                    echo " <a href=\"#edit_name\" onclick=\"convertHidden('" . $element_id . "'); return false;\"> ";
                                                    if (isset($PGV_IMAGES["edit_indi"]["small"])) {
                                                        echo "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["edit_indi"]["small"] . "\" border=\"0\" width=\"20\" alt=\"" . $pgv_lang["edit_name"] . "\" align=\"top\" />";
                                                    } else {
                                                        echo "<span class=\"age\">[" . $pgv_lang["edit_name"] . "]</span>";
                                                    }
                                                    echo "</a>";
                                                } else {
                                                    // textarea
                                                    if ($rows > 1) {
                                                        echo "<textarea tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" rows=\"" . $rows . "\" cols=\"" . $cols . "\">" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "</textarea><br />\n";
                                                    } else {
                                                        // text
                                                        echo "<input tabindex=\"" . $tabkey . "\" type=\"text\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "\" size=\"" . $cols . "\" dir=\"ltr\"";
                                                        echo " class=\"{$fact}\"";
                                                        echo " autocomplete=\"off\"";
                                                        if (in_array($fact, $subnamefacts)) {
                                                            echo " onblur=\"updatewholename();\" onkeyup=\"updatewholename();\"";
                                                        }
                                                        if ($fact == "DATE") {
                                                            echo " onblur=\"valid_date(this);\" onmouseout=\"valid_date(this);\"";
                                                        }
                                                        if ($fact == "LATI") {
                                                            echo " onblur=\"valid_lati_long(this, 'N', 'S');\" onmouseout=\"valid_lati_long(this, 'N', 'S');\"";
                                                        }
                                                        if ($fact == "LONG") {
                                                            echo " onblur=\"valid_lati_long(this, 'E', 'W');\" onmouseout=\"valid_lati_long(this, 'E', 'W');\"";
                                                        }
                                                        //if ($fact=="FILE") echo " onchange=\"if (updateFormat) updateFormat(this.value);\"";
                                                        echo " " . $readOnly . " />\n";
                                                    }
                                                    // split PLAC
                                                    if ($fact == "PLAC" && $readOnly == "") {
                                                        echo "<div id=\"" . $element_id . "_pop\" style=\"display: inline;\">\n";
                                                        print_specialchar_link($element_id, false);
                                                        print_findplace_link($element_id);
                                                        echo "</div>\n";
                                                        echo "<a href=\"javascript:;\" onclick=\"toggle_lati_long();\"><img src=\"images/buttons/target.gif\" border=\"0\" align=\"middle\" alt=\"" . $factarray["LATI"] . " / " . $factarray["LONG"] . "\" title=\"" . $factarray["LATI"] . " / " . $factarray["LONG"] . "\" /></a>";
                                                        if ($SPLIT_PLACES) {
                                                            if (!function_exists("print_place_subfields")) {
                                                                require "includes/functions/functions_places.php";
                                                            }
                                                            setup_place_subfields($element_id);
                                                            print_place_subfields($element_id);
                                                        }
                                                    } else {
                                                        if (($cols > 20 || $fact == "NPFX") && $readOnly == "") {
                                                            print_specialchar_link($element_id, false);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // MARRiage TYPE : hide text field and show a selection list
    if ($fact == "TYPE" and $tags[0] == "MARR") {
        echo "<script type='text/javascript'>";
        echo "document.getElementById('" . $element_id . "').style.display='none'";
        echo "</script>";
        echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "_sel\" onchange=\"document.getElementById('" . $element_id . "').value=this.value;\" >\n";
        foreach (array("Unknown", "Civil", "Religious", "Partners") as $indexval => $key) {
            if ($key == "Unknown") {
                echo "<option value=\"\"";
            } else {
                echo "<option value=\"" . $key . "\"";
            }
            $a = strtolower($key);
            $b = strtolower($value);
            if (@strpos($a, $b) !== false or @strpos($b, $a) !== false) {
                echo " selected=\"selected\"";
            }
            echo ">" . $factarray["MARR_" . strtoupper($key)] . "</option>\n";
        }
        echo "</select>";
    }
    // popup links
    if ($readOnly == "") {
        if ($fact == "DATE") {
            print_calendar_popup($element_id);
        }
        if ($fact == "FAMC") {
            print_findfamily_link($element_id, "");
        }
        if ($fact == "FAMS") {
            print_findfamily_link($element_id, "");
        }
        if ($fact == "ASSO") {
            print_findindi_link($element_id, "");
        }
        if ($fact == "FILE") {
            print_findmedia_link($element_id, "0file");
        }
        if ($fact == "SOUR") {
            print_findsource_link($element_id);
            print_addnewsource_link($element_id);
            //print_autopaste_link($element_id, array("S1", "S2"), false, false, true);
            //-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR'
            if ($level == 1) {
                echo '<br />';
                if ($PREFER_LEVEL2_SOURCES === '0') {
                    $level1_checked = '';
                    $level2_checked = '';
                } else {
                    if ($PREFER_LEVEL2_SOURCES === '1' || $PREFER_LEVEL2_SOURCES === true) {
                        $level1_checked = '';
                        $level2_checked = ' checked="checked"';
                    } else {
                        $level1_checked = ' checked="checked"';
                        $level2_checked = '';
                    }
                }
                if (strpos($bdm, 'B') !== false) {
                    echo '&nbsp;<input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="Y" />';
                    echo $pgv_lang['individual'];
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            if (!in_array($match, explode('|', PGV_EVENTS_DEAT))) {
                                echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                                echo $factarray[$match];
                            }
                        }
                    }
                }
                if (strpos($bdm, 'D') !== false) {
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            if (in_array($match, explode('|', PGV_EVENTS_DEAT))) {
                                echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                                echo $factarray[$match];
                            }
                        }
                    }
                }
                if (strpos($bdm, 'M') !== false) {
                    echo '&nbsp;<input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="Y" />';
                    echo $pgv_lang["family"];
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                            echo $factarray[$match];
                        }
                    }
                }
            }
        }
        if ($fact == "REPO") {
            print_findrepository_link($element_id);
            print_addnewrepository_link($element_id);
        }
        // Shared Notes Icons ========================================
        // $record=GedcomRecord::getInstance($value);
        if ($fact == "NOTE" && $islink) {
            print_findnote_link($element_id);
            print_addnewnote_link($element_id);
            if ($value != "") {
                echo "&nbsp;&nbsp;&nbsp;";
                print_editnote_link($value);
            }
            // If GEDFAct_assistant/_CENS/ module exists && we are on the INDI page
            // Then show the add Shared note assisted icon, if not  ... do not show
            if ($pid) {
                $type_pid = GedcomRecord::getInstance($pid);
                if (file_exists('modules/GEDFact_assistant/_CENS/census_1_ctrl.php') && $type_pid->getType() == "INDI") {
                    echo "&nbsp;&nbsp;&nbsp;";
                    print_addnewnote_assisted_link($element_id);
                }
            }
            echo "<br />";
        }
        // ===========================================================
        if ($fact == "OBJE") {
            print_findmedia_link($element_id, "1media");
        }
        if ($fact == "OBJE" && !$value) {
            print_addnewmedia_link($element_id);
            $value = "new";
        }
    }
    // current value
    if ($TEXT_DIRECTION == "ltr") {
        if ($fact == "DATE") {
            $date = new GedcomDate($value);
            echo $date->Display(false);
        }
        if (($fact == "ASSO" || $fact == "SOUR" || $fact == "OBJE" || $fact == "NOTE" && $islink) && $value) {
            $record = GedcomRecord::getInstance($value);
            if ($record) {
                echo ' ', PrintReady($record->getFullName()), ' (', $value, ')';
            } else {
                if ($value != "new") {
                    echo ' ', $value;
                }
            }
        }
    } else {
        if ($fact == "DATE") {
            $date = new GedcomDate($value);
            echo getRLM(), $date->Display(false), getRLM();
        }
        if (($fact == "ASSO" || $fact == "SOUR" || $fact == "OBJE" || $fact == "NOTE" && $islink) && $value) {
            $record = GedcomRecord::getInstance($value);
            if ($record) {
                echo getRLM(), PrintReady($record->getFullName()), ' ', getLRM(), '(', $value, ') ', getLRM(), getRLM();
            } else {
                if ($value != "new") {
                    echo getRLM(), $value, ' ', getRLM();
                }
            }
        }
    }
    /*
    	if ($fact=="NOTE" && $islink && $value!="") {
    		include('includes/functions/functions_print_lists.php'); 
    		echo "<tr><td class=\"descriptionbox ".$TEXT_DIRECTION." wrap width25\">";
    				print_help_link("edit_add_SHARED_NOTE_help", "qm");
    			//	echo $pgv_lang["admin_override"];
    			echo "Shared Note Links<br /><br />";
    		echo "</td><td class=\"optionbox wrap\">\n";
    			print_indi_list(fetch_linked_indi($value, "NOTE", "1"));
    		echo "</td></tr>\n";
    	}
    */
    // pastable values
    if ($readOnly == "") {
        if ($fact == "SPFX") {
            print_autopaste_link($element_id, $SPFX_accept);
        }
        if ($fact == "NSFX") {
            print_autopaste_link($element_id, $NSFX_accept);
        }
        if ($fact == "FORM") {
            print_autopaste_link($element_id, $FILE_FORM_accept, false, false);
        }
    }
    if ($noClose != "NOCLOSE") {
        echo "</td></tr>\n";
    }
    $tabkey++;
    return $element_id;
}
コード例 #29
0
    ?>
" onfocus="getHelp('gedcom_path_help');" />
		</td>
	</tr>
	<?php 
}
if ($source != "replace_form") {
    ?>
	<tr>
		<td class="descriptionbox wrap width20"><?php 
    print_help_link("gedcom_title_help", "qm", "gedcom_title", true);
    print print_text("gedcom_title");
    ?>
</td>
		<td class="optionbox"><input type="text" name="gedcom_title" dir="ltr" value="<?php 
    print str_replace("\"", "&quot;", PrintReady($gedcom_title));
    ?>
" size="40" tabindex="<?php 
    $i++;
    print $i;
    ?>
" onfocus="getHelp('gedcom_title_help');" /></td>
	</tr>
	<tr>
		<td class="descriptionbox wrap width20">
		<?php 
    print_help_link("LANGUAGE_help", "qm", "LANGUAGE");
    print $pgv_lang["LANGUAGE"];
    ?>
</td>
		<td class="optionbox"><input type="hidden" name="changelanguage" value="yes" />
コード例 #30
0
ファイル: descendancy.php プロジェクト: bitweaver/phpgedview
        if (count($famids)) {
            $controller->print_child_family($controller->descPerson, $controller->generations);
        }
        break;
    case 2:
        //-- Individual list
        $descendants = indi_desc($controller->descPerson, $controller->generations, array());
        echo '<div class="center">';
        print_indi_table($descendants, $pgv_lang['descend_chart'] . ' : ' . PrintReady($controller->name));
        echo '</div>';
        break;
    case 3:
        //-- Family list
        $descendants = fam_desc($controller->descPerson, $controller->generations, array());
        echo '<div class="center">';
        print_fam_table($descendants, $pgv_lang['descend_chart'] . ' : ' . PrintReady($controller->name));
        echo '</div>';
        break;
}
print_footer();
function indi_desc($person, $n, $array)
{
    if ($n < 0) {
        return $array;
    }
    $array[$person->getXref()] = $person;
    foreach ($person->getSpouseFamilies() as $family) {
        $spouse = $family->getSpouse($person);
        if (isset($spouse)) {
            $array[$spouse->getXref()] = $spouse;
        }