function admin()
{
    if ($_SESSION['loggedin'] == 1 && $_SESSION['permissions'] == 10) {
        if (isset($_GET['admin'])) {
            $module = $_GET['admin'];
            $adm_module = "admin_" . $module;
        } else {
            $module = "main";
            $adm_module = "admin_" . $module;
        }
        if (is_file("admin/{$module}.php")) {
            include "admin/nav.php";
            include "admin/{$module}.php";
            echo "<div class=\"entry\">";
            echo "<h3>Welcome to the Admin Control Panel!</h3><br />";
            admin_nav();
            $adm_module();
            echo "</div>";
        } else {
            echo "No such Admin module!";
        }
    } else {
        admin_denied();
    }
}
/**
 * Builds a data structure representing the menu for Mahara.
 */
function main_nav()
{
    if (defined('ADMIN') || defined('INSTITUTIONALADMIN')) {
        global $USER;
        $menu = $USER->get('admin') ? admin_nav() : institutional_admin_nav();
    } else {
        // Build the menu structure for the site
        // The keys of each entry are as follows:
        //   path: Where the link sits in the menu. E.g. 'myporfolio/myplugin'
        //   url:  The URL to the page, relative to wwwroot. E.g. 'artefact/myplugin/'
        //   title: Translated text to use for the text of the link. E.g. get_string('myplugin', 'artefact.myplugin')
        //   weight: Where in the menu the item should be inserted. Larger number are to the right.
        $menu = mahara_standard_nav();
    }
    // local_main_nav_update allows sites to customise the menu by munging the $menu array.
    if (function_exists('local_main_nav_update')) {
        local_main_nav_update($menu);
    }
    $menu_structure = find_menu_children($menu, '');
    return $menu_structure;
}
Exemple #3
0
/**
 * Builds a data structure representing the menu for Mahara.
 *
 * @return array
 */
function main_nav()
{
    global $USER;
    $language = current_language();
    $cachemenu = false;
    // Get the first institution
    $institution = $USER->get_primary_institution();
    $menutype = '';
    if (in_admin_section()) {
        global $USER, $SESSION;
        if ($USER->get('admin')) {
            $menutype = 'admin_nav';
            if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
                $menu = admin_nav();
            }
        } else {
            if ($USER->is_institutional_admin()) {
                $menutype = 'instadmin_nav';
                if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
                    $menu = institutional_admin_nav();
                }
            } else {
                if ($USER->get('staff')) {
                    $menutype = 'staff_nav';
                    if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
                        $menu = staff_nav();
                    }
                } else {
                    $menutype = 'inststaff_nav';
                    if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
                        $menu = institutional_staff_nav();
                    }
                }
            }
        }
    } else {
        // Build the menu structure for the site
        $menutype = 'standard_nav';
        if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
            $menu = mahara_standard_nav();
        }
    }
    if ($cachemenu) {
        $menu = json_decode($cachemenu, true);
    } else {
        $menu = array_filter($menu, create_function('$a', 'return empty($a["ignore"]);'));
        // enable plugins to augment the menu structure
        foreach (array('artefact', 'interaction', 'module', 'auth') as $plugintype) {
            if ($plugins = plugins_installed($plugintype)) {
                foreach ($plugins as &$plugin) {
                    if (safe_require_plugin($plugintype, $plugin->name)) {
                        $plugin_menu = call_static_method(generate_class_name($plugintype, $plugin->name), 'menu_items');
                        $menu = array_merge($menu, $plugin_menu);
                    }
                }
            }
        }
        set_config_institution($institution, $menutype . '_' . $language, json_encode($menu));
    }
    // local_main_nav_update allows sites to customise the menu by munging the $menu array.
    // as there is no internal way to know if the local_main_nav array has changed we keep it outside the cached menu
    if (function_exists('local_main_nav_update')) {
        local_main_nav_update($menu);
    }
    $menu_structure = find_menu_children($menu, '');
    return $menu_structure;
}
 function admin_nav($nav, $depth = 1)
 {
     $list_item = '<ul>';
     foreach ($nav as $item) {
         $item['url'] = trim($item['url'], '/');
         if (show_admin_nav_li($item) && empty($item['hidden'])) {
             $list_item .= '<li' . ($depth == 1 && is_admin_nav_li_selected($item) ? ' class="selected"' : '') . (isset($item['id']) ? ' id="' . $item['id'] . '"' : '') . '>';
             $list_item .= '<a href="' . (admin_is_permitted(ADMIN_PATH . '/' . $item['url']) ? site_url(ADMIN_PATH . '/' . $item['url']) : 'javascript:void(0)') . '"' . ($depth == 1 ? ' class="top"' : '') . '>' . $item['title'] . '</a>';
             if (!empty($item['sub'])) {
                 $list_item .= admin_nav($item['sub'], $depth + 1);
             }
             $list_item .= '</li>';
         }
     }
     $list_item .= '</ul>';
     return $list_item;
 }
Exemple #5
0
/**
 * Builds a data structure representing the menu for Mahara.
 */
