-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.php
66 lines (44 loc) · 2.04 KB
/
view.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
<?php
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE___).'/lib.php');
$id = optional_param('id', 0, PARAM_INT);
$n = optional_param('n', 0 , PARAM_INT);
if($id){
$cm = get_coursemodule_from_id('oneclick', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$oneclick = $DB->get_record('oneclick', array('id' => $cm->instance), '*', MUST_EXIST);
}elseif($n){
$oneclick = $DB->get_record('oneclick', array('id' => $n), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $oneclick->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('oneclick', $oneclick->id, $course->id, false, MUST_EXIST);
}else{
error("you must specify a course module ID or instance ID");
}
require_login($course, true, $cm);
$context = context_module::instance($cm->id);
//add_to_log($course->id, 'oneclick', 'view', "view.php?id={$cm->id}", $oneclick->name, $cm->id);
$PAGE->set_url('/mod/oneclick/view.php', array('id' => $cm->id));
$PAGE->set_title(format_string($oneclick->name));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_context($context);
echo $OUTPUT->header();
// Replace the following lines with you own code
echo $OUTPUT->heading($oneclick->name);
//echo $OUTPUT->
$roomname = $oneclick->name;
echo <<< EOT
<script src="https://1click.io/static/js/jquery.min.js" type="text/javascript"></script>
<script src="https://1click.io/static/js/adapter.js" type="text/javascript"></script>
<script src="https://1click.io/static/js/oks.js" type="text/javascript"></script>
EOT;
echo "<script>";
echo "var identity = '".$roomname."'";
//echo "var identity = 'chemistryclass'";
echo "</script>";
$html="<video id='remoteView' autoplay style='width: 480px;'> </video><br>" ;
$html.="<button onclick='video_call();' style='margin-right: 50px; margin-bottom: 20px;'>Start Call</button>" ;
$html.="<button onclick='hang_up(1);'>End Call</button>" ;
echo $html;
// Finish the page
echo $OUTPUT->footer();
?>