plugin.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * This script is a configuration file for the vchamilo 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 api_get_path(LIBRARY_PATH).'plugin.class.php';
  9. require_once api_get_path(SYS_PLUGIN_PATH).'vchamilo/lib/vchamilo_plugin.class.php';
  10. require_once api_get_path(SYS_PLUGIN_PATH).'vchamilo/lib.php';
  11. global $_configuration;
  12. /**
  13. * Plugin details (must be present)
  14. */
  15. /* Plugin config */
  16. //the plugin title
  17. $plugin_info['title'] = 'Chamilo Virtualization';
  18. //the comments that go with the plugin
  19. $plugin_info['comment'] = "Holds chamilo virtualisation tools";
  20. //the plugin version
  21. $plugin_info['version'] = '1.0';
  22. //the plugin author
  23. $plugin_info['author'] = 'Valery Fremaux, Julio Montoya';
  24. /* Plugin optional settings */
  25. /*
  26. * This form will be showed in the plugin settings once the plugin was installed
  27. * in the plugin/hello_world/index.php you can have access to the value: $plugin_info['settings']['hello_world_show_type']
  28. */
  29. $form = new FormValidator('vchamilo_form');
  30. $plugininstance = VChamiloPlugin::create();
  31. $form_settings = array(
  32. 'enable_virtualisation' => vchamilo_get_config('vchamilo', 'enable_virtualisation', true),
  33. 'httpproxyhost' => vchamilo_get_config('vchamilo', 'httpproxyhost', true),
  34. 'httpproxyport' => vchamilo_get_config('vchamilo', 'httpproxyport', true),
  35. 'httpproxybypass' => vchamilo_get_config('vchamilo', 'httpproxybypass', true),
  36. 'httpproxyuser' => vchamilo_get_config('vchamilo', 'httpproxyuser', true),
  37. 'httpproxypassword' => vchamilo_get_config('vchamilo', 'httpproxypassword', true),
  38. 'cmd_mysql' => vchamilo_get_config('vchamilo', 'cmd_mysql', true),
  39. 'cmd_mysqldump' => vchamilo_get_config('vchamilo', 'cmd_mysqldump', true),
  40. 'course_real_root' => vchamilo_get_config('vchamilo', 'course_real_root', true),
  41. 'archive_real_root' => vchamilo_get_config('vchamilo', 'archive_real_root', true),
  42. 'home_real_root' => vchamilo_get_config('vchamilo', 'home_real_root', true),
  43. );
  44. $form->setDefaults($form_settings);
  45. $wwwroot = $_configuration['root_web'];
  46. //A simple select
  47. $options = array(0 => $plugininstance->get_lang('no'), 1 => $plugininstance->get_lang('yes'));
  48. $form->addlabel('', '<a class="btn btn-primary" href="'.api_get_path(WEB_PLUGIN_PATH).'vchamilo/views/manage.php">'.
  49. $plugininstance->get_lang('manage_instances').'</a>');
  50. $form->addElement('header', $plugininstance->get_lang('enabling'));
  51. $form->addElement('select', 'enable_virtualisation', $plugininstance->get_lang('enable_virtualisation'), $options);
  52. $form->addElement(
  53. 'text',
  54. 'course_real_root',
  55. [$plugininstance->get_lang('courserealroot'), 'Example: '.api_get_path(SYS_PATH).'var/courses/']
  56. );
  57. $form->addElement(
  58. 'text',
  59. 'archive_real_root',
  60. [$plugininstance->get_lang('archiverealroot'), 'Example: '.api_get_path(SYS_PATH).'var/archive/']
  61. );
  62. $form->addElement(
  63. 'text',
  64. 'home_real_root',
  65. [$plugininstance->get_lang('homerealroot'), 'Example: '.api_get_path(SYS_PATH).'var/home/']
  66. );
  67. $form->addElement('header', $plugininstance->get_lang('mysqlcmds'));
  68. $form->addElement('text', 'cmd_mysql', [$plugininstance->get_lang('mysqlcmd'), 'Example: /usr/bin/mysql']);
  69. $form->addElement('text', 'cmd_mysqldump', [$plugininstance->get_lang('mysqldumpcmd'), 'Example: /usr/bin/mysqldump']);
  70. $form->addElement('header', $plugininstance->get_lang('proxysettings'));
  71. $form->addElement('text', 'httpproxyhost', $plugininstance->get_lang('httpproxyhost'));
  72. $form->addElement('text', 'httpproxyport', $plugininstance->get_lang('httpproxyport'));
  73. $form->addElement('text', 'httpproxybypass', $plugininstance->get_lang('httpproxybypass'));
  74. $form->addElement('text', 'httpproxyuser', $plugininstance->get_lang('httpproxyuser'));
  75. $form->addElement('text', 'httpproxypassword', $plugininstance->get_lang('httpproxypassword'));
  76. $form->addButtonSave($plugininstance->get_lang('Save'));
  77. $plugin_info['settings_form'] = $form;
  78. //set the templates that are going to be used
  79. $plugin_info['templates'] = array('template.tpl');