Example #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);
 }
Example #2
0
 /**
  * 用户最后学习的节
  * @param $uid
  * @param array $courseIds
  */
 function getUserCourseLastSection($uid, $courseIds = array())
 {
     $course = array();
     $inCourseIds = implode(",", $courseIds);
     $tblUserSec = new DB_Haodu_UserSection();
     $last = array();
     foreach ($courseIds as $cid) {
         $rs = $tblUserSec->scalar("course_id, section_id", "where uid={$uid} and course_id={$cid}", "order by last_time desc");
         if ($rs) {
             $last[] = $rs;
         }
     }
     if ($last) {
         $tblCourSec = new DB_Haodu_CourseSection();
         foreach ($last as $lastSec) {
             $section = $tblCourSec->fetchRow($lastSec['section_id'], 'id,parent_id,name,seq');
             $chapter = $tblCourSec->fetchRow($section['parent_id'], "id,name,seq");
             $course[$lastSec['course_id']] = array('last_section_id' => $section['id'], 'last_section_name' => $section['name'], 'last_section_seq' => $section['seq'], 'last_chapter_id' => $chapter['id'], 'last_chapter_name' => $chapter['name'], 'last_chapter_seq' => $chapter['seq']);
         }
     }
     return $course;
 }
Example #3
0
 /**
  * 视频所属节
  */
 public function getVideoBelongSection($videoId)
 {
     $tbl = new DB_Haodu_CourseSection();
     return $tbl->scalar("*", "where video_id={$videoId}");
 }