public function executeProgress() { // determine active lesson if the user has added cards in order, // otherwise set to FALSE $cur_frame = ReviewsPeer::getHeisigProgressCount($this->getUser()->getUserId()); $this->currentLesson = $cur_frame ? rtkBook::getLessonForFramenum($cur_frame + 1) : false; // find the success/fail flashcard count per lesson $progress = ReviewsPeer::getProgressStatus($this->getUser()->getUserId()); // rtk lesson data $rtkLessons = rtkBook::getLessons(); // how many lessons have been started $this->activeLessons = 0; $lessons = array(); for ($i = 1; $i <= 56; $i++) { $lessons[$i] = array('label' => 'Lesson ' . $i, 'passValue' => 0, 'failValue' => 0, 'testedCards' => 0, 'totalCards' => 0, 'maxValue' => $rtkLessons[$i]); } foreach ($progress as $p) { if ($p->lessonId <= 0) { throw new coreException('Bad lesson id'); } // fixme: only RtK1 for now if ($p->lessonId > 56) { break; } $lessons[$p->lessonId] = array('label' => 'Lesson ' . $p->lessonId, 'passValue' => $p->pass, 'failValue' => $p->fail, 'testedCards' => $p->pass + $p->fail, 'totalCards' => $p->total, 'maxValue' => $rtkLessons[$p->lessonId]); $this->activeLessons++; } $this->lessons = $lessons; }