Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP-3652 support H5P marks transfer #67

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions classes/assessment/hvp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_sitsgradepush\assessment;

/**
* Class for hvp (mod_hvp plugin, not core H5P) assessment.
* Note that the default for "Grade > Maximum grade" when HVP is added to a course is 10.
* If it is to be a candidate for marks transfer, this needs to be set to 100 by the teacher.
* Otherwise it will not be shown as a source for marks transfer.
*
* @package local_sitsgradepush
* @copyright 2024 onwards University College London {@link https://www.ucl.ac.uk/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author David Watson <[email protected]>
*/
class hvp extends activity {

/**
* Get all participants.
*
* @return array
*/
public function get_all_participants(): array {
$context = \context_module::instance($this->coursemodule->id);
return get_enrolled_users($context, 'mod/hvp:view');
}

/**
* Get the start date of the assessment.
*
* @return int|null
*/
public function get_start_date(): ?int {
// Activity does not have a start date.
return null;
}

/**
* Get the end date of the assessment.
*
* @return int|null
*/
public function get_end_date(): ?int {
// Activity does not have an end date.
return null;
}
}
69 changes: 69 additions & 0 deletions classes/submission/hvp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_sitsgradepush\submission;

/**
* Class for coursework plugin (mod_coursework) submission.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class for hvp?

*
* @package local_sitsgradepush
* @copyright 2024 onwards University College London {@link https://www.ucl.ac.uk/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author David Watson <[email protected]>
*/
class hvp extends submission {
/**
* Get hand in datetime.
*
* @return string
*/
public function get_handin_datetime(): string {
// We cannot provide a hand in time as we don't have one.
// See notes under set_submission_data() below.
return "";
}

/**
* Set the module instance.
*
* @return void
* @throws \dml_exception
* @throws \moodle_exception
*/
protected function set_module_instance() {
global $DB;
if (!$instance = $DB->get_record('hvp', ['id' => $this->coursemodule->instance])) {
throw new \moodle_exception(
'error:coursemodulenotfound', 'local_sitsgradepush', '', null,
"Instance ID: " . $this->coursemodule->instance
);
}

$this->modinstance = $instance;
}

/**
* Set submission.
*
* @return void
*/
protected function set_submission_data(): void {
// We don't have the time submitted stored in the mod_hvp local tables so can't use that.
// The timecreated and timemodified fields are not set in grade_grades either.
// There is a timemodified in mdl_grade_items_history, but we can't rely on "loggeduser" being our user ID.
// So we can't set any data for hand in time here.
}
}
Loading