plugin.php 4.1 KB

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