function main_nav()
{
    if (in_admin_section()) {
        global $USER, $SESSION;
        if ($USER->get('admin')) {
            $menu = admin_nav();
        } else {
            if ($USER->is_institutional_admin()) {
                $menu = institutional_admin_nav();
            } else {
                if ($USER->get('staff')) {
                    $menu = staff_nav();
                } else {
                    $menu = institutional_staff_nav();
                }
            }
        }
    } else {
        // Build the menu structure for the site
        // The keys of each entry are as follows:
        //   path: Where the link sits in the menu. E.g. 'myporfolio/myplugin'
        //   url:  The URL to the page, relative to wwwroot. E.g. 'artefact/myplugin/'
        //   title: Translated text to use for the text of the link. E.g. get_string('myplugin', 'artefact.myplugin')
        //   weight: Where in the menu the item should be inserted. Larger number are to the right.
        $menu = mahara_standard_nav();
    }
    $menu = array_filter($menu, create_function('$a', 'return empty($a["ignore"]);'));
    if ($plugins = plugins_installed('artefact')) {
        foreach ($plugins as &$plugin) {
            if (safe_require_plugin('artefact', $plugin->name)) {
                $plugin_menu = call_static_method(generate_class_name('artefact', $plugin->name), 'menu_items');
                $menu = array_merge($menu, $plugin_menu);
            }
        }
    }
    if ($plugins = plugins_installed('interaction')) {
        foreach ($plugins as &$plugin) {
            if (safe_require_plugin('interaction', $plugin->name)) {
                $plugin_menu = call_static_method(generate_class_name('interaction', $plugin->name), 'menu_items');
                $menu = array_merge($menu, $plugin_menu);
            }
        }
    }
    // local_main_nav_update allows sites to customise the menu by munging the $menu array.
    if (function_exists('local_main_nav_update')) {
        local_main_nav_update($menu);
    }
    $menu_structure = find_menu_children($menu, '');
    return $menu_structure;
}
/**
 * Builds a data structure representing the menu for Mahara.
 *
 * @return array
 */
function main_nav()
{
    if (in_admin_section()) {
        global $USER, $SESSION;
        if ($USER->get('admin')) {
            $menu = admin_nav();
        } else {
            if ($USER->is_institutional_admin()) {
                $menu = institutional_admin_nav();
            } else {
                if ($USER->get('staff')) {
                    $menu = staff_nav();
                } else {
                    $menu = institutional_staff_nav();
                }
            }
        }
    } else {
        // Build the menu structure for the site
        $menu = mahara_standard_nav();
    }
    $menu = array_filter($menu, create_function('$a', 'return empty($a["ignore"]);'));
    // enable plugins to augment the menu structure
    foreach (array('artefact', 'interaction', 'module') as $plugintype) {
        if ($plugins = plugins_installed($plugintype)) {
            foreach ($plugins as &$plugin) {
                if (safe_require_plugin($plugintype, $plugin->name)) {
                    $plugin_menu = call_static_method(generate_class_name($plugintype, $plugin->name), 'menu_items');
                    $menu = array_merge($menu, $plugin_menu);
                }
            }
        }
    }
    // local_main_nav_update allows sites to customise the menu by munging the $menu array.
    if (function_exists('local_main_nav_update')) {
        local_main_nav_update($menu);
    }
    $menu_structure = find_menu_children($menu, '');
    return $menu_structure;
}
Exemple #7
0
echo admin_nav('settings');
?>
 <?php 
echo admin_nav('home');
?>
">
            <a href="<?php 
echo base_url();
?>
admin/settings">Settings</a>
          </li>
          <li class="<?php 
echo admin_nav('events');
?>
"><a href="<?php 
echo base_url();
?>
admin/events">Events</a></li>
          <li class="<?php 
echo admin_nav('eboards');
?>
"><a href="<?php 
echo base_url();
?>
admin/eboards">Eboards</a></li>
        </ul>
      </aside>
    </header>
    <section class="main">
<!-- end header -->
Exemple #8
0
<?php

$nav_array = array(array('title' => 'Dashboard', 'url' => '/', 'id' => 'dashboard', 'sub' => array()), array('title' => 'Content', 'url' => 'content/entries', 'sub' => array(array('title' => 'Entries', 'url' => 'content/entries'), array('title' => 'Navigations', 'url' => 'navigations'), array('title' => 'Galleries', 'url' => 'galleries'))), array('title' => 'Users', 'url' => 'users', 'sub' => array(array('title' => 'Users', 'url' => 'users'), array('title' => 'User Groups', 'url' => 'users/groups'))), array('title' => 'Tools', 'url' => 'content/types', 'sub' => array(array('title' => 'Content Types', 'url' => 'content/types'), array('title' => 'Content Fields', 'url' => 'content/fields', 'hidden' => TRUE), array('title' => 'Code Snippets', 'url' => 'content/snippets'), array('title' => 'Categories', 'url' => 'content/categories/groups'), array('title' => 'Theme Editor', 'url' => 'settings/theme-editor'))), array('title' => 'System', 'url' => 'settings/general-settings', 'sub' => array(array('title' => 'General Settings', 'url' => 'settings/general-settings'), array('title' => 'Clear Cache', 'url' => 'settings/clear-cache'), array('title' => 'Server Info', 'url' => 'settings/server-info'))));
echo admin_nav($nav_array);