示例#1
1
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('TITL');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
         }
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
示例#2
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-fam');
     if (Auth::isEditor($this->record->getTree())) {
         // edit_fam / members
         $menu->addSubmenu(new Menu(I18N::translate('Change family members'), '#', 'menu-fam-change', array('onclick' => 'return change_family_members("' . $this->record->getXref() . '");')));
         // edit_fam / add child
         $menu->addSubmenu(new Menu(I18N::translate('Add a child to this family'), '#', 'menu-fam-addchil', array('onclick' => 'return add_child_to_family("' . $this->record->getXref() . '", "U");')));
         // edit_fam / reorder_children
         if ($this->record->getNumberOfChildren() > 1) {
             $menu->addSubmenu(new Menu(I18N::translate('Re-order children'), '#', 'menu-fam-orderchil', array('onclick' => 'return reorder_children("' . $this->record->getXref() . '");')));
         }
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-fam-del', array('onclick' => 'return delete_record("' . I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-fam-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
示例#3
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_note("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-note-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
示例#4
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('NAME');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "NAME");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-repo-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-repo-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-repo-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite" ,{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     return $menu;
 }
示例#6
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-fam');
     if (Auth::isEditor($this->record->getTree())) {
         // edit_fam / members
         $menu->addSubmenu(new Menu(I18N::translate('Change family members'), '#', 'menu-fam-change', array('onclick' => 'return change_family_members("' . $this->record->getXref() . '");')));
         // edit_fam / add child
         $menu->addSubmenu(new Menu(I18N::translate('Add a child to this family'), '#', 'menu-fam-addchil', array('onclick' => 'return add_child_to_family("' . $this->record->getXref() . '", "U");')));
         // edit_fam / reorder_children
         if ($this->record->getNumberOfChildren() > 1) {
             $menu->addSubmenu(new Menu(I18N::translate('Re-order children'), '#', 'menu-fam-orderchil', array('onclick' => 'return reorder_children("' . $this->record->getXref() . '");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-fam-del', array('onclick' => 'return delete_family("' . I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place.  Are you sure you want to delete this family?') . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-fam-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-fam-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
示例#7
0
 /**
  * Add markup to an item in the secondary menu.
  *
  * @param Menu $menu
  *
  * @return string
  */
 protected function formatSecondaryMenuItem(Menu $menu)
 {
     return $menu->getMenuAsList();
 }
示例#8
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('TITL');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-sour-addfav', array('onlick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
示例#9
0
 /**
  * Create a menu of palette options
  *
  * @return Menu
  */
 protected function menuPalette()
 {
     if ($this->tree && Site::getPreference('ALLOW_USER_THEMES') && $this->tree->getPreference('ALLOW_THEME_DROPDOWN')) {
         $menu = new Menu(I18N::translate('Palette'), '#', 'menu-color');
         foreach ($this->palettes as $palette_id => $palette_name) {
             $menu->addSubmenu(new Menu($palette_name, Functions::getQueryUrl(array('themecolor' => $palette_id), '&'), 'menu-color-' . $palette_id . ($this->palette === $palette_id ? ' active' : '')));
         }
         return $menu;
     } else {
         return null;
     }
 }
示例#10
0
    /**
     * Create a family on the census navigator.
     *
     * @param CensusInterface $census
     * @param Family          $family
     * @param Individual      $head
     *
     * @return string
     */
    public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head)
    {
        $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>';
        foreach ($family->getSpouses() as $spouse) {
            $menu = new Menu(Functions::getCloseRelationshipName($head, $spouse));
            foreach ($spouse->getChildFamilies() as $grandparents) {
                foreach ($grandparents->getSpouses() as $grandparent) {
                    $submenu = new Menu(Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");'));
                    $submenu->addClass('submenuitem', '');
                    $menu->addSubmenu($submenu);
                    $menu->addClass('', 'submenu');
                }
            }
            ?>
			<tr>
				<td class="optionbox">
					<?php 
            echo $menu->getMenu();
            ?>
				</td>
				<td class="facts_value nowrap">
					<a href="#" onclick="return appendCensusRow('<?php 
            echo Filter::escapeJs(self::censusTableRow($census, $spouse, $head));
            ?>
');">
						<?php 
            echo $spouse->getFullName();
            ?>
					</a>
				</td>
				<td class="facts_value">
					<?php 
            if ($head !== $spouse) {
                ?>
						<a href="edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=<?php 
                echo $spouse->getXref();
                ?>
&amp;gedcom=<?php 
                echo $spouse->getTree()->getNameUrl();
                ?>
&amp;census=<?php 
                echo get_class($census);
                ?>
">
							<?php 
                echo $headImg2;
                ?>
						</a>
					<?php 
            }
            ?>
				</td>
			</tr>
			<?php 
        }
        foreach ($family->getChildren() as $child) {
            $menu = new Menu(Functions::getCloseRelationshipName($head, $child));
            foreach ($child->getSpouseFamilies() as $spouse_family) {
                foreach ($spouse_family->getSpouses() as $spouse_family_spouse) {
                    if ($spouse_family_spouse != $child) {
                        $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");'));
                        $submenu->addClass('submenuitem', '');
                        $menu->addSubmenu($submenu);
                        $menu->addClass('', 'submenu');
                    }
                }
                foreach ($spouse_family->getChildren() as $spouse_family_child) {
                    $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");'));
                    $submenu->addClass('submenuitem', '');
                    $menu->addSubmenu($submenu);
                    $menu->addClass('', 'submenu');
                }
            }
            ?>
			<tr>
				<td class="optionbox">
					<?php 
            echo $menu->getMenu();
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="return appendCensusRow('<?php 
            echo Filter::escapeJs(self::censusTableRow($census, $child, $head));
            ?>
');">
						<?php 
            echo $child->getFullName();
            ?>
					</a>
				</td>
				<td class="facts_value">
					<?php 
            if ($head !== $child) {
                ?>
						<a href="edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=<?php 
                echo $child->getXref();
                ?>
&amp;gedcom=<?php 
                echo $child->getTree()->getNameUrl();
                ?>
&amp;census=<?php 
                echo get_class($census);
                ?>
">
							<?php 
                echo $headImg2;
                ?>
						</a>
					<?php 
            }
            ?>
				</td>
			</tr>
			<?php 
        }
        echo '<tr><td><br></td></tr>';
    }
示例#11
0
 /**
  * A menu to show a list of available languages.
  *
  * @return Menu|null
  */
 protected function menuLanguages()
 {
     $menu = new Menu(I18N::translate('Language'), '#', 'menu-language');
     foreach (I18N::activeLocales() as $locale) {
         $language_tag = $locale->languageTag();
         $class = 'menu-language-' . $language_tag . (WT_LOCALE === $language_tag ? ' active' : '');
         $menu->addSubmenu(new Menu($locale->endonym(), '#', $class, array('onclick' => 'return false;', 'data-language' => $language_tag)));
     }
     if (count($menu->getSubmenus()) > 1) {
         return $menu;
     } else {
         return null;
     }
 }
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-record');
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-record-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-record-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
示例#13
0
 /**
  * Create a menu of palette options
  *
  * @return Menu
  */
 protected function menuPalette()
 {
     $menu = new Menu(I18N::translate('Palette'), '#', 'menu-color');
     foreach ($this->palettes as $palette_id => $palette_name) {
         $menu->addSubmenu(new Menu($palette_name, Functions::getQueryUrl(array('themecolor' => $palette_id), '&amp;'), 'menu-color-' . $palette_id . ($this->palette === $palette_id ? ' active' : '')));
     }
     return $menu;
 }
示例#14
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-indi');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Add a name'), '#', 'menu-indi-addname', array('onclick' => 'return add_name("' . $this->record->getXref() . '");')));
         $has_sex_record = false;
         foreach ($this->record->getFacts() as $fact) {
             if ($fact->getTag() === 'SEX' && $fact->canEdit()) {
                 $menu->addSubmenu(new Menu(I18N::translate('Edit the gender'), '#', 'menu-indi-editsex', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
                 $has_sex_record = true;
                 break;
             }
         }
         if (!$has_sex_record) {
             $menu->addSubmenu(new Menu(I18N::translate('Edit the gender'), '#', 'menu-indi-editsex', array('onclick' => 'return add_new_record("' . $this->record->getXref() . '", "SEX");')));
         }
         if (count($this->record->getSpouseFamilies()) > 1) {
             $menu->addSubmenu(new Menu(I18N::translate('Re-order families'), '#', 'menu-indi-orderfam', array('onclick' => 'return reorder_families("' . $this->record->getXref() . '");')));
         }
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-indi-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-indi-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
示例#15
0
 public function getMenu()
 {
     global $controller, $WT_TREE;
     $args = array();
     $args['block_order'] = 0;
     $args['module_name'] = $this->getName();
     $block_id = webtrees\Filter::get('block_id');
     $default_block = webtrees\Database::prepare("SELECT block_id FROM `##block` WHERE block_order=:block_order AND module_name=:module_name")->execute($args)->fetchOne();
     if (webtrees\Auth::isSearchEngine()) {
         return null;
     }
     if (file_exists(WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/')) {
         echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/style.css" type="text/css">';
     } else {
         echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/webtrees/style.css" type="text/css">';
     }
     //-- main PAGES menu item
     $menu = new webtrees\Menu($this->getMenuTitle(), 'module.php?mod=' . $this->getName() . '&amp;mod_action=show&amp;pages_id=' . $default_block, $this->getName());
     $menu->addClass('menuitem', 'menuitem_hover', '');
     foreach ($this->getMenupagesList() as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) {
             $path = 'module.php?mod=' . $this->getName() . '&amp;mod_action=show&amp;pages_id=' . $items->block_id;
             $submenu = new webtrees\Menu(webtrees\I18N::translate($items->pages_title), $path, $this->getName() . '-' . $items->block_id);
             $menu->addSubmenu($submenu);
         }
     }
     if (webtrees\Auth::isAdmin()) {
         $submenu = new webtrees\Menu(webtrees\I18N::translate('Edit pages'), $this->getConfigLink(), $this->getName() . '-edit');
         $menu->addSubmenu($submenu);
     }
     return $menu;
 }
示例#16
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-indi', array('onclick' => 'return false;'));
     // What behaviour shall we give the main menu?  If we leave it blank, the framework
     // will copy the first submenu - which may be edit-raw or delete.
     // As a temporary solution, make it edit the name
     if (Auth::isEditor($this->record->getTree())) {
         foreach ($this->record->getFacts() as $fact) {
             if ($fact->getTag() === 'NAME' && $fact->canEdit()) {
                 $menu->setAttrs(array('onclick' => 'return edit_name("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");'));
                 break;
             }
         }
         $menu->addSubmenu(new Menu(I18N::translate('Add a new name'), '#', 'menu-indi-addname', array('onclick' => 'return add_name("' . $this->record->getXref() . '");')));
         $has_sex_record = false;
         foreach ($this->record->getFacts() as $fact) {
             if ($fact->getTag() === 'SEX' && $fact->canEdit()) {
                 $menu->addSubmenu(new Menu(I18N::translate('Edit gender'), '#', 'menu-indi-editsex', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
                 $has_sex_record = true;
                 break;
             }
         }
         if (!$has_sex_record) {
             $menu->addSubmenu(new Menu(I18N::translate('Edit gender'), '#', 'menu-indi-editsex', array('return add_new_record("' . $this->record->getXref() . '", "SEX");')));
         }
         if (count($this->record->getSpouseFamilies()) > 1) {
             $menu->addSubmenu(new Menu(I18N::translate('Re-order families'), '#', 'menu-indi-orderfam', array('onclick' => 'return reorder_families("' . $this->record->getXref() . '");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-indi-del', array('onclick' => 'return delete_individual("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-indi-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-indi-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     return $menu;
 }
示例#17
0
 protected function menuMedia()
 {
     $resns = $this->tree->getFactPrivacy();
     if (isset($resns['OBJE'])) {
         $resn = $resns['OBJE'];
     } else {
         $resn = Auth::PRIV_PRIVATE;
     }
     if ($resn >= Auth::accessLevel($this->tree)) {
         $MEDIA_DIRECTORY = $this->tree->getPreference('MEDIA_DIRECTORY');
         $folders = $this->themeOption('mediafolders');
         $show_subfolders = $this->themeOption('show_subfolders') ? '&amp;subdirs=on' : '';
         if (count($folders) > 1) {
             $menu = new Menu(I18N::translate('Media'), '', 'menu-media');
             $submenu = new Menu(I18N::translate('Media'), 'medialist.php?' . $this->tree_url . '&amp;action=filter&amp;search=no&amp;folder=&amp;sortby=title' . $show_subfolders . '&amp;max=20&amp;columns=2&amp;action=submit', 'menu-media-all');
             $menu->addSubmenu($submenu);
             // divider
             $divider = new Menu('', '#', 'menu-media-divider divider');
             $menu->addSubmenu($divider);
             foreach ($folders as $key => $folder) {
                 if ($key !== $MEDIA_DIRECTORY) {
                     $submenu = new Menu(ucfirst($folder), 'medialist.php?' . $this->tree_url . '&amp;action=filter&amp;search=no&amp;folder=' . Filter::escapeUrl($key) . '&amp;sortby=title' . $show_subfolders . '&amp;max=20&amp;columns=2&amp;action=submit', 'menu-media-' . preg_replace('/[^A-Za-z0-9\\. -]/', '', str_replace(" ", "-", $folder)));
                     $menu->addSubmenu($submenu);
                 }
             }
         } else {
             // fallback if we don't have any subfolders added to the list
             $menu = new Menu(I18N::translate('Media'), 'medialist.php?' . $this->tree_url . '&amp;sortby=title&amp;max=20&amp;columns=2&amp;action=submit', 'menu-media');
         }
         return $menu;
     }
 }
示例#18
0
 /**
  * A menu, to be added to the main application menu.
  *
  * @return Menu|null
  */
 public function getMenu()
 {
     global $controller, $WT_TREE;
     //-- main clippings menu item
     $menu = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', array('rel' => 'nofollow'));
     if (isset($controller->record)) {
         $submenu = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippingscart', array('rel' => 'nofollow'));
         $menu->addSubmenu($submenu);
     }
     if (!empty($controller->record) && $controller->record->canShow()) {
         $submenu = new Menu(I18N::translate('Add to the clippings cart'), 'module.php?mod=clippings&amp;mod_action=index&amp;action=add&amp;id=' . $controller->record->getXref(), 'menu-clippingsadd', array('rel' => 'nofollow'));
         $menu->addSubmenu($submenu);
     }
     return $menu;
 }
示例#19
0
 /** {@inheritdoc} */
 public function getMenu()
 {
     global $controller;
     if (!Auth::isSearchEngine()) {
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
         static $menu;
         // Function has already run
         if ($menu !== null && count($menu->getSubmenus()) > 0) {
             return $menu;
         }
         $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
         if (!empty($FTV_SETTINGS)) {
             foreach ($FTV_SETTINGS as $FTV_ITEM) {
                 if ($FTV_ITEM['TREE'] == $this->tree_id && !empty($FTV_ITEM['PID']) && $FTV_ITEM['ACCESS_LEVEL'] >= Auth::accessLevel($this->tree)) {
                     $FTV_GED_SETTINGS[] = $FTV_ITEM;
                 }
             }
             if (!empty($FTV_GED_SETTINGS)) {
                 if (Theme::theme()->themeId() !== '_administration') {
                     // load the module stylesheets
                     echo $this->module()->getStylesheet();
                     // add javascript files and scripts
                     $this->module()->includeJs($controller, 'menu');
                     if (WT_SCRIPT_NAME === 'individual.php') {
                         $this->module()->includeJs($controller, 'tab');
                     }
                 }
                 $tree_name = Filter::escapeUrl($this->tree->getName());
                 $menu = new Menu(I18N::translate('Family tree overview'), 'module.php?mod=' . $this->getName() . '&amp;mod_action=page&amp;rootid=' . $FTV_GED_SETTINGS[0]['PID'] . '&amp;ged=' . $tree_name, 'menu-fancy_treeview');
                 foreach ($FTV_GED_SETTINGS as $FTV_ITEM) {
                     $record = Individual::getInstance($FTV_ITEM['PID'], $this->tree);
                     if ($record && $record->canShowName()) {
                         if ($this->module()->options('use_fullname') == true) {
                             $submenu = new Menu(I18N::translate('Descendants of %s', $record->getFullName()), 'module.php?mod=' . $this->getName() . '&amp;mod_action=page&amp;rootid=' . $FTV_ITEM['PID'] . '&amp;ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
                         } else {
                             $submenu = new Menu(I18N::translate('Descendants of the %s family', $FTV_ITEM['SURNAME']), 'module.php?mod=' . $this->getName() . '&amp;mod_action=page&amp;rootid=' . $FTV_ITEM['PID'] . '&amp;ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
                         }
                         $menu->addSubmenu($submenu);
                     }
                 }
                 if (count($menu->getSubmenus()) > 0) {
                     return $menu;
                 }
             }
         }
     }
 }
示例#20
0
 public function getMenu()
 {
     global $controller, $WT_TREE;
     $menu_titles = $this->getMenuList();
     $lang = '';
     $min_block = webtrees\Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
     foreach ($menu_titles as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if (in_array(WT_LOCALE, explode(',', $languages))) {
             $lang = WT_LOCALE;
         } else {
             $lang = '';
         }
     }
     $default_block = webtrees\Database::prepare("SELECT ##block.block_id FROM `##block`, `##block_setting` WHERE block_order=? AND module_name=? AND ##block.block_id = ##block_setting.block_id AND ##block_setting.setting_value LIKE ?")->execute(array($min_block, $this->getName(), '%' . $lang . '%'))->fetchOne();
     $main_menu_address = webtrees\Database::prepare("SELECT setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?")->execute(array($default_block, 'menu_address'))->fetchOne();
     if (count($menu_titles) > 1) {
         $main_menu_title = $this->getMenuTitle();
     } else {
         $main_menu_title = webtrees\Database::prepare("SELECT setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?")->execute(array($default_block, 'menu_title'))->fetchOne();
     }
     if (webtrees\Auth::isSearchEngine()) {
         return null;
     }
     if (file_exists(WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/')) {
         echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/style.css" type="text/css">';
     } else {
         echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/webtrees/style.css" type="text/css">';
     }
     //-- main menu item
     $menu = new webtrees\Menu($main_menu_title, $main_menu_address, $this->getName());
     $menu->addClass('menuitem', 'menuitem_hover', '');
     foreach ($menu_titles as $items) {
         if (count($menu_titles) > 1) {
             $languages = $this->getBlockSetting($items->block_id, 'languages');
             if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->menu_access >= webtrees\Auth::accessLevel($WT_TREE)) {
                 $submenu = new webtrees\Menu(webtrees\I18N::translate($items->menu_title), $items->menu_address, $this->getName() . '-' . str_replace(' ', '', $items->menu_title));
                 $menu->addSubmenu($submenu);
             }
         }
     }
     if (webtrees\Auth::isAdmin()) {
         $submenu = new webtrees\Menu(webtrees\I18N::translate('Edit menus'), $this->getConfigLink(), $this->getName() . '-edit');
         $menu->addSubmenu($submenu);
     }
     return $menu;
 }
示例#21
0
 /**
  * Create the search menu
  *
  * @return Menu
  */
 protected function menuSearch()
 {
     //-- main search menu item
     $menu = new Menu(I18N::translate('Search'), '#', 'menu-search', array('rel' => 'nofollow'));
     //-- search_general sub menu
     $menu->addSubmenu(new Menu(I18N::translate('General search'), 'search.php?' . $this->tree_url, 'menu-search-general', array('rel' => 'nofollow')));
     //-- search_soundex sub menu
     $menu->addSubmenu(new Menu(I18N::translate('Phonetic search'), 'search.php?' . $this->tree_url . '&amp;action=soundex', 'menu-search-soundex', array('rel' => 'nofollow')));
     //-- advanced search
     $menu->addSubmenu(new Menu(I18N::translate('Advanced search'), 'search_advanced.php?' . $this->tree_url, 'menu-search-advanced', array('rel' => 'nofollow')));
     //-- search_replace sub menu
     if (Auth::isEditor($this->tree)) {
         $menu->addSubmenu(new Menu(I18N::translate('Search and replace'), 'search.php?' . $this->tree_url . '&amp;action=replace', 'menu-search-replace'));
     }
     return $menu;
 }
示例#22
0
 /**
  * Generate the HTML content of this tab.
  *
  * @return string
  */
 public function getTabContent()
 {
     global $WT_TREE, $controller;
     $html = '<div id="' . $this->getName() . '_content">';
     //Show Lightbox-Album header Links
     if (Auth::isEditor($WT_TREE)) {
         $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">';
         // Add a new media object
         if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
             $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_add.png" id="head_icon" class="icon" title="' . I18N::translate('Add a new media object') . '" alt="' . I18N::translate('Add a new media object') . '">';
             $html .= I18N::translate('Add a new media object');
             $html .= '</a></span>';
             // Link to an existing item
             $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_link.png" id="head_icon" class="icon" title="' . I18N::translate('Link to an existing media object') . '" alt="' . I18N::translate('Link to an existing media object') . '">';
             $html .= I18N::translate('Link to an existing media object');
             $html .= '</a></span>';
         }
         if (Auth::isManager($WT_TREE) && $this->getMedia()) {
             // Popup Reorder Media
             $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/images.png" id="head_icon" class="icon" title="' . I18N::translate('Re-order media') . '" alt="' . I18N::translate('Re-order media') . '">';
             $html .= I18N::translate('Re-order media');
             $html .= '</a></span>';
         }
         $html .= '</td></tr></table>';
     }
     // Used when sorting media on album tab page
     $html .= '<table class="facts_table"><tr><td class="facts_value">';
     // one-cell table - for presentation only
     $html .= '<ul class="album-list">';
     foreach ($this->getMedia() as $media) {
         //View Edit Menu ----------------------------------
         //Get media item Notes
         $haystack = $media->getGedcom();
         $needle = '1 NOTE';
         $before = substr($haystack, 0, strpos($haystack, $needle));
         $after = substr(strstr($haystack, $needle), strlen($needle));
         $notes = FunctionsPrint::printFactNotes($before . $needle . $after, 1, true);
         // Prepare Below Thumbnail  menu ----------------------------------------------------
         $menu = new Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>');
         $menu->addClass('', 'submenu');
         // View Notes
         if (strpos($media->getGedcom(), "\n1 NOTE")) {
             $submenu = new Menu(I18N::translate('View notes'), '#', '', array('onclick' => 'modalNotes("' . Filter::escapeJs($notes) . '","' . I18N::translate('View notes') . '"); return false;'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
         }
         //View Details
         $submenu = new Menu(I18N::translate('View details'), $media->getHtmlUrl());
         $submenu->addClass("submenuitem");
         $menu->addSubmenu($submenu);
         //View Sources
         foreach ($media->getFacts('SOUR') as $source_fact) {
             $source = $source_fact->getTarget();
             if ($source && $source->canShow()) {
                 $submenu = new Menu(I18N::translate('Source') . ' – ' . $source->getFullName(), $source->getHtmlUrl());
                 $submenu->addClass('submenuitem');
                 $menu->addSubmenu($submenu);
             }
         }
         if (Auth::isEditor($media->getTree())) {
             // Edit Media
             $submenu = new Menu(I18N::translate('Edit media'), '#', '', array('onclick' => 'return window.open("addmedia.php?action=editmedia&pid=' . $media->getXref() . '", "_blank", edit_window_specs);'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
             if (Auth::isAdmin()) {
                 if (Module::getModuleByName('GEDFact_assistant')) {
                     $submenu = new Menu(I18N::translate('Manage links'), '#', '', array('onclick' => 'return window.open("inverselink.php?mediaid=' . $media->getXref() . '&linkto=manage", "_blank", find_window_specs);'));
                     $submenu->addClass("submenuitem");
                     $menu->addSubmenu($submenu);
                 } else {
                     $submenu = new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","person");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","family");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","source");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                 }
                 $submenu = new Menu(I18N::translate('Unlink media'), '#', '', array('onclick' => 'return unlink_media("' . I18N::translate('Are you sure you want to remove links to this media object?') . '", "' . $controller->record->getXref() . '", "' . $media->getXref() . '");'));
                 $submenu->addClass("submenuitem");
                 $menu->addSubmenu($submenu);
             }
         }
         $html .= '<li class="album-list-item">';
         $html .= '<div class="album-image">' . $media->displayImage() . '</div>';
         $html .= '<div class="album-title">' . $menu->getMenu() . '</div>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</td></tr></table>';
     return $html;
 }
示例#23
0
                // Child’s Date of Death (Julian)
                $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod;
                array_push($chBLDarray, $chBLD);
            }
        }
        // Get Spouse child’s details
        $nam = $child->getAllNames();
        $fulln = strip_tags($nam[0]['full']);
        $fulmn = $fulln;
        foreach ($nam as $n) {
            if ($n['type'] === '_MARNM') {
                $fulmn = strip_tags($n['full']);
            }
        }
        $label = Functions::getCloseRelationshipName($person, $child);
        $menu = new Menu($label);
        print_pedigree_person_nav_cens($child->getXref(), $label, $censyear);
        $submenu = new Menu($spouselinks);
        $menu->addSubmenu($submenu);
        ?>
								<tr>
									<td align="left" class="linkcell optionbox">
										<?php 
        echo $menu->getMenu();
        ?>
									</td>
									<td align="left" class="facts_value">
										<?php 
        echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $child->getXref() . "&amp;gedcom=" . $child->getTree()->getNameUrl() . "\">";
        echo $headImg2;
        echo "</a>";
示例#24
0
 /**
  * Edit menu items used in media list
  *
  * @param Media $mediaobject
  *
  * @return string
  */
 public static function getMediaListMenu(Media $mediaobject)
 {
     $html = '';
     $menu = new Menu(I18N::translate('Edit details'), '#', 'lb-image_edit', array('onclick' => 'return window.open("addmedia.php?action=editmedia&pid=' . $mediaobject->getXref() . '", "_blank", edit_window_specs);'));
     $html .= '<ul class="makeMenu lb-menu">' . $menu->getMenuAsList() . '</ul>';
     $menu = new Menu(I18N::translate('Manage links'), '#', 'lb-image_link', array('onclick' => 'return false;'), array(new Menu(I18N::translate('Link this media object to an individual'), '#', '', array('onclick' => 'return ilinkitem("' . $mediaobject->getXref() . '","person");')), new Menu(I18N::translate('Link this media object to a family'), '#', '', array('onclick' => 'return ilinkitem("' . $mediaobject->getXref() . '","family");')), new Menu(I18N::translate('Link this media object to a source'), '#', '', array('onclick' => 'return ilinkitem("' . $mediaobject->getXref() . '","source");'))));
     $html .= '<ul class="makeMenu lb-menu">' . $menu->getMenuAsList() . '</ul>';
     $menu = new Menu(I18N::translate('View details'), $mediaobject->getHtmlUrl(), 'lb-image_view');
     $html .= '<ul class="makeMenu lb-menu">' . $menu->getMenuAsList() . '</ul>';
     return '<div class="lightbox-menu">' . $html . '</div>';
 }
    /**
     * Format a family.
     *
     * @param Family $family
     * @param string $title
     */
    private function drawFamily(Family $family, $title)
    {
        global $controller;
        ?>
		<tr>
			<td class="center" colspan="2">
				<a class="famnav_title" href="<?php 
        echo $family->getHtmlUrl();
        ?>
">
					<?php 
        echo $title;
        ?>
				</a>
			</td>
		</tr>
		<?php 
        foreach ($family->getSpouses() as $spouse) {
            $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $spouse));
            $menu->addClass('', 'submenu flyout');
            $menu->addSubmenu(new Menu($this->getParents($spouse)));
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo $menu->getMenu();
            ?>
				</td>
				<td class="center <?php 
            echo $controller->getPersonStyle($spouse);
            ?>
 nam">
					<a class="famnav_link" href="<?php 
            echo $spouse->getHtmlUrl();
            ?>
">
						<?php 
            echo $spouse->getFullName();
            ?>
					</a>
					<div class="font9">
						<?php 
            echo $spouse->getLifeSpan();
            ?>
					</div>
				</td>
			</tr>
		<?php 
        }
        foreach ($family->getChildren() as $child) {
            $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $child));
            $menu->addClass('', 'submenu flyout');
            $menu->addSubmenu(new Menu($this->getFamily($child)));
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo $menu->getMenu();
            ?>
				</td>
				<td class="center <?php 
            echo $controller->getPersonStyle($child);
            ?>
 nam">
					<a class="famnav_link" href="<?php 
            echo $child->getHtmlUrl();
            ?>
">
						<?php 
            echo $child->getFullName();
            ?>
					</a>
					<div class="font9">
						<?php 
            echo $child->getLifeSpan();
            ?>
					</div>
				</td>
			</tr>
		<?php 
        }
    }