예제 #1
0
function html_header($course, $wdir, $formfield = "")
{
    # HU, CS Repository plugin support
    global $CFG, $ME, $choose, $repository, $scheme;
    $navlinks = array();
    if ($course->id == SITEID) {
        $strfiles = get_string("sitefiles");
    } else {
        $strfiles = get_string("files");
    }
    if ($wdir == "/") {
        $navlinks[] = array('name' => $strfiles, 'link' => null, 'type' => 'misc');
    } else {
        $dirs = explode("/", $wdir);
        $numdirs = count($dirs);
        $link = "";
        $navlinks[] = array('name' => $strfiles, 'link' => $ME . "?id={$course->id}&wdir=/&choose={$choose}" . $repository->get_arg(), 'type' => 'misc');
        for ($i = 1; $i < $numdirs - 1; $i++) {
            $link .= "/" . urlencode($dirs[$i]);
            $navlinks[] = array('name' => $dirs[$i], 'link' => $ME . "?id={$course->id}&amp;wdir={$link}&amp;choose={$choose}" . $repository->get_arg(), 'type' => 'misc');
        }
        $navlinks[] = array('name' => $dirs[$numdirs - 1], 'link' => null, 'type' => 'misc');
    }
    $navigation = build_navigation($navlinks);
    # HU, CS Repository plugin support
    $page = podcaster_page::create_page($c = null);
    $csslink = $page->get_stylesheet();
    if ($choose) {
        # HU, CS Repository plugin support
        print_header('', '', '', '', $csslink);
        $chooseparts = explode('.', $choose);
        if (count($chooseparts) == 2) {
            ?>
            <script type="text/javascript">
            //<![CDATA[
            function set_value(txt) {
                opener.document.forms['<?php 
            echo $chooseparts[0] . "']." . $chooseparts[1];
            ?>
.value = txt;
                window.close();
            }
            //]]>
            </script>

            <?php 
        } elseif (count($chooseparts) == 1) {
            ?>
            <script type="text/javascript">
            //<![CDATA[
            function set_value(txt) {
                opener.document.getElementById('<?php 
            echo $chooseparts[0];
            ?>
').value = txt;
                window.close();
            }
            //]]>
            </script>

            <?php 
        }
        $fullnav = '';
        $i = 0;
        foreach ($navlinks as $navlink) {
            // If this is the last link do not link
            if ($i == count($navlinks) - 1) {
                $fullnav .= $navlink['name'];
            } else {
                $fullnav .= '<a href="' . $navlink['link'] . '">' . $navlink['name'] . '</a>';
            }
            $fullnav .= ' -> ';
            $i++;
        }
        $fullnav = substr($fullnav, 0, -4);
        $fullnav = str_replace('->', '&raquo;', format_string($course->shortname) . " -> " . $fullnav);
        # HU, CS Repository plugin support
        echo '<div id="nav-bar"><img src="' . $CFG->pixpath . '/mod/podcaster/icon.gif" alt="podcaster">&nbsp;' . $fullnav . '</div>';
        if ($course->id == SITEID and $wdir != "/backupdata") {
            print_heading(get_string("publicsitefileswarning"), "center", 2);
        }
    } else {
        if ($course->id == SITEID) {
            if ($wdir == "/backupdata") {
                admin_externalpage_setup('frontpagerestore');
                admin_externalpage_print_header();
            } else {
                admin_externalpage_setup('sitefiles');
                admin_externalpage_print_header();
                print_heading(get_string("publicsitefileswarning"), "center", 2);
            }
        } else {
            print_header("{$course->shortname}: {$strfiles}", $course->fullname, "<a href=\"../../../course/view.php?id={$course->id}\">{$course->shortname}" . "</a> -> {$fullnav}", $formfield, $csslink);
        }
    }
    echo "<table border=\"0\" style=\"margin-left:auto;margin-right:auto\" cellspacing=\"3\" cellpadding=\"3\" width=\"640\">";
    echo "<tr>";
    echo "<td colspan=\"2\">";
    # HU, CS Repository plugin support
    echo '<div id="mod-podcaster-upload-headline">' . podcaster_util::get_string('repository_' . $repository->name . '_desc') . '</div>';
    echo '</tr><tr><td colspan="2">';
}
예제 #2
0
    if (!isloggedin() || isguestuser()) {
        if ($repository && $repository->public && $channel->coursemodule->visible) {
            break;
        }
    }
    if (!($context = get_context_instance(CONTEXT_COURSE, $course->id))) {
        error('Could not setup context');
    }
    if (has_capability('moodle/course:view', $context)) {
        require_login($course->id);
        $buildnav = true;
    } elseif (!$repository || !$repository->public || !$channel->coursemodule->visible) {
        error('You cannot view this channel');
    }
} while (false);
$page = podcaster_page::create_page($channel);
/// Print the page header
$strpodcasters = get_string('modulenameplural', 'podcaster');
$strpodcaster = get_string('modulename', 'podcaster');
$navlinks = array();
$navlinks[] = array('name' => $strpodcasters, 'link' => 'index.php?id=' . $course->id, 'type' => 'activity');
$navlinks[] = array('name' => format_string($channel->name), 'link' => '', 'type' => 'activityinstance');
$navigation = $channel->name;
print_header_simple(format_string($obj->name), '', $navigation, '', $page->get_stylesheet(), true, update_module_button($cm->id, $course->id, $strpodcaster), $buildnav ? navmenu($course, $cm) : false);
// set up tabs
$tabs = array(array(new tabobject('channel', $CFG->wwwroot . '/mod/podcaster/view.php?' . 'id=' . $cm->id, get_string('channel_tabtitle', 'podcaster')), new tabobject('items', $CFG->wwwroot . '/mod/podcaster/view.php?' . 'id=' . $cm->id . '&amp;' . 'tab=items', get_string('items_tabtitle', 'podcaster'))));
if ($tab == 'item') {
    $tabs[0][] = new tabobject('item', $CFG->wwwroot . '/mod/podcaster/view.php?' . 'id=' . $cm->id . '&amp;' . 'tab=item&amp;' . 'item=' . optional_param('item', 0, PARAM_INT), get_string('item_tabtitle', 'podcaster'));
}
print_tabs($tabs, $tab);
/// Print the main part of the page