i18n::translate('User Favorites'), 'type'=>'user', 'descr'=>i18n::translate('The User Favorites block shows the user a list of his favorite people in the database so that he can easily link to them.'), 'canconfig'=>false, 'config'=>array( 'cache'=>0 ) ); //-- print user favorites function print_user_favorites($block=true, $config="", $side, $index) { global $WT_IMAGE_DIR, $WT_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(WT_USER_NAME); if (!is_array($userfavs)) $userfavs = array(); $id="user_favorites"; $title = i18n::translate('My Favorites'); $title .= help_link('mygedview_favorites'); if ($TEXT_DIRECTION=="rtl") $title .= getRLM(); $title .= "(".count($userfavs).")"; if ($TEXT_DIRECTION=="rtl") $title .= getRLM(); if ($ENABLE_AUTOCOMPLETE) { $content = ' '; } 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 .= i18n::translate('You have not selected any favorites.

To add an individual, a family, or a source to your favorites, click on the Add a new favorite link to reveal some fields where you can enter or search for an ID number. Instead of an ID number, you can enter a URL and a title.'); } else { $mygedcom = $GEDCOM; $current_gedcom = $GEDCOM; $content .= ""; foreach($userfavs as $key=>$favorite) { if (isset($favorite["id"])) $key=$favorite["id"]; $removeFavourite = "".i18n::translate('Remove')."
"; $current_gedcom = $GEDCOM; $GEDCOM = $favorite["file"]; $content .= ""; $GEDCOM = $mygedcom; require $INDEX_DIRECTORY.$GEDCOM.'_conf.php'; } $content .= "
"; if ($favorite["type"]=="URL") { $content .= "
"; if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite; $content .= "".PrintReady($favorite["title"]).""; $content .= "
".PrintReady($favorite["note"]); } else { require $INDEX_DIRECTORY.$GEDCOM.'_conf.php'; $indirec = find_gedcom_record($favorite["gid"], WT_GED_ID); if ($favorite["type"]=="INDI") { $content .= "
"; if ($ctype=="user" || WT_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 .= "
"; if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite; if ($record) { $content.=$record->format_list('span'); } else { $content.=i18n::translate('No such ID exists in this GEDCOM file.'); } $content .= "
".PrintReady($favorite["note"]); } } $content .= "
"; $content .= "
"; } $content .= '
'; $uniqueID = floor(microtime() * 1000000); $content .= "\"\" ".i18n::translate('Add a new favorite').""; $content .= help_link('index_add_favorites'); $content .= "
"; $content .= "
"; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
".i18n::translate('Enter a Person, Family, or Source ID')."
"; $content .= ""; $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 .= "
".i18n::translate('OR
Enter a URL and a title'); $content .= ""; $content .= "
".i18n::translate('URL')."
".i18n::translate('Title:')."
"; if ($block) $content .= "\n

"; else $content .= "\n
"; $content .= i18n::translate('Enter an optional note about this favorite'); $content .= "
"; $content .= "
"; $content .= "
"; $content .= "
"; 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; } ?>