private function getActiveUserTimeInLesson($lesson) { //$timeReport = new EfrontTimes(); $userTimes = EfrontLesson::getUserActiveTimeInLesson($this->user['login'], $lesson->lesson['id']); $userTimes = EfrontTimes::formatTimeForReporting($userTimes); return $userTimes; }
$message_type = 'failure'; $smarty->assign("T_RULE_CHECK_FAILED", true); $ruleCheck = false; } $smarty->assign("T_USER_PROGRESS", $userProgress); } if ($_student_) { if (preg_match("#</object>#", $currentUnit['data']) || preg_match("#</applet>#", $currentUnit['data'])) { $smarty->assign("T_CONTAINS_FLASH", true); } //$smarty -> assign("T_NEXT_LESSON", $currentLesson -> getNextLesson()); //$userTimeInUnit = EfrontTimes::formatTimeForReporting($times->getUserSessionTimeInUnit($currentUser->user['login'], $currentUnit['id'])); $userTimeInUnit = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInUnit($currentUser->user['login'], $currentUnit['id'])); $smarty->assign("T_USER_TIME_IN_UNIT", $userTimeInUnit); //$smarty -> assign("T_USER_CURRENT_TIME_IN_UNIT", $times->getUserCurrentSessionTimeInUnit($currentUser->user['login'], $currentUnit['id'])); $userTimeInLesson = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInLesson($currentUser->user['login'], $currentLesson->lesson['id'])); $smarty->assign("T_USER_CURRENT_TIME_IN_LESSON", $userTimeInLesson['total_seconds']); $smarty->assign("T_USER_TIME_IN_LESSON", $userTimeInLesson); foreach ($currentLesson->getConditions() as $value) { if ($value['type'] == 'time_in_lesson') { $smarty->assign("T_REQUIRED_TIME_IN_LESSON", $value['options'][0] * 60); } } if ($_change_ && $currentLesson->options['tracking'] && $currentUnit['options']['complete_unit_setting'] == EfrontUnit::COMPLETION_OPTIONS_AUTOCOMPLETE && $ruleCheck && !in_array($currentUnit['id'], array_keys($seenContent))) { $smarty->assign("T_AUTO_SET_SEEN_UNIT", true); } if ($_change_ && $currentLesson->options['tracking'] && $currentUnit['options']['complete_unit_setting'] == EfrontUnit::COMPLETION_OPTIONS_COMPLETEAFTERSECONDS && $ruleCheck && !in_array($currentUnit['id'], array_keys($seenContent)) && $userTimeInUnit['total_seconds'] > $currentUnit['options']['complete_time']) { $smarty->assign("T_AUTO_SET_SEEN_UNIT", true); } /*$hideFeedback = false; foreach (new EfrontNoFeedbackFilterIterator(new EfrontVisitableAndEmptyFilterIterator($visitableIterator)) as $key => $value) {
} } $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']); } }
$currentTheme = new themes($_SESSION['s_theme']); $newTime = ''; $jsonValues = array(); if ($_SESSION['s_login']) { $entity = getUserTimeTarget($_GET['HTTP_REFERER']); //Update times for this entity if ($_SESSION['s_lesson_user_type'] == 'student' && isset($_POST['user_total_time_in_unit']) && current($entity) == 'unit' && eF_checkParameter(key($entity), 'id')) { $newTime = $_POST['user_total_time_in_unit']; $jsonValues['entity'] = current($entity); $jsonValues['entity_id'] = current($entity); if ($newTime && is_numeric($newTime)) { $result = eF_executeNew("insert into users_to_content (users_LOGIN, content_ID, lessons_ID) values('" . $_SESSION['s_login'] . "', " . key($entity) . ", " . $_SESSION['s_lessons_ID'] . ") on duplicate key update total_time={$newTime}"); $jsonValues['time_in_unit'] = EfrontTimes::formatTimeForReporting($newTime); } else { $jsonValues['old_time_in_unit'] = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInUnit($_SESSION['s_login'], key($entity))); $jsonValues['old_time_in_lesson'] = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInLesson($_SESSION['s_login'], $_SESSION['s_lessons_ID'])); } } if (empty($_SESSION['last_periodic_check']) || time() - $_SESSION['last_periodic_check'] >= ceil($GLOBALS['configuration']['updater_period'] / 1000)) { $result = eF_executeNew("update user_times set time=time+(" . time() . "-timestamp_now),timestamp_now=" . time() . "\r\n\t\t\t\t\t\twhere session_expired = 0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN = '******'s_login'] . "'\r\n\t\t\t\t\t\tand entity = '" . current($entity) . "' and entity_id = '" . key($entity) . "'"); $_SESSION['last_periodic_check'] = time(); if ($currentTheme->options['sidebar_interface'] == 0) { if (empty($_SESSION['last_periodic_check_users']) || time() - $_SESSION['last_periodic_check_users'] >= 300) { $_SESSION['last_periodic_check_users'] = $_SESSION['last_periodic_check']; $online = EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60); $_SESSION['online_users'] = $online; if ($currentTheme->options['sidebar_interface'] == 0) { $jsonValues['online'] = $online; } } else { if ($currentTheme->options['sidebar_interface'] == 0) {
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; }