-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters