本文整理汇总了PHP中EfrontLesson::createInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP EfrontLesson::createInstance方法的具体用法?PHP EfrontLesson::createInstance怎么用?PHP EfrontLesson::createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EfrontLesson
的用法示例。
在下文中一共展示了EfrontLesson::createInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUniqueLessonMode
/**
* Set the lesson mode to 'unique' in the course
*
* @param EfrontLesson $lesson The lesson to set the mode for
* @since 3.6.1
* @access private
*/
private function setUniqueLessonMode($lesson)
{
$courseUsers = $this->countCourseUsers(array('archive' => false));
if ($courseUsers['count'] > 0) {
throw new Exception(_YOUCANNOTCHANGEMODECOURSENOTEMPTY, EfrontCourseException::COURSE_NOT_EMPTY);
}
//First, search for any instances that where already defined for this lesson and course in the past
$result = eF_getTableData("lessons", "*", "instance_source=" . $lesson->lesson['id'] . " and originating_course=" . $this->course['id']);
$coursedata = eF_getTableData("lessons_to_courses", "*", "lessons_ID=" . $lesson->lesson['id'] . " and courses_ID=" . $this->course['id']);
if (sizeof($result) > 0) {
$lessonInstance = new EfrontLesson($result[0]);
$lessonsSchedule[$lessonInstance->lesson['id']] = array('start_date' => $coursedata[0]['start_date'], 'end_date' => $coursedata[0]['end_date'], 'start_period' => $coursedata[0]['start_period'], 'end_period' => $coursedata[0]['end_period']);
$this->addLessons($lessonInstance, $lessonsSchedule);
} else {
$lessonInstance = EfrontLesson::createInstance($lesson, $this);
$lessonsSchedule[$lessonInstance->lesson['id']] = array('start_date' => $coursedata[0]['start_date'], 'end_date' => $coursedata[0]['end_date'], 'start_period' => $coursedata[0]['start_period'], 'end_period' => $coursedata[0]['end_period']);
$this->addLessons($lessonInstance, $lessonsSchedule);
}
$this->replaceLessonInCourseOrder($lesson, $lessonInstance);
$this->replaceLessonInCourseRules($lesson, $lessonInstance);
//Must be put *before* removeLessons()
//$this -> removeLessons($lesson); //commented out because it was messing up with order
eF_deleteTableData("lessons_to_courses", "courses_ID=" . $this->course['id'] . " and lessons_ID=" . $lesson->lesson['id']);
}