My Courses in MM

Re: My Courses in MM

by y h -
Number of replies: 4

I created a folder in plugins. In this one, I created main.js in which i put all the functions of the plugins "contents" and "participants". Also i copied to this folder all html files of both plugins. When I add this plugin in config.json, I got this error: Uncaught SyntaxError: Unexpected token < in this line in main.js: 

templates: {
"participant": {
model: "participant",
html: participantTpl },
"participants": {
html: participantsTpl },
"folder": {
html: folderTpl },
"contents": {
html: contentsTpl },
"sections": {
html: sectionsTpl },
"mimetypes": JSON.parse(mimeTypes)}}

Honestly, I need your help to know if my method is wrong and i shouldn't put the functions of the plugins "contents" and "participants" and i should put another functions but my idea was that when I click on mycourses another page will open and there all the courses will be listed in the same way of the main page in the original moodle mobile app with contents and participants.

Thank you for your helpsmile

In reply to y h

Re: My Courses in MM

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Please, can you share the full code of your plugin so I can check what is happening?

In reply to Juan Leyva

Re: My Courses in MM

by y h -

Kindly find attached the plugin's folder.

In reply to y h

Re: My Courses in MM

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi,

I've found two erros:

lang: {
component: "moodle"
}

is invalid it should be:

lang: {
component: "core"
}

And also, define(templates, function (sectionsTpl, contentsTpl, folderTpl, mimeTypes, participantsTpl, participantTpl) { should match with the templates set you define before, so it should be:

define(templates, function (participantsTpl, participantTpl, sectionsTpl, contentsTpl, folderTpl, mimeTypes, mycoursesTpl) {

 

Find attached the correct file

In reply to Juan Leyva

Re: My Courses in MM

by y h -

Hi, I modified the code and no more errors but actually the result is not what I wanted because it gives me mycourses followed by contents and participants and I can't click on any of them what I wanted is like this (I want to have the list of courses (second picture) when I click on mycourses with content and  participants for each of them the same way it's displayed in the main page in your moodle mobile):

 

Do you have any suggestions or anyone else at least about my way to develop the plugin because what I did and already mentioned and attached is not giving me the result I want.

Thanks in advancesmile