I am trying to write an enrol plugin for moodle and therefor I need the functions of the /moodle/enrol/cohort/lib.php file.
But when I try
global $CFG;
require_once($CFG->dirroot . '../lib.php');
it gives me
Notice: Trying to get property of non-object in /var/www/html/moodle/enrol/cohort/enrol_module/result.php on line 20
line 20 is
require_once($CFG->dirroot . '../lib.php');
The Path should be correct. Can someone tell me what is responsible for this?