public function get_dependencies_restriction_status() {
        global $DB, $USER;
        if ($this->can_manage()) {
            return false;
        }

        if ($dependentlesson = $DB->get_record('lesson', array('id' => $this->properties->dependency))) {
            // Lesson exists, so we can proceed.
            $conditions = unserialize($this->properties->conditions);
            // Assume false for all.
            $errors = array();
            // Check for the timespent condition.
            if ($conditions->timespent) {
                $timespent = false;
                if ($attempttimes = $DB->get_records('lesson_timer', array("userid" => $USER->id, "lessonid" => $dependentlesson->id))) {
                    // Go through all the times and test to see if any of them satisfy the condition.
                    foreach ($attempttimes as $attempttime) {
                        $duration = $attempttime->lessontime - $attempttime->starttime;
                        if ($conditions->timespent < $duration / 60) {
                            $timespent = true;
                        }
                    }
                }
                if (!$timespent) {
                    $errors[] = get_string('timespenterror', 'lesson', $conditions->timespent);
                }
            }
            // Check for the gradebetterthan condition.
            if ($conditions->gradebetterthan) {
                $gradebetterthan = false;
                if ($studentgrades = $DB->get_records('lesson_grades', array("userid" => $USER->id, "lessonid" => $dependentlesson->id))) {
                    // Go through all the grades and test to see if any of them satisfy the condition.
                    foreach ($studentgrades as $studentgrade) {
                        if ($studentgrade->grade >= $conditions->gradebetterthan) {
                            $gradebetterthan = true;
                        }
                    }
                }
                if (!$gradebetterthan) {
                    $errors[] = get_string('gradebetterthanerror', 'lesson', $conditions->gradebetterthan);
                }
            }
            // Check for the completed condition.
            if ($conditions->completed) {
                if (!$DB->count_records('lesson_grades', array('userid' => $USER->id, 'lessonid' => $dependentlesson->id))) {
                    $errors[] = get_string('completederror', 'lesson');
                }
            }
            if (!empty($errors)) {
                return (object) ['errors' => $errors, 'dependentlesson' => $dependentlesson];
            }
        }
        return false;
    }