get-date.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. //
  3. require_once "../../../config.php";
  4. require_once "../../../public/_pdo.php";
  5. function get_teacher_course($teacher_id)
  6. {
  7. $teacher = " ";
  8. global $PDO;
  9. PDO_Connect("" . _FILE_DB_COURSE_);
  10. $query = "select * from course where teacher = ? order by create_time DESC limit 0,100";
  11. $Fetch = PDO_FetchAll($query, array($teacher_id));
  12. $output = array();
  13. foreach ($Fetch as $key => $couse) {
  14. # code...
  15. $query = "select * from lesson where course_id = '{$couse["id"]}' limit 0,300";
  16. $fAllLesson = PDO_FetchAll($query);
  17. foreach ($fAllLesson as $lesson) {
  18. $start = date("Y-m-d\TH:i:s+00:00", $lesson["date"] / 1000);
  19. $end = date("Y-m-d\TH:i:s+00:00", $lesson["date"] / 1000 + $lesson["duration"]);
  20. $output[] = array("id" => $lesson["id"],
  21. "title" => $couse["title"],
  22. "url" => "../../course/lesson.php?id=" . $lesson["id"],
  23. "start" => $start,
  24. "end" => $end,
  25. );
  26. }
  27. }
  28. return ($output);
  29. }