From 7860a3003b45327adf6e52cdcce161d6e1951a3f Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 5 Oct 2016 18:11:08 -0500 Subject: [PATCH] merge --- plugin/bbb/admin.php | 41 +++++++++++++++++++++++++ plugin/bbb/admin.tpl | 45 ++++++++++++++++++++++++++++ plugin/bbb/lib/bbb.lib.php | 46 +++++++++++------------------ plugin/bbb/lib/bbb_plugin.class.php | 4 ++- plugin/bbb/listing.php | 6 +++- 5 files changed, 111 insertions(+), 31 deletions(-) create mode 100644 plugin/bbb/admin.php create mode 100644 plugin/bbb/admin.tpl 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 347a229181..cfcf1a95fc 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -532,42 +532,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(); - $isGlobal = $this->isGlobalConference(); - $isGlobalPerUser = $this->isGlobalConferencePerUserEnabled(); - - $courseId = api_get_course_int_id(); - $sessionId = api_get_session_id(); - - $conditions = array( - 'where' => array( - 'c_id = ? AND session_id = ? AND access_url = ?' => array( - $courseId, - $sessionId, - $this->accessUrl - ), - ), - ); + $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 = ? AND access_url = ?' => - array($courseId, $sessionId, $groupId, $this->accessUrl) - ) + 'c_id = ? AND session_id = ? ' => array($courseId, $sessionId), + ), ); - } - if ($isGlobalPerUser) { - $conditions = array( - 'where' => array( - 'user_id = ? AND access_url = ?' => - array($this->userId, $this->accessUrl) - ) - ); + if ($this->hasGroupSupport()) { + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND group_id = ? ' => array($courseId, $sessionId, $groupId) + ) + ); + } } $meetingList = Database::select( @@ -789,6 +773,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 b991c3aee8..28460f60bb 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -35,7 +35,7 @@ class BBBPlugin extends Plugin { parent::__construct( '2.5', - 'Julio Montoya, Yannick Warnier', + 'Julio Montoya, Yannick Warnier, Angel Fernando Quiroz Campos', [ 'tool_enable' => 'boolean', 'host' => 'text', @@ -46,6 +46,8 @@ class BBBPlugin extends Plugin 'enable_global_conference_link' => 'boolean' ] ); + + $this->isAdminPlugin = true; } /** diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php index a106b2ab2a..55f0611fbe 100755 --- a/plugin/bbb/listing.php +++ b/plugin/bbb/listing.php @@ -112,7 +112,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); }