本文整理汇总了PHP中get_sub_record函数的典型用法代码示例。如果您正苦于以下问题:PHP get_sub_record函数的具体用法?PHP get_sub_record怎么用?PHP get_sub_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_sub_record函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: check_alive
/**
* is the person alive in the given year
* @param string $indirec the persons raw gedcom record
* @param int $year the year to check if they are alive in
* @return int return 0 if the person is alive, negative number if they died earlier, positive number if they will be born in the future
*/
function check_alive($indirec, $year)
{
global $MAX_ALIVE_AGE;
if (is_dead($indirec, $year)) {
return -1;
}
// Died before year?
$deathrec = get_sub_record(1, "1 DEAT", $indirec);
if (preg_match("/\\d DATE (.*)/", $deathrec, $match)) {
$ddate = new GedcomDate($match[1]);
$dyear = $ddate->gregorianYear();
if ($year > $dyear) {
return -1;
}
}
// Born after year?
$birthrec = get_sub_record(1, "1 BIRT", $indirec);
if (preg_match("/\\d DATE (.*)/", $birthrec, $match)) {
$bdate = new GedcomDate($match[1]);
$byear = $bdate->gregorianYear();
if ($year < $byear) {
return 1;
}
}
// Born before year and died after year
if (isset($byear) && isset($dyear) && $year >= $byear && $year <= $dyear) {
return 0;
}
// If no death record than check all dates;
$years = array();
$subrecs = get_all_subrecords($indirec, "CHAN", true, true, false);
foreach ($subrecs as $ind => $subrec) {
if (preg_match("/\\d DATE (.*)/", $subrec, $match)) {
$date = new GedcomDate($match[1]);
$datey = $date->gregorianYear();
if ($datey) {
$years[] = $datey;
}
}
}
// Events both before and after year
if (count($years) > 1 && $year >= $years[0] && $year <= $years[count($years) - 1]) {
return 0;
}
foreach ($years as $ind => $year1) {
if ($year1 - $year > $MAX_ALIVE_AGE) {
return -1;
}
}
return 0;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:57,代码来源:aliveinyear.php
示例2: get_first_tag
function get_first_tag($level, $tag, $gedrec, $num = 1)
{
$temp = get_sub_record($level, $level . " " . $tag, $gedrec, $num) . "\n";
$length = strpos($temp, "\n");
if ($length === false) {
$length = strlen($temp);
}
return substr($temp, 2, $length - 2);
}
开发者ID:brambravo,项目名称:webtrees,代码行数:9,代码来源:addmedia.php
示例3: get_lds_glance
/**
* get a quick-glance view of current LDS ordinances
* @param string $indirec
* @return string
*/
function get_lds_glance($indirec)
{
$text = "";
$ord = get_sub_record(1, "1 BAPL", $indirec);
if ($ord) {
$text .= "B";
} else {
$text .= "_";
}
$ord = get_sub_record(1, "1 ENDL", $indirec);
if ($ord) {
$text .= "E";
} else {
$text .= "_";
}
$found = false;
$ct = preg_match_all("/1 FAMS @(.*)@/", $indirec, $match, PREG_SET_ORDER);
for ($i = 0; $i < $ct; $i++) {
$famrec = find_family_record($match[$i][1]);
if ($famrec) {
$ord = get_sub_record(1, "1 SLGS", $famrec);
if ($ord) {
$found = true;
break;
}
}
}
if ($found) {
$text .= "S";
} else {
$text .= "_";
}
$ord = get_sub_record(1, "1 SLGC", $indirec);
if ($ord) {
$text .= "P";
} else {
$text .= "_";
}
return $text;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:45,代码来源:bit_print.php
示例4: print_fan_chart
//.........这里部分代码省略.........
$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;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:67,代码来源:fanchart.php
示例5: format_fact_place
/**
* print fact PLACe TEMPle STATus
*
* @param WT_Fact $event gedcom fact record
* @param bool $anchor to print a link to placelist
* @param bool $sub_records to print place subrecords
* @param bool $lds to print LDS TEMPle and STATus
*
* @return string HTML
*/
function format_fact_place(WT_Fact $event, $anchor = false, $sub_records = false, $lds = false)
{
global $SEARCH_SPIDER;
if ($anchor) {
// Show the full place name, for facts/events tab
if ($SEARCH_SPIDER) {
$html = $event->getPlace()->getFullName();
} else {
$html = '<a href="' . $event->getPlace()->getURL() . '">' . $event->getPlace()->getFullName() . '</a>';
}
} else {
// Abbreviate the place name, for chart boxes
return ' - ' . $event->getPlace()->getShortName();
}
if ($sub_records) {
$placerec = get_sub_record(2, '2 PLAC', $event->getGedcom());
if (!empty($placerec)) {
if (preg_match_all('/\\n3 (?:_HEB|ROMN) (.+)/', $placerec, $matches)) {
foreach ($matches[1] as $match) {
$wt_place = new WT_Place($match, WT_GED_ID);
$html .= ' - ' . $wt_place->getFullName();
}
}
$map_lati = "";
$cts = preg_match('/\\d LATI (.*)/', $placerec, $match);
if ($cts > 0) {
$map_lati = $match[1];
$html .= '<br><span class="label">' . WT_Gedcom_Tag::getLabel('LATI') . ': </span>' . $map_lati;
}
$map_long = '';
$cts = preg_match('/\\d LONG (.*)/', $placerec, $match);
if ($cts > 0) {
$map_long = $match[1];
$html .= ' <span class="label">' . WT_Gedcom_Tag::getLabel('LONG') . ': </span>' . $map_long;
}
if ($map_lati && $map_long) {
$map_lati = trim(strtr($map_lati, "NSEW,�", " - -. "));
// S5,6789 ==> -5.6789
$map_long = trim(strtr($map_long, "NSEW,�", " - -. "));
// E3.456� ==> 3.456
$html .= ' <a rel="nofollow" href="https://maps.google.com/maps?q=' . $map_lati . ',' . $map_long . '" class="icon-googlemaps" title="' . WT_I18N::translate('Google Maps™') . '"></a>';
$html .= ' <a rel="nofollow" href="https://www.bing.com/maps/?lvl=15&cp=' . $map_lati . '~' . $map_long . '" class="icon-bing" title="' . WT_I18N::translate('Bing Maps™') . '"></a>';
$html .= ' <a rel="nofollow" href="https://www.openstreetmap.org/#map=15/' . $map_lati . '/' . $map_long . '" class="icon-osm" title="' . WT_I18N::translate('OpenStreetMap™') . '"></a>';
}
if (preg_match('/\\d NOTE (.*)/', $placerec, $match)) {
$html .= '<br>' . print_fact_notes($placerec, 3);
}
}
}
if ($lds) {
if (preg_match('/2 TEMP (.*)/', $event->getGedcom(), $match)) {
$html .= '<br>' . WT_I18N::translate('LDS temple') . ': ' . WT_Gedcom_Code_Temp::templeName($match[1]);
}
if (preg_match('/2 STAT (.*)/', $event->getGedcom(), $match)) {
$html .= '<br>' . WT_I18N::translate('Status') . ': ' . WT_Gedcom_Code_Stat::statusName($match[1]);
if (preg_match('/3 DATE (.*)/', $event->getGedcom(), $match)) {
$date = new WT_Date($match[1]);
$html .= ', ' . WT_Gedcom_Tag::getLabel('STAT:DATE') . ': ' . $date->Display(false);
}
}
}
return $html;
}
开发者ID:brambravo,项目名称:webtrees,代码行数:73,代码来源:functions_print.php
示例6: adminPlaces
private function adminPlaces()
{
require WT_ROOT . 'includes/functions/functions_edit.php';
$action = WT_Filter::get('action');
$parent = WT_Filter::get('parent');
$inactive = WT_Filter::getBool('inactive');
$deleteRecord = WT_Filter::get('deleteRecord');
if (!isset($parent)) {
$parent = 0;
}
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin());
if ($action == 'ExportFile' && Auth::isAdmin()) {
Zend_Session::writeClose();
$tmp = $this->placeIdToHierarchy($parent);
$maxLevel = $this->getHighestLevel();
if ($maxLevel > 8) {
$maxLevel = 8;
}
$tmp[0] = 'places';
$outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv';
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
if ($maxLevel > 0) {
echo '"', WT_I18N::translate('State'), '";';
}
if ($maxLevel > 1) {
echo '"', WT_I18N::translate('County'), '";';
}
if ($maxLevel > 2) {
echo '"', WT_I18N::translate('City'), '";';
}
if ($maxLevel > 3) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 4) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 5) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 6) {
echo '"', WT_I18N::translate('Place'), '";';
}
if ($maxLevel > 7) {
echo '"', WT_I18N::translate('Place'), '";';
}
echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
$this->outputLevel($parent);
exit;
}
$controller->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader();
?>
<table id="gm_config">
<tr>
<th>
<a href="module.php?mod=googlemap&mod_action=admin_config">
<?php
echo WT_I18N::translate('Google Maps™ preferences');
?>
</a>
</th>
<th>
<a class="current" href="module.php?mod=googlemap&mod_action=admin_places">
<?php
echo WT_I18N::translate('Geographic data');
?>
</a>
</th>
<th>
<a href="module.php?mod=googlemap&mod_action=admin_placecheck">
<?php
echo WT_I18N::translate('Place check');
?>
</a>
</th>
</tr>
</table>
<?php
if ($action == 'ImportGedcom') {
$placelist = array();
$j = 0;
$gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array(WT_GED_ID, WT_GED_ID))->fetchOneColumn();
foreach ($gedcom_records as $gedrec) {
$i = 1;
$placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
while (!empty($placerec)) {
if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
$placelist[$j] = array();
$placelist[$j]['place'] = trim($match[1]);
if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
$placelist[$j]['lati'] = trim($match[1]);
if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
if ($placelist[$j]['lati'] < 0) {
$placelist[$j]['lati'][0] = 'S';
} else {
$placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
}
//.........这里部分代码省略.........
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:module.php
示例7: print_indi_form
//.........这里部分代码省略.........
}
$bdm = "BD";
if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
foreach ($matches[1] as $match) {
if (!in_array($match, explode('|', PGV_EVENTS_DEAT))) {
addSimpleTags($match);
}
}
}
//-- if adding a spouse add the option to add a marriage fact to the new family
if ($nextaction == 'addspouseaction' || $nextaction == 'addnewparentaction' && $famid != 'new') {
$bdm .= "M";
if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) {
foreach ($matches[1] as $match) {
addSimpleTags($match);
}
}
}
if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
foreach ($matches[1] as $match) {
if (in_array($match, explode('|', PGV_EVENTS_DEAT))) {
addSimpleTags($match);
}
}
}
}
if (PGV_USER_IS_ADMIN) {
echo "<tr><td class=\"descriptionbox " . $TEXT_DIRECTION . " wrap width25\">";
print_help_link("no_update_CHAN_help", "qm");
echo $pgv_lang["admin_override"] . "</td><td class=\"optionbox wrap\">\n";
echo "<input type=\"checkbox\" name=\"preserve_last_changed\" />\n";
echo $pgv_lang["no_update_CHAN"] . "<br />\n";
if (isset($famrec)) {
$event = new Event(get_sub_record(1, "1 CHAN", $famrec));
echo format_fact_date($event, false, true);
}
echo "</td></tr>\n";
}
echo "</table>\n";
if ($nextaction == 'update') {
// GEDCOM 5.5.1 spec says NAME doesn't get a OBJE
print_add_layer('SOUR');
print_add_layer('NOTE');
print_add_layer('SHARED_NOTE');
} else {
print_add_layer('SOUR', 1);
print_add_layer('NOTE', 1);
print_add_layer('SHARED_NOTE', 1);
print_add_layer('OBJE', 1);
}
echo "<input type=\"submit\" value=\"" . $pgv_lang["save"] . "\" />\n";
if (preg_match('/^add(child|spouse|newparent|source)/', $nextaction)) {
echo "<input type=\"submit\" value=\"{$pgv_lang['saveandgo']}\" onclick=\"document.addchildform.goto.value='new';\"/>\n";
}
echo "</form>\n";
?>
<script type="text/javascript">
<!--
function trim(str) {
// Commas are used in the GIVN and SURN field to separate lists of surnames.
// For example, to differentiate the two Spanish surnames from an English
// double-barred name.
// Commas *may* be used in the NAME field, and will form part of the displayed
// name. This is not encouraged, as it may confuse some logic that assumes
// "list" format names are always "surn, givn".
str=str.replace(/,/g," ");
开发者ID:bitweaver,项目名称:phpgedview,代码行数:67,代码来源:functions_edit.php
示例8: print_descendency
function print_descendency($pid, $count)
{
global $show_spouse, $dgenerations, $bwidth, $bheight, $bhalfheight;
global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $generations, $box_width, $view, $show_full, $pgv_lang;
if ($count >= $dgenerations) {
return 0;
}
print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
print "<tr>";
print "<td width=\"" . ($bwidth - 2) . "\">\n";
$numkids = 0;
$famids = find_sfamily_ids($pid);
if (count($famids) > 0) {
$firstkids = 0;
foreach ($famids as $indexval => $famid) {
$famrec = find_family_record($famid, PGV_GED_ID);
$ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER);
if ($ct > 0) {
print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
for ($i = 0; $i < $ct; $i++) {
$rowspan = 2;
if ($i > 0 && $i < $ct - 1) {
$rowspan = 1;
}
$chil = trim($match[$i][1]);
print "<tr><td rowspan=\"{$rowspan}\" width=\"{$bwidth}\" style=\"padding-top: 2px;\">\n";
if ($count < $dgenerations - 1) {
$kids = print_descendency($chil, $count + 1);
if ($i == 0) {
$firstkids = $kids;
}
$numkids += $kids;
} else {
print_pedigree_person($chil);
$numkids++;
}
print "</td>\n";
$twidth = 7;
if ($ct == 1) {
$twidth += 3;
}
print "<td rowspan=\"{$rowspan}\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" width=\"{$twidth}\" height=\"3\" alt=\"\" /></td>\n";
if ($ct > 1) {
if ($i == 0) {
print "<td height=\"" . ($bhalfheight + 3) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td></tr>\n";
print "<tr><td height=\"" . ($bhalfheight + 3) . "\" style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>\n";
} else {
if ($i == $ct - 1) {
print "<td height=\"" . ($bhalfheight + 4) . "\" style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td></tr>\n";
print "<tr><td height=\"" . ($bhalfheight + 4) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>\n";
} 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>\n";
}
}
}
print "</tr>\n";
}
print "</table>\n";
}
}
print "</td>\n";
print "<td width=\"{$bwidth}\">\n";
}
// NOTE: If statement OK
if ($numkids == 0) {
$numkids = 1;
$tbwidth = $bwidth + 16;
for ($j = $count; $j < $dgenerations; $j++) {
print "</td>\n<td width=\"{$bwidth}\">\n";
}
}
//-- add offset divs to make things line up better
if ($show_spouse) {
foreach ($famids as $indexval => $famid) {
$famrec = find_family_record($famid, PGV_GED_ID);
if (!empty($famrec)) {
$marrec = get_sub_record(1, "1 MARR", $famrec);
if (!empty($marrec)) {
print "<br />";
}
print "<div style=\"height: " . $bheight . "px; width: " . $bwidth . "px;\"><br /></div>\n";
}
}
}
print_pedigree_person($pid);
// NOTE: If statement OK
if ($show_spouse) {
foreach ($famids as $indexval => $famid) {
$famrec = find_family_record($famid, PGV_GED_ID);
if (!empty($famrec)) {
$parents = find_parents_in_record($famrec);
$marrec = get_sub_record(1, "1 MARR", $famrec);
if (!empty($marrec)) {
print "<br />";
$marriage = new Event($marrec);
$marriage->print_simple_fact();
}
if ($parents["HUSB"] != $pid) {
print_pedigree_person($parents["HUSB"]);
} else {
//.........这里部分代码省略.........
开发者ID:rathervague,项目名称:phpgedview,代码行数:101,代码来源:familybook.php
示例9: print_help_link
</tr></table>
</div>
</td>
</tr>
<?php
if (PGV_USER_IS_ADMIN) {
echo "<tr><td class=\"descriptionbox ", $TEXT_DIRECTION, " wrap width25\">";
print_help_link("no_update_CHAN_help", "qm", "no_update_CHAN");
echo $pgv_lang["admin_override"], "</td><td class=\"optionbox wrap\">\n";
if ($NO_UPDATE_CHAN) {
echo "<input type=\"checkbox\" checked=\"checked\" name=\"preserve_last_changed\" />\n";
} else {
echo "<input type=\"checkbox\" name=\"preserve_last_changed\" />\n";
}
echo $pgv_lang["no_update_CHAN"], "<br />\n";
$event = new Event(get_sub_record(1, "1 CHAN", ""));
echo format_fact_date($event, false, true);
echo "</td></tr>\n";
}
?>
</table>
<br />
<input type="submit" value="<?php
echo $pgv_lang["label_add_remote_link"];
?>
" id="btnSubmit" name="btnSubmit" />
</form>
<?php
echo PGV_JS_START, 'swapComponents("', $controller->form_location, '");', PGV_JS_END;
}
// autoclose window when update successful
开发者ID:rathervague,项目名称:phpgedview,代码行数:31,代码来源:addremotelink.php
示例10: autocomplete_FAM_SOUR_PAGE
/**
* returns FAM:SOUR:PAGE matching filter
* @return Array of string
*/
function autocomplete_FAM_SOUR_PAGE($FILTER, $OPTION)
{
$rows = get_autocomplete_FAM_SOUR_PAGE($FILTER, $OPTION);
$data = array();
foreach ($rows as $row) {
$family = Family::getInstance($row);
if ($family->canDisplayDetails()) {
// a single FAM may have multiple level 1 and level 2 sources
for ($level = 1; $level <= 2; $level++) {
$i = 1;
do {
$srec = get_sub_record("SOUR @{$OPTION}@", $level, $family->gedrec, $i++);
$page = get_gedcom_value("PAGE", $level + 1, $srec);
if (stripos($page, $FILTER) !== false || empty($FILTER)) {
$data[] = $page;
}
} while ($srec);
}
}
}
return $data;
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:26,代码来源:autocomplete.php
示例11: create_media
/**
* Creates a GrampsXML for a media, if that media exists in the given GEDCOM record
* @param $mediaRec - The GEDCOM record of the media
* @param $mediaID - The id of the media
* @param $level - The level on which the media can be found, the default is 1
* @return GrampsXML for the recrord
*/
function create_media($mediaRec, $mediaID, $level = 1)
{
global $file, $eRoot;
if (!isset($this->dom)) {
$this->dom = new DomDocument("1.0", "UTF-8");
$this->dom->formatOutput = true;
$eRoot = $this->dom->createElementNS("http://gramps-project.org/xml/1.1.0/", "database");
$eRoot = $this->dom->appendChild($eRoot);
}
$object = $this->dom->createElement("object");
/*primary object elements and attributes*/
$object->setAttribute("id", $mediaID);
$object->setAttribute("handle", $mediaID);
$object->setAttribute("change", time());
/*elements and attributes of the object element*/
/*File elements*/
$file_ = get_gedcom_value("FILE", 1, $mediaRec);
$fileNode = $this->dom->createElement("file");
/*Source*/
$src = $this->dom->createAttribute("src");
$srcData = $this->dom->createTextNode($file_);
$srcData = $src->appendChild($srcData);
$src = $fileNode->appendChild($src);
/*MIME*/
$mime_ = get_gedcom_value("FORM", 1, $mediaRec);
$mime = $this->dom->createAttribute("mime");
if (empty($mime_)) {
$path = pathinfo($file_);
if (!isset($path["extension"])) {
$mime_ = "unknown_file_extension";
} else {
$mime_ = $path["extension"];
}
}
$mimeData = $this->dom->createTextNode($mime_);
$mimeData = $mime->appendChild($mimeData);
$mime = $fileNode->appendChild($mime);
/*DESCRIPTION*/
$description_ = get_gedcom_value("TITL", 1, $mediaRec);
$description = $this->dom->createAttribute("description");
$descriptionData = $this->dom->createTextNode($description_);
$descriptionData = $description->appendChild($descriptionData);
$description = $fileNode->appendChild($description);
/*fileNode elements*/
$fileNode = $object->appendChild($fileNode);
$fileNode = $this->dom->createElement("file");
if (($note = get_sub_record(1, "1 NOTE", $mediaRec)) != null) {
$this->create_note($object, $note, 1);
}
$num = 1;
while (($nameSource = get_sub_record($level, $level . " SOUR", $mediaRec, $num)) != null) {
$this->create_sourceref($object, $nameSource, 1);
$num++;
}
$eRoot->appendChild($object);
return $this->dom->saveXML();
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:64,代码来源:class_gewebservice.php
示例12: create_lds_event
/**
* Creates the lds_ord element and appends the correct information depending
* on the type of lds_ord (Endowment, Sealing, Baptism). If there is a sealing,
* the function will search if the family is in the clippings cart and if the
* family is created or not. If the family is not created yet, it will be created
* and added to the DOMDocument
*
* @param $indirec - The full INDI GEDCOM record of the person the lds_ord is being created
* @param $eventName - the name of the LDS event (Baptism, Sealing, Endowment, etc...)
* @param $eventABV - the event abbreviation in the GEDCOM (ie. SLGC, BAPL, ENDL)
* @param $eParent - The parent element the lds event is attached to
*/
function create_lds_event($indirec, $eventName, $eventABV, $eParent)
{
global $ePerson, $TEMPLE_CODES, $clipping;
if (($hasldsevent = get_sub_record(1, "1 " . $eventABV, $indirec)) != null) {
// Create <lds_ord> and attaches the type attribute
$eLdsEvent = $this->dom->createElement("lds_ord");
$eLdsEvent->setAttribute("type", $eventName);
if (($dateRec = get_sub_record(1, "2 DATE", $hasldsevent)) != null) {
$this->create_date($eLdsEvent, $dateRec, 2);
}
// Create <temple>, this element is common with all lds ords
if (($temple = get_gedcom_value($eventABV . ":TEMP", 1, $indirec)) != null) {
$eTemple = $this->dom->createElement("temple");
$eTemple->setAttribute("val", $temple);
$eTemple = $eLdsEvent->appendChild($eTemple);
}
if (($place = get_gedcom_value($eventABV . ":PLAC", 1, $indirec)) != null) {
$hlink = $this->query_dom("./places/placeobj[@title=\"{$place}\"]/@handle");
if ($hlink == null) {
$hlink = $this->generateHandle();
$this->create_placeobj($place, $hlink);
$this->create_place($eLdsEvent, $hlink);
} else {
$this->create_place($eLdsEvent, $hlink);
}
}
// Check to see if the STAT of the ordinance is set and add it to the
// <lds_ord> element
if (($stat = get_gedcom_value($eventABV . ":STAT", 1, $indirec)) != null) {
$eStatus = $this->dom->createElement("status");
$stat = get_gedcom_value($eventABV . ":STAT", 1, $indirec);
$eStatus->setAttribute("val", isset($stat));
$eStatus = $eLdsEvent->appendChild($eStatus);
}
// If the event is a sealing
if ($eventABV == "SLGC") {
// Create an instance of person and look for their family record
$person = Person::getInstance($clipping["id"]);
$famId = $person->getChildFamilyIds();
$famrec = find_family_record($famId[0]);
$fid = $famId[0];
$handle = $this->query_dom("./families/family[@id=\"{$fid}\"]/@handle");
if ($handle == null) {
/*
* If the family does not exist and their ID is in the clippings cart,
* you must create the family before you can query them in the dom to get
* their hlink. The hlink is generated when the person element is created.
* This causes overhead creating objects that are never added to the XML file
* perhaps there is some other way this can be done reducing the overhead?
*
*/
$this->create_family($famrec, $famId[0]);
$handle = $this->query_dom("./families/family[@id=\"{$fid}\"]/@handle");
$eFam = $this->dom->createElement("sealed_to");
$eFam->setAttribute("hlink", $handle);
$eFam = $eLdsEvent->appendChild($eFam);
$person = null;
} else {
if ($handle != null) {
$eFam = $this->dom->createElement("sealed_to");
$eFam->setAttribute("hlink", $handle);
$eFam = $eLdsEvent->appendChild($eFam);
$person = null;
}
}
}
if (($note = get_sub_record(1, "2 NOTE", $hasldsevent)) != null) {
$this->create_note($eLdsEvent, $note, 2);
}
$num = 1;
while (($sourcerefRec = get_sub_record(2, "2 SOUR", $hasldsevent, $num)) != null) {
$this->create_sourceref($eLdsEvent, $sourcerefRec, 2);
$num++;
}
$eLdsEvent = $eParent->appendChild($eLdsEvent);
}
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:89,代码来源:class_gedownloadgedcom.php
示例13: _statsPlaces
function _statsPlaces($what = 'ALL', $fact = false, $parent = 0, $country = false)
{
global $TBLPREFIX, $gBitDb;
if ($fact) {
if ($what == 'INDI') {
$rows = $gBitDb->query("SELECT i_gedcom AS ged FROM {$TBLPREFIX}individuals WHERE i_file=?", array($this->_ged_id));
} else {
if ($what == 'FAM') {
$rows = $gBitDb->query("SELECT f_gedcom AS ged FROM {$TBLPREFIX}families WHERE f_file=?", array($this->_ged_id));
}
}
$placelist = array();
while ($row = $roes->fetchRow()) {
$factrec = trim(get_sub_record(1, "1 {$fact}", $row[ged], 1));
if (!empty($factrec) && preg_match("/2 PLAC (.+)/", $factrec, $match)) {
if ($country) {
$place = getPlaceCountry(trim($match[1]));
} else {
$place = trim($match[1]);
}
if (!isset($placelist[$place])) {
$placelist[$place] = 1;
} else {
$placelist[$place]++;
}
}
}
return $placelist;
} else {
if ($parent > 0) {
if ($what == 'INDI') {
$join = " JOIN {$TBLPREFIX}individuals ON pl_file = i_file AND pl_gid = i_id";
} else {
if ($what == 'FAM') {
$join = " JOIN {$TBLPREFIX}families ON pl_file = f_file AND pl_gid = f_id";
} else {
$join = "";
}
}
$rows = self::_runSQL('' . ' SELECT' . ' p_place AS place,' . ' COUNT(*)' . ' FROM' . " {$TBLPREFIX}places" . " JOIN {$TBLPREFIX}placelinks ON pl_file=p_file AND p_id=pl_p_id" . $join . ' WHERE' . " p_id={$parent} AND" . " p_file={$this->_ged_id}" . ' GROUP BY place');
if (!isset($rows[0])) {
return '';
}
return $rows;
} else {
if ($what == 'INDI') {
$join = " JOIN {$TBLPREFIX}individuals ON pl_file = i_file AND pl_gid = i_id";
} else {
if ($what == 'FAM') {
$join = " JOIN {$TBLPREFIX}families ON pl_file = f_file AND pl_gid = f_id";
} else {
$join = "";
}
}
$rows = self::_runSQL('' . ' SELECT' . ' p_place AS country,' . ' COUNT(*) AS tot' . ' FROM' . " {$TBLPREFIX}places" . " JOIN {$TBLPREFIX}placelinks ON pl_file=p_file AND p_id=pl_p_id" . $join . ' WHERE' . " p_file={$this->_ged_id}" . " AND p_parent_id='0'" . ' GROUP BY country ORDER BY tot DESC, country ASC');
if (!isset($rows[0])) {
return '';
}
return $rows;
}
}
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:62,代码来源:class_stats.php
示例14: subrecord_createobjectref
/**
* parse out specific subrecords (NOTE, _PRIM, _THUM) from a given OBJE record
*
* @author Joseph King
* @param string $objrec the OBJE record to retrieve the subrecords from
* @param int $objlevel the level of the OBJE record
* @param string $m_media that media id of the OBJE record
* @return string containing NOTE, _PRIM, and _THUM subrecords parsed from the passed object record
*/
function subrecord_createobjectref($objrec, $objlevel, $m_media)
{
//- level of subrecords is object record level + 1
$level = $objlevel + 1;
//- get and concatenate NOTE subrecords
$n = 1;
$nt = "";
$note = "";
do {
$nt = get_sub_record($level, $level . " NOTE", $objrec, $n);
if ($nt != "") {
$note = $note . trim($nt) . "\n";
}
$n++;
} while ($nt != "");
//- get and concatenate PRIM subrecords
$n = 1;
$pm = "";
$prim = "";
do {
$pm = get_sub_record($level, $level . " _PRIM", $objrec, $n);
if ($pm != "") {
$prim = $prim . trim($pm) . "\n";
}
$n++;
} while ($pm != "");
//- get and concatenate THUM subrecords
$n = 1;
$tm = "";
$thum = "";
do {
$tm = get_sub_record($level, $level . " _THUM", $objrec, $n);
if ($tm != "") {
//- call image cropping function ($tm contains thum data)
$thum = $thum . trim($tm) . "\n";
}
$n++;
} while ($tm != "");
//- add object reference
$objmed = addslashes($objlevel . ' OBJE @' . $m_media . "@\n" . $note . $prim . $thum);
//- return the object media reference
return $objmed;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:52,代码来源:functions_import.php
示例15: autocomplete_FAM_SOUR_PAGE
/**
* returns FAM:SOUR:PAGE matching filter
* @return Array of string
*/
function autocomplete_FAM_SOUR_PAGE($FILTER, $OPTION)
{
global $TBLPREFIX, $gBitDb;
$sql = "SELECT 'FAM' AS type, f_id AS xref, f_file AS ged_id, f_gedcom AS gedrec, f_husb, f_wife, f_chil, f_numchil FROM {$TBLPREFIX}families WHERE f_gedcom LIKE ? AND f_file=?";
$rows = $gBitDb->query($sql, array("% SOUR @{$OPTION}@% PAGE %{$FILTER}%", PGV_GED_ID), PGV_AUTOCOMPLETE_LIMIT);
$data = array();
while ($row = $rows->fetchRows()) {
$family = Family::getInstance($row);
if ($family->canDisplayDetails()) {
// a single FAM may have multiple level 1 and level 2 sources
for ($level = 1; $level <= 2; $level++) {
$i = 1;
do {
$srec = get_sub_record("SOUR @{$OPTION}@", $level, $family->gedrec, $i++);
$page = get_gedcom_value("PAGE", $level + 1, $srec);
if (stripos($page, $FILTER) !== false || empty($FILTER)) {
$data[] = $page;
}
} while ($srec);
}
}
}
return $data;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:28,代码来源:autocomplete.php
示例16: get_gedcom_value
/**
* get gedcom tag value
*
* @param string $tag The tag to find, use : to delineate subtags
* @param int $level The gedcom line level of the first tag to
|
请发表评论