$mspr = MSPR::get($user);
                $name = $user->getFirstname() . " " . $user->getLastname();
                $page_title = $name . "'s MSPR page";
                $url = ENTRADA_URL . "/admin/users/manage/students?section=mspr&id=" . $user_id;
                if ($mspr->saveMSPRFiles()) {
                    success_redirect($url, $page_title, "<p>Report successfully generated.</p>");
                } else {
                    error_redirect($url, $page_title, "<p>Error generating report for " . $name . ".</p>");
                }
                break;
            case "group_mode":
                $timestamp = time();
                foreach ($user_ids as $user_id) {
                    $user = User::get($user_id);
                    $mspr = MSPR::get($user);
                    $name = $user->getFirstname() . " " . $user->getLastname();
                    if (!$mspr->saveMSPRFiles($timestamp)) {
                        add_error("Error generating report for {$name}.");
                    }
                }
                $page_title = "Class of " . $year . " MSPR page";
                $url = ENTRADA_URL . "/admin/mspr?mode=year&year=" . $year;
                if (!has_error()) {
                    success_redirect($url, $page_title, "<p>Reports successfully generated.</p>");
                } else {
                    error_redirect($url, $page_title, "");
                }
                break;
        }
    }
}
        $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/users/manage/students?section=mspr-edit&id=" . $PROXY_ID . "&from=" . $from . $rev_append, "title" => "Edit MSPR");
        $mspr = MSPR::get($user);
        if ($mspr) {
            $is_closed = $mspr->isClosed();
            $rev = $mspr->getMSPRRevisions("html");
            if ($is_closed) {
                if (!empty($rev)) {
                    if (isset($_POST['action']) && $_POST['action'] == 'save') {
                        if (isset($_POST['edit-html']) && ($edit_html = trim($_POST['edit-html']))) {
                            $ts = time();
                            $pdf = $mspr->generatePDF($edit_html);
                            $wrote_html = $mspr->saveMSPRFile("html", $edit_html, $ts);
                            $wrote_pdf = $mspr->saveMSPRFile("pdf", $pdf, $ts);
                            if ($wrote_html && $wrote_pdf) {
                                $mspr->setGeneratedTimestamp($ts);
                                success_redirect($success_url, $success_title, "Successfully edited HTML and generated PDF.");
                            }
                        } else {
                            error_redirect(ENTRADA_URL . "/admin/users/manage/students?section=mspr-edit&id=" . $PROXY_ID . "&from=" . $from . $rev_append, "Edit MSPR", "No content provided. Cannot create empty MSPR.");
                        }
                    } else {
                        if ($REVISION) {
                            $html_file = $mspr->getMSPRFile("html", $REVISION);
                        } else {
                            $html_file = $mspr->getMSPRFile("html");
                        }
                        load_rte("mspr");
                        ?>
						<h1>Edit MSPR: <?php 
                        echo $user->getFullName();
                        ?>