Beispiel #1
0
function page_print_site_page_structure_ul($pages = null, $ulid = '')
{
    global $CFG, $PAGE;
    if (empty($pages)) {
        $pages = page_get_master_pages(SITEID, 0, DISP_THEME);
    }
    if (empty($pages)) {
        return '';
    }
    $baseurl = $CFG->wwwroot . '/index.php?page=';
    static $canviewnonpublishedpages = null;
    if (is_null($canviewnonpublishedpages)) {
        $canviewnonpublishedpages = has_capability('format/page:managepages', get_system_context());
        // this is a recursive function so cache this heavy op
    }
    $pagestring = '';
    foreach ($pages as $page) {
        if (!($page->display & DISP_PUBLISH) && !$canviewnonpublishedpages) {
            continue;
            // this page isn't published and the user doesn't have the ability to see it
        }
        $pagestring .= !empty($page->children) ? '<li class="havechild">' : '<li>';
        $pageurl = !empty($page->redirect) ? $page->redirect : $baseurl . $page->id;
        $pagestring .= "<a href=\"{$pageurl}\"><span class=\"menu-title\">{$page->nameone}</span></a>";
        if (!empty($page->children)) {
            $pagestring .= page_print_site_page_structure_ul($page->children);
        }
        $pagestring .= '</li>';
    }
    return "<ul id=\"{$ulid}\" class=\"{$ulid}\">{$pagestring}</ul>";
}
Beispiel #2
0
<?php

include_once $CFG->dirroot . '/course/format/page/lib.php';
echo '<div class="navbar2 clearfix">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td class="dropdown-cell">' . page_print_site_page_structure_ul(null, 'dropdown') . '</td>
            <td class="navbutton-cell">
            <div class="navbutton"><span>' . $button . '</span></div>
          </tr>
        </table>
      </div>';