Exemple #1
0
 function getAll($courseId)
 {
     $tblSection = new DB_Haodu_CourseSection();
     $where = "where course_id={$courseId}";
     $orderby = "order by seq asc";
     return $tblSection->fetchAll("*", $where, $orderby);
 }
Exemple #2
0
 /**
  * 章节列表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;
 }