Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('Courses.php');
- class schedule
- {
- public function test()
- {
- $course = new Courses;
- $course ->setCourseName("testing class");
- //getters don't work
- echo $course;
- $string = $course->getCourseName;
- echo $string;
- }
- public function toSchedule()
- {
- $course1 = new Courses;
- $course2 = new Courses;
- $course3 = new Courses;
- $course4 = new Courses;
- $course1 ->__construct("Server Side Web Programming", "2910", "201", "Desjardins",
- "M-W", "5:00pm", "6:50pm");
- $course2 ->__construct("Fundamentals of Business IS", "3720", "001", "Hendrix/Desjardins",
- "T-Tr", "9:00am", "11:00am");
- $course3 ->__construct("Astronomy", "1010", "202", "Smith/Grey",
- "T-Tr", "12:45pm/7:30pm", "2:05pm/9:30pm");
- $course4 ->__construct("Organizational Business Management", "3000", "002", "Mitchel",
- "T-Tr", "11:15am", "12:30am");
- $schedule = array($course1, $course2, $course3, $course4);
- echo $course4;
- return $schedule;
- }
- /*
- *
- * converts the array into a html table
- */
- public function toTable()
- {
- $course1 = new Courses;
- $course2 = new Courses;
- $course3 = new Courses;
- $course4 = new Courses;
- //$schedule = array();
- $course1 ->__construct("Server Side Web Programming", "2910", "201", "Desjardins",
- "M-W", "5:00pm", "6:50pm");
- $course2 ->__construct("Fundamentals of Business IS", "3720", "001", "Hendrix/Desjardins",
- "T-Tr", "9:00am", "11:00am");
- $course3 ->__construct("Astronomy", "1010", "202", "Smith/Grey",
- "T-Tr", "12:45pm/7:30pm", "2:05pm/9:30pm");
- $course4 ->__construct("Organizational Business Management", "3000", "002", "Mitchel",
- "T-Tr", "11:15am", "12:30am");
- $schedule = array($course1, $course2, $course3, $course4);
- $myString = "<table class=\"table\">
- <thead>
- <tr>
- <td>Class Name</td>
- <td>Course Number</td>
- <td>Section Number</td>
- <td>Instructor</td>
- <td>Days</td>
- <td>Start Time</td>
- <td>End Time</td>
- </tr>
- </thead>";
- foreach($schedule as $course)
- {
- /* $myString .="<tr>
- <td>{$course->getCourseName()}</td>
- <td>{$course->getCourseNumber()}</td>
- <td>{$course->getSectionNumber()}</td>
- <td>{$course->getInstructor()}</td>
- <td>{$course->getDays()}</td>
- <td>{$course->getStartTime()}</td>
- <td>{$course->getEndTime()}</td>";
- */
- $myString .="<tr>
- <td>{$course}</td></tr>";
- }
- $myString .= "</tbody</table>";
- echo $myString;
- return $myString;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement