Improve list for admin from conference plugin - refs BT#11636

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 8 years ago
parent f4754ae6b2
commit c963622db8
  1. 31
      plugin/bbb/admin.php
  2. 1
      plugin/bbb/admin.tpl
  3. 35
      plugin/bbb/lib/bbb.lib.php

@ -21,7 +21,28 @@ $isGlobal = isset($_GET['global']) ? true : false;
$bbb = new bbb('', '', $isGlobal);
$action = isset($_GET['action']) ? $_GET['action'] : null;
$meetings = $bbb->getMeetings(0, 0, 0, true);
$currentMonth = date('n');
$dateStart = isset($_REQUEST['search_meeting_start']) ? $_REQUEST['search_meeting_start'] : date('Y-m-d', mktime(1, 1, 1, $currentMonth, 1, date('Y')));
$dateEnd = isset($_REQUEST['search_meeting_end']) ? $_REQUEST['search_meeting_end'] : date('Y-m-d', mktime(1, 1, 1, ++$currentMonth, 0, date('Y')));
$dateRange = [
'search_meeting_start' => $dateStart,
'search_meeting_end' => $dateEnd
];
$form = new FormValidator(get_lang('Search'));
$form->addDatePicker('search_meeting_start', get_lang('DateStart'));
$form->addDatePicker('search_meeting_end', get_lang('DateEnd'));
$form->addButtonSearch(get_lang('Search'));
$form->setDefaults($dateRange);
$actions = [];
if ($form->validate()) {
$dateRange = $form->getSubmitValues();
}
$meetings = $bbb->getMeetings(0, 0, 0, true, $dateRange);
foreach ($meetings as &$meeting) {
$participants = $bbb->findMeetingParticipants($meeting['id']);
@ -82,8 +103,8 @@ $htmlHeadXtra[] = api_get_js_simple(
$htmlHeadXtra[] = "<script>var _p = {web_plugin: '" . api_get_path(WEB_PLUGIN_PATH). "'}</script>";
$tpl = new Template($tool_name);
$tpl->assign('meetings', $meetings);
$tpl->assign('search_form', $form->returnForm());
$content = $tpl->fetch('bbb/admin.tpl');
$actions = [];
@ -91,7 +112,11 @@ $actions = [];
if ($meetings) {
$actions[] = Display::toolbarButton(
get_lang('ExportInExcel'),
api_get_self() . '?action=export',
api_get_self() . '?' . http_build_query([
'action' => 'export',
'search_meeting_start' => $dateStart,
'search_meeting_end' => $dateEnd
]),
'file-excel-o',
'success'
);

@ -1,3 +1,4 @@
{{ search_form }}
<table class="table table-hover table-striped">
<thead>
<tr>

@ -577,9 +577,20 @@ class bbb
/**
* Gets all the course meetings saved in the plugin_bbb_meeting table
* @param int $courseId
* @param int $sessionId
* @param int $groupId
* @param bool $isAdminReport Optional. Set to true then the report is for admins
* @param array $dateRange Optional
* @return array Array of current open meeting rooms
*/
public function getMeetings($courseId = 0, $sessionId = 0, $groupId = 0, $isAdminReport = false)
public function getMeetings(
$courseId = 0,
$sessionId = 0,
$groupId = 0,
$isAdminReport = false,
$dateRange = []
)
{
$em = Database::getManager();
@ -608,6 +619,20 @@ class bbb
}
}
if (!empty($dateRange)) {
$dateStart = date_create($dateRange['search_meeting_start']);
$dateStart = date_format($dateStart, 'Y-m-d H:i:s');
$dateEnd = date_create($dateRange['search_meeting_end']);
$dateEnd = $dateEnd->add(new DateInterval('P1D'));
$dateEnd = date_format($dateEnd, 'Y-m-d H:i:s');
$conditions = array(
'where' => array(
'created_at BETWEEN ? AND ? ' => array($dateStart, $dateEnd),
),
);
}
$meetingList = Database::select(
'*',
$this->table,
@ -1207,10 +1232,16 @@ class bbb
'plugin_bbb_room',
array('where' => array('meeting_id = ?' => intval($meetingId)))
);
$participantIds = [];
$return = [];
foreach ($meetingData as $participantInfo) {
if (in_array($participantInfo['participant_id'], $participantIds)) {
continue;
}
$participantIds[] = $participantInfo['participant_id'];
$return[] = [
'id' => $participantInfo['id'],
'meeting_id' => $participantInfo['meeting_id'],

Loading…
Cancel
Save