Example #1
0
                if (!$mspr_meta) {
                    //no class data set up.. create it now
                    MSPRClassData::create($year, null);
                    $mspr_meta = MSPRClassData::get($year);
                }
                $class_close = $mspr_meta->getClosedTimestamp();
                if (!$class_close) {
                    $opt_notice = "<div class=\"display-notice\">MSPR submission deadline has not been set. It is strongly recommended that you <a href=\"" . ENTRADA_URL . "/admin/mspr?section=mspr-options&year=" . $year . "\" >set the deadline</a> in the options now.</div>";
                }
                //cannot assume that the class list hasn't changed.
                $query = "INSERT IGNORE into `student_mspr` (`user_id`) select a.id from `" . AUTH_DATABASE . "`.`user_data` a \n\t\t\t\t\t\t\twhere a.`grad_year`=" . $db->qstr($year) . " and \n\t\t\t\t\t\t\ta.`id` NOT IN (SELECT b.`user_id` from `student_mspr` b)";
                if (!$db->Execute($query)) {
                    add_error("Failed to update MSPR Clas List");
                    application_log("error", "Unable to update student_mspr records. Database said: " . $db->ErrorMsg());
                }
                $msprs = MSPRs::getYear($year);
                if (!isset($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["showAll"])) {
                    $_SESSION[APPLICATION_IDENTIFIER][$MODULE]["showAll"] = true;
                }
                if ($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["showAll"] == true) {
                    $ONLOAD[] = "showAll();";
                } else {
                    $ONLOAD[] = "hideAttentionNotRequired();";
                }
                ?>
				<script>

				function showAll() {
					$("mspr-class-list").addClassName("show-all");
				}
				
     $parts = date_parse($class_close_date);
     $timestamp = mktime($class_close_hour, $class_close_min, 0, $parts['month'], $parts['day'], $parts['year']);
     if (!has_error()) {
         $has_custom = MSPRs::hasCustomDeadlines_Year($year);
         if ($_POST["confirm"] != "Continue" && $has_custom) {
             //there are set custom deadlines. need to present another set of options
             $page_mode = "confirm";
         } else {
             $resolve_type = $_POST['resolve_type'];
             $class_data->setClosedTimestamp($timestamp);
             switch ($resolve_type) {
                 case "update_earlier":
                     MSPRs::clearCustomDeadlinesEarlierThan_Year($year, $timestamp);
                     break;
                 case "update_all":
                     MSPRs::clearCustomDeadlines_Year($year);
                     break;
             }
             if (!has_error()) {
                 add_success("MSPR options for the class of " . $year . " successfully updated.<br /><br />You will be redirected to the MSPR Class page in 5 seconds.");
                 $page_mode = "complete";
                 header("refresh:5;url=" . ENTRADA_URL . "/admin/mspr?year=" . $year);
             }
         }
     }
 }
 switch ($page_mode) {
     case "complete":
         display_status_messages();
         break;
     case "confirm":