bbb_plugin.class.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /* To showing the plugin course icons you need to add these icons:
  4. * main/img/icons/22/plugin_name.png
  5. * main/img/icons/64/plugin_name.png
  6. * main/img/icons/64/plugin_name_na.png
  7. */
  8. class BBBPlugin extends Plugin
  9. {
  10. public $is_course_plugin = true;
  11. //When creating a new course this settings are added to the course
  12. public $course_settings = array(
  13. // array('name' => 'big_blue_button_welcome_message', 'type' => 'text'),
  14. array('name' => 'big_blue_button_record_and_store', 'type' => 'checkbox')
  15. );
  16. static function create() {
  17. static $result = null;
  18. return $result ? $result : $result = new self();
  19. }
  20. protected function __construct() {
  21. parent::__construct('2.0', 'Julio Montoya, Yannick Warnier', array('tool_enable' => 'boolean', 'host' =>'text', 'salt' => 'text'));
  22. }
  23. function install() {
  24. $table = Database::get_main_table('plugin_bbb_meeting');
  25. $sql = "CREATE TABLE IF NOT EXISTS $table (
  26. id INT unsigned NOT NULL auto_increment PRIMARY KEY,
  27. c_id INT unsigned NOT NULL DEFAULT 0,
  28. meeting_name VARCHAR(255) NOT NULL DEFAULT '',
  29. attendee_pw VARCHAR(255) NOT NULL DEFAULT '',
  30. moderator_pw VARCHAR(255) NOT NULL DEFAULT '',
  31. record INT NOT NULL DEFAULT 0,
  32. status INT NOT NULL DEFAULT 0,
  33. created_at VARCHAR(255) NOT NULL,
  34. closed_at VARCHAR(255) NOT NULL,
  35. calendar_id INT DEFAULT 0,
  36. welcome_msg VARCHAR(255) NOT NULL DEFAULT '')";
  37. Database::query($sql);
  38. //Installing course settings
  39. $this->install_course_fields_in_all_courses();
  40. }
  41. function uninstall() {
  42. $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  43. $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
  44. $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
  45. //New settings
  46. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_tool_enable'";
  47. Database::query($sql);
  48. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_salt'";
  49. Database::query($sql);
  50. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_host'";
  51. Database::query($sql);
  52. //Old settings deleting just in case
  53. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin'";
  54. Database::query($sql);
  55. $sql = "DELETE FROM $t_options WHERE variable = 'bbb_plugin'";
  56. Database::query($sql);
  57. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_host'";
  58. Database::query($sql);
  59. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_salt'";
  60. Database::query($sql);
  61. //hack to get rid of Database::query warning (please add c_id...)
  62. $sql = "DELETE FROM $t_tool WHERE name = 'videoconference' AND c_id = c_id";
  63. Database::query($sql);
  64. $sql = "DROP TABLE IF EXISTS plugin_bbb_meeting";
  65. Database::query($sql);
  66. //Deleting course settings
  67. $this->uninstall_course_fields_in_all_courses();
  68. }
  69. }