/** * get the other menu * @return Menu */ function &getOtherMenu() { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $pgv_lang; global $SHOW_GEDCOM_RECORD, $ENABLE_CLIPPINGS_CART; if ($TEXT_DIRECTION == "rtl") { $ff = "_rtl"; } else { $ff = ""; } if (!$this->note->canDisplayDetails() || !$SHOW_GEDCOM_RECORD && $ENABLE_CLIPPINGS_CART < PGV_USER_ACCESS_LEVEL) { $tempvar = false; return $tempvar; } // other menu $menu = new Menu($pgv_lang['other']); $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}"); if ($SHOW_GEDCOM_RECORD) { $menu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['gedcom']['small']}"); if ($this->show_changes && $this->userCanEdit()) { $menu->addLink("javascript:show_gedcom_record('new');"); } else { $menu->addLink("javascript:show_gedcom_record();"); } } else { if (!empty($PGV_IMAGES["clippings"]["small"])) { $menu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['clippings']['small']}"); } $menu->addLink(encode_url("clippings.php?action=add&id={$this->nid}&type=note")); } if ($SHOW_GEDCOM_RECORD) { // other / view_gedcom $submenu = new Menu($pgv_lang['view_gedcom']); if ($this->show_changes && $this->userCanEdit()) { $submenu->addLink("javascript:show_gedcom_record('new');"); } else { $submenu->addLink("javascript:show_gedcom_record();"); } $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['gedcom']['small']}"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } if ($ENABLE_CLIPPINGS_CART >= PGV_USER_ACCESS_LEVEL) { // other / add_to_cart $submenu = new Menu($pgv_lang['add_to_cart'], encode_url("clippings.php?action=add&id={$this->nid}&type=note")); if (!empty($PGV_IMAGES["clippings"]["small"])) { $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['clippings']['small']}"); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } if ($this->note->canDisplayDetails() && !empty($this->uname)) { // other / add_to_my_favorites $submenu = new Menu($pgv_lang['add_to_my_favorites'], encode_url("note.php?action=addfav&nid={$this->nid}&gid={$this->nid}")); $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['gedcom']['small']}"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } return $menu; }
/** * get the "other" menu * @return Menu */ function &getOtherMenu() { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $THEME_DIR; global $SHOW_GEDCOM_RECORD, $ENABLE_CLIPPINGS_CART, $pgv_lang; if ($TEXT_DIRECTION == "rtl") { $ff = "_rtl"; } else { $ff = ""; } //-- main other menu item $menu = new Menu($pgv_lang["other"]); if ($SHOW_GEDCOM_RECORD) { if (!empty($PGV_IMAGES["gedcom"]["small"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["small"]); } if ($this->show_changes && PGV_USER_CAN_EDIT) { $menu->addOnclick("return show_gedcom_record('new');"); } else { $menu->addOnclick("return show_gedcom_record('');"); } } else { if (!empty($PGV_IMAGES["clippings"]["small"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["clippings"]["small"]); } $menu->addLink(encode_url("clippings.php?action=add&id={$this->pid}&type=indi")); } $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}"); if ($SHOW_GEDCOM_RECORD) { $submenu = new Menu($pgv_lang["view_gedcom"]); if (!empty($PGV_IMAGES["gedcom"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["small"]); } if ($this->show_changes && PGV_USER_CAN_EDIT) { $submenu->addOnclick("return show_gedcom_record('new');"); } else { $submenu->addOnclick("return show_gedcom_record();"); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } if ($this->indi->canDisplayDetails() && $ENABLE_CLIPPINGS_CART >= PGV_USER_ACCESS_LEVEL) { $submenu = new Menu($pgv_lang["add_to_cart"], encode_url("clippings.php?action=add&id={$this->pid}&type=indi")); if (!empty($PGV_IMAGES["clippings"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["clippings"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } if ($this->indi->canDisplayDetails() && PGV_USER_NAME) { $submenu = new Menu($pgv_lang["add_to_my_favorites"], encode_url($this->indi->getLinkUrl() . "&action=addfav&gid={$this->pid}")); if (!empty($PGV_IMAGES["gedcom"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } return $menu; }
/** * get the other menu * @return Menu */ function &getOtherMenu() { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $pgv_lang; global $SHOW_GEDCOM_RECORD, $ENABLE_CLIPPINGS_CART; if ($TEXT_DIRECTION == "rtl") { $ff = "_rtl"; } else { $ff = ""; } // other menu $menu = new Menu($pgv_lang['other']); $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}"); if ($SHOW_GEDCOM_RECORD) { $menu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['gedcom']['small']}"); if ($this->show_changes && PGV_USER_CAN_EDIT) { $menu->addLink("javascript:show_gedcom_record('new');"); } else { $menu->addLink("javascript:show_gedcom_record();"); } } else { if (!empty($PGV_IMAGES["clippings"]["small"])) { $menu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['clippings']['small']}"); } $menu->addLink(encode_url('clippings.php?action=add&id=' . $this->getFamilyID() . '&type=fam')); } if ($SHOW_GEDCOM_RECORD) { // other / view_gedcom $submenu = new Menu($pgv_lang['view_gedcom']); if ($this->show_changes && PGV_USER_CAN_EDIT) { $submenu->addLink("javascript:show_gedcom_record('new');"); } else { $submenu->addLink("javascript:show_gedcom_record();"); } $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['gedcom']['small']}"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } if ($ENABLE_CLIPPINGS_CART >= PGV_USER_ACCESS_LEVEL) { // other / add_to_cart $submenu = new Menu($pgv_lang['add_to_cart'], encode_url('clippings.php?action=add&id=' . $this->getFamilyID() . '&type=fam')); if (!empty($PGV_IMAGES["clippings"]["small"])) { $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['clippings']['small']}"); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } if ($this->display && PGV_USER_ID) { // other / add_to_my_favorites $submenu = new Menu($pgv_lang['add_to_my_favorites'], encode_url('family.php?action=addfav&famid=' . $this->getFamilyID() . '&gid=' . $this->getFamilyID())); $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['gedcom']['small']}"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } return $menu; }
* with a backslash or enclose the entire URL in apostrophes instead of quotation marks. */ if (!defined('PGV_PHPGEDVIEW')) { header('HTTP/1.0 403 Forbidden'); exit; } //-- main Optional menu item $menu = new Menu("Optional Menu name", "custom link #1", "down"); if (!empty($PGV_IMAGES["gedcom"]["large"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["large"]); } $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}"); // First sub-menu (visible even when Search robots are looking at the site) $submenu = new Menu("Custom Menu Item 1", "custom link #1"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); // Second sub-menu (invisible to Search robots) if (empty($SEARCH_SPIDER)) { $submenu = new Menu("Custom Menu Item 2", "custom link #2"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } // Third sub-menu (visible only to users with site Admin rights) if (PGV_USER_IS_ADMIN) { $submenu = new Menu("Custom Menu Item 3", "custom link #2"); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}"); $menu->addSubmenu($submenu); } // Fourth sub-menu (visible only to users with GEDCOM Admin rights) if (PGV_USER_GEDCOM_ADMIN) { $submenu = new Menu("Custom Menu Item 4", "custom link #2");
/** * convert an old array style menu to an object * @static */ static function convertMenu($menu) { $conv = array('label' => 'label', 'labelpos' => 'labelpos', 'icon' => 'icon', 'hovericon' => 'hovericon', 'link' => 'link', 'accesskey' => 'accesskey', 'class' => 'class', 'hoverclass' => 'hoverclass', 'flyout' => 'flyout', 'submenuclass' => 'submenuclass', 'onclick' => 'onclick'); $obj = new Menu(); if ($menu == 'separator') { $obj->isSeparator(); $obj->printMenu(); return; } $items = false; foreach ($menu as $k => $v) { if ($k == 'items' && is_array($v) && count($v) > 0) { $items = $v; } else { if (isset($conv[$k])) { if ($v != '') { $obj->{$conv}[$k] = $v; } } } } if ($items !== false) { foreach ($items as $sub) { $sobj = new Menu(); if ($sub == 'separator') { $sobj->isSeparator(); $obj->addSubmenu($sobj); continue; } foreach ($sub as $k2 => $v2) { if (isset($conv[$k2])) { if ($v2 != '') { $sobj->{$conv}[$k2] = $v2; } } } $obj->addSubmenu($sobj); } } return $obj; }
/** * get the help menu * @return Menu the menu item */ static function &getHelpMenu() { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $pgv_lang, $SEARCH_SPIDER; global $SHOW_CONTEXT_HELP, $SCRIPT_NAME, $QUERY_STRING, $helpindex, $action; if ($TEXT_DIRECTION == "rtl") { $ff = "_rtl"; } else { $ff = ""; } if (!empty($SEARCH_SPIDER)) { $menu = new Menu("", "", ""); // $menu->print_menu = null; return $menu; } //-- main help menu item $menu = new Menu($pgv_lang["page_help"], "#", "down"); if (!empty($PGV_IMAGES["help"]["large"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["large"]); } if (empty($helpindex)) { $menu->addOnclick("return helpPopup('help_" . basename($SCRIPT_NAME) . "&action=" . $action . "');"); } else { $menu->addOnclick("return helpPopup('" . $helpindex . "');"); } $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}", "icon_large_help"); //-- help_for_this_page sub menu $submenu = new Menu($pgv_lang["help_for_this_page"], "#"); if (!empty($PGV_IMAGES["menu_help"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["menu_help"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_menu_help"); if (empty($helpindex)) { $submenu->addOnclick("return helpPopup('help_" . basename($SCRIPT_NAME) . "&action=" . $action . "');"); } else { $submenu->addOnclick("return helpPopup('" . $helpindex . "');"); } $menu->addSubmenu($submenu); //-- help_contents sub menu $submenu = new Menu($pgv_lang["help_contents"], "#"); if (!empty($PGV_IMAGES["menu_help"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["menu_help"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_menu_help"); $submenu->addOnclick("return helpPopup('help_contents_help');"); $menu->addSubmenu($submenu); //-- faq sub menu if (file_exists("faq.php")) { $submenu = new Menu($pgv_lang["faq_list"], "faq.php"); if (!empty($PGV_IMAGES["menu_help"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["menu_help"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_menu_help"); $menu->addSubmenu($submenu); } //-- searchhelp sub menu if (file_exists("searchhelp.php")) { $submenu = new Menu($pgv_lang["hs_title"], "#"); if (!empty($PGV_IMAGES["search"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_search"); $submenu->addOnclick("window.open('searchhelp.php', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1');"); $menu->addSubmenu($submenu); } //-- add wiki links $menu->addSeparator(); $submenu = new Menu($pgv_lang["wiki_main_page"], PGV_PHPGEDVIEW_WIKI . '/en/index.php?title=Main_Page" target="_blank'); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_wiki"); $menu->addSubmenu($submenu); $submenu = new Menu($pgv_lang["wiki_users_guide"], PGV_PHPGEDVIEW_WIKI . '/en/index.php?title=Users_Guide" target="_blank'); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_wiki"); $menu->addSubmenu($submenu); if (PGV_USER_GEDCOM_ADMIN) { $submenu = new Menu($pgv_lang["wiki_admin_guide"], PGV_PHPGEDVIEW_WIKI . '/en/index.php?title=Administrators_Guide" target="_blank'); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_wiki"); $menu->addSubmenu($submenu); } //-- add contact links to help menu $menu->addSeparator(); $menuitems = contact_menus(); foreach ($menuitems as $menuitem) { $submenu = new Menu($menuitem["label"], $menuitem["link"]); $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_contact"); if (!empty($menuitem["onclick"])) { $submenu->addOnclick($menuitem["onclick"]); } $menu->addSubmenu($submenu); } //-- add show/hide context_help $menu->addSeparator(); if ($_SESSION["show_context_help"]) { $submenu = new Menu($pgv_lang["hide_context_help"], "{$SCRIPT_NAME}" . normalize_query_string($QUERY_STRING . "&show_context_help=no")); } else { $submenu = new Menu($pgv_lang["show_context_help"], "{$SCRIPT_NAME}" . normalize_query_string($QUERY_STRING . "&show_context_help=yes")); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_menu_help"); $menu->addSubmenu($submenu); return $menu; }