/
sublinks.php
70 lines (61 loc) · 2.61 KB
/
sublinks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/****************************************************************/
/* BigBlueButton module for ATutor */
/* https://github.com/nishant1000/BigBlueButton-module-for-ATutor*/
/* */
/* This module allows to search OpenLearn for educational */
/* content. */
/* Author: Greg Gay */
/* This program is free software. You can redistribute it and/or*/
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation. */
/****************************************************************/
// $Id$
if (!defined('AT_INCLUDE_PATH')) { exit; }
global $db;
global $_base_href, $msg, $_config;
$link_limit = 3; // Number of links to be displayed on "detail view" box
require_once("bbb_api_conf.php");
require_once("bbb_api.php");
$bbb_joinURL;
$_moderatorPassword="mp";
$_attendeePassword="ap";
$_logoutUrl= $_base_href.'index.php';
$username=get_login(intval($_SESSION["member_id"]));
$meetingID=$_SESSION['course_id'];
$bbb_welcome = _AT('bbb_welcome');
$salt = $_config['bbb_salt'];
$url = $_config['bbb_url']."/bigbluebutton/";
$response = BigBlueButton::createMeetingArray($username,$meetingID,$bbb_welcome, $_moderatorPassword,$_attendeePassword, $salt, $url,$_logoutUrl);
//Analyzes the bigbluebutton server's response
if(!$response){//If the server is unreachable
$msg->addError("UNABLE_TO_CONNECT_TO_BBB");
}
else if( $response['returncode'] == 'FAILED' ) { //The meeting was not created
if($response['messageKey'] == 'checksumError'){
$msg->addError("CHECKSUM_ERROR_BBB");
}
else{
$msg = $response['message'];
}
}
else{//"The meeting was created, and the user will now be joined "
$bbb_joinURL = BigBlueButton::joinURL($meetingID,$username,"ap", $salt, $url);
}
$sql = "SELECT * from ".TABLE_PREFIX."bigbluebutton WHERE course_id = '$meetingID'";
$result = mysql_query($sql, $db);
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
/****
* SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY are defined in include/lib/constance.lib.inc
* SUBLINK_TEXT_LEN determins the maxium length of the string to be displayed on "detail view" box.
*****/
$list[] = '<a href="'.$bbb_joinURL.'"'.
(strlen(htmlentities_utf8($row['message'])) > SUBLINK_TEXT_LEN ? ' title="'.htmlentities_utf8($row['course_timing']).'"' : '') .' title="'.htmlentities_utf8($row['course_timing']).'">'.
validate_length(htmlentities_utf8($row['message']), SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
}
return $list;
} else {
return 0;
}
?>