diff --git a/plugin/bbb/admin.php b/plugin/bbb/admin.php new file mode 100644 index 0000000000..501e44b33c --- /dev/null +++ b/plugin/bbb/admin.php @@ -0,0 +1,41 @@ +get_lang('Videoconference'); +$tpl = new Template($tool_name); + +$isGlobal = isset($_GET['global']) ? true : false; + +$bbb = new bbb('', '', $isGlobal); +$action = isset($_GET['action']) ? $_GET['action'] : null; + +$meetings = $bbb->getMeetings(); + +if (!empty($meetings)) { + $meetings = array_reverse($meetings); +} + +if (!$bbb->isServerRunning()) { + Display::addFlash( + Display::return_message(get_lang('ServerIsNotRunning'), 'error') + ); +} + +$tpl->assign('meetings', $meetings); + +$content = $tpl->fetch('bbb/admin.tpl'); + +$tpl->assign('header', get_lang('RecordList')); +$tpl->assign('content', $content); +$tpl->display_one_col_template(); diff --git a/plugin/bbb/admin.tpl b/plugin/bbb/admin.tpl new file mode 100644 index 0000000000..e20c983227 --- /dev/null +++ b/plugin/bbb/admin.tpl @@ -0,0 +1,45 @@ + + + + + + + + + + + + + {% for meeting in meetings %} + + {% if meeting.visibility == 0 %} + + {% else %} + + {% endif %} + + + + + + + {% endfor %} + +
{{ 'CreatedAt'|get_lang }}{{ 'Status'|get_lang }}{{ 'Records'|get_lang }}{{ 'Course'|get_lang }}{{ 'Session'|get_lang }}{{ 'Actions'|get_lang }}
{{ meeting.created_at }}{{ meeting.created_at }} + {% if meeting.status == 1 %} + {{ 'MeetingOpened'|get_lang }} + {% else %} + {{ 'MeetingClosed'|get_lang }} + {% endif %} + + {% if meeting.record == 1 %} + {# Record list #} + {{ meeting.show_links }} + {% endif %} + {{ meeting.course ? meeting.course.title : '-' }}{{ meeting.session ? meeting.session.name : '-' }} + {% if meeting.status == 1 %} + {{ 'CloseMeeting'|get_lang }} + {% else %} + {{ meeting.action_links }} + {% endif %} +
diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 7c46bb74dc..ca0cf311e2 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -445,29 +445,26 @@ class bbb * Gets all the course meetings saved in the plugin_bbb_meeting table * @return array Array of current open meeting rooms */ - public function getMeetings() + public function getMeetings($courseId = 0, $sessionId = 0, $groupId = 0) { + $em = Database::getManager(); $pass = $this->getUserMeetingPassword(); - $courseId = api_get_course_int_id(); - $sessionId = api_get_session_id(); - - $conditions = array( - 'where' => array( - 'c_id = ? AND session_id = ? ' => array( - $courseId, - $sessionId, - ), - ), - ); + $conditions = []; - if ($this->hasGroupSupport()) { - $groupId = api_get_group_id(); + if ($courseId || $sessionId || $groupId) { $conditions = array( 'where' => array( - 'c_id = ? AND session_id = ? AND group_id = ? ' => - array($courseId, $sessionId, $groupId) - ) + 'c_id = ? AND session_id = ? ' => array($courseId, $sessionId), + ), ); + + if ($this->hasGroupSupport()) { + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND group_id = ? ' => array($courseId, $sessionId, $groupId) + ) + ); + } } $meetingList = Database::select( @@ -690,6 +687,10 @@ class bbb $item['go_url'] = $this->protocol.$this->api->getJoinMeetingURL($joinParams); } $item = array_merge($item, $meetingDB, $meetingBBB); + + $item['course'] = $em->find('ChamiloCoreBundle:Course', $item['c_id']); + $item['session'] = $em->find('ChamiloCoreBundle:Session', $item['session_id']); + $newMeetingList[] = $item; } diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index dc83bf43f9..bf529592b8 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -34,8 +34,8 @@ class BBBPlugin extends Plugin protected function __construct() { parent::__construct( - '2.4', - 'Julio Montoya, Yannick Warnier', + '2.5', + 'Julio Montoya, Yannick Warnier, Angel Fernando Quiroz Campos', [ 'tool_enable' => 'boolean', 'host' => 'text', @@ -44,6 +44,8 @@ class BBBPlugin extends Plugin 'enable_conference_in_course_groups' => 'boolean', ] ); + + $this->isAdminPlugin = true; } /** diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php index b059157a93..fcb7b0674c 100755 --- a/plugin/bbb/listing.php +++ b/plugin/bbb/listing.php @@ -107,7 +107,11 @@ if ($conferenceManager) { } -$meetings = $bbb->getMeetings(); +$meetings = $bbb->getMeetings( + api_get_course_int_id(), + api_get_session_id(), + api_get_group_id() +); if (!empty($meetings)) { $meetings = array_reverse($meetings); }