/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-obje');
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Edit media object'), '#', 'menu-obje-edit');
$submenu->addOnclick("window.open('addmedia.php?action=editmedia&pid={$this->record->getXref()}', '_blank', edit_window_specs)");
$menu->addSubmenu($submenu);
// main link displayed on page
if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Manage links'), '#', 'menu-obje-link');
$submenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','manage');");
} else {
$submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', 'menu-obje-link');
$ssubmenu = new WT_Menu(WT_I18N::translate('To individual'), '#', 'menu-obje-link-indi');
$ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','person');");
$submenu->addSubMenu($ssubmenu);
$ssubmenu = new WT_Menu(WT_I18N::translate('To family'), '#', 'menu-obje-link-fam');
$ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','family');");
$submenu->addSubMenu($ssubmenu);
$ssubmenu = new WT_Menu(WT_I18N::translate('To source'), '#', 'menu-obje-link-sour');
$ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','source');");
$submenu->addSubMenu($ssubmenu);
}
$menu->addSubmenu($submenu);
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-obje-del');
$submenu->addOnclick("return delete_media('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// edit raw
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-obje-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-repo');
if (WT_USER_CAN_EDIT) {
$fact = $this->record->getFirstFact('NAME');
$submenu = new WT_Menu(WT_I18N::translate('Edit repository'), '#', 'menu-repo-edit');
if ($fact) {
// Edit existing name
$submenu->addOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');');
} else {
// Add new name
$submenu->addOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'NAME\');');
}
$menu->addSubmenu($submenu);
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del');
$submenu->addOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// edit raw
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-repo-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note');
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit');
$submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');');
$menu->addSubmenu($submenu);
}
// edit raw
/* Does not currently work - NOTE records do not contain nice level 1 facts
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-note-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
*/
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del');
$submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
break;
case 'style2':
default:
echo format_surname_table($surns, WT_SCRIPT_NAME);
break;
}
} else {
// Show the list
$count = 0;
foreach ($surns as $surnames) {
foreach ($surnames as $list) {
$count += count($list);
}
}
// Don't sublists short lists.
if ($count < get_gedcom_setting(WT_GED_ID, 'SUBLIST_TRIGGER_I')) {
$falpha = '';
$show_all_firstnames = 'no';
} else {
$givn_initials = WT_Query_Name::givenAlpha($surname, $alpha, $show_marnm, true, WT_GED_ID);
// Break long lists by initial letter of given name
if ($surname || $show_all == 'yes') {
// Don't show the list until we have some filter criteria
$show = $falpha || $show_all_firstnames == 'yes' ? 'indi' : 'none';
$list = array();
foreach ($givn_initials as $givn_initial => $count) {
switch ($givn_initial) {
case '@':
$html = $UNKNOWN_PN;
break;
default:
print "function helpPopup03(which) {";
print "location.href = 'editlang_edit_settings.php?' + which + '&new_shortcut=' + document.new_lang_form.new_shortcut.value;";
print "return false;";
print "}";
print PGV_JS_END;
// Create array with configured languages in gedcoms and users
$configuredlanguages = array();
// Read GEDCOMS configuration and collect language data
foreach (get_all_gedcoms() as $ged_id => $ged_name) {
require get_gedcom_setting($ged_id, 'config');
if (!isset($configuredlanguages["gedcom"][$LANGUAGE][$ged_name])) {
$configuredlanguages["gedcom"][$LANGUAGE][$ged_name] = true;
}
}
// Restore the current settings
require get_gedcom_setting(PGV_GED_ID, 'config');
// Read user configuration and collect language data
foreach (get_all_users() as $user_id => $user_name) {
if (!isset($configuredlanguages["users"][get_user_setting($user_id, 'language')][$user_id])) {
$configuredlanguages["users"][get_user_setting($user_id, 'language')][$user_id] = true;
}
}
// Sort the Language table into localized language name order
foreach ($pgv_language as $key => $value) {
$d_LangName = "lang_name_" . $key;
$Sorted_Langs[$key] = $pgv_lang[$d_LangName];
}
asort($Sorted_Langs);
// Split defined languages into active and inactive
$split_langs_active = array();
$split_langs_inactive = array();
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
echo '</div>';
// <div id="content">
if ($view != 'simple') {
echo '<div id="footer" class="', $TEXT_DIRECTION, '">';
echo '<br>';
echo contact_links();
echo '<br>';
echo '<p class="logo">';
echo '<a href="', WT_WEBTREES_URL, '" target="_blank" class="icon-webtrees" title="', WT_WEBTREES, ' ', WT_VERSION, '"></a>';
echo '</p>';
if (WT_DEBUG || get_gedcom_setting(WT_GED_ID, 'SHOW_STATS')) {
echo execution_stats();
}
if (exists_pending_change()) {
echo '<a href="#" onclick="window.open(\'edit_changes.php\', \'_blank\', chan_window_specs); return false;">';
echo '<p class="error center">', WT_I18N::translate('There are pending changes for you to moderate.'), '</p>';
echo '</a>';
}
echo '</div>';
// <div id="footer">
}
public function getSignificantIndividual()
{
static $individual;
// Only query the DB once.
if (!$individual && WT_USER_ROOT_ID) {
$individual = WT_Individual::getInstance(WT_USER_ROOT_ID);
}
if (!$individual && WT_USER_GEDCOM_ID) {
$individual = WT_Individual::getInstance(WT_USER_GEDCOM_ID);
}
if (!$individual) {
$individual = WT_Individual::getInstance(get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID'));
}
if (!$individual) {
$individual = WT_Individual::getInstance(WT_DB::prepare("SELECT MIN(i_id) FROM `##individuals` WHERE i_file=?")->execute(array(WT_GED_ID))->fetchOne());
}
if (!$individual) {
// always return a record
$individual = new WT_Individual('I', '0 @I@ INDI', null, WT_GED_ID);
}
return $individual;
}
请发表评论