Parcourir la source

bbb plugin: Adding english translations, adding add to calendar and add to link tool icons

Julio Montoya il y a 13 ans
Parent
commit
fbcb4e9ab5

+ 5 - 5
main/template/default/agenda/month.tpl

@@ -1,4 +1,4 @@
-<script type="text/javascript">
+<script>
 
 function checkLength( o, n, min, max ) {
     if ( o.val().length > max || o.val().length < min ) {
@@ -39,7 +39,7 @@ $(document).ready(function() {
 		autoOpen: false,
 		modal	: false, 
 		width	: 550, 
-		height	: 450,
+		height	: 480,
         zIndex: 20000 // added because of qtip2
    	});
     
@@ -47,7 +47,7 @@ $(document).ready(function() {
 		autoOpen: false,
 		modal	: false, 
 		width	: 550, 
-		height	: 450,
+		height	: 480,
         zIndex: 20000 // added because of qtip2
    	});
 
@@ -471,5 +471,5 @@ $(document).ready(function() {
 	</form>
 	</div>
 </div>
-<div id='loading' style='margin-left:150px;position:absolute;display:none'>{{"Loading"|get_lang}}...</div>
-<div id='calendar'></div>
+<div id="loading" style="margin-left:150px;position:absolute;display:none">{{"Loading"|get_lang}}...</div>
+<div id="calendar"></div>

+ 9 - 6
plugin/bbb/bbb.lib.php

@@ -134,9 +134,10 @@ 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'];    
+                $item_meeting['end_url']             = api_get_self().'?action=end&id='.$meeting['id'];    
+                $item_meeting['add_to_calendar_url'] = api_get_self().'?action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['created_at']);
             }   
             $record_array = array();
             
@@ -156,12 +157,13 @@ class bbb {
                             foreach ($record['playbacks'] as $item) {                                                        
                                 $url = Display::url(get_lang('ViewRecord').' #'.$count, $item['url'], array('target' => '_blank'));
                                 //$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 .= Display::url(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meeting['id'].'&record_id='.$record['recordID']);
+                                $url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['created_at']).'&url='.$item['url']);
+                                
                                 //$url .= api_get_self().'?action=publish&id='.$record['recordID'];
                                 $count++;
                                 $record_array[] = $url;
-                            }
-                            
+                            }                            
                         }
                     }
                 }
