function block_exabis_eportfolio_get_view_from_access($access)
{
    global $CFG, $USER;
    if (block_exabis_eportfolio_get_active_version() < 3) {
        // only allowed since version 3
        return;
    }
    $accessPath = explode('/', $access);
    if (count($accessPath) != 2) {
        return;
    }
    $view = null;
    if ($accessPath[0] == 'hash') {
        $hash = $accessPath[1];
        $hash = explode('-', $hash);
        if (count($hash) != 2) {
            return;
        }
        $userid = clean_param($hash[0], PARAM_INT);
        $hash = clean_param($hash[1], PARAM_ALPHANUM);
        //$userid = $hash[0];
        //$hash = $hash[1];
        if (empty($userid) || empty($hash)) {
            return;
        }
        if (!($view = get_record("block_exabeporview", "userid", $userid, "hash", $hash, "externaccess", 1))) {
            // view not found
            return;
        }
        $view->access = new stdClass();
        $view->access->request = 'extern';
    } elseif ($accessPath[0] == 'id') {
        // guest not allowed
        // require exabis_eportfolio:use -> guest hasn't this right
        $context = get_context_instance(CONTEXT_SYSTEM);
        require_capability('block/exabis_eportfolio:use', $context);
        $hash = $accessPath[1];
        $hash = explode('-', $hash);
        if (count($hash) != 2) {
            return;
        }
        $userid = clean_param($hash[0], PARAM_INT);
        $viewid = clean_param($hash[1], PARAM_INT);
        //$userid = $hash[0];
        //$viewid = $hash[1];
        $view = get_record_sql("SELECT v.* FROM {$CFG->prefix}block_exabeporview v" . " LEFT JOIN {$CFG->prefix}block_exabeporviewshar vshar ON v.id=vshar.viewid AND vshar.userid='" . $USER->id . "'" . " WHERE v.userid='" . $userid . "' AND v.id='" . $viewid . "' AND" . " ((v.userid='" . $USER->id . "')" . "  OR (v.shareall=1)" . "  OR (v.shareall=0 AND vshar.userid IS NOT NULL))");
        // shared for me
        if (!$view) {
            // view not found
            return;
        }
        $view->access = new stdClass();
        $view->access->request = 'intern';
    }
    return $view;
}
    echo '<input type="submit" name="export" value="' . get_string("download", "block_exabis_eportfolio") . '"';
    echo ' onclick="window.open(\'' . $CFG->wwwroot . '/blocks/exabis_eportfolio/portfoliofile.php/' . export_file_area_name() . '/' . $zipname . '\');"/>';
    echo '</div>';
    print_simple_box_end();
    print_footer($course);
    exit;
}
echo "<br />";
echo '<div class="block_eportfolio_center">';
$views = get_records('block_exabeporview', 'userid', $USER->id, 'name');
print_simple_box_start("center", "40%", "#ccffbb");
echo '<p>' . get_string("explainexport", "block_exabis_eportfolio") . '</p>';
echo '<form method="post" class="block_eportfolio_center" action="' . $_SERVER['PHP_SELF'] . '" >';
echo '<fieldset>';
// views
if (block_exabis_eportfolio_get_active_version() >= 3) {
    echo '<div style="padding-bottom: 15px;">' . get_string("exportviewselect", "block_exabis_eportfolio") . ': ';
    echo '<select name="viewid">';
    echo '<option></option>';
    foreach ($views as $view) {
        echo '<option value="' . $view->id . '">' . $view->name . '</option>';
    }
    echo '</select>';
    echo ' </div>';
}
echo '<input type="hidden" name="confirm" value="1" />';
echo '<input type="submit" name="export" value="' . get_string("createexport", "block_exabis_eportfolio") . '" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<input type="hidden" name="courseid" value="' . $courseid . '" />';
echo '</fieldset>';
echo '</form>';
/**
 * Print moodle header
 * @param string $item_identifier translation-id for this page
 * @param string $sub_item_identifier translation-id for second level if needed
 */
