Skip to content

Commit 924b20a

Browse files

File tree

196 files changed

+58886
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+58886
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
defined('MOODLE_INTERNAL') || die();
4+
5+
class block_kalturamediagallery extends block_base {
6+
function init() {
7+
$this->title = get_string('pluginname', 'local_kalturamediagallery');
8+
}
9+
10+
function get_content() {
11+
if(!is_null($this->content)) {
12+
return $this->content;
13+
}
14+
15+
$this->content = new stdClass();
16+
$this->content->text = '';
17+
$this->content->footer = '';
18+
19+
if($context = $this->getCourseContext()) {
20+
$this->content->text = $this->getKalturaMediaGalleryLink($context->instanceid);
21+
}
22+
23+
return $this->content;
24+
}
25+
26+
function applicable_formats()
27+
{
28+
return array(
29+
'course-view' => true
30+
);
31+
}
32+
33+
private function getKalturaMediaGalleryLink($courseId) {
34+
$mediaGalleryUrl = new moodle_url('/local/kalturamediagallery/index.php', array(
35+
'courseid' => $courseId
36+
));
37+
38+
$link = html_writer::tag('a', get_string('nav_mediagallery', 'local_kalturamediagallery'), array(
39+
'href' => $mediaGalleryUrl->out(false)
40+
));
41+
42+
return $link;
43+
}
44+
45+
private function getCourseContext() {
46+
// Check the current page context. If the context is not of a course or module then return false.
47+
$context = context::instance_by_id($this->page->context->id);
48+
$isCourseContext = $context instanceof context_course;
49+
if (!$isCourseContext) {
50+
return false;
51+
}
52+
53+
// If the context if a module then get the parent context.
54+
$courseContext = ($context instanceof context_module) ? $context->get_course_context() : $context;
55+
56+
return $courseContext;
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace block_kalturamediagallery\privacy;
4+
5+
use \core_privacy\local\metadata\null_provider;
6+
7+
defined('MOODLE_INTERNAL') || die();
8+
9+
class provider implements null_provider {
10+
11+
/**
12+
* Get the language string identifier with the component's language
13+
* file to explain why this plugin stores no data.
14+
*
15+
* @return string
16+
*/
17+
public static function get_reason() : string {
18+
return 'privacy:metadata';
19+
}
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.