Ejemplo n.º 1
0
$action = optional_param('what', '', PARAM_ACTION);
$zipname = optional_param('zipname', NULL, PARAM_CLEAN);
$zipid = optional_param('zipid', NULL, PARAM_INT);
if ($zipname == NULL) {
    $zipname = 'zip01';
}
$cb = fm_clean_checkbox_array();
if ($cb != NULL) {
    $USER->fm_cb = $cb;
}
if (!($course = get_record('course', 'id', $id))) {
    error("That's an invalid course id", "view.php?id={$id}&rootdir={$rootdir}&groupid={$groupid}");
}
require_login($course->id);
// Ensures the user is able to view the fmanager
fm_check_access_rights($course->id);
$strtitle = get_string('zipfiles', 'block_file_manager');
$nav[] = array('name' => get_string('filemanager', 'block_file_manager'), 'link' => "view.php?id={$id}&groupid={$groupid}", 'type' => 'misc');
$nav[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($nav);
print_header($strtitle, format_string($course->fullname), $navigation, '', '', false, " ", " ");
if ($action == 'zipsel') {
    $headingstr = get_string('zipfiles', 'block_file_manager');
} elseif ($action == 'unzip') {
    $headingstr = get_string('unzipfiles', 'block_file_manager');
}
print_heading($headingstr);
switch ($action) {
    case 'viewzip':
        if ($groupid == 0) {
            $list = fm_view_zipped(fm_get_user_link($zipid), $groupid);
Ejemplo n.º 2
0
if (isset($_POST['cbu'])) {
	$cbu = $_POST['cbu'];		// Checkbox array
}
*/
$cbu = optional_param('cbu', null, PARAM_INT);
if (is_array($cbu)) {
    $tmp = array();
    foreach ($cbu as $c) {
        $tmp[] = (int) $c;
    }
    $cbu = $tmp;
} else {
    //$cbu[] = (int)$cb;
}
// Ensures the user is able to view the fmanager and can share files
fm_check_access_rights($course->id, true, true);
$strtitle = get_string('addlink', 'block_file_manager');
$nav[] = array('name' => get_string('filemanager', 'block_file_manager'), 'link' => "view.php?id={$id}&groupid={$groupid}", 'type' => 'misc');
$nav[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($nav);
print_header($strtitle, format_string($course->fullname), $navigation, "", "", false, " ", " ");
if ($groupid != 0) {
    // Depending on the groupmode, ensures that the user is member of the group and is allowed to access
    $groupmode = groups_get_course_groupmode($course);
    switch ($groupmode) {
        case NOGROUPS:
            // Should no to be there ...
            error(get_string('errnogroups', 'block_file_manager'), "{$CFG->wwwroot}/course/view.php?id={$course->id}");
            break;
        case VISIBLEGROUPS:
        case SEPARATEGROUPS: