plugin.php 1.8 KB

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