get-date.php 955 B

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