Example #1
0
 /**
  * Returns true if the closed timestamp/class deadline exceeds the current time
  */
 function isClosed()
 {
     //first check the local timestamp
     if (!is_null($this->closed)) {
         return $this->closed < time();
     } elseif ($class_data = MSPRClassData::get($this->getUser()->getGradYear())) {
         if ($class_data) {
             $class_closed = $class_data->getClosedTimestamp();
             //check the class data
             return $class_closed && $class_closed < time();
         }
     }
     return false;
     //no close date
 }
Example #2
0
			<?php 
            } else {
                ?>
			<div class="display-notice"><h3>None Found</h3>No MSPRs require attention at this time.</div>
			<?php 
            }
            break;
        case "year":
            if ($year) {
                $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/mspr?year=" . $year, "title" => "Class of " . $year);
                $mspr_meta = MSPRClassData::get($year);
                add_mspr_admin_sidebar($year);
                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;
                }
 $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/mspr?year=" . $year, "title" => "Class of " . $year);
 $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/mspr?section=mspr-options?year=" . $year, "title" => "MSPR Class Options");
 $PROCESSED = array();
 if (is_array($_SESSION["permissions"]) && ($total_permissions = count($_SESSION["permissions"]) > 1)) {
     $sidebar_html = "The following individual" . ($total_permissions - 1 != 1 ? "s have" : " has") . " given you access to their " . APPLICATION_NAME . " permission levels:";
     $sidebar_html .= "<ul class=\"menu\">\n";
     foreach ($_SESSION["permissions"] as $access_id => $result) {
         if ($access_id != $ENTRADA_USER->getDefaultAccessId()) {
             $sidebar_html .= "<li class=\"checkmark\"><strong>" . html_encode($result["fullname"]) . "</strong><br /><span class=\"content-small\">Exp: " . ($result["expires"] ? date("D M d/y", $result["expires"]) : "Unknown") . "</span></li>\n";
         }
     }
     $sidebar_html .= "</ul>\n";
     new_sidebar_item("Delegated Permissions", $sidebar_html, "delegated-permissions", "open");
 }
 add_mspr_admin_sidebar($year);
 $class_data = MSPRClassData::get($year);
 $class_close = $class_data->getClosedTimestamp();
 if ($_POST["action"] == "Update Options") {
     $class_close_date = $_POST['close_datetime_date'];
     $class_close_hour = $_POST['close_datetime_hour'];
     $class_close_min = $_POST['close_datetime_min'];
     //error checking.... the fun part
     if (!$class_close_date || !checkDateFormat($class_close_date)) {
         add_error("Invalid date format. The submission deadline date must be in the format yyyy-mm-dd, and be a valid date.");
     }
     if (!$class_close_hour < 0 || $class_close_hour > 23 || $class_close_mins < 0 || $class_close_mins > 59) {
         add_error("Invalid time. Please check your values and try again.");
     }
     $parts = date_parse($class_close_date);
     $timestamp = mktime($class_close_hour, $class_close_min, 0, $parts['month'], $parts['day'], $parts['year']);
     if (!has_error()) {