本文整理汇总了PHP中EfrontLesson类的典型用法代码示例。如果您正苦于以下问题:PHP EfrontLesson类的具体用法?PHP EfrontLesson怎么用?PHP EfrontLesson使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EfrontLesson类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
}
if ($_GET['cleanup'] != 'all') {
if (!isset($errors)) {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=maintenance&tab=cleanup&message=" . urlencode(_SUCCESFULLYCLEANEDUPFOLDERS) . '&message_type=success');
} else {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=maintenance&tab=cleanup&message=" . urlencode(_THEFOLLOWINGFOLDERSCOULDNOTBEDELETED) . ': ' . implode(", ", $errors) . '&message_type=failure');
}
}
}
if (isset($_GET['cleanup']) && ($_GET['cleanup'] == 'lessons_without_folders' || $_GET['cleanup'] == 'all')) {
foreach ($orphan_lessons as $lesson_id) {
try {
$lesson = new EfrontLesson($lesson_id);
$lesson->delete();
} catch (Exception $e) {
$errors[] = $folder;
}
}
if ($_GET['cleanup'] != 'all') {
if (!isset($errors)) {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=maintenance&tab=cleanup&message=" . urlencode(_SUCCESFULLYCLEANEDUPLESSONS) . '&message_type=success');
} else {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=maintenance&tab=cleanup&message=" . urlencode(_THEFOLLOWINGLESSONSCOULDNOTBEDELETED) . ': ' . implode(", ", $errors) . '&message_type=failure');
}
}
}
if (isset($_GET['create']) && $_GET['create'] == 'user_folders') {
foreach ($orphan_users as $login) {
示例2: EfrontLesson
$form->accept($renderer);
$smarty->assign('T_CONTACT_FORM', $renderer->toArray());
}
/* -------------------------------------------------------End of Contact part--------------------------------------------------------- */
/* -------------------------------------------------------Lesson information part--------------------------------------------------------- */
if (isset($_GET['ctg']) && $_GET['ctg'] == 'lesson_info') {
//The user asked to display information on a lesson
//session_start(); //Isn't needed here if the head session_start() is in place
if (!$smarty->is_cached('index.tpl', $cacheId) || !$GLOBALS['configuration']['smarty_caching']) {
include "directions_tree.php";
try {
if (isset($_GET['lessons_ID'])) {
if (isset($lessons[$_GET['lessons_ID']]) && $lessons[$_GET['lessons_ID']] instanceof EfrontLesson) {
$smarty->assign("T_HAS_LESSON", $lessons[$_GET['lessons_ID']]->lesson['has_lesson']);
}
$lesson = new EfrontLesson($_GET['lessons_ID']);
$lesson->lesson['price_string'] = formatPrice($lesson->lesson['price'], array($lesson->options['recurring'], $lesson->options['recurring_duration']), true);
$lesson->lesson['num_students'] = sizeof($lesson->getStudentUsers());
$lesson->lesson['seats_remaining'] = $lesson->lesson['max_users'] - $lesson->lesson['num_students'];
$lesson->lesson['seats_remaining'] >= 0 or $lesson->lesson['seats_remaining'] = 0;
$smarty->assign("T_LESSON", $lesson);
$lessonInformation = $lesson->getInformation();
$content = new EfrontContentTree($lesson);
if (sizeof($content->tree) > 0) {
$smarty->assign("T_CONTENT_TREE", $content->toHTML(false, 'dhtml_content_tree', array('noclick' => 1)));
}
$lessonInfo = new LearningObjectInformation(unserialize($lesson->lesson['info']));
$smarty->assign("T_LESSON_INFO", $lessonInfo);
$additionalInfo = $lesson->getInformation();
$smarty->assign("T_ADDITIONAL_LESSON_INFO", $additionalInfo);
if ($lesson->lesson['course_only']) {
示例3: completeLesson
/**
* Complete lesson
*
* This function is used to set the designated lesson's status
* to 'completed' for the current user.
* <br/>Example:
* <code>
* $user -> completeLesson(5, 87, 'Very good progress'); //Complete lesson with id 5
* </code>
*
* @param mixed $lesson Either the lesson id, or an EfrontLesson object
* @param array $fields Extra fields containing the user score and any comments
* @return boolean true if everything is ok
* @since 3.5.0
* @access public
*/
public function completeLesson($lesson, $score = 100, $comments = '', $timestamp = '')
{
if (!$lesson instanceof EfrontLesson) {
$lesson = new EfrontLesson($lesson);
}
if (in_array($lesson->lesson['id'], array_keys($this->getLessons()))) {
$fields = array('completed' => 1, 'to_timestamp' => $timestamp ? $timestamp : time(), 'score' => str_replace(',', '.', $score), 'comments' => $comments);
eF_updateTableData("users_to_lessons", $fields, "users_LOGIN = '" . $this->user['login'] . "' and lessons_ID=" . $lesson->lesson['id']);
//$cacheKey = "user_lesson_status:lesson:".$lesson -> lesson['id']."user:".$this -> user['login'];
//EfrontCache::getInstance()->deleteCache($cacheKey);
// Timelines event
EfrontEvent::triggerEvent(array("type" => EfrontEvent::LESSON_COMPLETION, "users_LOGIN" => $this->user['login'], "lessons_ID" => $lesson->lesson['id'], "lessons_name" => $lesson->lesson['name']));
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
if (!$this->aspects['hcd']) {
$this->aspects['hcd'] = EfrontEmployeeFactory::factory($this->user['login']);
}
$employee = $this->aspects['hcd'];
$newSkills = eF_getTableDataFlat("module_hcd_lesson_offers_skill", "skill_ID, specification", "lesson_ID = '" . $lesson->lesson['id'] . "'");
// The lesson associated skills will *complement* the existing ones - last argument = true
$employee->addSkills($newSkills['skill_ID'], $newSkills['specification'], array_fill(0, sizeof($newSkills['skill_ID']), $score), true);
}
#cpp#endif
//Get results in lessons
$userLessons = array();
$result = eF_getTableData("users_to_lessons", "lessons_ID,completed,score", "users_LOGIN='" . $this->user['login'] . "'");
foreach ($result as $value) {
if ($userLessons[$value['lessons_ID']] = $value) {
}
}
$lessonCourses = $lesson->getCourses(true);
//Get the courses that this lesson is part of. This way, we can auto complete a course, if it should be auto completed
//Filter out courses that the student doesn't have
$result = eF_getTableDataFlat("users_to_courses", "courses_ID", "users_LOGIN='" . $this->user['login'] . "'");
$userCourses = $result['courses_ID'];
foreach ($lessonCourses as $id => $course) {
if (!in_array($id, $userCourses)) {
unset($lessonCourses[$id]);
}
}
//$userStatus = EfrontStats :: getUsersCourseStatus(array_keys($courses), $this -> user['login']);
foreach ($lessonCourses as $course) {
if ($course->options['auto_complete']) {
$constraints = array('archive' => false, 'active' => true, 'return_objects' => false);
$courseLessons = $course->getCourseLessons($constraints);
$completed = $score = array();
foreach ($courseLessons as $lessonId => $value) {
$userLessons[$lessonId]['completed'] ? $completed[] = 1 : ($completed[] = 0);
$score[] = $userLessons[$lessonId]['score'];
}
if (array_sum($completed) == sizeof($completed)) {
//If all the course's lessons are completed, then auto complete the course, using the mean lessons score
$this->completeCourse($course->course['id'], round(array_sum($score) / sizeof($score)), _AUTOCOMPLETEDCOURSE);
}
}
}
$modules = eF_loadAllModules();
foreach ($modules as $module) {
$module->onCompleteLesson($lesson->lesson['id'], $this->user['login']);
}
return true;
} else {
return false;
}
}
示例4: EfrontLesson
echo "<status>error</status>";
echo "<message>Incomplete arguments</message>";
echo "</xml>";
}
} else {
echo "<xml>";
echo "<status>error</status>";
echo "<message>Invalid token</message>";
echo "</xml>";
}
break;
case 'lesson_info':
if (isset($_GET['token']) && checkToken($_GET['token'])) {
if (isset($_GET['lesson'])) {
try {
$lesson = new EfrontLesson($_GET['lesson']);
$info = $lesson->getStatisticInformation();
echo "<xml>";
echo "<general_info>";
echo "<name>" . $lesson->lesson['name'] . "</name>";
echo "<direction>" . $info['direction'] . "</direction>";
echo "<price>" . $info['price_string'] . "</price>";
echo "<language>" . $info['language'] . "</language>";
echo "</general_info>";
echo "</xml>";
} catch (Exception $e) {
echo "<xml>";
echo "<status>error</status>";
echo "<message>Lesson doesn't exist</message>";
echo "</xml>";
}
示例5: unset
unset($copyPropertiesLesson->options['recurring_duration']);
$fields_insert['options'] = serialize($copyPropertiesLesson->options);
}
//Create the new lesson
$newLesson = EfrontLesson::createLesson($fields_insert);
//If a recurring payment is set, set this up to the lesson properties
if ($values['price'] && $values['recurring'] && in_array($values['recurring'], array_keys($recurringOptions))) {
$newLesson->options['recurring'] = $values['recurring'];
if ($newLesson->options['recurring']) {
$newLesson->options['recurring_duration'] = $form->exportValue($newLesson->options['recurring'] . '_duration');
}
$newLesson->persist();
}
//Import file, if any specified
if ($values['clone_lesson']) {
$cloneLesson = new EfrontLesson($values['clone_lesson']);
$file = $cloneLesson->export();
$exportedFile = $file->copy($newLesson->getDirectory() . '/' . $exportedFile['name']);
}
if (isset($exportedFile)) {
$newLesson->import($exportedFile);
} else {
//There was no file imported, then it's safe to add a default completion condition
$fields = array('lessons_ID' => $newLesson->lesson['id'], 'type' => 'all_units', 'relation' => 'and');
eF_insertTableData('lesson_conditions', $fields);
}
if ($newLesson->lesson['course_only']) {
//For course-only lessons, redirect to lessons list, not to "edit lesson" page
eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=lessons&message=" . urlencode(_SUCCESSFULLYCREATEDLESSON) . "&message_type=success");
} else {
eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=lessons&edit_lesson=" . $newLesson->lesson['id'] . "&tab=users&message=" . urlencode(_SUCCESSFULLYCREATEDLESSON) . "&message_type=success");
示例6: copySimpleUnit
/**
* Copy simple unit
*
* This function copies a unit (NOT its children) into the current content tree
* <br/>Example:
* <code>
* $currentContent = new EfrontContentTree(5); //Initialize content for lesson with id 5
* $sourceUnit = new EfrontUnit(20); //Get the unit with id = 20
* $currentContent -> copySimpleUnit($sourceUnit, false); //Copy the source unit into the content tree (at its end)
* </code>
*
* @param EfrontUnit $sourceUnit The unit object to be copied
* @param mixed $targetUnit The id of the parent unit (or the parent EfrontUnit)in which the new unit will be copied, or false (the unit will be appended at the end)
* @param mixed $previousUnit The id of the previous unit (or the unit itself) of the new unit, or false (the unit will be put to the end of the units)
* @param boolean $copyFiles whether to copy files as well.
* @param boolean $copyQuestions Whether to copy questions as well
* @return EfrontUnit The newly created unit object
* @since 3.5.0
* @access public
*/
public function copySimpleUnit($sourceUnit, $targetUnit = false, $previousUnit = false, $copyFiles = true, $copyQuestions = true)
{
if (!$sourceUnit instanceof EfrontUnit) {
$sourceUnit = new EfrontUnit($sourceUnit);
}
$newUnit['name'] = $sourceUnit->offsetGet('name');
$newUnit['ctg_type'] = $sourceUnit->offsetGet('ctg_type');
$newUnit['data'] = $sourceUnit->offsetGet('data');
$options = $sourceUnit->offsetGet('options');
$newOptions['complete_unit_setting'] = $options['complete_unit_setting'];
$newOptions['hide_navigation'] = $options['hide_navigation'];
$newOptions['maximize_viewport'] = $options['maximize_viewport'];
$newOptions['object_ids'] = $options['object_ids'];
$newUnit['options'] = serialize($newOptions);
$newUnit['lessons_ID'] = $this->lessonId;
if ($targetUnit) {
if ($targetUnit instanceof EfrontUnit) {
$newUnit['parent_content_ID'] = $targetUnit->offsetGet('id');
} else {
if (eF_checkParameter($targetUnit, 'id')) {
$newUnit['parent_content_ID'] = $targetUnit;
}
}
if ($previousUnit instanceof EfrontUnit) {
$newUnit['previous_content_ID'] = $previousUnit->offsetGet('id');
} else {
if (eF_checkParameter($previousUnit, 'id')) {
$newUnit['previous_content_ID'] = $previousUnit;
}
}
$unit = $this->insertNode($newUnit);
} else {
$unit = $this->appendUnit($newUnit);
}
if ($copyFiles) {
$files = $unit->getFiles();
$lesson = new EfrontLesson($this->lessonId);
$data = $unit->offsetGet('data');
foreach ($files as $file) {
try {
$sourceFile = new EfrontFile($file);
$sourceFileOffset = preg_replace("#" . G_LESSONSPATH . "#", "", $sourceFile['directory']);
$position = strpos($sourceFileOffset, "/");
//check case that the file is in a subfolder of the lesson
if ($position !== false) {
$sourceLink = mb_substr($sourceFileOffset, $position + 1);
mkdir($lesson->getDirectory() . $sourceLink . '/', 0755, true);
$destinationPath = $lesson->getDirectory() . $sourceLink . '/' . basename($sourceFile['path']);
$copiedFile = $sourceFile->copy($destinationPath, false);
} else {
$destinationPath = $lesson->getDirectory() . basename($sourceFile['path']);
$copiedFile = $sourceFile->copy($destinationPath, false);
}
//@todo view_file.php?action=download&file=10410
//$data = str_replace("view_file.php?file=".$file, "view_file.php?file=".$copiedFile -> offsetGet('id'), $data);
//$data = str_replace("&file=".$file, "&file=".$copiedFile -> offsetGet('id'), $data);
//$data = str_replace("&file=".$file, "&file=".$copiedFile -> offsetGet('id'), $data);
$data = preg_replace('#view_file\\.php(.*)file=' . $file . '#', 'view_file.php${1}file=' . $copiedFile->offsetGet('id'), $data);
$folderId = $lesson->lesson['share_folder'] ? $lesson->lesson['share_folder'] : $lesson->lesson['id'];
$data = preg_replace("#(" . G_SERVERNAME . ")*content/lessons/" . $sourceUnit['lessons_ID'] . "/(.*)#", "content/lessons/" . $folderId . '/${2}', $data);
} catch (EfrontFileException $e) {
if ($e->getCode() == EfrontFileException::FILE_ALREADY_EXISTS) {
$copiedFile = new EfrontFile($destinationPath);
//$data = str_replace("view_file.php?file=".$file, "view_file.php?file=".$copiedFile -> offsetGet('id'), $data);
//$data = str_replace("&file=".$file, "&file=".$copiedFile -> offsetGet('id'), $data);
//$data = str_replace("&file=".$file, "&file=".$copiedFile -> offsetGet('id'), $data);
$data = preg_replace('#view_file\\.php(.*)file=' . $file . '#', 'view_file.php${1}file=' . $copiedFile->offsetGet('id'), $data);
$folderId = $lesson->lesson['share_folder'] ? $lesson->lesson['share_folder'] : $lesson->lesson['id'];
$data = preg_replace("#(" . G_SERVERNAME . ")*content/lessons/" . $sourceUnit['lessons_ID'] . "/(.*)#", "content/lessons/" . $folderId . '/${2}', $data, -1, $count);
}
}
//this means that the file already exists
}
$unit->offsetSet('data', $data);
if ($file && $unit['ctg_type'] == 'scorm' || $unit['ctg_type'] == 'scorm_test') {
$d = new EfrontDirectory(dirname($file));
$d->copy($lesson->getDirectory() . basename(dirname($file)), true);
}
}
$unit->persist();
//.........这里部分代码省略.........
示例7: createInstance
/**
* Create lesson instance
*
* This function is used to create a lesson instance.
* <br/>Example:
* <code>
* $instance = EfrontLesson :: createInstance(43);
* </code>
*
* @param mixed $instanceSource Either a lesson id or an EfrontLesson object.
* @return EfrontLesson The new lesson instance
* @since 3.6.1
* @access public
* @static
*/
public static function createInstance($instanceSource, $originateCourse)
{
if (!$instanceSource instanceof EfrontLesson) {
$instanceSource = new EfrontLesson($instanceSource);
}
if (!$originateCourse instanceof EfrontCourse) {
$originateCourse = new EfrontCourse($originateCourse);
}
$result = eF_getTableData("lessons", "*", "id=" . $instanceSource->lesson['id']);
unset($result[0]['id']);
//unset($result[0]['directions_ID']); //Instances don't belong to a category
if (!$result[0]['share_folder']) {
$result[0]['share_folder'] = $instanceSource->lesson['id'];
}
//$result[0]['name'] .= ' ('._INSTANCE.')';
$result[0]['originating_course'] = $originateCourse->course['id'];
$result[0]['instance_source'] = $instanceSource->lesson['id'];
$file = $instanceSource->export(false, true, false);
$instance = EfrontLesson::createLesson($result[0]);
$instance->import($file, true, true, true);
$instance->course['originating_course'] = $originateCourse->course['id'];
$instance->course['instance_source'] = $instanceSource->lesson['id'];
$instance->persist();
$modules = eF_loadAllModules();
foreach ($modules as $module) {
$module->onCreateInstance($instance->lesson['id'], $instanceSource->lesson['id']);
}
return $instance;
}
示例8: array_pop
if ($isProfessor) {
$lessons = $currentUser->getLessons(true, 'professor');
}
}
if (sizeof($lessons) == 1) {
$infoLesson = array_pop($lessons);
//get the current (first) lesson
if (!$infoLesson instanceof EfrontLesson) {
$infoLesson = new EfrontLesson($infoLesson['id']);
}
} else {
if (isset($_GET['sel_lesson']) && in_array($_GET['sel_lesson'], array_keys($lessons))) {
$infoLesson = new EfrontLesson($_GET['sel_lesson']);
} else {
if (isset($_SESSION['s_lessons_ID']) && in_array($_SESSION['s_lessons_ID'], array_keys($lessons))) {
$infoLesson = new EfrontLesson($_SESSION['s_lessons_ID']);
}
}
}
$smarty->assign("T_INFO_LESSON", $infoLesson->lesson);
//get the lesson information
if (isset($infoLesson)) {
try {
$result = eF_getTableData("user_times ut join users_to_lessons ul on ut.users_LOGIN=ul.users_LOGIN and ut.lessons_ID=ul.lessons_ID", "sum(time) as sum, count(distinct ul.users_LOGIN) as count", "completed=1 and ul.archive=0 and ut.lessons_ID=" . $infoLesson->lesson['id'], "", "");
if ($result[0]['sum']) {
$smarty->assign("T_AVERAGE_COMPLETION_TIME", EfrontTimes::formatTimeForReporting($result[0]['sum'] / $result[0]['count']));
}
require_once $path . "includes/statistics/stats_filters.php";
$directionsTree = new EfrontDirectionsTree();
$directionsPaths = $directionsTree->toPathString();
$roles = EfrontLessonUser::getLessonsRoles(true);
示例9: isWorkbookInstalledByUser
function isWorkbookInstalledByUser($currentUser, $currentUserRole, $currentLessonID)
{
$userLessons = $currentUser->getLessons(false, $currentUserRole);
$lessons = array();
unset($userLessons[$currentLessonID]);
// do not use current lesson
$lessons[-1] = array("id" => -1, "name" => _WORKBOOK_SWITCH_TO);
$lessons[-2] = array("id" => -2, "name" => '-------------');
foreach ($userLessons as $key => $value) {
$lesson = new EfrontLesson($key);
$installed = $lesson->getOptions(array('module_workbook'));
if (count($installed) != 0 && $installed['module_workbook'] == 1) {
$lessons[$key] = array("id" => $key, "name" => $lesson->lesson['name']);
}
}
return $lessons;
}
示例10: session_cache_limiter
<?php
session_cache_limiter('none');
session_start();
$path = "../libraries/";
include_once $path . "configuration.php";
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
try {
$languages = EfrontSystem::getLanguages(true);
if (isset($_GET['lessons_ID']) && eF_checkParameter($_GET['lessons_ID'], 'id')) {
$lesson = new EfrontLesson($_GET['lessons_ID']);
$lessonInformation = $lesson->getInformation();
//$lessonInformation['language'] = $languages[$lesson -> lesson['languages_NAME']];
if ($lessonInformation['professors']) {
foreach ($lessonInformation['professors'] as $value) {
$professorsString[] = formatLogin($value['login']);
}
$lessonInformation['professors'] = implode(", ", $professorsString);
}
$lesson->lesson['price'] ? $priceString = formatPrice($lesson->lesson['price'], array($lesson->options['recurring'], $lesson->options['recurring_duration']), true) : ($priceString = false);
$lessonInformation['price_string'] = $priceString;
if ($lesson->lesson['max_users']) {
$lessonInformation['max_users'] = $lesson->lesson['max_users'];
$lessonInformation['seats_remaining'] = $lesson->lesson['max_users'] - sizeof($lesson->getStudentUsers());
$lessonInformation['seats_remaining'] >= 0 or $lessonInformation['seats_remaining'] = 0;
}
// if (!$lessonInformation['price']) {
// unset($lessonInformation['price_string']);
示例11: array
$smarty->assign('T_EDIT_COURSE', $editCourse);
//Perform ajax operations
if ($_GET['ajax'] == 'skillsTable') {
$skills = $editCourse->getSkills();
$dataSource = $skills;
$tableName = 'skillsTable';
include "sorted_table.php";
} else {
if ($_GET['ajax'] == 'lessonsTable') {
$courseUsers = $editCourse->countCourseUsers(array('archive' => false));
$smarty->assign("T_COURSE_HAS_USERS", $courseUsers['count']);
$constraints = array('archive' => false) + createConstraintsFromSortedTable();
$constraints['condition'] = 'l.creator_LOGIN="' . $_SESSION['s_login'] . '"';
$lessons = $editCourse->getCourseLessonsIncludingUnassigned($constraints);
$totalEntries = $editCourse->countCourseLessonsIncludingUnassigned($constraints);
$dataSource = EfrontLesson::convertLessonObjectsToArrays($lessons);
$directionsTree = new EfrontDirectionsTree();
$directionsPaths = $directionsTree->toPathString();
foreach ($dataSource as $key => $value) {
$dataSource[$key]['directionsPath'] = $directionsPaths[$value['directions_ID']];
$dataSource[$key]['mode'] = 'shared';
if ($value['instance_source']) {
if ($value['originating_course'] == $editCourse->course['id'] && $value['has_lesson']) {
$dataSource[$key]['mode'] = 'unique';
$lessonsToRemove[] = $value['instance_source'];
} else {
$lessonsToRemove[] = $key;
}
}
}
foreach ($lessonsToRemove as $value) {
示例12: array
//Filemanager settings and inclusion
if ($currentUser->getType() == "administrator") {
$basedir = G_ADMINPATH;
} else {
$basedir = $currentLesson->getDirectory();
}
if (!isset($currentUser->coreAccess['files']) || $currentUser->coreAccess['files'] == 'change') {
$options = array('lessons_ID' => $currentLesson->lesson['id'], 'metadata' => 0);
} else {
$options = array('delete' => false, 'edit' => false, 'share' => false, 'upload' => false, 'create_folder' => false, 'zip' => false, 'lessons_ID' => $currentLesson->lesson['id'], 'metadata' => 0);
}
/** Get the suggested list in a form that javascript can then understand **/
if (isset($_GET['postAjaxRequest']) && isset($_GET['get_proposed_skills'])) {
$question_lesson = eF_getTableData("questions", "lessons_ID", "id = " . $_GET['edit_question']);
if (!empty($question_lesson) && $question_lesson[0]['lessons_ID'] != 0) {
$lesson = new EfrontLesson($question_lesson[0]['lessons_ID']);
$skills_to_propose = array();
// If the lesson belongs only to courses, get all skills of its courses
if ($lesson->lesson['course_only']) {
$lesson_belonging_courses = $lesson->getCourses(true);
foreach ($lesson_belonging_courses as $course) {
$course_skills = $course->getSkills(true);
foreach ($course_skills as $skillID => $skill) {
$skills_to_propose[] = $skillID;
}
}
} else {
// Else get only its own skills
$lesson_skills = $lesson->getSkills(true);
foreach ($lesson_skills as $skillID => $skill) {
$skills_to_propose[] = $skillID;
示例13: askInformation
function askInformation()
{
try {
if (isset($_GET['lessons_ID']) && eF_checkParameter($_GET['lessons_ID'], 'id')) {
$lesson = new EfrontLesson($_GET['lessons_ID']);
$lessonInformation = $lesson->getInformation();
$languages = EfrontSystem::getLanguages(true);
//$lessonInformation['language'] = $languages[$lesson -> lesson['languages_NAME']];
if ($lessonInformation['professors']) {
foreach ($lessonInformation['professors'] as $value) {
$professorsString[] = $value['name'] . ' ' . $value['surname'];
}
$lessonInformation['professors'] = implode(", ", $professorsString);
}
$lesson->lesson['price'] ? $priceString = formatPrice($lesson->lesson['price'], array($lesson->options['recurring'], $lesson->options['recurring_duration']), true) : ($priceString = false);
$lessonInformation['price_string'] = $priceString;
// if (!$lessonInformation['price']) {
// unset($lessonInformation['price_string']);
// }
try {
if ($_GET['from_course']) {
$course = new EfrontCourse($_GET['from_course']);
$schedule = $course->getLessonScheduleInCourse($lesson);
if ($schedule['start_date'] || $schedule['end_date']) {
$lessonInformation['from_timestamp'] = $schedule['start_date'];
$lessonInformation['to_timestamp'] = $schedule['end_date'];
} else {
$lessonInformation['from_timestamp'] = $schedule['active_in_lesson'] + 24 * 60 * 60 * $schedule['start_period'];
$lessonInformation['to_timestamp'] = $lessonInformation['from_timestamp'] + 24 * 60 * 60 * $schedule['end_period'];
}
}
} catch (Exception $e) {
}
foreach ($lessonInformation as $key => $value) {
if ($value) {
switch ($key) {
case 'language':
$GLOBALS['configuration']['onelanguage'] or $tooltipInfo[] = '<div class = "infoEntry"><span>' . _LANGUAGE . "</span><span>: {$languages[$value]}</span></div>";
break;
case 'professors':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _PROFESSORS . "</span><span>: {$value}</span></div>";
break;
case 'content':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _CONTENTUNITS . "</span><span>: {$value}</span></div>";
break;
case 'tests':
EfrontUser::isOptionVisible('tests') ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _TESTS . "</span><span>: {$value}</span></div>" : null;
break;
case 'projects':
EfrontUser::isOptionVisible('projects') ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PROJECTS . "</span><span>: {$value}</span></div>" : null;
break;
case 'course_dependency':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _DEPENDSON . "</span><span>: {$value}</span></div>";
break;
case 'from_timestamp':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _AVAILABLEFROM . "</span><span>: " . formatTimestamp($value, 'time_nosec') . "</span></div>";
break;
case 'to_timestamp':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _AVAILABLEUNTIL . "</span><span>: " . formatTimestamp($value, 'time_nosec') . "</span></div>";
break;
case 'general_description':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _DESCRIPTION . "</span><span>: {$value}</span></div>";
break;
case 'assessment':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _ASSESSMENT . "</span><span>: {$value}</span></div>";
break;
case 'objectives':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _OBJECTIVES . "</span><span>: {$value}</span></div>";
break;
case 'lesson_topics':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _LESSONTOPICS . "</span><span>: {$value}</span></div>";
break;
case 'resources':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _RESOURCES . "</span><span>: {$value}</span></div>";
break;
case 'other_info':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _OTHERINFO . "</span><span>: {$value}</span></div>";
break;
case 'price_string':
!$lesson->lesson['course_only'] ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PRICE . "</span><span>: {$value}</span></div>" : null;
break;
default:
break;
}
}
}
if ($string = implode("", $tooltipInfo)) {
echo $string;
} else {
echo _NODATAFOUND;
}
}
if (isset($_GET['courses_ID']) && eF_checkParameter($_GET['courses_ID'], 'id')) {
$course = new EfrontCourse($_GET['courses_ID']);
$courseInformation = $course->getInformation();
$languages = EfrontSystem::getLanguages(true);
if ($courseInformation['professors']) {
foreach ($courseInformation['professors'] as $value) {
$professorsString[] = $value['name'] . ' ' . $value['surname'];
}
//.........这里部分代码省略.........
示例14: addLessons
$user -> addLessons($lessons, $userType, 1); //active lessons
}
}
}
}
*/
if ($currentGroup->group['user_types_ID'] == '0') {
foreach ($groupUsers as $user) {
$user = EfrontUserFactory::factory($user);
$user->user['user_types_ID'] ? $userType[] = $user->user['user_types_ID'] : ($userType[] = $user->user['user_type']);
}
} else {
$userType = $currentGroup->group['user_types_ID'];
}
foreach ($lessonIds as $id) {
$lesson = new EfrontLesson($id);
$lesson->addUsers($groupUsers, $userType, true, true);
}
}
}
}
}
}
}
}
}
}
}
}
exit;
}
示例15: themes
$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 = '" . $_SESSION['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) {