plugin.php 1.9 KB

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