I'm building a Moodle (2.0) module that interacts with a third-party web service.
The module has no UI except for the settings screen. Because the mod开发者_如何学Goule doesn't have a UI, it doesn't make sense for a user to be able to place it on the home screen or in a course as an activity. How do I prevent that? How do I keep it from appearing in the Add an activity... list?
I don't believe there is a way to do that within the API (ie - there is no function you can add to your lib.php file to prevent it from appearing in the menu). If you want to apply a dirty hack the function you would probably want to look at is print_section_add_menus in course/lib.php, but I don't recommend that kind of solution.
There is a way to restrict modules in courses through administration settings under the Site Administration -> Security -> Module Security, but that only restricts teachers from adding the activity, not administrators.
All that being said, I would think about reevaluating whether or not your plugin needs to be an activity module. Maybe it would be better off as a local/ plugin or a block.
精彩评论