function block_exabis_eportfolio_print_header($item_identifier, $sub_item_identifier = null)
{
    if (!is_string($item_identifier)) {
        echo 'noch nicht unterstützt';
    }
    global $CFG, $COURSE;
    $strbookmarks = get_string("mybookmarks", "block_exabis_eportfolio");
    // navigationspfad
    $navlinks = array();
    $navlinks[] = array('name' => $strbookmarks, 'link' => "view.php?courseid=" . $COURSE->id, 'type' => 'title');
    $nav_item_identifier = $item_identifier;
    $icon = $item_identifier;
    $currenttab = $item_identifier;
    // haupttabs
    $tabs = array();
    $tabs[] = new tabobject('personal', $CFG->wwwroot . '/blocks/exabis_eportfolio/view.php?courseid=' . $COURSE->id, get_string("personal", "block_exabis_eportfolio"), '', true);
    $tabs[] = new tabobject('categories', $CFG->wwwroot . '/blocks/exabis_eportfolio/view_categories.php?courseid=' . $COURSE->id, get_string("categories", "block_exabis_eportfolio"), '', true);
    $tabs[] = new tabobject('bookmarks', $CFG->wwwroot . '/blocks/exabis_eportfolio/view_items.php?courseid=' . $COURSE->id, get_string("bookmarks", "block_exabis_eportfolio"), '', true);
    if (block_exabis_eportfolio_get_active_version() >= 3) {
        $tabs[] = new tabobject('views', $CFG->wwwroot . '/blocks/exabis_eportfolio/views_list.php?courseid=' . $COURSE->id, get_string("views", "block_exabis_eportfolio"), '', true);
    }
    $tabs[] = new tabobject('exportimport', $CFG->wwwroot . '/blocks/exabis_eportfolio/exportimport.php?courseid=' . $COURSE->id, get_string("exportimport", "block_exabis_eportfolio"), '', true);
    $tabs[] = new tabobject('sharedbookmarks', $CFG->wwwroot . '/blocks/exabis_eportfolio/shared_people.php?courseid=' . $COURSE->id, get_string("sharedbookmarks", "block_exabis_eportfolio"), '', true);
    // tabs für das untermenü
    $tabs_sub = array();
    // ausgewählte tabs für untermenüs
    $activetabsubs = array();
    if (strpos($item_identifier, 'bookmarks') === 0) {
        $activetabsubs[] = $item_identifier;
        $currenttab = 'bookmarks';
        // untermenü tabs hinzufügen
        $tabs_sub['bookmarksall'] = new tabobject('bookmarksall', $CFG->wwwroot . '/blocks/exabis_eportfolio/view_items.php?courseid=' . $COURSE->id, get_string("bookmarksall", "block_exabis_eportfolio"), '', true);
        $tabs_sub['bookmarkslinks'] = new tabobject('bookmarkslinks', $CFG->wwwroot . '/blocks/exabis_eportfolio/view_items.php?courseid=' . $COURSE->id . '&type=link', get_string("bookmarkslinks", "block_exabis_eportfolio"), '', true);
        $tabs_sub['bookmarksfiles'] = new tabobject('bookmarksfiles', $CFG->wwwroot . '/blocks/exabis_eportfolio/view_items.php?courseid=' . $COURSE->id . '&type=file', get_string("bookmarksfiles", "block_exabis_eportfolio"), '', true);
        $tabs_sub['bookmarksnotes'] = new tabobject('bookmarksnotes', $CFG->wwwroot . '/blocks/exabis_eportfolio/view_items.php?courseid=' . $COURSE->id . '&type=note', get_string("bookmarksnotes", "block_exabis_eportfolio"), '', true);
        if ($sub_item_identifier) {
            $navlinks[] = array('name' => get_string($item_identifier, "block_exabis_eportfolio"), 'link' => $tabs_sub[$item_identifier]->link, 'type' => 'misc');
            $nav_item_identifier = $sub_item_identifier;
        }
    } elseif (strpos($item_identifier, 'exportimport') === 0) {
        $currenttab = 'exportimport';
        // unterpunkt?
        if ($tmp = substr($item_identifier, strlen($currenttab))) {
            $nav_item_identifier = $tmp;
        }
        if (strpos($nav_item_identifier, 'export') !== false) {
            $icon = 'export';
        } else {
            $icon = 'import';
        }
    }
    $item_name = get_string($nav_item_identifier, "block_exabis_eportfolio");
    if ($item_name[0] == '[') {
        $item_name = get_string($nav_item_identifier);
    }
    $navlinks[] = array('name' => $item_name, 'link' => null, 'type' => 'misc');
    $navigation = build_navigation($navlinks);
    print_header_simple($item_name, '', $navigation, "", "", true);
    // header
    print_heading("<img src=\"{$CFG->wwwroot}/blocks/exabis_eportfolio/pix/" . $icon . ".png\" width=\"16\" height=\"16\" alt='icon-{$item_identifier}' /> " . $strbookmarks . ': ' . $item_name);
    print_tabs(array($tabs, $tabs_sub), $currenttab, null, $activetabsubs);
}