예제 #1
0
파일: lessons.php 프로젝트: bqq1986/efront
} elseif (isset($_GET['unset_course_only']) && eF_checkParameter($_GET['unset_course_only'], 'id')) {
    //The administrator asked to deactivate a lesson
    if (isset($currentUser->coreAccess['lessons']) && $currentUser->coreAccess['lessons'] != 'change') {
        echo urlencode(_UNAUTHORIZEDACCESS);
        exit;
    }
    try {
        $lesson = new EfrontLesson($_GET['unset_course_only']);
        $lessonCourses = $lesson->getCourses();
        if (!empty($lessonCourses)) {
            throw new Exception(_THISLESSONISPARTOFCOURSESANDCANNOTCHANGEMODE);
        }
        if (G_VERSIONTYPE == 'educational') {
            #cpp#ifdef EDUCATIONAL
            $lesson->removeCoursesInheritedSkills();
            $lesson->insertLessonSkill();
        }
        #cpp#endif
        $lesson->lesson['course_only'] = 0;
        $lesson->persist();
        echo "0";
    } catch (Exception $e) {
        handleAjaxExceptions($e);
    }
    exit;
} elseif (isset($_GET['set_course_only']) && eF_checkParameter($_GET['set_course_only'], 'id')) {
    //The administrator asked to activate a lesson
    if (isset($currentUser->coreAccess['lessons']) && $currentUser->coreAccess['lessons'] != 'change') {
        echo urlencode(_UNAUTHORIZEDACCESS);
        exit;
    }