Exemplo n.º 1
0
            unset($cat);
        }
    }
    header('Location: ' . $_SESSION['gradebook_dest'] . '?addallcat=&selectcat=0');
    exit;
}
//move a category
$selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
if (isset($_GET['movecat'])) {
    $move_cat = Security::remove_XSS($_GET['movecat']);
    GradebookUtils::block_students();
    $cats = Category::load($move_cat);
    if (!isset($_GET['targetcat'])) {
        $move_form = new CatForm(CatForm::TYPE_MOVE, $cats[0], 'move_cat_form', null, api_get_self() . '?movecat=' . $move_cat . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
        if ($move_form->validate()) {
            header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&movecat=' . $move_cat . '&targetcat=' . $move_form->exportValue('move_cat'));
            exit;
        }
    } else {
        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
        $targetcat = Category::load($get_target_cat);
        $course_to_crsind = $cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null;
        if (!($course_to_crsind && !isset($_GET['confirm']))) {
            $cats[0]->move_to_cat($targetcat[0]);
            header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
            exit;
        }
        unset($targetcat);
    }
    unset($cats);
}