Esempio n. 1
0
 public function getCourseItems($courseId)
 {
     $lessons = LessonSerialize::unserializes($this->getLessonDao()->findLessonsByCourseId($courseId));
     $chapters = $this->getChapterDao()->findChaptersByCourseId($courseId);
     $items = array();
     foreach ($lessons as $lesson) {
         $lesson['itemType'] = 'lesson';
         $items["lesson-{$lesson['id']}"] = $lesson;
     }
     foreach ($chapters as $chapter) {
         $chapter['itemType'] = 'chapter';
         $items["chapter-{$chapter['id']}"] = $chapter;
     }
     uasort($items, function ($item1, $item2) {
         return $item1['seq'] > $item2['seq'];
     });
     return $items;
 }