Skip to content

Commit

Permalink
close window if returned
Browse files Browse the repository at this point in the history
  • Loading branch information
jibon57 committed Sep 29, 2024
1 parent 174566a commit 5f80d84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion classes/external/mod_plugnmeet_create_room.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function create_room($instanceid, $join, $isadmin) {

$connect = new PlugNmeetConnect($config);
try {
$logouturl = $PAGE->url->get_scheme() . "://".$PAGE->url->get_host() . "/mod/plugnmeet/view.php?id=" . $cm->id;
$logouturl = $PAGE->url->get_scheme() . "://".$PAGE->url->get_host() . "/mod/plugnmeet/view.php?id=" . $cm->id . "&returned=true";
$extradata = json_encode(array(
"platform" => "moodle",
"php-version" => phpversion(),
Expand Down
13 changes: 11 additions & 2 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use mod_plugnmeet\event\course_module_viewed;

require(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/lib.php');

Expand Down Expand Up @@ -61,7 +63,7 @@
exit();
}

$event = \mod_plugnmeet\event\course_module_viewed::create(array(
$event = course_module_viewed::create(array(
'objectid' => $moduleinstance->id,
'context' => $context
));
Expand All @@ -87,6 +89,13 @@
</div>
<?php endif; ?>
</div>

<script>
// check if returned from conference
const params = new URLSearchParams(document.location.search);
if (params.has("returned", "true")) {
// this will only work if link opened with window.open()
window.close();
}
</script>
<?php
echo $OUTPUT->footer();
2 changes: 1 addition & 1 deletion views/join_part.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function join_conference() {
if (!windowOpen) {
setTimeout(() => {
window.location.href = url
}, 2000);
}, 5000);
}
} else {
alert(res.msg);
Expand Down

0 comments on commit 5f80d84

Please sign in to comment.