コード例 #1
0
ファイル: Paper.php プロジェクト: krisrita/udo
 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'];
 }
コード例 #2
0
ファイル: Course.php プロジェクト: krisrita/udo
 /**
  * 章节列表array('chapter_id'=> array(array(节信息))
  */
 public function getSectionList($cid)
 {
     $tblSection = new DB_Haodu_CourseSection();
     $list = $tblSection->fetchAll("id, video_id, course_id, parent_id as chapter_id, name, seq", "where course_id = {$cid} and parent_id > 0", "order by seq asc");
     $tblVideo = new DB_Haodu_CourseVideo();
     foreach ($list as &$section) {
         $video = $tblVideo->fetchRow($section['video_id'], "duration");
         $section['duration'] = $video['duration'];
         $section['duration_fmt'] = sprintf("%'.02d", floor($video['duration'] / 60)) . ":" . sprintf("%'.02d", $video['duration'] % 60);
     }
     $list = $tblSection->map($list, "chapter_id");
     return $list;
 }
コード例 #3
0
ファイル: Video.php プロジェクト: krisrita/udo
 public function incrDislikeNum($videoId, $num = 1)
 {
     $tblVideo = new DB_Haodu_CourseVideo();
     $tblVideo->increase($videoId, array("dislike_num" => $num));
 }