Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. <?php
  2. include('Courses.php');
  3. class schedule
  4. {
  5.  
  6. public function test()
  7. {
  8. $course = new Courses;
  9. $course ->setCourseName("testing class");
  10. //getters don't work
  11. echo $course;
  12. $string = $course->getCourseName;
  13. echo $string;
  14. }
  15.  
  16. public function toSchedule()
  17. {
  18. $course1 = new Courses;
  19. $course2 = new Courses;
  20. $course3 = new Courses;
  21. $course4 = new Courses;
  22. $course1 ->__construct("Server Side Web Programming", "2910", "201", "Desjardins",
  23. "M-W", "5:00pm", "6:50pm");
  24. $course2 ->__construct("Fundamentals of Business IS", "3720", "001", "Hendrix/Desjardins",
  25. "T-Tr", "9:00am", "11:00am");
  26. $course3 ->__construct("Astronomy", "1010", "202", "Smith/Grey",
  27. "T-Tr", "12:45pm/7:30pm", "2:05pm/9:30pm");
  28. $course4 ->__construct("Organizational Business Management", "3000", "002", "Mitchel",
  29. "T-Tr", "11:15am", "12:30am");
  30. $schedule = array($course1, $course2, $course3, $course4);
  31. echo $course4;
  32. return $schedule;
  33.  
  34. }
  35.  
  36. /*
  37. *
  38. * converts the array into a html table
  39. */
  40.  
  41. public function toTable()
  42. {
  43. $course1 = new Courses;
  44. $course2 = new Courses;
  45. $course3 = new Courses;
  46. $course4 = new Courses;
  47. //$schedule = array();
  48. $course1 ->__construct("Server Side Web Programming", "2910", "201", "Desjardins",
  49. "M-W", "5:00pm", "6:50pm");
  50. $course2 ->__construct("Fundamentals of Business IS", "3720", "001", "Hendrix/Desjardins",
  51. "T-Tr", "9:00am", "11:00am");
  52. $course3 ->__construct("Astronomy", "1010", "202", "Smith/Grey",
  53. "T-Tr", "12:45pm/7:30pm", "2:05pm/9:30pm");
  54. $course4 ->__construct("Organizational Business Management", "3000", "002", "Mitchel",
  55. "T-Tr", "11:15am", "12:30am");
  56. $schedule = array($course1, $course2, $course3, $course4);
  57.  
  58. $myString = "<table class=\"table\">
  59. <thead>
  60. <tr>
  61. <td>Class Name</td>
  62. <td>Course Number</td>
  63. <td>Section Number</td>
  64. <td>Instructor</td>
  65. <td>Days</td>
  66. <td>Start Time</td>
  67. <td>End Time</td>
  68. </tr>
  69. </thead>";
  70. foreach($schedule as $course)
  71. {
  72. /* $myString .="<tr>
  73. <td>{$course->getCourseName()}</td>
  74. <td>{$course->getCourseNumber()}</td>
  75. <td>{$course->getSectionNumber()}</td>
  76. <td>{$course->getInstructor()}</td>
  77. <td>{$course->getDays()}</td>
  78. <td>{$course->getStartTime()}</td>
  79. <td>{$course->getEndTime()}</td>";
  80. */
  81. $myString .="<tr>
  82. <td>{$course}</td></tr>";
  83.  
  84. }
  85. $myString .= "</tbody</table>";
  86. echo $myString;
  87. return $myString;
  88. }
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement