From 27493b32acc9d6cde3e95b5a34e4c03dcc004589 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 16 Oct 2014 00:20:17 -0500 Subject: [PATCH] Add possibility to hide recordings to students in conferences list in BBB plugin - refs #7324 --- plugin/bbb/lib/bbb.lib.php | 50 +++++++++++++++++++++++++++-- plugin/bbb/lib/bbb_plugin.class.php | 4 ++- plugin/bbb/listing.php | 4 +-- plugin/bbb/listing.tpl | 12 +++++-- 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index ebad7c8a9a..260a87950e 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -389,6 +389,9 @@ class bbb $meetingBBB = $this->getMeetingInfo($params); } + if ($meetingDB['visibility'] == 0 and $this->isTeacher() == false) { + continue; + } $meetingBBB['end_url'] = api_get_self().'?'.api_get_cidreq().'&action=end&id='.$meetingDB['id']; if ((string)$meetingBBB['returncode'] == 'FAILED') { @@ -400,6 +403,7 @@ class bbb } $recordArray = array(); + $actionLinksArray = array(); if ($meetingDB['record'] == 1) { $recordingParams = array( @@ -424,8 +428,9 @@ class bbb $record['playbackFormatUrl'], array('target' => '_blank') ); + $actionLinks = ''; if ($this->isTeacher()) { - $url .= Display::url( + $actionLinks .= Display::url( Display::return_icon( 'link.gif', get_lang('CopyToLinkTool') @@ -434,7 +439,7 @@ class bbb api_get_cidreq(). '&action=copy_record_to_link_tool&id='.$meetingDB['id'] ); - $url .= Display::url( + $actionLinks .= Display::url( Display::return_icon( 'agenda.png', get_lang('AddToCalendar') @@ -445,7 +450,7 @@ class bbb '&start='.api_strtotime($meetingDB['created_at']). '&url='.$record['playbackFormatUrl'] ); - $url .= Display::url( + $actionLinks .= Display::url( Display::return_icon( 'delete.png', get_lang('Delete') @@ -454,10 +459,36 @@ class bbb api_get_cidreq(). '&action=delete_record&id='.$record['recordId'] ); + if ($meetingDB['visibility'] == 0) { + $actionLinks .= Display::url( + Display::return_icon( + 'invisible.png', + get_lang('MakeVisible'), + array(), + ICON_SIZE_MEDIUM + ), + api_get_self().'?'. + api_get_cidreq(). + '&action=publish&id='.$meetingDB['id'] + ); + } else { + $actionLinks .= Display::url( + Display::return_icon( + 'visible.png', + get_lang('MakeInvisible'), + array(), + ICON_SIZE_MEDIUM + ), + api_get_self().'?'. + api_get_cidreq(). + '&action=unpublish&id='.$meetingDB['id'] + ); + } } //$url .= api_get_self().'?action=publish&id='.$record['recordID']; $count++; $recordArray[] = $url; + $actionLinksArray[] = $actionLinks; } else { /*if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) { @@ -484,6 +515,7 @@ class bbb } //var_dump($recordArray); $item['show_links'] = implode('
', $recordArray); + $item['action_links'] = implode('
', $actionLinksArray); } $item['created_at'] = api_convert_and_format_date($meetingDB['created_at']); @@ -516,6 +548,12 @@ class bbb public function publishMeeting($id) { //return BigBlueButtonBN::setPublishRecordings($id, 'true', $this->url, $this->salt); + if (empty($id)) { + return false; + } + $id = intval($id); + Database::update($this->table, array('visibility' => 1), array('id = ? ' => $id), true); + return true; } /** @@ -524,6 +562,12 @@ class bbb public function unpublishMeeting($id) { //return BigBlueButtonBN::setPublishRecordings($id, 'false', $this->url, $this->salt); + if (empty($id)) { + return false; + } + $id = intval($id); + Database::update($this->table, array('visibility' => 0), array('id = ? ' => $id), true); + return true; } /** diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index 30c4689774..cf1298fd81 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -51,7 +51,9 @@ class BBBPlugin extends Plugin calendar_id INT DEFAULT 0, welcome_msg VARCHAR(255) NOT NULL DEFAULT '', session_id INT unsigned DEFAULT 0, - remote_id char(36))"; + remote_id CHAR(30), + visibility TINYINT NOT NULL DEFAULT 1 + )"; Database::query($sql); //Installing course settings diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php index a9679a31d2..3b292a8e20 100755 --- a/plugin/bbb/listing.php +++ b/plugin/bbb/listing.php @@ -88,10 +88,10 @@ if ($teacher) { break; case 'publish': - //$result = $bbb->publish_meeting($_GET['id']); + $result = $bbb->publishMeeting($_GET['id']); break; case 'unpublish': - //$result = $bbb->unpublish_meeting($_GET['id']); + $result = $bbb->unpublishMeeting($_GET['id']); break; default: break; diff --git a/plugin/bbb/listing.tpl b/plugin/bbb/listing.tpl index 5d63438af6..24c0f54b9b 100755 --- a/plugin/bbb/listing.tpl +++ b/plugin/bbb/listing.tpl @@ -17,7 +17,7 @@ - + @@ -29,8 +29,12 @@ {% for meeting in meetings %} - - + + {% if meeting.visibility == 0 %} + + {% else %} + + {% endif %} {% endif %}
# {{ 'CreatedAt'|get_lang }} {{ 'Status'|get_lang }} {{ 'Records'|get_lang }}
{{ meeting.id }}{{ meeting.created_at }}{{ meeting.created_at }}{{ meeting.created_at }} {% if meeting.status == 1 %} {{ 'MeetingOpened'|get_lang }} @@ -49,6 +53,8 @@ {% if meeting.status == 1 %} {{ 'CloseMeeting'|get_lang }} + {% else %} + {{ meeting.action_links }} {% endif %}