Exemple #1
0
 function getUserPaperDuration($uid, $courseId)
 {
     $tblUserSection = new DB_Haodu_UserSection();
     $list = $tblUserSection->fetchAll("section_id", "where uid={$uid} and course_id={$courseId}");
     if (!$list) {
         return 0;
     }
     $sectionIds = $tblUserSection->columnRow($list, "section_id");
     $tblPractiseAnswerHistory = new DB_Haodu_PractiseAnswerHistory();
     $practiseList = $tblPractiseAnswerHistory->fetchAll("practise_id", "where uid={$uid} and section_id in (" . implode(",", $sectionIds) . ")");
     if (!$practiseList) {
         return 0;
     }
     $practiseIds = $tblPractiseAnswerHistory->columnRow($practiseList, "practise_id");
     $tblCoursePractise = new DB_Haodu_CoursePractise();
     $videoList = $tblCoursePractise->fetchAll("video_id", "where practise_id in (" . implode(",", $practiseIds) . ")");
     if (!$videoList) {
         return 0;
     }
     $videoIds = $tblCoursePractise->columnRow($videoList, "video_id");
     $tblUserVideo = new DB_Haodu_UserVideo();
     $videoList = $tblUserVideo->fetchAll("video_id", "where uid={$uid} and video_id in (" . implode(",", $videoIds) . ")");
     if (!$videoList) {
         return 0;
     }
     $videoIds = $tblCoursePractise->columnRow($videoList, "video_id");
     $tblVideo = new DB_Haodu_CourseVideo();
     $video = $tblVideo->scalar("sum(duration) as total_duration", "where id in (" . implode(',', $videoIds) . ")");
     return (int) $video['total_duration'];
 }
Exemple #2
0
 function getCoursePractiseList($courseId)
 {
     $tblCoursePractise = new DB_Haodu_CoursePractise();
     $list = $tblCoursePractise->fetchAll("section_id, seq, video_id", "where course_id={$courseId}", "order by seq asc, id asc");
     if (!$list) {
         return array();
     }
     $data = array();
     foreach ($list as $row) {
         $data[$row['section_id']][$row['seq']] = $row['video_id'];
     }
     return $data;
 }
Exemple #3
0
 /**
  * 节习题列表
  */
 public function getSectionPractiseList($sectionId)
 {
     $tbl = new DB_Haodu_CoursePractise();
     $list = $tbl->fetchAll("*", "where section_id={$sectionId}", "order by seq asc");
     return $tbl->kv($list, "id");
 }