diff --git a/.gitignore b/.gitignore index 397e699..6486ae1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -application/cache/* -application/logs/* -cache* -temp* \ No newline at end of file +/application/cache/* +/application/logs/* +/cache/* +/temp/* +!/temp/README.txt \ No newline at end of file diff --git a/application/controllers/booking.php b/application/controllers/booking.php index 068adf7..8a53701 100644 --- a/application/controllers/booking.php +++ b/application/controllers/booking.php @@ -15,10 +15,7 @@ class Booking extends CI_Controller { //$this->template->load(template, view, vars) function Booking(){ parent::__construct(); - - //TEMP - - + //Check for existing login if(!strlen($this->session->userdata('username')) > 0){ $this->session->set_flashdata('origin', current_url()); @@ -176,6 +173,8 @@ function submit(){ $this->email->message($email_content); $this->email->attach('temp/'.$id.'.ics'); $this->email->send(); + $this->booking_model->delete_ics($id); + $this->session->set_flashdata('success', "Booking Successfully Made"); @@ -193,4 +192,5 @@ function submit(){ redirect(base_url()); } } + } \ No newline at end of file diff --git a/application/libraries/Calendar.php b/application/libraries/Calendar.php index 735a5a0..4f0815e 100644 --- a/application/libraries/Calendar.php +++ b/application/libraries/Calendar.php @@ -17,9 +17,9 @@ function drawCalendar($month = null, $year = null, $selected_day = null) { $rows = 1; $output = ""; - $output .= ''; - $output .= ''; - $output .= ""; + $output .= '
<  '. date('F Y', $date) .'  >
SuMoTuWeThFrSa
'; + $output .= ''; + $output .= ""; $output .= ""; for($i = 1; $i <= $offset; $i++){ diff --git a/application/models/booking_model.php b/application/models/booking_model.php index d755e05..20e2f99 100644 --- a/application/models/booking_model.php +++ b/application/models/booking_model.php @@ -111,6 +111,8 @@ function is_allowed($room_id){ function book_room($room_id, $start, $end, $comment){ //Make sure the slot is not already booked! + $this->db->cache_off(); + $sql = "SELECT * FROM bookings WHERE start >= '". date('Y-m-d H:i:s', $start)."' and end <= '". date('Y-m-d H:i:s', $end)."' @@ -118,6 +120,8 @@ function book_room($room_id, $start, $end, $comment){ $existing_bookings = $this->db->query($sql); + $this->db->cache_on(); + if($existing_bookings->num_rows() == 0){ $data = array( 'room_id' => $room_id, @@ -281,15 +285,27 @@ function set_block_booking_rooms($rooms, $bb_id){ } function generate_ics($booking_id){ + $this->load->model('room_model'); + $this->db->where('booking_id', $booking_id); $booking_data = $this->db->get('bookings')->row(); + $room_result = $this->room_model->load_room($booking_data->room_id); + $room = $room_result['room_data']->row(); + $data = array( 'start' => strtotime($booking_data->start), 'end' => strtotime($booking_data->end), + 'room' => $room->name, + 'booking_id' => $booking_id, ); $ics_content = $this->load->view('email/booking_ics',$data, TRUE); file_put_contents('temp/'.$booking_id.'.ics', $ics_content); } + + function delete_ics($booking_id){ + @unlink('temp/'.$booking_id.'.ics'); + return; + } } \ No newline at end of file diff --git a/application/views/booking/booking_main.php b/application/views/booking/booking_main.php index 3d9a163..ce7a099 100644 --- a/application/views/booking/booking_main.php +++ b/application/views/booking/booking_main.php @@ -28,40 +28,56 @@ session->flashdata('success') !== FALSE): ?>session->flashdata('danger') !== FALSE): ?> -
- -
-
SHOW TODAY
- -input->get('date') !== FALSE): ?> - -
Filter -
- -
- result() as $resource): ?> -
- +
+
+ - - result() as $building): ?> -
- +
+
- - +
+
+
+ +input->get('date') !== FALSE): ?> + +
@@ -84,21 +100,21 @@ if(isset($rooms[$role->role_id])): ?> -

name; ?>

+ +

name; ?>

+
name; ?>+
- - - -
Previous Month'. strtoupper(date('F Y', $date)) .'Next Month
SUNMONTUEWEDTHUFRISAT
+
+ '; + echo ''; $tStart = mktime(0,0,0) + (($hours['min'] * 24) * 60 * 60); @@ -110,7 +126,7 @@ $tNow = $tStart; while($tNow <= $tEnd){ - echo ''; + echo ''; $tNow += 60 * 30; //30 MINUTES (60 seconds * 30) } @@ -130,7 +146,7 @@ else{ $seats = "1 seat"; } - echo ''; + echo ''; $tStart = mktime(0,0,0, $date_raw['month'], $date_raw['day'], $date_raw['year']) + (($hours['min'] * 24) * 60 * 60); //Start the "closed" slot at the earliest time } @@ -153,7 +169,7 @@ $numSlots = ceil(((($hours[$room->external_id]->STARTTIME - $hours['min']) * 24) * 60) / 30); //Output the placeholder - echo ''; + echo ''; //Adjust the starting time to be offset $tStart = mktime(0,0,0,$date_raw['month'], $date_raw['day'], $date_raw['year']) + (($hours[$room->external_id]->STARTTIME * 24) * 60 * 60); @@ -176,10 +192,12 @@ if(strtotime($block_booking['start']) < $tStart){ $block_booking['start'] = date('Y-m-d H:i:s', $tStart); } - + //Since we bumped the start time forward, make sure it didn't pass the end time. If it did, ignore the block booking (since the booking started/ended during closed hours) if($block_booking['end'] > $block_booking['start']){ + if(array_key_exists($room->room_id, $block_booking['room']) && strtotime($block_booking['start']) == $tNow){ + $bbStart = strtotime($block_booking['start']); $bbEnd = strtotime($block_booking['end']); @@ -199,7 +217,7 @@ $end_row = true; } - echo ''; + echo ''; break; } @@ -219,11 +237,14 @@ $booker_name = $bookings[$room->room_id][$tNow]->booker_name; //If this is your booking, or you are admin, show who booked it - if($booker_username == $this->session->userdata('username') || $this->session->userdata('super_admin') == TRUE){ - echo ''; + if($booker_username == $this->session->userdata('username') ){ + echo ''; + } + else if($this->session->userdata('super_admin') == TRUE){ + echo ''; } else{ - echo ''; + echo ''; } $tNow += 60 * $diff ; //Add "diff" minutes @@ -237,10 +258,10 @@ //Check to see if the date is in the past, or too far in the future if(time() > $tNow){ - echo ''; + echo ''; } else{ - echo ''; + echo ''; } $tNow += 60 * 30; //Add 30 minutes @@ -254,7 +275,7 @@ $numSlots = ceil(((($hours['max'] - $hours[$room->external_id]->ENDTIME) * 24) * 60) / 30); //Output the placeholder - echo ''; + echo ''; } echo ''; diff --git a/application/views/denied.php b/application/views/denied.php new file mode 100644 index 0000000..b50529b --- /dev/null +++ b/application/views/denied.php @@ -0,0 +1,15 @@ + + +template->set('headers', $head);?> + + + +

Ryerson University Libray Room Booking

+ +

You do not have access to the Library Room Booking System

+ +

If you believe you have reached this page in error, please contact

+ +

Logout

+
+template->set('content', $content);?> \ No newline at end of file diff --git a/application/views/email/booking_ics.php b/application/views/email/booking_ics.php index fc38121..b637c98 100644 --- a/application/views/email/booking_ics.php +++ b/application/views/email/booking_ics.php @@ -2,11 +2,11 @@ VERSION:2.0 PRODID:-//Ryerson University Library//NONSGML v1.0//EN BEGIN:VEVENT -UID:session->userdata('username').EMAIL_SUFFIX; ?> -DTSTAMP: -DTSTART: -DTEND: -SUMMARY: Library Room Booking -LOCATION: TST100 +UID:session->userdata('username').EMAIL_SUFFIX. ":". $booking_id. "\n"; ?> +DTSTAMP: +DTSTART: +DTEND: +SUMMARY: Library Room Booking +LOCATION: END:VEVENT END:VCALENDAR \ No newline at end of file diff --git a/assets/css/booking_main.css b/assets/css/booking_main.css index c0461f3..52b2584 100644 --- a/assets/css/booking_main.css +++ b/assets/css/booking_main.css @@ -3,16 +3,12 @@ padding: 0; } -#showtoday{ - font-size: 0.9em; - background-color: #000000; - color: #FFFFFF; - padding: 0.3em 0.6em; - text-align:center; - margin: 0 auto; - text-decoration: none; +a, a:visited, a:hover, a:active { + color: inherit; } + + .center{ text-align: center; margin: 0 auto; @@ -20,19 +16,37 @@ .calendar_container{ margin-bottom:0.4em; + float: right; } .table_calendar{ - width: 300px; + width: 450px; + height: 300px; background-color: #f2f2f2; - border: 2px solid #d8d8d8; + margin: 0 auto; + border-collapse: collapse; +} + +.table_calendar a.month_arrow { + font-size: 25px; + background-color: #f5945d; + display: block; + height: 70px; + line-height: 70px; + width: 55px; + padding: 0!important; + margin: 0!important; + } .table_calendar a{ text-decoration: none; color: #000075; font-size: 14px; + width: 30px; + height: 30px; + display: inline-block; } .table_calendar .month_year a{ @@ -40,38 +54,57 @@ } .table_calendar td,.table_calendar th{ - padding: 0.4em; text-align: center; width: 90px; + height: 40px; + border-collapse: collapse; + font-family: 'Open Sans', sans-serif; + font-size:17px; + } + + + .table_calendar .month_year{ - font-size: 1.8em; text-align: center; - border-bottom: 2px solid #d8d8d8; - background-color: #f35d3c; + background-color: #f27935; color: #FFFFFF; - padding: 0.4em; + padding: 0; + margin: 0; + height: 70px; + line-height: 70px; + position: relative; + top: -2px; + font-family: 'Open Sans', sans-serif; + font-size:30px; + font-weight: normal; } -.table_calendar .calendar_today{ +.table_calendar .calendar_today a{ text-align: center; - -moz-border-radius: 28px; /* or 50% */ - border-radius: 28px; /* or 50% */ - - background-color: #f35d3c; - color: #FFFFFF; + -moz-border-radius: 0.5em; /* or 50% */ + border-radius: 0.5em; /* or 50% */ + width: 40px; + height: 40px; + line-height: 40px; + display: inline-block; + background-color: #a3eaf9; + } -.table_calendar .selected_date { +.table_calendar .selected_date a{ text-align: center; - -moz-border-radius: 28px; /* or 50% */ - border-radius: 28px; /* or 50% */ - - background-color: #ffffa4; + -moz-border-radius: 0.5em; /* or 50% */ + border-radius: 0.5em; /* or 50% */ + width: 40px; + height: 40px; + line-height: 40px; + display: inline-block; + background-color: #fbd4be; } .table_calendar .past_date a{ @@ -86,63 +119,124 @@ position: relative; } +.role_title{ + background-color: #191d23; + margin-left: 6px; + height: 40px; + color: #ffffff; + line-height: 40px; + padding-left: 3em; + font-size: 17px; + font-family: 'Open Sans', sans-serif; + position: relative; + top: 1px; + margin-top: 2em; +} + +.role_title_collapse a{ + float: right; + display: inline-block; + width: 40px; + background-color: #323a45; + text-align: center; + font-size: 23px; + text-decoration: none; +} + .table-wrapper { overflow-x:scroll; overflow-y:visible; margin-left: 185px; + } tr.room_row > td{ max-width: 70px; min-width: 70px; - padding: 0.4em; - border: 1px solid #999999; + padding: 0; + border: 1px solid #000000; } .table-wrapper th { - padding: 5px 20px; + padding: 0; width: 180px; max-width: 180px; - border: 1px solid #999999; - background-color: #ffffa4; + color: #ffffff; + background-color: #35383b; text-align:center; white-space: nowrap; + +} + +.table_cell_height{ + height: 25px; + line-height: 25px; + overflow: hidden; + text-overflow: ellipsis; + font-size: 1em; + width: 9em; + margin: 0 auto; + +} + +.room_name .table_cell_height{ + margin: 0; + width: 12em; +} + + +.booking_table td{ + max-height: 30px; + height: 30px; + min-height: 30px; + border: none; + overflow: hidden; +} + +.booking_table th{ + max-height: 30px; + height: 30px; + min-height: 30px; + border: 1px solid #000000; + + } .table-wrapper th:first-child { position: absolute; - left: 5px; - margin-top: -1px; - border-right: none; + left: 6px; + + } .table-wrapper .room_name{ color: #FFFFFF; - background-color: #f35d3c; + background-color: #f27935; text-align: left; + padding-left: 1em; } .table-wrapper .room_free{ - background-color: #63cbd8; - display: table-cell; + background-color: #a1e3ef; + min-width: 90px; - border: 1px solid #999999; - height: 30px; + border: 1px solid #000000; + text-align: center; } .table-wrapper .not_avail{ background-color: #e3e3e3; - display: table-cell; + min-width: 90px; - border: 1px solid #999999; - height: 30px; + border: 1px solid #000000; + text-align: center } @@ -161,7 +255,17 @@ tr.room_row > td{ } .booked_cell{ - background-color: #e3e3e3; + background-color: #e6e6e6; + color: #999999; + text-align: center; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.my_booked_cell{ + background-color: #1fbba6; + color: #333333; text-align: center; overflow: hidden; text-overflow: ellipsis; @@ -169,7 +273,8 @@ tr.room_row > td{ } .closed{ - background-color: #f1e4c9; + background-color: #2b3035; + color: #ffffff; text-align: center; overflow: hidden; text-overflow: ellipsis; @@ -182,4 +287,68 @@ tr.room_row > td{ #filter_container{ display: none; + color: #000000; +} + +#top_left{ + float: left; +} + +#top_content{ + width: 780px; + margin: 0 auto; +} + +#app_links{ + margin-bottom: 2em; +} + +#app_links li{ + list-style: none; + margin-bottom: 2px; + +} + +#app_links li a{ + text-decoration: none; + height: 40px; + line-height: 40px; + background-color: #F2F2F2; + color: #5E6D82; + text-align: center; + width: 280px; + display: inline-block; + + font-weight: bold; + border-radius:0.4em; +} + +#app_links .selected{ + color: #FFFFFF; + background-color: #323A45; +} + +#filter_link_title{ + width: 280px; + text-align: center; + text-decoration: none; + background-color: #f27935; + display: inline-block; + height: 40px; + line-height: 40px; + color: #FFFFFF; + font-weight: bold; + border-radius: 0.4em; +} + +#filter_link { + float: right; + color: #FFFFFF; + background-color: #f5945d; + border-top-right-radius: 0.2em; + border-bottom-right-radius: 0.2em; + text-decoration: none; + width: 40px; + font-size: 1.5em; + text-align: center; } \ No newline at end of file diff --git a/assets/img/Book-Room-Icon1.png b/assets/img/Book-Room-Icon1.png new file mode 100644 index 0000000..642aa3e Binary files /dev/null and b/assets/img/Book-Room-Icon1.png differ diff --git a/assets/img/Book-Room-Icon10.png b/assets/img/Book-Room-Icon10.png new file mode 100644 index 0000000..23397ee Binary files /dev/null and b/assets/img/Book-Room-Icon10.png differ diff --git a/assets/img/Book-Room-Icon11.png b/assets/img/Book-Room-Icon11.png new file mode 100644 index 0000000..a5c6719 Binary files /dev/null and b/assets/img/Book-Room-Icon11.png differ diff --git a/assets/img/Book-Room-Icon12.png b/assets/img/Book-Room-Icon12.png new file mode 100644 index 0000000..4627c06 Binary files /dev/null and b/assets/img/Book-Room-Icon12.png differ diff --git a/assets/img/Book-Room-Icon13.png b/assets/img/Book-Room-Icon13.png new file mode 100644 index 0000000..eb71402 Binary files /dev/null and b/assets/img/Book-Room-Icon13.png differ diff --git a/assets/img/Book-Room-Icon14.png b/assets/img/Book-Room-Icon14.png new file mode 100644 index 0000000..f2b23e8 Binary files /dev/null and b/assets/img/Book-Room-Icon14.png differ diff --git a/assets/img/Book-Room-Icon15.png b/assets/img/Book-Room-Icon15.png new file mode 100644 index 0000000..a449eab Binary files /dev/null and b/assets/img/Book-Room-Icon15.png differ diff --git a/assets/img/Book-Room-Icon16.png b/assets/img/Book-Room-Icon16.png new file mode 100644 index 0000000..5212497 Binary files /dev/null and b/assets/img/Book-Room-Icon16.png differ diff --git a/assets/img/Book-Room-Icon2.png b/assets/img/Book-Room-Icon2.png new file mode 100644 index 0000000..f8be274 Binary files /dev/null and b/assets/img/Book-Room-Icon2.png differ diff --git a/assets/img/Book-Room-Icon3.png b/assets/img/Book-Room-Icon3.png new file mode 100644 index 0000000..0658658 Binary files /dev/null and b/assets/img/Book-Room-Icon3.png differ diff --git a/assets/img/Book-Room-Icon4.png b/assets/img/Book-Room-Icon4.png new file mode 100644 index 0000000..da99e1f Binary files /dev/null and b/assets/img/Book-Room-Icon4.png differ diff --git a/assets/img/Book-Room-Icon5.png b/assets/img/Book-Room-Icon5.png new file mode 100644 index 0000000..4028037 Binary files /dev/null and b/assets/img/Book-Room-Icon5.png differ diff --git a/assets/img/Book-Room-Icon6.png b/assets/img/Book-Room-Icon6.png new file mode 100644 index 0000000..9bc86b6 Binary files /dev/null and b/assets/img/Book-Room-Icon6.png differ diff --git a/assets/img/Book-Room-Icon7.png b/assets/img/Book-Room-Icon7.png new file mode 100644 index 0000000..55d1a54 Binary files /dev/null and b/assets/img/Book-Room-Icon7.png differ diff --git a/assets/img/Book-Room-Icon8.png b/assets/img/Book-Room-Icon8.png new file mode 100644 index 0000000..2b1f549 Binary files /dev/null and b/assets/img/Book-Room-Icon8.png differ diff --git a/assets/img/Book-Room-Icon9.png b/assets/img/Book-Room-Icon9.png new file mode 100644 index 0000000..6572198 Binary files /dev/null and b/assets/img/Book-Room-Icon9.png differ diff --git a/assets/js/booking_main.js b/assets/js/booking_main.js index f6dbe93..65cff2b 100644 --- a/assets/js/booking_main.js +++ b/assets/js/booking_main.js @@ -6,6 +6,10 @@ $('#filter_link').on('click', function(){ $('#filter_container').toggle(); }); +$('.role_title_collapse a').on('click', function(){ + $(this).parent().parent().next().toggle(); +}); + //Create the filter functionality $(".filter_checkbox").change(function() { //Reset all the filters, then re-apply them diff --git a/temp/README.txt b/temp/README.txt new file mode 100644 index 0000000..eb64456 --- /dev/null +++ b/temp/README.txt @@ -0,0 +1,3 @@ +This folder is used as temporary storage when ICS files are created. +Also used for caching "hours". Reduces external calls, and make the application faster +DO NOT DELETE IT! \ No newline at end of file
 
 
'.date("g:iA",$tNow).'
'.date("g:iA",$tNow).'
'.$room->name .' ('.$seats.')
'; + echo '
'.$room->name .' • '.$seats.'
'; foreach($resources[$room->room_id]->result() as $resource){ echo ''.$resource->name . ''; @@ -144,7 +160,7 @@ $numSlots = ceil(((($hours['max'] - $hours['min']) * 24) * 60) / 30) + 1; //Output the placeholder - echo '
Closed
Closed
Closed
Closed
'.$block_booking['reason'].'
'.$block_booking['reason'].'
'.$booker_name.'
'.$booker_name.'
'.$booker_name.'
Booked
Booked
'.date("g:iA",$tNow).'
'.date("g:iA",$tNow).'
'.date("g:iA",$tNow).'Closed
Closed