Thread: Timetable

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    33
    Rep Power
    3

    Timetable


    HI everyone!! I am developing scheduling module for our thesis. My problem is how can I create dynamic timetable. I cannot place data from the database to a specific column. For example, the time is 8:00 - 8:30 and the room is Room 2.

    The <th> are, Time, Room 1, Room 2, Room 3 etc.
    and below the Time are the times 8:00-8:30, 8:30 - 9:00 in just one column.

    Now, I can place the data right in 8:00-8:30 but the Room 2 is so difficult to align.

    I hope you can understand me.

    Thank you! hoping for any replies.
  2. #2
  3. Jealous Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,303
    Rep Power
    9400
    What's your code?

    Comments on this post

    • ManiacDan agrees : Merry Christmas buddy
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    33
    Rep Power
    3
    btw, im using codeigniter php framework. my code is php
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Originally Posted by bads
    my code is php
    He was asking you to post your concrete code. The problem is that we, contrary to popular belief, can neither read minds nor access servers through telepathy. So we cannot help you with your table until we actually see it (I mean the code, not a screenshot or something).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    33
    Rep Power
    3
    im sorry,

    here is my view

    PHP Code:
    <div class=schedule>
                    <table>
                        <tr>
                            <th>Time</th>
                            <?php foreach($rooms as $room_item): ?>
                                <th> <?php echo $room_item['roomname'];?> </th>
                            <?php endforeach?>
                            <th></th>
                        </tr>
                        
                        <?php echo form_open('pms/pms/viewsched'?>
                        
                        View Schedule on: <input class=input name= "scheddate" type =date required=required></input> </br>
                        
                        Select Therapist: 
                        <select class = "input" name="therapists">    
                            <option> All Therapists </option>
                            <?php
                            
    if (is_array($therapists))
                            {
                                foreach (
    $therapists as $therapists
                                {
                                    
    $tfname $therapists['tfname'];
                                    
    $tlname $therapists['tlname'];
                                     
                                    echo 
    "<option>" $tfname " " $tlname ."</option>";
                                }
                            }
                            
    ?>
                        </select>
                        
                        <input type=submit class=button> </input>
                        <?php echo form_close(); ?>
                        
                        
                        <?php foreach($hours as $hour_item): ?>
                            <tr><td><?php echo $hour_item['hourtitle'?></td>
                                <?php foreach ($schedules as $sched_item): ?>
                                    <?php foreach ($rooms as $room_item): ?>
                                        <?php if($sched_item['room'] == $room_item['roomname'] and $sched_item['time'] == $hour_item['hourtitle']): ?>
                                            <td>
                                                
                                                <table class=scheditem>
                                                    <tr>
                                                        <td><?php echo $sched_item['patname'?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><?php echo $sched_item['therapist'?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><?php echo $sched_item['room'?></td>
                                                    </tr>
                                                </table>
                                            </td>
                                        <?php endif ?>
                                    <?php endforeach ?>
                                <?php endforeach ?>
                            </tr>
                        <?php endforeach ?>    
                        
                    </table>
                    
                </div>
  10. #6
  11. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,556
    Rep Power
    2338
    PHP Code:
    </br
    Not a valid tag. It's either
    PHP Code:
    <br
    or
    PHP Code:
    <br /> 
    Shouldn't you be putting an empty <td> in there if your conditions are not met?
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    33
    Rep Power
    3
    thanks for the <br> thing. i still cant even i place an empty <td>
    maybe there something wrong with my condition?? =(
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    33
    Rep Power
    3
    hello! when i added an empty <td> in my if condition and rearrange the order of the foreach loop I can now place them in there respective column. But i have another problem. It is now creating another set of "hourtitle" in the table.

    here is my code. -sorry

    PHP Code:
    <?php foreach ($schedules as $sched_item): ?>
                        <?php foreach($hours as $hour_item): ?>
                            <tr><td><?php echo $hour_item['hourtitle'?></td>
                                    <?php foreach ($rooms as $room_item): ?>
                                        <?php if($sched_item['room'] == $room_item['roomname'] and $sched_item['time'] == $hour_item['hourtitle']){
                                        
    ?>
                                            <td>
                                                
                                                <table class=scheditem>
                                                    <tr>
                                                        <td><?php echo $sched_item['patname'?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><?php echo $sched_item['therapist'?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><?php echo $sched_item['room'?></td>
                                                    </tr>
                                                </table>
                                            </td>
                                        <?php }else{ ?>
                                                    
                                            <td>
                                                
                                            </td>
                                                    
                                        <?php }    ?>
                                    <?php endforeach ?>
                                <?php endforeach ?>
                            </tr>
                        <?php endforeach ?>

IMN logo majestic logo threadwatch logo seochat tools logo