plugin.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * This script is a configuration file for the add_this plugin.
  4. * These settings will be used in the administration interface for plugins
  5. * (Chamilo configuration settings->Plugins).
  6. *
  7. * @package chamilo.plugin
  8. *
  9. * @author Julio Montoya <gugli100@gmail.com>
  10. */
  11. /* Plugin config */
  12. // The plugin title.
  13. $plugin_info['title'] = 'Show HTML before login';
  14. // The comments that go with the plugin.
  15. $plugin_info['comment'] = "Show a content before loading the login page.";
  16. // The plugin version.
  17. $plugin_info['version'] = '1.0';
  18. // The plugin author.
  19. $plugin_info['author'] = 'Julio Montoya';
  20. // The plugin configuration.
  21. $form = new FormValidator('form');
  22. $form->addElement('select', 'language', get_lang('Language'), api_get_languages_to_array());
  23. $form->addElement('header', 'Option 1');
  24. $form->addElement('textarea', 'option1', get_lang('Description'), ['rows' => 10, 'class' => 'span6']);
  25. $form->addElement('text', 'option1_url', get_lang('RedirectTo'));
  26. $form->addElement('header', 'Option 2');
  27. $form->addElement('textarea', 'option2', get_lang('Description'), ['rows' => 10, 'class' => 'span6']);
  28. $form->addElement('text', 'option2_url', get_lang('RedirectTo'));
  29. $form->addElement('button', 'submit_button', get_lang('Save'));
  30. // Get default value for form
  31. $defaults = [];
  32. $defaults['language'] = api_get_plugin_setting('before_login', 'language');
  33. $defaults['option1'] = api_get_plugin_setting('before_login', 'option1');
  34. $defaults['option2'] = api_get_plugin_setting('before_login', 'option2');
  35. $defaults['option1_url'] = api_get_plugin_setting('before_login', 'option1_url');
  36. $defaults['option2_url'] = api_get_plugin_setting('before_login', 'option2_url');
  37. $plugin_info['templates'] = ['template.tpl'];
  38. if (file_exists(__DIR__.'/custom.template.tpl')) {
  39. $plugin_info['templates'] = ['custom.template.tpl'];
  40. }
  41. $form->setDefaults($defaults);
  42. // Display form
  43. $plugin_info['settings_form'] = $form;