New kind of resource

New kind of resource

by Alexandre Garnier -
Number of replies: 3
Hello, how is it possible to create a new kind of resource ?

Thanks
Average of ratings: -
In reply to Alexandre Garnier

Re: New kind of resource

by Tom Flannaghan -

Hi,

I've just created a new resource in our version of moodle and heres how i did it...

The code for the resources is in mod/resource/type/. Each directory is a resource type, and by adding a new directory you create a new resource. I copied and pasted the add file resource (as this functionality very similar to what i wanted), renamed it and modified the code. Importantly, the directory name is important because it uses this to identify a class in the resource.class.php file. You must rename both the class and function in this file to resource_yourdirectoryname. To give your resource a name add a string to the language pack (or hard code it!). The rest I didn't find too bad - just look at the code for other resources. It looks pretty complicated if you are planning to create one from scratch though - luckily for me the changes I required where minimal!

Tom