install.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * This script is included by main/admin/settings.lib.php and generally
  4. * includes things to execute in the main database (settings_current table)
  5. * @package chamilo.plugin.bigbluebutton
  6. */
  7. /**
  8. * Initialization
  9. */
  10. require 'config.php';
  11. $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  12. $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
  13. /**
  14. * Queries
  15. */
  16. $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable, access_url_locked) VALUES
  17. ('bbb_plugin', '', 'radio', 'Extra', 'false', 'BigBlueButtonEnableTitle','BigBlueButtonEnableComment',NULL,NULL, 1, 1)";
  18. Database::query($sql);
  19. $sql = "INSERT INTO $t_options (variable, value, display_text) VALUES ('bbb_plugin', 'true', 'Yes')";
  20. Database::query($sql);
  21. $sql = "INSERT INTO $t_options (variable, value, display_text) VALUES ('bbb_plugin', 'false', 'No')";
  22. Database::query($sql);
  23. $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable, access_url_locked) VALUES
  24. ('bbb_plugin_host', '', 'textfield', 'Extra', '192.168.0.100', 'BigBlueButtonHostTitle','BigBlueButtonHostComment',NULL,NULL, 1,1)";
  25. Database::query($sql);
  26. $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable, access_url_locked) VALUES
  27. ('bbb_plugin_salt', '', 'textfield', 'Extra', '', 'BigBlueButtonSecuritySaltTitle','BigBlueButtonSecuritySaltComment',NULL,NULL, 1,1)";
  28. Database::query($sql);
  29. $table = Database::get_main_table('plugin_bbb_meeting');
  30. $sql = "CREATE TABLE $table (
  31. id INT unsigned NOT NULL auto_increment PRIMARY KEY,
  32. c_id INT unsigned NOT NULL DEFAULT 0,
  33. meeting_name VARCHAR(255) NOT NULL DEFAULT '',
  34. attendee_pw VARCHAR(255) NOT NULL DEFAULT '',
  35. moderator_pw VARCHAR(255) NOT NULL DEFAULT '',
  36. record INT NOT NULL DEFAULT 0,
  37. status INT NOT NULL DEFAULT 0,
  38. created_at VARCHAR(255) NOT NULL,
  39. calendar_id INT DEFAULT 0,
  40. welcome_msg VARCHAR(255) NOT NULL DEFAULT '')";
  41. Database::query($sql);
  42. // Update existing courses to add conference settings
  43. $t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
  44. $sql = "SELECT id, code FROM $t_courses ORDER BY id";
  45. $res = Database::query($sql);
  46. while ($row = Database::fetch_assoc($res)) {
  47. $course_id = $row['id'];
  48. foreach ($variables as $variable) {
  49. $sql = "SELECT value FROM $t_course WHERE c_id = $course_id AND variable = '$variable' ";
  50. $result = Database::query($sql);
  51. if (!Database::num_rows($result)) {
  52. $sql_course = "INSERT INTO $t_course (c_id, variable,value,category) VALUES ($course_id, '$variable','','plugins')";
  53. $r = Database::query($sql_course);
  54. }
  55. }
  56. $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
  57. $sql = "SELECT name FROM $t_tool WHERE c_id = $course_id AND name = 'videoconference' ";
  58. $result = Database::query($sql);
  59. if (!Database::num_rows($result)) {
  60. $sql_course = "INSERT INTO $t_tool VALUES ($course_id, NULL, 'videoconference','../../plugin/bbb/start.php','visio.gif','".string2binary(api_get_setting('course_create_active_tools', 'videoconference'))."','0','squaregrey.gif','NO','_self','plugin','0')";
  61. $r = Database::query($sql_course);
  62. }
  63. }