plugin.php 4.1 KB

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