install.php 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  11. $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
  12. /**
  13. * Queries
  14. */
  15. $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES
  16. ('bbb_plugin', '', 'radio', 'Extra', 'false', 'BigBlueButtonEnableTitle','BigBlueButtonEnableComment',NULL,NULL, 1)";
  17. Database::query($sql);
  18. $sql = "INSERT INTO $t_options (variable, value, display_text) VALUES ('bbb_plugin', 'true', 'Yes')";
  19. Database::query($sql);
  20. $sql = "INSERT INTO $t_options (variable, value, display_text) VALUES ('bbb_plugin', 'false', 'No')";
  21. Database::query($sql);
  22. $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES
  23. ('bbb_plugin_host', '', 'textfield', 'Extra', '192.168.0.100', 'BigBlueButtonHostTitle','BigBlueButtonHostComment',NULL,NULL, 1)";
  24. Database::query($sql);
  25. $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES
  26. ('bbb_plugin_salt', '', 'textfield', 'Extra', '', 'BigBlueButtonSecuritySaltTitle','BigBlueButtonSecuritySaltComment',NULL,NULL, 1)";
  27. Database::query($sql);
  28. $table = Database::get_main_table('plugin_bbb');
  29. $sql = "CREATE TABLE $table ( " .
  30. "id BIGINT unsigned NOT NULL auto_increment PRIMARY KEY, " .
  31. "course_id INT unsigned NOT NULL DEFAULT 0, " .
  32. "name VARCHAR(255) NOT NULL DEFAULT '', " .
  33. "meeting_name VARCHAR(255) NOT NULL DEFAULT '', " .
  34. "meeting_id VARCHAR(255) NOT NULL DEFAULT '', " .
  35. "attendee_pw VARCHAR(255) NOT NULL DEFAULT '', " .
  36. "moderator_pw VARCHAR(255) NOT NULL DEFAULT '', " .
  37. "auto_login VARCHAR(255) NOT NULL DEFAULT '', " .
  38. "new_window VARCHAR(255) NOT NULL DEFAULT '', " .
  39. "welcome_msg VARCHAR(255) NOT NULL DEFAULT '')";
  40. Database::query($sql);
  41. // Update existing courses to add conference settings
  42. $t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
  43. $sql = "SELECT id, code FROM $t_courses ORDER BY id";
  44. $res = Database::query($sql);
  45. while ($row = Database::fetch_assoc($res)) {
  46. $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
  47. $course_id = $row['id'];
  48. $sql = "SELECT value FROM $t_course WHERE c_id = $course_id AND variable = 'big_blue_button_meeting_name' ";
  49. $result = Database::query($sql);
  50. if (!Database::num_rows($result)) {
  51. $sql_course = "INSERT INTO $t_course (c_id, variable,value,category) VALUES ($course_id, 'big_blue_button_meeting_name','','plugins')";
  52. $r = Database::query($sql_course);
  53. }
  54. $sql = "SELECT value FROM $t_course WHERE c_id = $course_id AND variable = 'big_blue_button_attendee_password' ";
  55. $result = Database::query($sql);
  56. if (!Database::num_rows($result)) {
  57. $sql_course = "INSERT INTO $t_course (c_id, variable, value, category) VALUES ($course_id, 'big_blue_button_attendee_password','','plugins')";
  58. $r = Database::query($sql_course);
  59. }
  60. $sql = "SELECT value FROM $t_course WHERE c_id = $course_id AND variable = 'big_blue_button_moderator_password' ";
  61. $result = Database::query($sql);
  62. if (!Database::num_rows($result)) {
  63. $sql_course = "INSERT INTO $t_course (c_id, variable, value, category) VALUES ($course_id, 'big_blue_button_moderator_password','','plugins')";
  64. $r = Database::query($sql_course);
  65. }
  66. $sql = "SELECT value FROM $t_course WHERE c_id = $course_id AND variable = 'big_blue_button_welcome_message' ";
  67. $result = Database::query($sql);
  68. if (!Database::num_rows($result)) {
  69. $sql_course = "INSERT INTO $t_course (c_id, variable,value,category) VALUES ($course_id, 'big_blue_button_welcome_message','','plugins')";
  70. $r = Database::query($sql_course);
  71. }
  72. $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
  73. $sql = "SELECT name FROM $t_tool WHERE c_id = $course_id AND name = 'videoconference' ";
  74. $result = Database::query($sql);
  75. if (!Database::num_rows($result)) {
  76. $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','_blank','plugin','0')";
  77. $r = Database::query($sql_course);
  78. }
  79. }