listing.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. $plugin = BBBPlugin::create();
  12. $tool_name = $plugin->get_lang('Videoconference');
  13. $tpl = $app['template'];
  14. $bbb = new bbb();
  15. $action = isset($_GET['action']) ? $_GET['action'] : null;
  16. $teacher = $bbb->is_teacher();
  17. api_protect_course_script(true);
  18. $message = null;
  19. if ($teacher) {
  20. switch ($action) {
  21. case 'add_to_calendar':
  22. $course_info = api_get_course_info();
  23. $agenda = new Agenda();
  24. $agenda->type = 'course';
  25. $id = intval($_GET['id']);
  26. $title = sprintf(get_lang('VideoConferenceXCourseX'), $id, $course_info['name']);
  27. $content = Display::url(get_lang('GoToTheVideoConference'), $_GET['url']);
  28. $event_id = $agenda->add_event($_REQUEST['start'], null, 'true', null, $title, $content, array('everyone'));
  29. if (!empty($event_id)) {
  30. $message = Display::return_message(get_lang('VideoConferenceAddedToTheCalendar'), 'success');
  31. } else {
  32. $message = Display::return_message(get_lang('Error'), 'error');
  33. }
  34. break;
  35. case 'copy_record_to_link_tool':
  36. $result = $bbb->copy_record_to_link_tool($_GET['id'], $_GET['record_id']);
  37. if ($result) {
  38. $message = Display::return_message(get_lang('VideoConferenceAddedToTheLinkTool'), 'success');
  39. } else {
  40. $message = Display::return_message(get_lang('Error'), 'error');
  41. }
  42. break;
  43. case 'delete_record':
  44. $bbb->delete_record($_GET['id']);
  45. if ($result) {
  46. $message = Display::return_message(get_lang('Deleted'), 'success');
  47. } else {
  48. $message = Display::return_message(get_lang('Error'), 'error');
  49. }
  50. break;
  51. case 'end':
  52. $bbb->end_meeting($_GET['id']);
  53. $message = Display::return_message(get_lang('MeetingClosed').'<br />'.get_lang('MeetingClosedComment'), 'success', false);
  54. break;
  55. case 'publish':
  56. //$result = $bbb->publish_meeting($_GET['id']);
  57. break;
  58. case 'unpublish':
  59. //$result = $bbb->unpublish_meeting($_GET['id']);
  60. break;
  61. default:
  62. break;
  63. }
  64. }
  65. $meetings = $bbb->get_course_meetings();
  66. if (!empty($meetings)) {
  67. $meetings = array_reverse($meetings);
  68. }
  69. $users_online = $bbb->get_users_online_in_current_room();
  70. $status = $bbb->is_server_running();
  71. $meeting_exists = $bbb->meeting_exists(api_get_course_id());
  72. $show_join_button = false;
  73. if ($meeting_exists || $teacher) {
  74. $show_join_button = true;
  75. }
  76. $tpl->assign('allow_to_edit', $teacher);
  77. $tpl->assign('meetings', $meetings);
  78. $conference_url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.api_get_cidreq();
  79. $tpl->assign('conference_url', $conference_url);
  80. $tpl->assign('users_online', $users_online);
  81. $tpl->assign('bbb_status', $status);
  82. $tpl->assign('show_join_button', $show_join_button);
  83. $tpl->assign('message', $message);
  84. $listing_tpl = 'bbb/listing.tpl';
  85. $content = $tpl->fetch($listing_tpl);
  86. $tpl->assign('content', $content);$tpl->display_one_col_template();