# example

1. <?php
2. /**
3. * Plugin controller
4. *
5. * @author Mark Nielsen
6. * @version $Id$
7. * @package blocks/helloworld
8. */
10. defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
12. class block_helloworld_controller_plugin extends mr_controller_block {
13. /**
14. * Default screen
15. *
16. * Demo of plugins
17. */
18. public function view_action() {
19. $this->print_header();
21. echo $this->output->heading('Demo of mr_plugin and mr_helper_load');
22. $this->helper->highlight(__CLASS__, __FUNCTION__);
23. echo $this->output->box_start('generalbox boxaligncenter boxwidthnormal');
25. #### DEMO CODE ####
26. // Load all top-level plugins
27. $result = $this->helper->load->plugin();
28. $this->helper->dump($result, 'load->plugin() result');
30. // Load plugin 'one'
31. $result = $this->helper->load->plugin('one');
32. $this->helper->dump($result, 'load->plugin(\'one\') result');
34. // Inside of blocks/helloworld/plugin/one are more plugins which
35. // resemble the Multiple plugin type layout.
37. // All sub-plugins of plugin one
38. $result = $this->helper->load->plugin('one/*');
39. $this->helper->dump($result, 'load->plugin(\'one/*\') result');
41. // Load plugin 'one/aa'
42. $result = $this->helper->load->plugin('one/aa');
43. $this->helper->dump($result, 'load->plugin(\'one/aa\') result');
45. echo $this->output->heading('Example call to plugin methods:');
47. foreach ($this->helper->load->plugin() as $name => $plugin) {
48. echo $this->output->heading("For plugin $name:");
49. print_object('name(): '.$plugin->name());
50. print_object('type(): '.$plugin->type());
51. print_object('parent_method(): '.$plugin->parent_method());
52. print_object('abstract_method(): '.$plugin->abstract_method());
53. }
54. #### DEMO CODE ####
56. echo $this->output->box_end();
57. $this->print_footer();
58. }
59. }

Documentation generated on Thu, 28 Jun 2012 16:33:49 -0700 by phpDocumentor 1.4.3