plugin.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * This script is a configuration file for the delivery tools plugin.
  4. * You can use it as a master for other platform plugins (course plugins are slightly different).
  5. * These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)
  6. * @package chamilo.plugin
  7. * @author Julio Montoya <gugli100@gmail.com>
  8. */
  9. /**
  10. * Plugin details (must be present)
  11. */
  12. /* Plugin config */
  13. $plugin_info = CustomFooterPlugin::create()->get_info();
  14. //the plugin title
  15. $plugin_info['title'] = 'Custom Footer';
  16. //the comments that go with the plugin
  17. $plugin_info['comment'] = "Add custom footer. Set the regions to footer_left and footer_right.";
  18. //the plugin version
  19. $plugin_info['version'] = '1.0';
  20. //the plugin author
  21. $plugin_info['author'] = 'Valery Fremaux, Julio Montoya';
  22. /* Plugin optional settings */
  23. /*
  24. * This form will be showed in the plugin settings once the plugin was installed
  25. * in the plugin/hello_world/index.php you can have access to the value: $plugin_info['settings']['hello_world_show_type']
  26. */
  27. $form = new FormValidator('customfooter_form');
  28. $plugininstance = CustomFooterPlugin::create();
  29. $config = api_get_settings_params(
  30. array('subkey = ? ' => 'customfooter', ' AND category = ? ' => 'Plugins')
  31. );
  32. $form_settings = [];
  33. foreach ($config as $fooid => $configrecord) {
  34. $canonic = preg_replace('/^customfooter_/', '', $configrecord['variable']);
  35. if (in_array($canonic, array('footer_left', 'footer_right'))) {
  36. $form_settings[$canonic] = $configrecord['selected_value'];
  37. }
  38. }
  39. // A simple select.
  40. $form->addElement('text', 'footer_left', $plugininstance->get_lang('footerleft'));
  41. $form->addElement('text', 'footer_right', $plugininstance->get_lang('footerright'));
  42. $form->addButtonSave($plugininstance->get_lang('Save'));
  43. $form->setDefaults($form_settings);
  44. $plugin_info['settings_form'] = $form;