html - PHP - Create a Schedule table in relation to time -
i'm doing school project , have create schedule array. sorted array day & time. know how create simple table , insert data - wanted make more defined table in relation time:
the array monday looks this:
array ( [0] => array ( [courseid] => comp275 [lectureid] => gg [day] => monday [stime] => 12:15 [etime] => 15:16 [term] => winter [year] => 2014 ) [1] => array ( [courseid] => comp345 [lectureid] => ss [day] => monday [stime] => 18:20 [etime] => 20:30 [term] => winter [year] => 2014 ) )
i want table column "monday"
table type http://4.ii.gl/mthvqn.png
this code @ moment (its bit broken haven't figured out how want yet.)
<table> <tr> <th>monday</th> <th>tuesday</th> <th>wednesday</th> <th>thursday</th> <th>friday</th> </tr> <?php getmonday($array); ?> </table>
function :
foreach($array $ma) { echo "<tr class='success'><td>". "start-time :".$ma["stime"]." " ."<br><br>". "course :".$ma["courseid"]." " ."<br><br>". "end-time :".$ma["etime"]." " ."</td></tr>"; }
gives me :
instead of using cells in day colum, create div
s each class , change height based off time. example -
$curr_time = strtotime('08:00'); //beginning of day foreach($array $ma) { // create blank div if not equal $curr_time if(strtotime($ma['stime']) != $curr_time){ $empty_size = // size difference between $ma['stime'] , $curr_time echo "<div style='height:{$empty_size}px;'></div>"; } // create div class time $div_size = // size difference between $ma['etime'] , $ma['stime'] echo "<div class='success' style='height:{$div_size}px;'>". // data "start-time :".$ma["stime"]." " ."<br><br>". "course :".$ma["courseid"]." " ."<br><br>". "end-time :".$ma["etime"]. // end of data "</div>"; // change $curr_time $ma['etime'] $curr_time = strtotime($ma['etime']) ; }
since school project, won't give code / full working example, sample code/idea. need find way determine height of div
s based off difference in time. helps.
Comments
Post a Comment