//If all the course's lessons are completed, then auto complete the course, using the mean lessons score $currentUser->completeCourse($current_course->course['id'], round(array_sum($score) / sizeof($score)), _AUTOCOMPLETEDCOURSE); } } } $res = eF_getTableData("users_to_courses", "issued_certificate", "courses_ID=" . $_SESSION['s_courses_ID'] . " and users_LOGIN='******'s_login'] . "'"); if ($res[0]['issued_certificate'] != "") { $headerOptions[] = array('text' => _VIEWCOURSECERTIFICATE, 'image' => '32x32/certificate.png', 'href' => basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $_SESSION['s_courses_ID'] . '&export=' . $current_course->options['certificate_export_method'] . '&user='******'s_login']); } } if ($userProgress['current_unit']) { //If there exists a value within the 'current_unit' attribute, it means that the student was in the lesson before. Seek the first unit that he hasn't seen yet $firstUnseenUnit = $currentContent->getFirstNode($firstNodeIterator); //Get to the first unseen unit while ($firstUnseenUnit && in_array($firstUnseenUnit['id'], array_keys($seenContent))) { $firstUnseenUnit = $currentContent->getNextNode($firstUnseenUnit, $firstNodeIterator); } if (!$firstUnseenUnit) { $firstUnseenUnit = $currentContent->getFirstNode($firstNodeIterator); } if ($currentLesson->options['start_resume'] && $firstUnseenUnit) { $headerOptions[] = array('text' => _RESUMELESSON, 'image' => '32x32/continue.png', 'href' => basename($_SERVER['PHP_SELF']) . '?view_unit=' . $firstUnseenUnit['id']); } $smarty->assign("T_CURRENT_UNIT", $firstUnseenUnit); } else { if (EfrontUser::isOptionVisible('tests')) { $iterator = new EfrontVisitableFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree), RecursiveIteratorIterator::SELF_FIRST))); } else { $iterator = new EfrontNoTestsFilterIterator(new EfrontVisitableFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree), RecursiveIteratorIterator::SELF_FIRST)))); //Create a new iterator, so that the internal iterator pointer is not reset }
} if ($currentUnit['ctg_type'] == 'tests') { $test_id = eF_getTableData("tests", "id", "content_ID=" . $currentUnit['id']); $smarty->assign("T_UNIT_TEST_ID", $test_id[0]['id']); } $smarty->assign("T_UNIT", $currentUnit); $info = array('student_name' => $currentUser->user['name'], 'student_surname' => $currentUser->user['surname'], 'student_login' => $currentUser->user['login'], 'student_email' => $currentUser->user['email'] . "'", 'student_formatted_login' => formatLogin($currentUser->user['login']), 'lesson_name' => $currentLesson->lesson['name'], 'lesson_id' => $currentLesson->lesson['id'], 'course_name' => $currentCourse->course['name'], 'course_id' => $currentCourse->course['id'], 'timestamp' => time(), 'date' => formatTimestamp(time())); array_walk($info, create_function('&$v', '$v=htmlentities($v, ENT_QUOTES);')); $smarty->assign("T_INFORMATION_JSON", json_encode($info)); if ($currentUnit['options']['complete_unit_setting'] == EfrontUnit::COMPLETION_OPTIONS_COMPLETEAFTERSECONDS) { $smarty->assign("T_REQUIRED_TIME_IN_UNIT", $currentUnit['options']['complete_time']); } //Next and previous units are needed for navigation buttons //package_ID denotes that a SCORM 2004 unit is active. if (!isset($_GET['package_ID'])) { $nextUnit = $currentContent->getNextNode($currentUnit, $visitableIterator); $smarty->assign("T_NEXT_UNIT", $nextUnit); $previousUnit = $currentContent->getPreviousNode($currentUnit, $visitableIterator); $smarty->assign("T_PREVIOUS_UNIT", $previousUnit); //Parents are needed for printing the titles $smarty->assign("T_PARENT_LIST", $currentContent->getNodeAncestors($currentUnit)); } else { //SCORM 2004 content handles navigation on its own, so it's illegal to have additional navigation handles $smarty->assign("T_PARENT_LIST", $currentContent->getNodeAncestors($_GET['package_ID'])); $smarty->assign("T_SCORM_2004_TITLE", true); } $comments = array(); $result = array_merge(comments::getComments($currentLesson->lesson['id'], false, $currentUnit['id']), comments::getComments($currentLesson->lesson['id'], $currentUser, $currentUnit['id'], false, false)); foreach ($result as $value) { if (!isset($comments[$value['id']])) { $comments[$value['id']] = $value;
try { if (!$_change_) { throw new EfrontUserException(_UNAUTHORIZEDACCESS, EfrontUserException::RESTRICTED_USER_TYPE); } $currentQuestion = QuestionFactory::factory($_GET['delete_question']); $currentQuestion->delete(); } catch (Exception $e) { header("HTTP/1.0 500 "); echo $e->getMessage() . ' (' . $e->getCode() . ')'; } exit; } elseif (isset($_GET['show_test']) && in_array($_GET['show_test'], $legalValues) && eF_checkParameter($_GET['show_test'], 'id') || isset($_GET['view_unit']) && in_array($_GET['view_unit'], $legalUnits) && eF_checkParameter($_GET['view_unit'], 'id')) { if (isset($_GET['view_unit'])) { $showTest = new EfrontTest($_GET['view_unit'], true); $smarty->assign("T_UNIT", $currentUnit); $smarty->assign("T_NEXT_UNIT", $currentContent->getNextNode($currentUnit, $visitableIterator)); $smarty->assign("T_PREVIOUS_UNIT", $currentContent->getPreviousNode($currentUnit, $visitableIterator)); //Next and previous units are needed for navigation buttons $smarty->assign("T_PARENT_LIST", $currentContent->getNodeAncestors($currentUnit)); //Parents are needed for printing the title $smarty->assign("T_SHOW_TOOLS", true); //Tools is the right upper corner table box, that lists tools such as 'upload files', 'copy content' etc if (EfrontUser::isOptionVisible('comments')) { $smarty->assign("T_COMMENTS", comments::getComments($_SESSION['s_lessons_ID'], false, $currentUnit['id'])); //Retrieve any comments regarding this unit } $smarty->assign("T_SHOW_TOOLS", true); //Tools is the right upper corner table box, that lists tools such as 'upload files', 'copy content' etc } else { $showTest = new EfrontTest($_GET['show_test']); }