Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
abertranb committed Nov 25, 2024
2 parents c90c907 + 0a3f67f commit 9dfc0c4
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 86 deletions.
78 changes: 7 additions & 71 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,78 +34,14 @@
/**
* Privacy Subsystem for mod_videoconnect implementing null_provider.
*/
class provider implements
\core_privacy\local\request\core_userlist_provider,
\core_privacy\local\metadata\provider,
\core_privacy\local\request\plugin\provider {
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Returns the metadata for the plugin.
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @param int $userid
* @return contextlist
* @return string
*/
public static function get_contexts_for_userid(int $userid): contextlist {
return new contextlist();
}

/**
* Export all user data for the specified user, in the specified contexts.
*
* @param approved_contextlist $contextlist
* @return void
*/
public static function export_user_data(approved_contextlist $contextlist) {
}

/**
* Export all user data for the specified user, in the specified contexts.
*
* @param \context $context
* @return void
*/
public static function delete_data_for_all_users_in_context(\context $context) {
}

/**
* Delete all user data for the specified user, in the specified contexts.
*
* @param approved_contextlist $contextlist
* @return void
*/
public static function delete_data_for_user(approved_contextlist $contextlist) {
}

/**
* Get the list of contexts that contain user information for the specified user.
*
* @param userlist $userlist
*/
public static function get_users_in_context(userlist $userlist) {
}

/**
* Delete all user data for the specified user, in the specified contexts.
*
* @param approved_userlist $userlist
* @return void
*/
public static function delete_data_for_users(approved_userlist $userlist) {
}

/**
* Get the list of contexts that contain user information for the specified user.
*
* @param collection $collection
* @return collection
*/
public static function get_metadata(collection $collection): collection {
$collection->add_external_location_link(
'videoconnect',
[
'course' => 'privacy:metadata:courseid',
],
'privacy:metadata:externalpurpose'
);
return $collection;
}
public static function get_reason(): string {
return 'privacy:metadata';
}
}
94 changes: 84 additions & 10 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,96 @@
/**
* Display information about all the mod_videoconnect modules in the requested course.
*
* @package mod_videoconnect
* @copyright 2021-2024 3ipunt {@link https://www.tresipunt.com}
* @package mod_videoconnect
* @copyright 2021-2024 3ipunt {@link https://www.tresipunt.com}
* @author 3IPUNT <[email protected]>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

global $PAGE, $CFG;

// Course.
// Course id.
$id = required_param('id', PARAM_INT);

require_login($id);
$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST);

require_course_login($course, true);
$PAGE->set_pagelayout('incourse');

$params = [
'context' => context_course::instance($course->id),
];
$event = \mod_videoconnect\event\course_module_instance_list_viewed::create($params);
$event->add_record_snapshot('course', $course);
$event->trigger();

$strvideoconnect = get_string('modulename', 'videoconnect');
$strvideoconnects = get_string('modulenameplural', 'videoconnect');
$strname = get_string('name');
$strintro = get_string('moduleintro');
$strlastmodified = get_string('lastmodified');

$PAGE->set_url('/mod/videoconnect/index.php', ['id' => $course->id]);
$PAGE->set_title($course->shortname . ': ' . $strvideoconnects);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strvideoconnects);
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading($strvideoconnects);
}

if (!$videos = get_all_instances_in_course('videoconnect', $course)) {
notice(get_string('thereareno', 'moodle', $strvideoconnects), "$CFG->wwwroot/course/view.php?id=$course->id");
exit;
}

$usesections = course_format_uses_sections($course->format);

$table = new html_table();
$table->attributes['class'] = 'generaltable mod_index';

if ($usesections) {
$strsectionname = get_string('sectionname', 'format_' . $course->format);
$table->head = [$strsectionname, $strname, $strintro];
$table->align = ['center', 'left', 'left'];
} else {
$table->head = [$strlastmodified, $strname, $strintro];
$table->align = ['left', 'left', 'left'];
}

$modinfo = get_fast_modinfo($course);
$currentsection = '';
foreach ($videos as $video) {
$cm = $modinfo->cms[$video->coursemodule];
if ($usesections) {
$printsection = '';
if ($video->section !== $currentsection) {
if ($video->section) {
$printsection = get_section_name($course, $video->section);
}
if ($currentsection !== '') {
$table->data[] = 'hr';
}
$currentsection = $video->section;
}
} else {
$printsection = '<span class="smallinfo">' . userdate($video->timemodified) . "</span>";
}

$extra = empty($cm->extra) ? '' : $cm->extra;
$icon = '';
if (!empty($cm->icon)) {
$icon = $OUTPUT->pix_icon($cm->icon, get_string('modulename', $cm->modname)) . ' ';
}

// Hidden modules are dimmed.
$class = $video->visible ? '' : 'class="dimmed"';
$table->data[] = [
$printsection,
"<a $class $extra href=\"view.php?id=$cm->id\">" . $icon . format_string($video->name) . "</a>",
format_module_intro('videoconnect', $video, $cm->id)];
}

$PAGE->set_url('/mod/videoconnect/index.php', ['id' => $id]);
echo html_writer::table($table);

redirect("$CFG->wwwroot/course/view.php?id=$id");
echo $OUTPUT->footer();
2 changes: 2 additions & 0 deletions lang/en/videoconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@
$string['we_are_sorry'] = 'We are sorry';
$string['whitelist'] = 'Whitelist domain';
$string['whitelist_desc'] = "Domain to include in the privacy whitelist. Don't include protocol 'http://' or 'https://'. Ex: yoursite.test";
$string['privacy:metadata'] = 'The Videoconnect resource plugin does not store any personal data.';
$string['videoconnect:view'] = 'View Videoconnect content.';
2 changes: 2 additions & 0 deletions lang/es/videoconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@
$string['we_are_sorry'] = 'Lo sentimos';
$string['whitelist'] = 'Dominio Whitelist';
$string['whitelist_desc'] = "Dominio que queremos incluir a la lista blanca de privacidad. No incluir protocolo 'http://' or 'https://'. Ej: yoursite.test";
$string['privacy:metadata'] = 'El plugin Videoconnect no almacena ningún dato personal.';
$string['videoconnect:view'] = 'Visualizar un contenido de Videoconnect.';
4 changes: 1 addition & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use mod_videoconnect\output\view_page;
use mod_videoconnect\uploads;

defined('MOODLE_INTERNAL') || die();
/**
* Return if the plugin supports $feature.
*
Expand Down Expand Up @@ -78,9 +79,6 @@ function videoconnect_add_instance(object $moduleinstance, $mform = null): int {
*/
function videoconnect_get_coursemodule_info(object $coursemodule): cached_cm_info {
global $PAGE;
if ($PAGE->context->id != context_module::instance($coursemodule->id)) {
$PAGE->set_context(context_module::instance($coursemodule->id));
}
$output = $PAGE->get_renderer('mod_videoconnect');
$page = new view_page($coursemodule->id, false);
$content = $output->render($page);
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_videoconnect';
$plugin->release = '1.0.2';
$plugin->version = 2024101401;
$plugin->release = '1.0.3';
$plugin->version = 2024111901;
$plugin->requires = 2022112802; // Moodle 4.1.2+.
$plugin->maturity = MATURITY_STABLE;

0 comments on commit 9dfc0c4

Please sign in to comment.