protected static function get_lesson_summary_for_exporter($lessonrecord, $password = '') {
        global $USER;

        $lesson = new lesson($lessonrecord);
        $lesson->update_effective_access($USER->id);
        $lessonavailable = $lesson->get_time_restriction_status() === false;
        $lessonavailable = $lessonavailable && $lesson->get_password_restriction_status($password) === false;
        $lessonavailable = $lessonavailable && $lesson->get_dependencies_restriction_status() === false;
        $canmanage = $lesson->can_manage();

        if (!$canmanage && !$lessonavailable) {
            $fields = array('intro', 'introfiles', 'mediafiles', 'practice', 'modattempts', 'usepassword',
                'grade', 'custom', 'ongoing', 'usemaxgrade',
                'maxanswers', 'maxattempts', 'review', 'nextpagedefault', 'feedback', 'minquestions',
                'maxpages', 'timelimit', 'retake', 'mediafile', 'mediaheight', 'mediawidth',
                'mediaclose', 'slideshow', 'width', 'height', 'bgcolor', 'displayleft', 'displayleftif',
                'progressbar');

            foreach ($fields as $field) {
                unset($lessonrecord->{$field});
            }
        }

        // Fields only for managers.
        if (!$canmanage) {
            $fields = array('password', 'dependency', 'conditions', 'activitylink', 'available', 'deadline',
                            'timemodified', 'completionendreached', 'completiontimespent');

            foreach ($fields as $field) {
                unset($lessonrecord->{$field});
            }
        }
        return $lessonrecord;
    }