Getting URL of activity/lesson via Common module ID

Getting URL of activity/lesson via Common module ID

by jeff mayer -
Number of replies: 4

Is there a method via the API to retrieve the URL of an in-course activity by its common module id? 

Average of ratings: -
In reply to jeff mayer

Re: Getting URL of activity/lesson via Common module ID

by jeff mayer -
Anyone?
In reply to jeff mayer

Re: Getting URL of activity/lesson via Common module ID

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Hi,

Not that I am aware of. You could of course generate it in code by getting the course module object determining the module and calling the module's view.php script.
In reply to Benjamin Ellis

Re: Getting URL of activity/lesson via Common module ID

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, the URL will be

...moodle wwwroot.../mod/<type>/view.php?id=<cmid>

Where cmid is the id you have. So, you just need the type of activity (e.g. forum/quiz). There must be a web service that includes that in the return.

In reply to Benjamin Ellis

Re: Getting URL of activity/lesson via Common module ID

by jeff mayer -

If you have any specifics on how to dos this I would appreciate it.  Either by web service or directly.