本文整理汇总了PHP中EfrontLesson::getCourses方法的典型用法代码示例。如果您正苦于以下问题:PHP EfrontLesson::getCourses方法的具体用法?PHP EfrontLesson::getCourses怎么用?PHP EfrontLesson::getCourses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EfrontLesson
的用法示例。
在下文中一共展示了EfrontLesson::getCourses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EfrontLesson
//$form -> addElement('select', 'branches_ID', _LOCATIONBRANCH, eF_createBranchesTreeSelect($branches,$only_existing), 'class = "inputText"');
//$smarty -> assign("T_BRANCHES_FILTER", eF_createBranchesFilterSelect());
*/
$smarty->assign("T_JOBS_FILTER", eF_createJobFilterSelect());
}
#cpp#endif
if (isset($_GET['edit_lesson'])) {
//If we are editing a lesson, we set the default form values to the ones stored in the database
$editLesson = new EfrontLesson($_GET['edit_lesson']);
$form->setDefaults(array('name' => $editLesson->lesson['name'], 'active' => $editLesson->lesson['active'], 'show_catalog' => $editLesson->lesson['show_catalog'], 'course_only' => $editLesson->lesson['course_only'], 'directions_ID' => $editLesson->lesson['directions_ID'], 'languages_NAME' => $editLesson->lesson['languages_NAME'], 'duration' => $editLesson->lesson['duration'] ? $editLesson->lesson['duration'] : '', 'access_limit' => $editLesson->lesson['access_limit'] ? $editLesson->lesson['access_limit'] : '', 'share_folder' => $editLesson->lesson['share_folder'] ? $editLesson->lesson['share_folder'] : 0, 'max_users' => $editLesson->lesson['max_users'] ? $editLesson->lesson['max_users'] : null, 'price' => $editLesson->lesson['price'], 'recurring' => $editLesson->options['recurring'], $editLesson->options['recurring'] . '_duration' => $editLesson->options['recurring_duration']));
if ($editLesson->lesson['share_folder']) {
$shareFolderLesson = new EfrontLesson($editLesson->lesson['share_folder']);
$smarty->assign("T_SHARE_FOLDER_WITH", $shareFolderLesson->lesson['name']);
}
if ($editLesson->lesson['course_only'] && sizeof($editLesson->getCourses()) > 0 || !$editLesson->lesson['course_only']) {
$result = eF_getTableData("users_to_lessons", "count(*)", "lessons_ID={$editLesson->lesson['id']} and archive=0");
if ($result[0]['count(*)'] > 0) {
$courseOnly->freeze();
$directAccess->freeze();
}
}
$smarty->assign("T_EDIT_LESSON", $editLesson);
} else {
//$form -> addElement('file', 'import_content', _UPLOADLESSONFILE, 'class = "inputText"');
$form->setDefaults(array('active' => 1, 'show_catalog' => 1, 'price' => 0, 'course_only' => 1, 'languages_NAME' => $GLOBALS['configuration']['default_language']));
}
if (isset($currentUser->coreAccess['lessons']) && $currentUser->coreAccess['lessons'] != 'change') {
$form->freeze();
} else {
$form->addElement('submit', 'submit_lesson', _SUBMIT, 'class = "flatButton"');
示例2: 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;
}
}
示例3: array
$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;
}
}
if (!empty($skills_to_propose)) {
echo implode(" ", $skills_to_propose);