<input name="span_id" type="text" size="20" id="span_id" value="<?php echo html_encode($result['span_id']); ?> " /> <?php echo gettext('Class'); ?> <input name="span_class" type="text" size="20" id="span_class" value="<?php echo html_encode($result['span_class']); ?> " /> </td> </tr> <?php if (is_array($result) && !empty($result['type'])) { $array = getItemTitleAndURL($result); if (!$array['valid']) { ?> <tr> <td colspan="2"> <span class="notebox"> <?php if (array_key_exists('theme', $array)) { printf(gettext('Target does not exist in <em>%1$s</em> theme'), $array['theme']); } else { echo gettext('Target does not exist.'); } ?> </span> </td> </tr>
/** * Prints a context sensitive menu of all pages as a unordered html list * * @param string $menuset the menu tree to output * @param string $option The mode for the menu: * "list" context sensitive toplevel plus sublevel pages, * "list-top" only top level pages, * "omit-top" only sub level pages * "list-sub" lists only the current pages direct offspring * @param string $css_id CSS id of the top level list * @param string $css_class_topactive class of the active item in the top level list * @param string $css_class CSS class of the sub level list(s) * @param string $css_class_active CSS class of the sub level list(s) * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" (default) if you don't use it, it is not printed then. * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list". * @param bool $counter TRUE (FALSE default) if you want the count of articles for Zenpage news categories or images/subalbums for albums. * @return string */ function printCustomMenu($menuset = 'default', $option = 'list', $css_id = '', $css_class_topactive = '', $css_class = '', $css_class_active = '', $showsubs = 0, $counter = false) { $itemcounter = ''; if ($css_id != "") { $css_id = " id='" . $css_id . "'"; } if ($showsubs === true) { $showsubs = 9999999999; } $sortorder = getCurrentMenuItem($menuset); $items = getMenuItems($menuset, getMenuVisibility()); if (count($items) == 0) { return; } // nothing to do $currentitem_parentid = @$items[$sortorder]['parentid']; if ($startlist = !($option == 'omit-top' || $option == 'list-sub')) { echo "<ul{$css_id}>"; } $pageid = @$items[$sortorder]['id']; $baseindent = max(1, count(explode("-", $sortorder))); $indent = 1; $open = array($indent => 0); $parents = array(NULL); $order = explode('-', $sortorder); $mylevel = count($order); $myparentsort = array_shift($order); for ($c = 0; $c <= $mylevel; $c++) { $parents[$c] = NULL; } foreach ($items as $item) { $itemarray = getItemTitleAndURL($item); $itemURL = $itemarray['url']; $itemtitle = $itemarray['title']; $level = max(1, count(explode('-', $item['sort_order']))); $process = $level <= $showsubs && $option == "list" || ($option == 'list' || $option == 'list-top') && $level == 1 || (($option == 'list' || $option == 'omit-top' && $level > 1) && ($item['id'] == $pageid || $item['parentid'] == $pageid || $level < $mylevel && $level > 1 && strpos($item['sort_order'], $myparentsort) === 0) || $level == $mylevel && $currentitem_parentid == $item['parentid']) || $option == 'list-sub' && $item['parentid'] == $pageid; if ($process && $itemarray['valid']) { if ($level > $indent) { echo "\n" . str_pad("\t", $indent, "\t") . "<ul class=\"{$css_class} menu_{$item['type']}\">\n"; $indent++; $parents[$indent] = NULL; $open[$indent] = 0; } else { if ($level < $indent) { $parents[$indent] = NULL; while ($indent > $level) { if ($open[$indent]) { $open[$indent]--; echo "</li>\n"; } $indent--; echo str_pad("\t", $indent, "\t") . "</ul>\n"; } } else { // level == indent, have not changed if ($open[$indent]) { // level = indent echo str_pad("\t", $indent, "\t") . "</li>\n"; $open[$indent]--; } else { echo "\n"; } } } if ($open[$indent]) { // close an open LI if it exists echo "</li>\n"; $open[$indent]--; } echo str_pad("\t", $indent - 1, "\t"); $open[$indent] += $item['include_li']; $parents[$indent] = $item['id']; if ($counter) { switch ($item['type']) { case 'album': $albumobj = newAlbum($item['link']); $numimages = $albumobj->getNumImages(); $numsubalbums = $albumobj->getNumAlbums(); $itemcounter = ' <span style="white-space:nowrap;"><small>('; if ($numsubalbums != 0) { $itemcounter .= sprintf(ngettext('%u album', '%u albums', $numsubalbums), $numsubalbums); } if ($numimages != 0) { if ($numsubalbums != 0) { $itemcounter .= ' '; } $itemcounter .= sprintf(ngettext('%u image', '%u images', $numimages), $numimages); } $itemcounter .= ')</small></span>'; break; case 'category': if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) { $published = "all"; } else { $published = "published"; } $catobj = newCategory($item['link']); $catcount = count($catobj->getArticles(0, $published)); $itemcounter = "<small> (" . $catcount . ")</small>"; break; } } if ($item['id'] == $pageid && !is_null($pageid)) { if ($level == 1) { // top level $class = $css_class_topactive; } else { $class = $css_class_active; } echo '<li class="menu_' . trim($item['type'] . ' ' . $class) . '">' . $itemtitle . $itemcounter; } else { if (strpos($sortorder, $item['sort_order']) === 0) { // we are in the heritage chain $class = ' ' . $css_class_active . '-' . ($mylevel - $level); } else { $class = ''; } if ($item['include_li']) { echo '<li class="menu_' . $item['type'] . $class . '">'; } if ($item['span_id'] || $item['span_class']) { echo '<span'; if ($item['span_id']) { echo ' id="' . $item['span_id'] . '"'; } if ($item['span_class']) { echo ' class="' . $item['span_class'] . '"'; } echo '>'; } switch ($item['type']) { case 'html': echo $item['link']; break; case 'menufunction': $i = strpos($itemURL, '('); if ($i) { if (function_exists(trim(substr($itemURL, 0, $i)))) { eval($itemURL); } } break; case 'menulabel': echo $itemtitle; break; default: if (empty($itemURL)) { $itemURL = FULLWEBPATH; } echo '<a href="' . $itemURL . '" title="' . html_encode(getBare($itemtitle)) . '">' . $itemtitle . '</a>' . $itemcounter; break; } if ($item['span_id'] || $item['span_class']) { echo '</span>'; } } } } // cleanup any hanging list elements while ($indent > 1) { if ($open[$indent]) { echo "</li>\n"; $open[$indent]--; } $indent--; echo str_pad("\t", $indent, "\t") . "</ul>"; } if ($open[$indent]) { echo "</li>\n"; $open[$indent]--; } else { echo "\n"; } if ($startlist) { echo "</ul>\n"; } }
/** * Prints the link to the edit page of a menu item. For gallery and Zenpage items it links to their normal edit pages, for custom pages and custom links to menu specific edit page. * * @param array $item Array of the menu item */ function printItemEditLink($item) { $link = ""; $array = getItemTitleAndURL($item); $title = html_encode($array['title']); $link = '<a href="menu_tab_edit.php?edit&id=' . $item['id'] . "&type=" . $item['type'] . "&menuset=" . html_encode(checkChosenMenuset()) . '">' . $title . '</a>'; echo $link; }
/** * Prints the link to the edit page of a menu item. For gallery and Zenpage items it links to their normal edit pages, for custom pages and custom links to menu specific edit page. * * @param array $item Array of the menu item */ function printItemEditLink($item) { $link = ""; $array = getItemTitleAndURL($item); if (is_null($array['title'])) { $title = '<span class="notebox">' . gettext('The target for this menu element no longer exists') . '</span>'; } else { $title = html_encode($array['title']); } switch ($item['type']) { case "album": $link = '<a href="../../admin-edit.php?page=edit&album=' . $item['link'] . '">' . $title . '</a>'; break; case "zenpagepage": $link = '<a href="../zenpage/admin-edit.php?page&titlelink=' . $item['link'] . '">' . $title . '</a>'; break; case "zenpagecategory": $cat = new ZenpageCategory($item['link']); $catid = $cat->getID(); $link = '<a href="../zenpage/admin-categories.php?edit&id=' . $catid . '&tab=categories">' . $title . '</a>'; break; default: $link = '<a href="menu_tab_edit.php?edit&id=' . $item['id'] . "&type=" . $item['type'] . "&menuset=" . html_encode(checkChosenMenuset()) . '">' . $title . '</a>'; break; } echo $link; }