示例#1
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;
 }
示例#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-obje');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit media object'), '#', 'menu-obje-edit', array('onclick' => 'window.open("addmedia.php?action=editmedia&pid=' . $this->record->getXref() . '", "_blank", edit_window_specs)')));
         // main link displayed on page
         if (Module::getModuleByName('GEDFact_assistant')) {
             $menu->addSubmenu(new Menu(I18N::translate('Manage links'), '#', 'menu-obje-link', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","manage");')));
         } else {
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","person");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","family");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","source");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_media("' . 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-obje-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-obje-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;
 }
示例#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-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;
 }
示例#4
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;
     }
 }
示例#5
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() . '&mod_action=page&rootid=' . $FTV_GED_SETTINGS[0]['PID'] . '&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() . '&mod_action=page&rootid=' . $FTV_ITEM['PID'] . '&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() . '&mod_action=page&rootid=' . $FTV_ITEM['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
                         }
                         $menu->addSubmenu($submenu);
                     }
                 }
                 if (count($menu->getSubmenus()) > 0) {
                     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
 protected function menuCompact(Individual $individual, $surname)
 {
     $menu = new Menu(I18N::translate('View'), '#', 'menu-view');
     $menu->addSubmenu($this->menuChart($individual));
     $menu->addSubmenu($this->menuLists($surname));
     /** $menuReports could return null */
     if ($this->themeOption('compact_menu_reports') && $this->menuReports()) {
         $menu->addSubmenu($this->menuReports());
     }
     $menu->addSubmenu($this->menuCalendar());
     foreach ($menu->getSubmenus() as $submenu) {
         $class = explode("-", $submenu->getClass());
         $new_class = implode("-", array($class[0], 'view', $class[1]));
         $submenu->setClass($new_class);
     }
     return $menu;
 }