本文整理汇总了PHP中Menu::addSubMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::addSubMenu方法的具体用法?PHP Menu::addSubMenu怎么用?PHP Menu::addSubMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::addSubMenu方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Menu
<?php
PHPWS_Core::initModClass('othermenu', 'Menu.php');
$menu = new Menu('Main', 'main');
$menu->addSubMenu('Search', 'search');
$menu->addMenuItem('Settings2', 'settings2', 'search');
Layout::add($menu->show());
示例2: Menu
static function &getFavoritesMenu()
{
global $REQUIRE_AUTHENTICATION, $pgv_lang, $GEDCOM, $QUERY_STRING, $SCRIPT_NAME, $PGV_IMAGE_DIR, $PGV_IMAGES, $TEXT_DIRECTION;
global $SEARCH_SPIDER;
global $controller;
// Pages with a controller can be added to the favorites
if (!empty($SEARCH_SPIDER)) {
return false;
// show no favorites, because they taint every page that is indexed.
}
if ($TEXT_DIRECTION == "rtl") {
$ff = "_rtl";
} else {
$ff = "";
}
if (PGV_USER_ID || !$REQUIRE_AUTHENTICATION) {
$menu = new Menu($pgv_lang['favorites'], '#', '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}", "icon_large_gedcom");
// $menu->print_menu = NULL;
$userfavs = getUserFavorites(PGV_USER_ID);
$gedfavs = getUserFavorites($GEDCOM);
// User favorites
if ($userfavs || PGV_USER_ID) {
$submenu = new Menu('<strong>' . $pgv_lang['my_favorites'] . '</strong>');
$submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
$menu->addSubMenu($submenu);
while (PGV_USER_ID && isset($controller)) {
// Get the right $gid from each supported controller type
switch (get_class($controller)) {
case 'IndividualController':
$gid = $controller->pid;
break;
case 'FamilyController':
$gid = $controller->famid;
break;
case 'MediaController':
$gid = $controller->mid;
break;
case 'SourceController':
$gid = $controller->sid;
break;
case 'RepositoryController':
$gid = $controller->rid;
break;
default:
break 2;
}
$submenu = new Menu('<em>' . $pgv_lang['add_to_my_favorites'] . '</em>', $SCRIPT_NAME . normalize_query_string($QUERY_STRING . '&action=addfav&gid=' . $gid));
$submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
$menu->addSubMenu($submenu);
break;
}
foreach ($userfavs as $fav) {
$OLD_GEDCOM = $GEDCOM;
$GEDCOM = $fav['file'];
switch ($fav['type']) {
case 'URL':
$submenu = new Menu(PrintReady($fav['title']), $fav['url']);
$submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
$menu->addSubMenu($submenu);
break;
case 'INDI':
case 'FAM':
case 'SOUR':
case 'OBJE':
if (displayDetailsById($fav['gid'], $fav['type'])) {
$obj = GedcomRecord::getInstance($fav['gid']);
if ($obj) {
$submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
$submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
$menu->addSubMenu($submenu);
}
}
break;
}
$GEDCOM = $OLD_GEDCOM;
}
if ($gedfavs) {
$menu->addSeparator();
}
}
// Gedcom favorites
if ($gedfavs) {
$submenu = new Menu('<strong>' . $pgv_lang['gedcom_favorites'] . '</strong>');
$submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
$menu->addSubMenu($submenu);
foreach ($gedfavs as $fav) {
$OLD_GEDCOM = $GEDCOM;
$GEDCOM = $fav['file'];
switch ($fav['type']) {
case 'URL':
$submenu = new Menu(PrintReady($fav['title']), $fav['url']);
$submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
$menu->addSubMenu($submenu);
break;
case 'INDI':
case 'FAM':
//.........这里部分代码省略.........
示例3: foreach
/**
* get the edit menu
* @return Menu
*/
function &getEditMenu()
{
global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TOTAL_NAMES;
global $NAME_LINENUM, $SEX_LINENUM, $pgv_lang, $pgv_changes, $USE_QUICK_UPDATE;
global $SHOW_GEDCOM_RECORD;
if ($TEXT_DIRECTION == "rtl") {
$ff = "_rtl";
} else {
$ff = "";
}
$links = get_media_relations($this->pid);
$linktoid = "new";
foreach ($links as $linktoid => $type) {
break;
// we're only interested in the key of the first list entry
}
//-- main edit menu
$menu = new Menu($pgv_lang["edit"]);
$click_link = "window.open('addmedia.php?action=editmedia&pid={$this->pid}&linktoid={$linktoid}', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1')";
$menu->addOnclick($click_link);
if (!empty($PGV_IMAGES["edit_indi"]["small"])) {
$menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["edit_indi"]["small"]);
}
$menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
if (PGV_USER_CAN_EDIT) {
//- plain edit option
$submenu = new Menu($pgv_lang["edit"]);
$click_link = "window.open('addmedia.php?action=editmedia&pid={$this->pid}&linktoid={$linktoid}', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1')";
$submenu->addOnclick($click_link);
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$menu->addSubmenu($submenu);
if ($SHOW_GEDCOM_RECORD || PGV_USER_IS_ADMIN) {
$submenu = new Menu($pgv_lang["edit_raw"]);
$submenu->addOnclick("return edit_raw('" . $this->pid . "');");
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$menu->addSubmenu($submenu);
}
//- end plain edit option
if (PGV_USER_GEDCOM_ADMIN) {
//- remove object option
$submenu = new Menu($pgv_lang["remove_object"]);
$submenu->addLink(encode_url("media.php?action=removeobject&xref=" . $this->pid));
$submenu->addOnclick("return confirm('" . $pgv_lang["confirm_remove_object"] . "')");
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$menu->addSubmenu($submenu);
}
// main link displayed on page
if (PGV_USER_GEDCOM_ADMIN && file_exists('modules/GEDFact_assistant/_MEDIA/media_1_ctrl.php')) {
$submenu = new Menu($pgv_lang["add_or_remove_links"]);
} else {
$submenu = new Menu($pgv_lang["set_link"]);
}
// GEDFact assistant Add Media Links =======================
if (PGV_USER_GEDCOM_ADMIN && file_exists('modules/GEDFact_assistant/_MEDIA/media_1_ctrl.php')) {
$submenu->addOnclick("return ilinkitem('" . $this->pid . "','manage');");
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
// Do not print ssubmunu
} else {
$submenu->addOnclick("return ilinkitem('" . $this->pid . "','person');");
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
$ssubmenu = new Menu($pgv_lang["to_person"]);
$ssubmenu->addOnclick("return ilinkitem('" . $this->pid . "','person');");
$ssubmenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$submenu->addSubMenu($ssubmenu);
$ssubmenu = new Menu($pgv_lang["to_family"]);
$ssubmenu->addOnclick("return ilinkitem('" . $this->pid . "','family');");
$ssubmenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$submenu->addSubMenu($ssubmenu);
$ssubmenu = new Menu($pgv_lang["to_source"]);
$ssubmenu->addOnclick("return ilinkitem('" . $this->pid . "','source');");
$ssubmenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$submenu->addSubMenu($ssubmenu);
}
$menu->addSubmenu($submenu);
}
if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
$menu->addSeparator();
if (!$this->show_changes) {
$label = $pgv_lang["show_changes"];
$link = "mediaviewer.php?mid={$this->pid}&show_changes=yes";
} else {
$label = $pgv_lang["hide_changes"];
$link = "mediaviewer.php?mid={$this->pid}&show_changes=no";
}
$submenu = new Menu($label, encode_url($link));
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$menu->addSubmenu($submenu);
if (PGV_USER_CAN_ACCEPT) {
$submenu = new Menu($pgv_lang["undo_all"], encode_url("mediaviewer.php?mid={$this->pid}&action=undo"));
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$menu->addSubmenu($submenu);
$submenu = new Menu($pgv_lang["accept_all"], encode_url("mediaviewer.php?mid={$this->pid}&action=accept"));
$submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
$menu->addSubmenu($submenu);
}
}
//.........这里部分代码省略.........
示例4: Menu
?>
</td>
</tr>
<?php
}
if (isset($people["wife"]) && $spousetag == 'WIFE') {
$menu = new Menu(" " . $people["wife"]->getLabel() . " " . "\n");
if ($TEXT_DIRECTION == "ltr") {
$menu->addClass("", "", "submenu flyout");
} else {
$menu->addClass("", "", "submenu flyoutrtl");
}
$slabel = "</a>" . print_pedigree_person_nav($people["wife"]->getXref(), 2, !$this->isPrintPreview(), 0, $personcount++);
$slabel .= PrintReady($parentlinks) . "<a>";
$submenu = new Menu($slabel);
$menu->addSubMenu($submenu);
if (PrintReady($people["wife"]->getDeathYear()) == 0) {
$DeathYr = "";
} else {
$DeathYr = PrintReady($people["wife"]->getDeathYear());
}
if (PrintReady($people["wife"]->getBirthYear()) == 0) {
$BirthYr = "";
} else {
$BirthYr = PrintReady($people["wife"]->getBirthYear());
}
?>
<tr>
<td class="facts_label<?php
print $styleadd;
?>