@@ -210,13 +212,14 @@ class bbb {
      */
     function get_users_online_in_current_room() {
         $course_id = api_get_course_int_id();
-        $meeting_data = Database::select('*', $this->table, array('where' => array('c_id = ? AND status = 1 ' => $course_id)), 'first');        
+        $meeting_data = Database::select('*', $this->table, array('where' => array('c_id = ? AND status = 1 ' => $course_id)), 'first');                
         if (empty($meeting_data)) {
             return 0;
         }        
         $pass = $this->get_user_metting_password();        
         //$meeting_is_running = BigBlueButtonBN::isMeetingRunning($meeting_data['id'], $this->url, $this->salt);
         $info = BigBlueButtonBN::getMeetingInfoArray($meeting_data['id'], $pass, $this->url, $this->salt);
+        var_dump($meeting_data['id']);
         
         if (!empty($info) && isset($info['participantCount'])) {
             return $info['participantCount'];

+ 11 - 10
plugin/bbb/install.php

@@ -30,16 +30,17 @@ $sql = "INSERT INTO $t_settings (variable, subkey, type, category, selected_valu
 Database::query($sql);
 
 $table = Database::get_main_table('plugin_bbb_meeting');
-$sql = "CREATE TABLE $table ( " .
-        "id INT unsigned NOT NULL auto_increment PRIMARY KEY, " .
-        "c_id INT unsigned NOT NULL DEFAULT 0, " .        
-        "meeting_name VARCHAR(255) NOT NULL DEFAULT '', " .        
-        "attendee_pw VARCHAR(255) NOT NULL DEFAULT '', " .
-        "moderator_pw VARCHAR(255) NOT NULL DEFAULT '', " .                
-        "record INT NOT NULL DEFAULT 0, " .
-        "status INT NOT NULL DEFAULT 0, " .
-        "created_at VARCHAR(255) NOT NULL, " .
-        "welcome_msg VARCHAR(255) NOT NULL DEFAULT '')";
+$sql = "CREATE TABLE $table ( 
+        id INT unsigned NOT NULL auto_increment PRIMARY KEY, 
+        c_id INT unsigned NOT NULL DEFAULT 0,
+        meeting_name VARCHAR(255) NOT NULL DEFAULT '', 
+        attendee_pw VARCHAR(255) NOT NULL DEFAULT '',
+        moderator_pw VARCHAR(255) NOT NULL DEFAULT '', 
+        record INT NOT NULL DEFAULT 0,
+        status INT NOT NULL DEFAULT 0,
+        created_at VARCHAR(255) NOT NULL,
+        calendar_id INT DEFAULT 0,
+        welcome_msg VARCHAR(255) NOT NULL DEFAULT '')";
 Database::query($sql);
 
 // Update existing courses to add conference settings

+ 14 - 1
plugin/bbb/lang/english.php

@@ -13,6 +13,19 @@ $strings['plugin_comment']      = "Open Source Videoconference tool";
 
 $strings['Videoconference']     = "Videoconference";
 $strings['MeetingOpened']       = "Meeting opened";
+$strings['MeetingClosed']       = "Meeting closed";
+$strings['CloseMeeting']        = "Close meeting";
+
+$strings['VideoConferenceXCourseX']             = "Videoconference #%s course %s";
+$strings['VideoConferenceAddedToTheCalendar']   = "Videoconference added to the calendar";
+
+$strings['Records']             = "Records";
+$strings['Meeting']             = "Meeting";
+
+$strings['ViewRecord']          = "View record";
+$strings['CopyToLinkTool']      = "Copy to link tool";
+
 $strings['StartConference']     = "Start conference";
 $strings['RecordList']          = "Record list";
-$strings['ServerIsNotRunning']  = "Server Is Not Running";
+$strings['ServerIsNotRunning']  = "Videoconference server is not running";
+$strings['XUsersOnLine']        = "%s user(s) online";

+ 26 - 6
plugin/bbb/listing.php

@@ -13,11 +13,32 @@ require_once '../../main/inc/global.inc.php';
 require_once 'bbb.lib.php';
 require_once 'bbb_api.php';
 
-$bbb = new bbb();
 
+$tool_name = get_lang('Videoconference');
+$tpl = new Template($tool_name);
+
+$bbb = new bbb();
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
+
 switch ($action) {
+    case 'add_to_calendar':
+        $course_info = api_get_course_info();        
+        $agenda = new Agenda();
+        $agenda->type = 'course';
+        
+        $id = intval($_GET['id']);        
+        $title = sprintf(get_lang('VideoConferenceXCourseX'), $id, $course_info['name']);
+        $content = Display::url(get_lang('GoToTheVideoConference'), $_GET['url']);
+        
+        $event_id = $agenda->add_event($_REQUEST['start'], null, 'true', null, $title, $content, array('everyone'));
+        if (!empty($event_id)) {        
+            $message = Display::return_message(get_lang('VideoConferenceAddedToTheCalendar'), 'success');
+        } else {
+            $message = Display::return_message(get_lang('Error'), 'error');
+        }
+        
+        break;
     case 'copy_record_to_link_tool':
         $result = $bbb->copy_record_to_link_tool($_GET['id'], $_GET['record_id']);        
         if ($result) {
@@ -42,13 +63,12 @@ switch ($action) {
 }
 
 $meetings       = $bbb->get_course_meetings();
+if (!empty($meetings)) {
+    $meetings = array_reverse($meetings);
+}
 $users_online   = $bbb->get_users_online_in_current_room();
 $status         = $bbb->is_server_running();
-$status         = false;
-
-$tool_name = get_lang('Videoconference');
-
-$tpl = new Template($tool_name);
+//$status         = false;
 
 $tpl->assign('meetings', $meetings);
 $conference_url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.api_get_cidreq();

+ 19 - 18
plugin/bbb/listing.tpl

@@ -6,7 +6,7 @@
         <a href="{{ conference_url }}" class="btn btn-primary btn-large">
             {{ 'StartConference'|get_lang }} 	
         </a>
-        <span id="users_online" class="label label-warning">{{ users_online }} user(s) online</span>
+        <span id="users_online" class="label label-warning">{{ 'XUsersOnLine'| get_lang | format(users_online) }} </span>
     </div>
 
     <div class ="span12">    
@@ -17,34 +17,35 @@
 
         <table class="table">
             <tr>
-                <th>#</th>
-                <th>{{'Meeting'|get_lang}}</th>        
-                <th>{{'Date'|get_lang}}</th>   
+                <th>#</th>                
+                <th>{{'Date'|get_lang}}</th>
+                <th>{{'Status'|get_lang}}</th>
+                <th>{{'Records'|get_lang}}</th>
                 <th>{{'Actions'|get_lang}}</th>
             </tr>    
             {% for meeting in meetings %}
             <tr>
-                <td>{{ meeting.id }}</td>
-                <td>{{ meeting.meeting_name }}</td>        
-                <td>{{ meeting.created_at }}</td>                
+                <td>{{ meeting.id }}</td>                     
+                <td>{{ meeting.created_at }}</td>        
+                <td>
+                    {% if meeting.status == 1 %}                
+                        <span class="label label-success">{{'MeetingOpened'|get_lang}}</span>
+                    {% else %}
+                        <span class="label label-info">{{'MeetingClosed'|get_lang}}</span>
+                    {% endif %}
+                </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 %}            
-
-                    {% if meeting.status == 1 %}                
-                        <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 %}
-
-
+                </td>
+                <td>
+                {% if meeting.status == 1 %}                                        
+                    <a class="btn" href="{{ meeting.end_url }} "> {{'CloseMeeting'|get_lang}}</a>                    
+                {% endif %}
                 </td>
             </tr>
             {% endfor %}