Esempio n. 1
0
     $ERRORSTR[] = "You must select a date that the occupant will move into " . html_encode($APARTMENT_INFO["apartment_title"]);
 }
 if (isset($inhabiting_date["finish"]) && (int) $inhabiting_date["finish"]) {
     $PROCESSED["inhabiting_finish"] = (int) $inhabiting_date["finish"];
 } else {
     $ERROR++;
     $ERRORSTR[] = "You must select a date that the occupant will vacate from " . html_encode($APARTMENT_INFO["apartment_title"]);
 }
 if (!$ERROR) {
     $PROCESSED["updated_last"] = time();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     $PROCESSED["aschedule_status"] = "published";
     /**
      * Check to ensure the availability still exists.
      */
     $availability = regionaled_apartment_availability($PROCESSED["apartment_id"], $PROCESSED["inhabiting_start"], $PROCESSED["inhabiting_finish"]);
     if ($availability["openings"] > 0) {
         /**
          * Check to make sure the provided event_id requires accommodation and belongs to the provided proxy_id.
          */
         if ($PROCESSED["event_id"]) {
             $query = "\tSELECT a.*, b.`etype_id`\n\t\t\t\t\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`events` AS a\n\t\t\t\t\t\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`event_contacts` AS b\n\t\t\t\t\t\t\t\t\tON b.`event_id` = a.`event_id`\n\t\t\t\t\t\t\t\t\tWHERE a.`event_id`=" . $db->qstr($PROCESSED["event_id"]) . "\n\t\t\t\t\t\t\t\t\tAND b.`etype_id`=" . $db->qstr($PROCESSED["proxy_id"]);
             $event_info = $db->GetRow($query);
             if ($event_info) {
                 if ($event_info["region_id"] == $APARTMENT_INFO["region_id"]) {
                     if ($event_info["requires_apartment"] == 0) {
                         $ERROR++;
                         $ERRORSTR[] = "The learner has either specified they do not require accommodation for the selected event, or there are no accommodations available in the region this event takes place in.";
                     }
                 } else {
                     $ERROR++;
Esempio n. 2
0
            switch ($STEP) {
                case 2:
                    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/regionaled\\'', 5000)";
                    $SUCCESS++;
                    $SUCCESSSTR[] = "You have successfully assigned <strong>" . html_encode($event_info["firstname"] . " " . $event_info["lastname"]) . "</strong> to <strong>" . html_encode($APARTMENT_INFO["apartment_title"]) . "</strong> during the <strong>" . html_encode($event_info["event_title"]) . "</strong> rotation.<br /><br />You will be automatically redirected back to the " . $APARTMENT_INFO["department_title"] . " dashboard in 5 seconds, or <a href=\"" . ENTRADA_URL . "/admin/regionaled\">click here</a> if you do not wish to wait.";
                    echo display_success();
                    break;
                default:
                    if ($ERROR) {
                        echo display_error($ERRORSTR);
                    }
                    if (count($apartment_ids)) {
                        /**
                         * Check to ensure the availability still exists.
                         */
                        $available_apartments = regionaled_apartment_availability($apartment_ids, $event_info["event_start"], $event_info["event_finish"]);
                        if (is_array($available_apartments) && $available_apartments["openings"] > 0) {
                            ?>
							<div class="userProfile">
								<div class="head">
									<div>Learner Profile</div>
								</div>
								<div class="body">
									<table style="width: 100%" cellspacing="0" cellpadding="0" border="0">
										<tr>
											<td style="width: 110px; vertical-align: top; padding-left: 10px">
												<div style="position: relative">
													<?php 
                            $query = "SELECT `photo_active` FROM `" . AUTH_DATABASE . "`.`user_photos` WHERE `photo_type` = 1 AND `proxy_id` = " . $db->qstr($event_info["proxy_id"]);
                            $uploaded_file_active = $db->GetOne($query);
                            echo "<div id=\"img-holder-" . $event_info["proxy_id"] . "\" class=\"img-holder\">\n";
    } elseif (isset($_POST["apartment_id"]) && ($tmp_input = clean_input($_POST["apartment_id"], array("nows", "int")))) {
        $apartment_id = $tmp_input;
    } else {
        $apartment_id = 0;
    }
    if (isset($_GET["start_date"]) && ($tmp_input = clean_input($_GET["start_date"], array("nows", "notags")))) {
        $start_date = strtotime($tmp_input . " 00:00:00");
    } elseif (isset($_POST["start_date"]) && ($tmp_input = clean_input($_POST["start_date"], array("nows", "notags")))) {
        $start_date = strtotime($tmp_input . " 00:00:00");
    } else {
        $start_date = 0;
    }
    if (isset($_GET["finish_date"]) && ($tmp_input = clean_input($_GET["finish_date"], array("nows", "notags")))) {
        $finish_date = strtotime($tmp_input . " 23:59:59");
    } elseif (isset($_POST["finish_date"]) && ($tmp_input = clean_input($_POST["finish_date"], array("nows", "notags")))) {
        $finish_date = strtotime($tmp_input . " 23:59:59");
    } else {
        $finish_date = 0;
    }
    if ($apartment_id && $start_date && $finish_date) {
        $availability = regionaled_apartment_availability($apartment_id, $start_date, $finish_date);
        if ($availability["openings"] > 0) {
            echo 1;
        } else {
            echo 0;
        }
    } else {
        echo 0;
    }
    exit;
}