Adding copying bbb slide to the chamilo link tool + improving UI see BT#3123

skala
Julio Montoya 14 years ago
parent 728c292687
commit 0fab4c9b72
  1. 7
      main/inc/lib/career.lib.php
  2. 25
      main/inc/lib/link.lib.php
  3. 6
      main/link/link.php
  4. 74
      plugin/bbb/bbb.lib.php
  5. 29
      plugin/bbb/listing.php
  6. 26
      plugin/bbb/listing.tpl
  7. 8
      plugin/bbb/start.php

@ -13,6 +13,7 @@ require_once 'fckeditor/fckeditor.php';
define ('CAREER_STATUS_ACTIVE', 1);
define ('CAREER_STATUS_INACTIVE',0);
/**
* @package chamilo.library
*/
@ -162,7 +163,6 @@ class Career extends Model {
return $cid;
}
public function save($params) {
$id = parent::save($params);
if (!empty($id)) {
@ -174,6 +174,5 @@ class Career extends Model {
public function delete($id) {
parent::delete($id);
event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
}
}
}
}

@ -20,6 +20,31 @@
/* FUNCTIONS */
class Link extends Model {
var $table;
var $is_course_model = true;
var $columns = array('id', 'c_id','url','title','description','category_id', 'display_order', 'on_homepage', 'target', 'session_id');
var $required = array('url', 'title');
public function __construct() {
$this->table = Database::get_course_table(TABLE_LINK);
}
public function save($params) {
$course_info = api_get_course_info();
$params['session_id'] = api_get_session_id();
$params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0;
$id = parent::save($params);
if (!empty($id)) {
api_item_property_update($course_info, TOOL_LINK, $id, 'LinkAdded', api_get_user_id());
}
return $id;
}
}
/**
* Used to add a link or a category
* @param string $type, "link" or "category"

@ -224,7 +224,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
<span class="form_required">*</span> URL
</label>
<div class="controls">
<input type="text" name="urllink" size="50" value="' . (empty($urllink) ? 'http://' : Security::remove_XSS($urllink)) . '" />
<input type="text" name="urllink" class="span6" value="' . (empty($urllink) ? 'http://' : Security::remove_XSS($urllink)) . '" />
</div>
</div>';
echo ' <div class="control-group">
@ -232,7 +232,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
'.get_lang('LinkName').'
</label>
<div class="controls">
<input type="text" name="title" size="50" value="' . Security::remove_XSS($title) . '" />
<input type="text" name="title" class="span6" value="' . Security::remove_XSS($title) . '" />
</div>
</div>';
echo ' <div class="control-group">
@ -248,7 +248,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
'.get_lang('Description').'
</label>
<div class="controls">
<textarea rows="3" cols="50" name="description">' . Security::remove_XSS($description) . '</textarea>
<textarea class="span3" cols="50" name="description">' . Security::remove_XSS($description) . '</textarea>
</div>
</div>';

@ -101,16 +101,30 @@ class bbb {
if ($this->debug) error_log("meeting does not exist: $meeting_name ");
return false;
}
$meeting_is_running = BigBlueButtonBN::isMeetingRunning($meeting_data['id'], $this->url, $this->salt);
$meeting_info = BigBlueButtonBN::getMeetingInfoArray($meeting['id'], $pass, $this->url, $this->salt);
$meeting_info_exists = false;
if ($meeting_info['returncode'] != 'FAILED') {
$meeting_info_exists = true;
}
$url = false;
if ($this->debug) error_log("meeting is running".$meeting_is_running);
if (isset($meeting_is_running)) {
if (isset($meeting_is_running) && $meeting_info_exists) {
$url = $this->protocol.BigBlueButtonBN::joinURL($meeting_data['id'], $this->user_complete_name, $pass, $this->salt, $this->url);
}
if ($this->debug) error_log("url :".$url);
if ($this->debug) error_log("return url :".$url);
return $url;
}
/**
* Gets all the course meetings saved in the plugin_bbb_meeting table
* @return string
*/
function get_course_meetings() {
$pass = $this->get_user_metting_password();
$meeting_list = Database::select('*', $this->table, array('where' => array('c_id = ? ' => api_get_course_int_id())));
@ -120,8 +134,7 @@ class bbb {
$item_meeting = $meeting;
$item_meeting['info'] = BigBlueButtonBN::getMeetingInfoArray($meeting['id'], $pass, $this->url, $this->salt);
if ($meeting['info']['returncode'] == 'FAILED') {
if ($meeting['info']['returncode'] == 'FAILED') {
} else {
$item_meeting['end_url'] = api_get_self().'?action=end&id='.$meeting['id'];
}
@ -129,19 +142,25 @@ class bbb {
if ($meeting['record'] == 1) {
$records = BigBlueButtonBN::getRecordingsArray($meeting['id'], $this->url, $this->salt);
if (!empty($records)) {
foreach ($records as $record) {
//var_dump($record);
//var_dump($meeting['id']);
if (!empty($records)) {
foreach ($records as $record) {
if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) {
foreach ($record['playbacks'] as $item) {
$url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank'));
//Fix the bbb timestamp
$record['startTime'] = substr($record['startTime'], 0, strlen($record['startTime']) -3);
$record['endTime'] = substr($record['endTime'], 0, strlen($record['endTime']) -3);
foreach ($record['playbacks'] as $item) {
$url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank')).' - '.api_convert_and_format_date($record['startTime']).' - '.api_convert_and_format_date($record['endTime']);
//$url .= Display::url(get_lang('DeleteRecord'), api_get_self().'?action=delete_record&'.$record['recordID']);
$url .= Display::url(get_lang('CopyToLinkTool'), api_get_self().'?action=copy_record_to_link_tool&id='.$meeting['id'].'&record_id='.$record['recordID']);
//$url .= api_get_self().'?action=publish&id='.$record['recordID'];
$record_array[] = $url;
}
}
}
}
}
$item_meeting['show_links'] = implode('<br />', $record_array);
}
@ -200,5 +219,34 @@ class bbb {
}
return 0;
}
}
/**
* @todo
*/
function delete_record($id) {
}
function copy_record_to_link_tool($id, $record_id) {
require_once api_get_path(LIBRARY_PATH).'link.lib.php';
$records = BigBlueButtonBN::getRecordingsArray($id, $this->url, $this->salt);
if (!empty($records)) {
foreach ($records as $record) {
if ($record['recordID'] == $record_id) {
if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) {
foreach ($record['playbacks'] as $item) {
$link = new Link();
$params['url'] = $item['url'];
$params['title'] = 'bbb 1';
$id = $link->save($params);
return $id;
}
}
}
}
}
return false;
}
}

@ -6,40 +6,49 @@
/**
* Initialization
*/
$language_file = array('videoconf');
require_once '../../main/inc/global.inc.php';
require_once 'bbb.lib.php';
require_once 'bbb_api.php';
$course_code = api_get_course_id();
$bbb = new bbb();
$action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
case 'copy_record_to_link_tool':
$result = $bbb->copy_record_to_link_tool($_GET['id'], $_GET['record_id']);
if ($result) {
$message = Display::return_message(get_lang('Copied'), 'success');
} else {
$message = Display::return_message(get_lang('Error'), 'error');
}
break;
case 'delete_recording':
//$bbb->delete_record($_GET['id']);
break;
case 'end':
$bbb->end_meeting($_GET['id']);
break;
case 'save_to_documents':
$bbb->save_recording_to_document($_GET['id']);
$message = Display::return_message(get_lang('MeetingClosed'), 'success');
break;
case 'publish':
$result = $bbb->publish_meeting($_GET['id']);
//$result = $bbb->publish_meeting($_GET['id']);
break;
case 'unpublish':
$result = $bbb->unpublish_meeting($_GET['id']);
//$result = $bbb->unpublish_meeting($_GET['id']);
break;
}
$meetings = $bbb->get_course_meetings();
$users_online = $bbb->get_users_online_in_current_room();
$tool_name = get_lang('OrganisationSVideoconference');
$tpl = new Template($tool_name);
$tpl->assign('meetings', $meetings);
$conference_url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?'.api_get_cidreq();
$conference_url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.api_get_cidreq();
$tpl->assign('conference_url', $conference_url);
$tpl->assign('users_online', $users_online);

