} } $smarty->assign("T_LESSON_INFO", $lessonInformation); if (!$_admin_) { $seenContent = EfrontStats::getStudentsSeenContent($currentLesson->lesson['id'], $currentUser->user['login']); //Get the passing score for each "specific_test" rule $allTestsScore = eF_getTableDataFlat("tests", "content_ID,mastery_score"); if (sizeof($allTestsScore) > 0) { $allTestsScore = array_combine($allTestsScore['content_ID'], $allTestsScore['mastery_score']); } else { $allTestsScore = array(); } foreach ($conditions as $key => $condition) { if ($condition['type'] == 'specific_test') { $conditions[$key]['test_passing_score'] = $allTestsScore[$condition['options'][0]]; } } $times = new EfrontTimes(); list($conditionsStatus, $lessonPassed) = EfrontStats::checkConditions($seenContent[$currentLesson->lesson['id']][$currentUser->user['login']], $conditions, $visitableContentIds, $testsIds, EfrontLesson::getUserActiveTimeInLesson($currentUser->user['login'], $currentLesson->lesson['id'])); $smarty->assign("T_CONDITIONS", $conditions); $smarty->assign("T_CONDITIONS_STATUS", $conditionsStatus); //$smarty -> assign("T_LESSON_PASSED", $lessonPassed); foreach ($iterator = new EfrontAttributeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree)), array('id', 'name')) as $key => $value) { $key == 'id' ? $ids[] = $value : ($names[] = $value); } $smarty->assign("T_TREE_NAMES", array_combine($ids, $names)); $smarty->assign("T_BASE_URL", "ctg=lesson_information"); } else { $smarty->assign("T_BASE_URL", "ctg=lessons&lesson_info=" . $currentLesson->lesson['id']); } }
public static function lightGetUserStatusInLesson($login, $currentLesson, $seenContent, $visitableIterator) { $visitableTestIds = $visitableUnits = array(); foreach ($visitableIterator as $key => $value) { if ($value['active']) { $visitableUnits[$key] = $key; if ($value['ctg_type'] == 'tests' || $value['ctg_type'] == 'scorm_test') { $visitableTestIds[$key] = $key; } } } $overallProgress = 0; if (sizeof($visitableUnits) > 0) { $overallProgress = round(100 * sizeof(array_intersect(array_keys($visitableUnits), array_keys($seenContent))) / sizeof($visitableUnits), 2); } $conditions = $currentLesson->getConditions(); foreach ($conditions as $condition) { if ($condition['time_in_lesson']) { $time_condition = true; } } if ($time_condition) { $usersTimesInLessonContent = EfrontLesson::getUserActiveTimeInLesson($login, $currentLesson->lesson['id']); } else { $usersTimesInLessonContent = null; } list($conditionsMet, $lessonPassed) = EfrontStats::checkConditions($seenContent, $conditions, $visitableUnits, $visitableTestIds, $usersTimesInLessonContent); $status = eF_getTableData("users_to_lessons", "*", "users_LOGIN='******' and lessons_ID={$currentLesson->lesson['id']}"); $userProgress = array('completed' => $status[0]['completed'], 'score' => $status[0]['score'], 'overall_progress' => $overallProgress, 'lesson_passed' => $lessonPassed, 'total_conditions' => sizeof($conditions), 'conditions_passed' => array_sum($conditionsMet)); return $userProgress; }