start.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * This script initiates a videoconference session, calling the BigBlueButton API
  4. * @package chamilo.plugin.bigbluebutton
  5. */
  6. /**
  7. * Initialization
  8. */
  9. $course_plugin = 'bbb'; //needed in order to load the plugin lang variables
  10. require_once dirname(__FILE__).'/config.php';
  11. $tool_name = get_lang('Videoconference');
  12. $app['title'] = $tool_name;
  13. $tpl = $app['template'];
  14. $bbb = new bbb();
  15. if ($bbb->plugin_enabled) {
  16. if ($bbb->is_server_running()) {
  17. if (isset($_GET['launch']) && $_GET['launch'] == 1) {
  18. $meeting_params = array();
  19. $meeting_params['meeting_name'] = api_get_course_id();
  20. if ($bbb->meeting_exists($meeting_params['meeting_name'])) {
  21. $url = $bbb->join_meeting($meeting_params['meeting_name']);
  22. if ($url) {
  23. header('location: '.$url);
  24. exit;
  25. } else {
  26. $url = $bbb->create_meeting($meeting_params);
  27. header('location: '.$url);
  28. exit;
  29. }
  30. } else {
  31. if ($bbb->is_teacher()) {
  32. $url = $bbb->create_meeting($meeting_params);
  33. header('location: '.$url);
  34. exit;
  35. } else {
  36. $url = 'listing.php';
  37. header('location: '.$url);
  38. exit;
  39. }
  40. }
  41. } else {
  42. $url = 'listing.php';
  43. header('location: '.$url);
  44. exit;
  45. }
  46. } else {
  47. $message = Display::return_message(get_lang('ServerIsNotRunning'), 'warning');
  48. }
  49. } else {
  50. $message = Display::return_message(get_lang('ServerIsNotConfigured'), 'warning');
  51. }
  52. $tpl->assign('message', $message);
  53. $tpl->display_one_col_template();