public function __construct($folder = false) { global $CFG; $user = $CFG->current_app->getCurrentUser()->getUserOnInstitution(); parent::__construct($user->getApp()); if (!$user && $CFG->current_app->hasPrivilege('GCAdmin')) { $user = $CFG->current_app->getInstitution()->getGCAdminUser(); } $this->user = $user; if (!$folder || !$this->authorizeAccess($folder)) { $folder = $this->getUserFolder(); } $this->setKey($folder); $this->setFolders(); $this->files = array(); $this->has_list = false; }