-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjoinrecording.php
executable file
·124 lines (91 loc) · 3.74 KB
/
joinrecording.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php // $Id: $
/**
* The purpose of this file is to add a log entry when the user views a
* recording
*
* @author Your Name <adelamarre@remote-learner.net>
* @version $Id: view.php,v 1.1.2.13 2011/05/09 21:41:28 adelamarre Exp $
* @package mod/adobeconnect
*/
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE__).'/locallib.php');
require_once(dirname(__FILE__).'/connect_class.php');
require_once(dirname(__FILE__).'/connect_class_dom.php');
$id = required_param('id', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
$recordingid = required_param('recording', PARAM_INT);
global $CFG, $USER, $DB;
// Robert Russo - make sure logged in as users can't accidentally (or on purpose) log in to Connect as someone else
if (isset($USER->realuser)) {
error('You are logged in as someone else.<br /> Please log in as yourself or have the real user log in to continue.');
}
// Do the usual Moodle setup
if (! $cm = get_coursemodule_from_id('adobeconnect', $id)) {
error('Course Module ID was incorrect');
}
$cond = array('id' => $cm->course);
if (! $course = $DB->get_record('course', $cond)) {
error('Course is misconfigured');
}
$cond = array('id' => $cm->instance);
if (! $adobeconnect = $DB->get_record('adobeconnect', $cond)) {
error('Course module is incorrect');
}
require_login($course, true, $cm);
// ---------- //
// Get HTTPS setting
$https = false;
$protocol = 'http://';
if (isset($CFG->adobeconnect_https) and (!empty($CFG->adobeconnect_https))) {
$https = true;
$protocol = 'https://';
}
// Create a Connect Pro login session for this user
$usrobj = new stdClass();
$usrobj = clone($USER);
$login = $usrobj->username;
$aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port,
'', '', '', $https);
$aconnect->request_http_header_login(1, $login);
$adobesession = $aconnect->get_cookie();
$params = array('instanceid' => $cm->instance, 'groupid' => $groupid);
$sql = "SELECT meetingscoid FROM {adobeconnect_meeting_groups} amg WHERE ".
"amg.instanceid = :instanceid AND amg.groupid = :groupid";
$meetscoid = $DB->get_record_sql($sql, $params);
// Get the Meeting recording details
$aconnect = aconnect_login();
$recordings = array();
$fldid = aconnect_get_folder($aconnect, 'content');
$data = aconnect_get_recordings($aconnect, $fldid, $meetscoid->meetingscoid);
if (!empty($data)) {
$recordings = $data;
}
// If at first you don't succeed ...
$data2 = aconnect_get_recordings($aconnect, $meetscoid->meetingscoid, $meetscoid->meetingscoid);
if (!empty($data2)) {
$recordings = $data2;
}
aconnect_logout($aconnect);
if ((!isset($recordings[$recordingid]) || empty($recordings[$recordingid])) && confirm_sesskey()) {
/// Print the page header
$url = new moodle_url('/mod/adobeconnect/view.php', array('id' => $cm->id));
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if ($groupid) {
$url->param('group', $groupid);
}
$PAGE->set_url($url);
$PAGE->set_context($context);
$PAGE->set_title(format_string($adobeconnect->name));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
notice(get_string('errorrecording', 'adobeconnect'), $url);
}
add_to_log($course->id, 'adobeconnect', 'view',
"view.php?id=$cm->id", "View recording {$adobeconnect->name} details", $cm->id);
// Include the port number only if it is a port other than 80
$port = '';
if (!empty($CFG->adobeconnect_port) and (80 != $CFG->adobeconnect_port)) {
$port = ':' . $CFG->adobeconnect_port;
}
redirect($protocol . $CFG->adobeconnect_meethost . $port
. $recordings[$recordingid]->url . '?session=' . $adobesession);