codes in both the files are deleted to make it concise and to the point :
controller/LessonMainController.php
use demo\Model\Courses\CourseToUser;
use demo\Model\Courses\CourseDependency;
use demo\Model\User;
use demo\Model\Course;
    if (!CourseDependency::isDependencyAccessible($_GET['course']) || !$this->course->isDateAccessible())
 {
   TemplateController::setMessage("This course does not exist or you are not allowed to access it");
   UrlhelperController::redirect(array('ctg' => 'start'));
  }
Model/Courses/CourseDependency.php
public static function isDependencyAccessible($course_id, $user_id = false) {
        self::checkId($course_id);
        if (!$user_id) {
            $user_id = User::getCurrentUser()->id;
        }
        $courses =  self::getDependencies($course_id);
        $access = true;
        if (!empty($courses)) {
            $user  = new User($user_id);
            $user_to_courses = CourseToUser::getAll(array('condition' => 'users_ID='.$user->id." and courses_ID IN (".implode(",", $courses).")"), array('courses_ID', 'status'));
            foreach ($user_to_courses as $value) {
                if ($value['status'] != CourseToUser::STATUS_COMPLETED) {
                     $access = false;
                }
            }
        }
        return $access;
    }
}
PROBELM:
In the absence of !CourseDependency::isDependencyAccessible($_GET['course']) everything works well but with this condition i get the error Using $this when not in object context (0) Please guide me to fix this.
