Permalink
Browse files

Style time table

  • Loading branch information...
1 parent d21571f commit ab0a3b4271b92e2e4ab50e0711964a220b60c147 @snwfog snwfog committed Apr 8, 2012
View
2 application/controllers/scheduler.php
@@ -16,7 +16,7 @@ public function time_table(){
private function sort_by_day($set_of_courses){
- $time_table = array("M" => array(), "T" => array(), "W"=> array(), "J"=> array(), "F" => array(), "S" => array(), "SU" => array());
+ $time_table = array("M" => array(), "T" => array(), "W"=> array(), "J"=> array(), "F" => array());
foreach($set_of_courses as $course){
$lecture_days = explode("," , $course["lecture"]["day"]);
foreach($lecture_days as $day){
View
135 application/views/scheduleBuilder_views/time_table.php
@@ -1,76 +1,71 @@
<div id="content">
- <?php
+ <?php
//THIS should be moved to a helper class. helper class help views? maybe dono.
- function get_hour_min($time){
- //Note: should be moved to helper class
- $length = strlen($time);
- $third_last = $length -2;
- $min = substr($time, $third_last, $length);
- $hour= substr($time, 0, $third_last);
- return array("hour" => $hour, "min" =>$min);
- }
- ?>
- <table id="time_table" >
- <tr id="time_table_header">
- <td id="time_header"> <small>Time</small> </th>
- <td id="day_header"> <small>Monday</small> </th>
- <td id="day_header"> <small>Tuesday</small> </th>
- <td id="day_header"> <small>Wednesday</small> </th>
- <td id="day_header"> <small>Thursday</small> </th>
- <td id="day_header"> <small>FUNDAY</small> </th>
- <td id="day_header"> <small>Saturday</small> </th>
- <td id="day_header"> <small>BORINGDAY</small> </th>
- <tr>
- <tr >
+ function get_hour_min($time)
+ {
+ //Note: should be moved to helper class
+ $length = strlen($time);
+ $third_last = $length -2;
+ $min = substr($time, $third_last, $length);
+ $hour= substr($time, 0, $third_last);
+
+ return array("hour" => $hour, "min" =>$min);
+ }
+ ?>
+ <?=anchor(site_url("profile"), "Back"); ?>
+ <table id="time_table" >
+ <tr id="time_table_header">
+ <td>TIME</th><td>MONDAY</th><td>TUESDAY</th>
+ <td>WEDNESDAY</th><td>THURSDAY</th><td>FRIDAY</th>
+ <tr>
+ <tr>
<td>
- <table width=100% id="time_column">
- <?php
- $total_height = 0;
- for($i=7; $i<24; $i++){
- $total_height += 60;
- $bgcolor=null;
- if(($i%2)==0){
- $bgcolor = "bgcolor = 'DDDDDD'";
- }
- echo "<tr height=60px>
- <td ".$bgcolor."> <small>".$i.":00 </small></td>
- </tr>";
- }?>
- </table>
- </td>
- <?php foreach($time_table as $key => $day): ?>
- <td>
- <table width = 100% height = <?php echo $total_height?>px id="day_column">
- <? $last_end = array("min" => 0, "hour" => 7);
- foreach($day as $course){
- $start = get_hour_min($course["start_time"]);
- $end = get_hour_min($course["end_time"]);
- $upper_size = abs((($start["hour"]*60)+$start["min"])-(($last_end["hour"]*60)+$last_end["min"]));
- $lower_size = abs((($start["hour"]*60)+$start["min"])-(($end["hour"]*60)+$end["min"]));
- $last_end = $end;
- echo "
- <tr height=".$upper_size."px>
- <td>
- </td>
- </tr>
- <tr height=".$lower_size."px bgcolor = 'DDDDDD'>
- <td >"
-
- .$course["code"]." ".$course["number"]."<br/>"
- .$course["type"]."(".$course["section"].")<br/>"
- .$start["hour"].":".$start["min"]."-".$end["hour"].":".$end["min"]."<br/>"
- ."
- </td>
+ <table style="width: 100%" id="time_column">
+ <?php
+ $total_height = 0;
+ for($i=7; $i<24; $i++)
+ {
+ $total_height += 60;
+ $bgcolor=null;
+ echo "<tr style='height: 60px'>
+ <td>".$i.":00</td>
</tr>";
- }
- echo "<tr height=100%>
- </tr>";
-
-
- ?>
+ }
+ ?>
</table>
- </td>
- <?php endforeach ?>
- </tr>
- </table>
+ </td>
+ <?php foreach($time_table as $key => $day): ?>
+ <td>
+ <table style="width=100%; height=<?=$total_height?>px" id="day_column">
+ <?php
+ $last_end = array("min" => 0, "hour" => 7);
+ foreach($day as $course)
+ {
+ $start = get_hour_min($course["start_time"]);
+ $end = get_hour_min($course["end_time"]);
+ $upper_size = abs((($start["hour"]*60)+$start["min"])-(($last_end["hour"]*60)+$last_end["min"]));
+ $lower_size = abs((($start["hour"]*60)+$start["min"])-(($end["hour"]*60)+$end["min"]));
+ $last_end = $end;
+ echo "<tr height=".$upper_size."px>
+ <td></td>
+ </tr>
+ <tr height=".$lower_size."px bgcolor = 'DDDDDD'>
+ <td>"
+ .$course["code"]." ".$course["number"]."<br/>"
+ .$course["type"]."(".$course["section"].")<br/>"
+ .$start["hour"].":".$start["min"]."-".$end["hour"].":".$end["min"]."<br/>"
+ ."
+ </td>
+ </tr>";
+ }
+
+ echo "<tr height=100%></tr>";
+
+
+ ?>
+ </table>
+ </td>
+ <?php endforeach ?>
+ </tr>
+ </table>
</div>
View
56 assets/css/style.css
@@ -1,8 +1,8 @@
/**
* Font collections
*------------------*/
-@import url(http://fonts.googleapis.com/css?family=Just+Me+Again+Down+Here|Open+Sans:400,300,600|Maven+Pro:400,700);
-
+/*@import url(http://fonts.googleapis.com/css?family=Just+Me+Again+Down+Here|Open+Sans:400,300,600|Maven+Pro:400,700);
+*/
* {
font-family: 'Helvetica Neue', 'Open Sans', 'Helvetica';
}
@@ -618,33 +618,54 @@ div#menu_list input:hover{
}
/*Time Table CSS*/
+
+#time_table {
+ margin: 20px auto;
+}
+
+#time_table_header {
+ font-family: 'Helvetica Neue', 'Open Sans', 'Helvetica';
+ font-weight: lighter;
+ color: #9a1729;
+}
+
+#time_table_header td:not(:first-child) {
+ width: 110px;
+ text-align: center;
+}
+
+#time_table_header td:first-child {
+ width: 45px;
+}
+
#time_table td{
- border: 1px solid black;
+ border: 1px solid #9a1729;
+ text-align: center;
+ vertical-align: top;
+ padding-top: 2px;
}
-#time_header{
+#time_header {
width: 40px;
- font-size:10px;
- color:Black;
- text-align:center;
- background-color:#DDDDDD;
-}
-#time_table_header{
- border-bottom-width:0;
+ font-size: 10px;
+ color: black;
+ text-align: center;
+ background-color: #DDDDDD;
}
#day_header{
width: 100px;
- font-size:10px;
- color:Black;
- text-align:center;
- background-color:#DDDDDD;
+ font-size: 10px;
+ color: black;
+ text-align: center;
+ background-color: #DDDDDD;
}
-#day_column td{
+#day_column td {
border: 0px;
+ width: 110px;
}
-#time_column td{
+#time_column td {
border: 0px;
font-size:12px;
}
@@ -700,7 +721,6 @@ div#schedule_table_button{
/* End of Schedule Table Css*/
-
/*****************/
/* Media Queries */
/*****************/
View
7 assets/js/script.js
@@ -182,4 +182,11 @@ $(document).ready(function() {
$('#dummy-view-schedule-table').click(function() {
$(this).parents('form').submit();
});
+
+ /**
+ * Alternating Time Table Schedule Coloring
+ */
+ $('table#time_column tr:odd td').css({
+ 'background-color' : 'rgba(154, 23, 41, 0.1)',
+ });
});

0 comments on commit ab0a3b4

Please sign in to comment.