function email_user_approved($reservation_idx) { //emails the user when thier loan has been approved $reserve = ReserveDatabaseAPI::by_id($reservation_idx); $reservation = $reserve[$reservation_idx]; $index = $reserve[$reservation_idx]['building_idx']; $categories = ReserveDatabaseAPI::categories(); $locations = ReserveDatabaseAPI::locations(); $email = new \PSUSmarty(); $email->assign('categories', $categories); $email->assign('locations', $locations); $email->assign('reserve', $reservation); $contents = $email->fetch($GLOBALS['TEMPLATES'] . '/email.user.approve.tpl'); return PSU::mail($reserve[$reservation_idx]['email'], 'Media Request Approved!', $contents, self::headers()); }
//when a user decides to do a new reservation, delete anything that is currently stored in the session unset($_SESSION['cts']); //delete the cts session array $response->redirect($GLOBALS['BASE_URL'] . '/reserve/'); }); //end new reservation respond('POST', '/success', function ($request, $response, $app) { //when the user has finally confirmed their reservation if (count($_SESSION['cts']['equipment']) <= 0) { //check to make sure that there is at least one equipment item selected $_SESSION['errors'][] = "Please select at least one item from the list of equipment."; $response->redirect($GLOBALS['BASE_URL'] . '/reserve/equipment'); } //put the data in the correct form before inserting it into the database $currtime = date('Y-n-j G:i:s'); $categories = ReserveDatabaseAPI::categories(); $start_time = date("H:i:s", strtotime($_SESSION['cts']['start_time'])); $end_time = date("H:i:s", strtotime($_SESSION['cts']['end_time'])); $start_date = date("Y-m-d", strtotime($_SESSION['cts']['start_date'])); $end_date = date("Y-m-d", strtotime($_SESSION['cts']['end_date'])); foreach ($_SESSION['cts']['equipment'] as $i) { $name = $categories[$i]; $equipment .= $name . ", "; } $data = array($_SESSION['wp_id'], $_SESSION['cts']['last_name'], $_SESSION['cts']['first_name'], $_SESSION['cts']['phone'], $_SESSION['cts']['email'], $currtime, $start_date, $start_time, $end_date, $end_time, $_SESSION['cts']['comments'], $_SESSION['cts']['location'], $_SESSION['cts']['room'], $_SESSION['cts']['title'], $_SESSION['cts']['reserve_type'], $equipment, "pending"); $insert_id = ReserveDatabaseAPI::insert_reservation($data); //mail the user and the cts staff CTSEmailAPI::email_user($_SESSION['cts']); CTSEmailAPI::email_CTS($_SESSION['cts'], $insert_id); unset($_SESSION['cts']); //delete the cts session array