Save participants when they join to videoconference - refs BT#11636

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 8 years ago committed by Yannick Warnier
parent f43438ebf7
commit e074abcbad
  1. 11
      plugin/bbb/admin.php
  2. 6
      plugin/bbb/admin.tpl
  3. 64
      plugin/bbb/lib/bbb.lib.php
  4. 14
      plugin/bbb/lib/bbb_plugin.class.php
  5. 23
      plugin/bbb/start.php

@ -4,6 +4,8 @@
* @package chamilo.plugin.bigbluebutton
*/
use Chamilo\UserBundle\Entity\User;
$course_plugin = 'bbb'; //needed in order to load the plugin lang variables
$cidReset = true;
@ -20,6 +22,15 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
$meetings = $bbb->getMeetings();
foreach ($meetings as &$meeting) {
$participants = $bbb->findMeetingParticipants($meeting['id']);
/** @var User $participant */
foreach ($participants as $participant) {
$meeting['participants'][] = $participant['participant']->getCompleteName();
}
}
if ($action) {
switch ($action) {
case 'export':

@ -30,10 +30,10 @@
{{ meeting.show_links }}
{% endif %}
</td>
<td>{{ meeting.course ? meeting.course.title : '-' }}</td>
<td>{{ meeting.session ? meeting.session.name : '-' }}</td>
<td>{{ meeting.course ?: '-' }}</td>
<td>{{ meeting.session ?: '-' }}</td>
<td>
{{ meeting.participants|join('<br>') }}
{{ meeting.participants ? meeting.participants|join('<br>') : '-' }}
</td>
</tr>
{% endfor %}

@ -309,6 +309,25 @@ class bbb
}
}
/**
* Save a participant in a meeting room
* @param int $meetingId
* @param int $participantId
* @return false|int The last inserted ID. Otherwise return false
*/
public function saveParticipant($meetingId, $participantId)
{
return Database::insert(
'plugin_bbb_room',
[
'meeting_id' => $meetingId,
'participant_id' => $participantId,
'in_at' => api_get_utc_datetime(),
'out_at' => api_get_utc_datetime()
]
);
}
/**
* Tells whether the given meeting exists and is running
* (using course code as name)
@ -1235,4 +1254,49 @@ class bbb
return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=copy_record_to_link_tool&id='.$meeting['id'];
}
/**
* Get the meeting info from DB by its name
* @param string $name
* @return array
*/
public function findMeetingByName($name)
{
$meetingData = Database::select(
'*',
'plugin_bbb_meeting',
array('where' => array('meeting_name = ? AND status = 1 ' => $name)),
'first'
);
return $meetingData;
}
/**
* @param int $meetingId
* @return array
*/
public function findMeetingParticipants($meetingId)
{
$em = Database::getManager();
$meetingData = Database::select(
'*',
'plugin_bbb_room',
array('where' => array('meeting_id = ?' => intval($meetingId)))
);
$return = [];
foreach ($meetingData as $participantInfo) {
$return[] = [
'id' => $participantInfo['id'],
'meeting_id' => $participantInfo['meeting_id'],
'participant' => $em->find('ChamiloUserBundle:User', $participantInfo['participant_id']),
'in_at' => $participantInfo['in_at'],
'out_at' => $participantInfo['out_at']
];
}
return $return;
}
}

@ -105,6 +105,18 @@ class BBBPlugin extends Plugin
)";
Database::query($sql);
Database::query(
"CREATE TABLE plugin_bbb_room (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
meeting_id int(10) unsigned NOT NULL,
participant_id int(11) NOT NULL,
in_at datetime NOT NULL,
out_at datetime NOT NULL,
FOREIGN KEY (meeting_id) REFERENCES plugin_bbb_meeting (id),
FOREIGN KEY (participant_id) REFERENCES user (id)
);"
);
// Installing course settings
$this->install_course_fields_in_all_courses();
}
@ -146,6 +158,8 @@ class BBBPlugin extends Plugin
$sql = "DROP TABLE IF EXISTS $t";
Database::query($sql);
Database::query('DROP TABLE IF EXISTS plugin_bbb_room');
// Deleting course settings
$this->uninstall_course_fields_in_all_courses($this->course_settings);
}

@ -50,23 +50,18 @@ if ($bbb->pluginEnabled) {
$meetingParams = array();
$meetingParams['meeting_name'] = $bbb->getCurrentVideoConferenceName();
if ($bbb->meetingExists($meetingParams['meeting_name'])) {
$url = $bbb->joinMeeting($meetingParams['meeting_name']);
if ($url) {
$bbb->redirectToBBB($url);
} else {
$url = $bbb->createMeeting($meetingParams);
$bbb->redirectToBBB($url);
}
$url = $bbb->joinMeeting($meetingParams['meeting_name']) ?: $bbb->createMeeting($meetingParams);
} else {
if ($bbb->isConferenceManager()) {
$url = $bbb->createMeeting($meetingParams);
$bbb->redirectToBBB($url);
} else {
$url = $bbb->getListingUrl();
$bbb->redirectToBBB($url);
}
$url = $bbb->isConferenceManager() ? $bbb->createMeeting($meetingParams) : $bbb->getListingUrl();
}
$meetingInfo = $bbb->findMeetingByName($meetingParams['meeting_name']);
$bbb->saveParticipant($meetingInfo['id'], api_get_user_id());
$bbb->redirectToBBB($url);
} else {
$url = $bbb->getListingUrl();
header('Location: ' . $url);

Loading…
Cancel
Save