Skip to content

Commit

Permalink
course units: student access to h5p ignoring module visibility.
Browse files Browse the repository at this point in the history
--HG--
branch : 3.12
  • Loading branch information
jexi committed Oct 5, 2021
1 parent 3e6a0c5 commit 3be4038
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
10 changes: 9 additions & 1 deletion modules/h5p/show.php
Expand Up @@ -23,8 +23,16 @@

require_once '../../include/baseTheme.php';

$unit = isset($_GET['unit'])? intval($_GET['unit']): null;
$res_type = isset($_GET['res_type']);

$content_id = $_GET['id'];
$backUrl = $urlAppend . 'modules/h5p/?course=' . $course_code;
if (!$res_type) {
$backUrl = $urlAppend . 'modules/h5p/?course=' . $course_code;
} else {
$backUrl = $urlAppend . 'modules/units/?course=' . $course_code . '&id=' . $_REQUEST['unit'];
}

$toolName = $langImport;
$navigation[] = ['url' => $backUrl, 'name' => $langH5p];

Expand Down
16 changes: 14 additions & 2 deletions modules/h5p/view.php
Expand Up @@ -22,10 +22,22 @@
$require_current_course = true;
require_once '../../include/baseTheme.php';

$unit = isset($_GET['unit'])? intval($_GET['unit']): null;
$res_type = isset($_GET['res_type']);

if (showContent($_GET['id'])) {
redirect($urlAppend . 'modules/h5p/show.php?course=' . $course_code . '&id=' . intval($_GET['id']));
if (isset($unit)) {
redirect($urlServer . 'modules/units/view.php?course=' . $course_code . '&res_type=h5p_show&unit=' . $unit . '&id=' . intval($_GET['id']));;
} else {
redirect($urlAppend . 'modules/h5p/show.php?course=' . $course_code . '&id=' . intval($_GET['id']));
}
}

/**
* @brief show h5p content
* @param $contentId
* @return bool
*/
function showContent($contentId): bool {
global $course_code, $webDir;

Expand Down Expand Up @@ -55,4 +67,4 @@ function showContent($contentId): bool {
}
}
}
}
}
4 changes: 2 additions & 2 deletions modules/units/functions.php
Expand Up @@ -1279,8 +1279,8 @@ function show_h5p($title, $comments, $resource_id, $h5p_id, $visibility) {
$h5plink = "<span class='not_visible'>$title ($langWasDeleted)</span>";
}
} else {
//$link = "<a href='${urlServer}modules/units/view.php?course=$course_code&amp;res_type=chat&amp;conference_id=$chat_id&amp;unit=$id'>";
$link = "<a href='${urlServer}modules/h5p/view.php?course=$course_code&amp;id=$h5p_id'>";
$link = "<a href='${urlServer}modules/units/view.php?course=$course_code&amp;res_type=h5p&amp;id=$h5p_id&amp;unit=$id'>";
//$link = "<a href='${urlServer}modules/h5p/view.php?course=$course_code&amp;id=$h5p_id'>";
$h5plink = $link . "$title</a>";
$imagelink = $link . "</a>" .icon('fa-tablet') . "";
}
Expand Down
14 changes: 10 additions & 4 deletions modules/units/view.php
Expand Up @@ -39,18 +39,24 @@
case 'questionnaire_results':
require_once "../questionnaire/pollresults.php";
exit;
case 'forum';
case 'forum':
require_once "../forum/viewforum.php";
exit;
case 'forum_topic';
case 'forum_topic':
require_once "../forum/viewtopic.php";
exit;
case 'forum_new_topic';
case 'forum_new_topic':
require_once "../forum/newtopic.php";
exit;
case 'forum_topic_reply';
case 'forum_topic_reply':
require_once "../forum/reply.php";
exit;
case 'h5p':
require_once "../h5p/view.php";
exit;
case 'h5p_show':
require_once "../h5p/show.php";
exit;
default:
break;
}

0 comments on commit 3be4038

Please sign in to comment.