load(); if ($course && $course->getType() == 'course' && $course->isRegistrationOpen()) { if ($course->isLearner($user_id)) { $Dippler->add_system_message(_("Already is a learner."), 'error'); forward($course->getURL('learners')); } $status = $course->getLearnerDefaultStatus(); if ($course->canEdit()) { $added = $course->addLearner($user_id); } else { $added = $course->enrollLearner($user_id); } if ($added) { if ($status == 5) { if ($course->canEdit()) { $Dippler->add_system_message(_("Learner added to the course.")); } else { $Dippler->add_system_message(_("You have been enrolled to the course.")); } // TODO Send email message } else if ($status == 1) { $Dippler->add_system_message(_("You application was submitted, please wait until your application is processed.")); // TODO Send email message } } else { $Dippler->add_system_message(_("Learner could not be enrolled to the course."), "error"); } forward($course->getURL('participants')); } forward(); ?>