} </style> </head><!--/head--> <body style="overflow:hidden"> <!-- Remove overflow to use scrollbars --> <?php include "resources/navbar.php"; ?> <section id="page-title" class="torquiose peter-river" style=""> <div class="container"> <div class="row"> <?php $time = get_time_set("7:00-8:30"); ?> <h3> <i class="icon-map-marker" ></i> I'm the MAP!!!<?php echo $time["time-start"] . " - " . $time["time-end"]; ?> </h3> </div> </div> </section><!--/#services--> <div id="viewport" class="hidden" style="margin:20px; background-color:#FFF; height:460px; border:1px solid #DADADA; padding: 10px;"> <h1>This is it</h1> <i class="icon-linux "></i> </div><!--/#main--> <section class="" style="padding-bottom:0; padding-top:20px; height:90%">
function insert_schedule_entries($db_con, $class_id, $day, $time, $room) { //$schedule_details = array( "class_id"=>$class_id, "day"=>$day, "time"=>$time, "room"=>$room); $count = 0; $room = str_replace("-", " ", $room); $days = explode("/", $day); $times = explode("/", $time); $rooms = explode("/", $room); $building = explode(" ", $rooms[0])[0]; //echo $day." ".$time." ".$room." "; $count = count($days); if ($count < count($times)) { $count = count($times); } elseif ($count < count($rooms)) { $count = count($rooms); } for ($i = 0; $i < $count; $i++) { $day_i = $i < count($days) ? $i : count($days) - 1; $time_i = $i < count($times) ? $i : count($times) - 1; $room_i = $i < count($rooms) ? $i : count($rooms) - 1; $day_str = $days[$day_i]; $time = $times[$time_i]; $room = $rooms[$room_i]; if (is_numeric($room)) { $room = $building . " " . $room; } //echo $room." --------"; $building_code = strtolower($building); $building_code = insert_building($db_con, $building_code, ''); if ($building_code == NULL) { //notify : alert user that entry has building code not existing in the database continue; } $room_code = insert_room($db_con, $room, $building_code, NULL); //echo $room_code."- "; //echo $day_str." ".$time." ".$room." = "; $time_set = get_time_set($time); // returns array containing start time and end time of given time range $time_start = date("H:i:s", strtotime($time_set['time-start'])); $time_end = date("H:i:s", strtotime($time_set['time-end'])); $pos_m = stripos($day_str, "M"); $pos_t = stripos($day_str, "T"); $pos_w = stripos($day_str, "W"); $pos_th = stripos($day_str, "Th"); $pos_f = stripos($day_str, "F"); $pos_sat = stripos($day_str, "Sat"); //echo " [ ".$pos_m ." ] "; //echo " [ ".$pos_t ." ] "; //echo " [ ".$pos_w ." ] "; //echo " [ ".$pos_th." ] "; //echo " [ ".$pos_f ." ] "; if (is_numeric($pos_sat)) { $day = "saturday"; $day = 6; insert_schedule($db_con, $class_id, $day, $time_start, $time_end, $room_code); } else { if (is_numeric($pos_m)) { $day = "monday"; $day = 1; insert_schedule($db_con, $class_id, $day, $time_start, $time_end, $room_code); //echo "<br>monday<br>"; } if (is_numeric($pos_t)) { $check = true; if ($pos_t < strlen($day_str) - 1) { //echo "<br><br>".strcasecmp(substr($day_str, $pos_t+1, 1),"h"); if (strcasecmp(substr($day_str, $pos_t + 1, 1), "h") == 0) { $check = false; } } if ($check) { $day = "tuesday"; $day = 2; insert_schedule($db_con, $class_id, $day, $time_start, $time_end, $room_code); //echo "<br>tuesday<br>"; } } if (is_numeric($pos_w)) { $day = "wednesday"; $day = 3; insert_schedule($db_con, $class_id, $day, $time_start, $time_end, $room_code); //echo "<br>wednesday<br>"; } if (is_numeric($pos_th)) { $day = "thursday"; $day = 4; insert_schedule($db_con, $class_id, $day, $time_start, $time_end, $room_code); //echo "<br>thursday<br>"; } if (is_numeric($pos_f)) { $day = "friday"; $day = 5; insert_schedule($db_con, $class_id, $day, $time_start, $time_end, $room_code); //echo "<br>friday<br>"; } } } }