Skip to content

Instantly share code, notes, and snippets.

View stuartlamour's full-sized avatar

Stuart Lamour stuartlamour

View GitHub Profile
<?php
// NB - example test test generated by genimi llm.
// Not been tested!
namespace mod_coursework\test\output;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../../lib/testlib.php');
require_once(__DIR__ . '/../../../mod/coursework/classes/output/renderer.php');
/**
* Return if user has archetype editingteacher.
*
*/
public static function is_teacher(): bool {
global $DB, $USER;
// Get id's from role where archetype is editingteacher.
$roles = $DB->get_fieldset('role', 'id', ['archetype' => 'editingteacher']);
public static function get_assessments() {
global $COURSE, $USER, $OUTPUT;
// Can edit.
$context = context_course::instance($COURSE->id);
$canedit = has_capability('moodle/course:update', $context);
// Viewing a student record.
$viewasstudent = false; // TODO.
<div class="d-flex">
{{! Years. }}
{{#hasyears}}
<hr>
Academic year:
<a href="{{mainurl}}" class="mr-2">Current</a>
{{#year}}
<a href="{{url}}" class="mr-2">{{{name}}}</a>
{{/year}}
@stuartlamour
stuartlamour / mod.mustache
Last active August 29, 2024 14:21
mod mustache for feedback report
{{!
@template mod
}}
<div class="row">
<!-- Mod name. -->
<div class="col-12 col-md-5 mb-3 mb-md-0">
<img src="https://moodle.ucl.ac.uk/theme/image.php/ucl/quiz/1724290347/monologo" class="icon mr-1">
<a href="">modname</a>
</div>
/**
* Check if an activity is sits mapped.
*
*/
function sitsmapped($cmid) {
global $DB;
$dbman = $DB->get_manager();
$table = 'local_sitsgradepush_mapping';
if ($dbman->table_exists($table)) {
{{!
@template core_courseformat/local/content/cm/cmicon
Displays a course module icon.
Example context (json):
{
"icon": "../../../pix/help.svg",
"iconclass": "",
"purpose": "content",
{{#url}}
<div class="activity-name-area activity-instance d-flex flex-column mr-2 ">
<div class="activitytitle media position-relative align-self-start {{textclasses}} modtype_{{modname}}">
{{! Icon }}
{{#activityicon}}
{{$ core_courseformat/local/content/cm/cmicon }}
{{> core_courseformat/local/content/cm/cmicon }}
{{/ core_courseformat/local/content/cm/cmicon }}
{{/activityicon}}
@stuartlamour
stuartlamour / table.mustache
Last active January 23, 2024 14:13
marks transfer
<!-- Header. -->
<div id="#{{{ id }}}" class="pb-3">
<hr>
<div class="row">
<div class="col-6">
<small>Module Delivery</small>
<h3 class="mb-0">{{{ delivercode }}}</h3>
<small>{{{ level }}}</small>
</div>
<div class="col-6">
<div class="position-absolute w-100" style="bottom: 0; z-index: 6666;">
<div class="bg-white">
<div class="alert alert-danger mb-0">
<i class="fa fa-exclamation-triangle text-danger mr-2" aria-hidden="true"></i>
This is a preview of Moodle 4.2 and the new UCL Moodle theme.
Every fortnight this site will be refreshed. Any work here will be lost.
See the <a href="https://wiki.ucl.ac.uk/x/2wDfDw" target="_blank">Moodle 4.2 wiki page</a> for support and to report any issues.</a>
</div>
</div>
</div>