@ -1,20 +1,25 @@
<div class ="row">
<div class ="span12" style="text-align:center">
<div class ="span12" style="text-align:center">
<a href="{{ conference_url }}" class="btn btn-primary btn-large">
{{ 'EnterTheConference'|get_lang }}
{{ 'StartConference'|get_lang }}
</a>
<span id="users_online" class="label label-warning">{{ users_online }} user online</span>
<span id="users_online" class="label label-warning">{{ users_online }} user(s) online</span>
</div>
<div class ="span12">
<div class="page-header">
<h2>{{ 'RecordList'|get_lang }}</h2>
</div>
<table class="table">
<tr>
<th>{{'id'|get_lang}}</th>
<th>#</th>
<th>{{'Meeting'|get_lang}}</th>
<th>{{'Date'|get_lang}}</th>
<th>{{'Actions'|get_lang}}</th>
</tr>
</tr>
{% for meeting in meetings %}
<tr>
<td>{{ meeting.id }}</td>
@ -22,13 +27,20 @@
<td>{{ meeting.created_at }}</td>
<td>
{% if meeting.record == 1 %}
{# Record list #}
{{ meeting.show_links }}
<!-- <a href="{{ meeting.publish_url}} "> Publish </a>
<a href="{{ meeting.unpublish_url}} "> UnPublish </a> -->
{% endif %}
<br />
{% if meeting.status == 1 %}
<a href="{{ meeting.end_url }} "> Close </a>
<span class="label label-success">{{'MeetingOpened'|get_lang}}</span>
<a class="btn" href="{{ meeting.end_url }} "> {{'CloseMeeting'|get_lang}} </a>
{% else %}
<span class="label label-info">{{'MeetingClosed'|get_lang}}</span>
{% endif %}

@ -15,6 +15,14 @@ $course_code = api_get_course_id();
$meeting_params = array();
$meeting_params['meeting_name'] = api_get_course_id();
$teacher = api_is_course_admin() || api_is_coach() || api_is_platform_admin();
//If I'm a teacher I'm going to the listing page
if ($teacher && !isset($_GET['launch'])) {
header('location: listing.php?'.api_get_cidreq());
exit;
}
$bbb = new bbb();
if ($bbb) {

Loading…
Cancel
Save