start.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script initiates a ticket management system session
  5. * @package chamilo.plugin.ticket
  6. */
  7. /**
  8. * Initialization
  9. */
  10. $course_plugin = 'ticket'; //needed in order to load the plugin lang variables
  11. require_once dirname(__FILE__).'/config.php';
  12. $tool_name = get_lang('Ticket');
  13. $tpl = new Template($tool_name);
  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();