';
// Assessment name.
-echo '
Sits grade push history
';
+echo '
' . get_string('index:header', 'local_sitsgradepush') . '
';
$manager = manager::get_manager();
// Get assessment.
@@ -84,6 +84,8 @@
// Get page content.
$content = $manager->get_assessment_data($assessment);
+$mappingids = [];
+
if (!empty($content)) {
// Check if asynchronous grade push is enabled.
$async = get_config('local_sitsgradepush', 'async');
@@ -93,12 +95,6 @@
// Get push button label.
$buttonlabel = get_string('label:pushgrade', 'local_sitsgradepush');
$disabled = '';
-
- // Check if this course module has pending task.
- if ($task = $manager->get_pending_task_in_queue($coursemoduleid)) {
- $buttonlabel = $task->buttonlabel;
- $disabled = 'disabled';
- }
} else {
// Push grade and submission log.
if ($pushgrade == 1) {
@@ -128,21 +124,13 @@
echo $renderer->render_link('local_sitsgradepush_pushbutton', $buttonlabel, $url->out(false));
}
- if ($lastfinishedtask = $manager->get_last_finished_push_task($coursemoduleid)) {
- echo '
'. get_string(
- 'label:lastpushtext',
- 'local_sitsgradepush', [
- 'statustext' => $lastfinishedtask->statustext,
- 'date' => date('d/m/Y', $lastfinishedtask->timeupdated),
- 'time' => date('g:i:s a', $lastfinishedtask->timeupdated), ]) .
- '
';
- }
} else {
echo '
' . get_string('error:assessmentisnotmapped', 'local_sitsgradepush') . '
';
}
// Display grade push records for each mapping.
foreach ($content['mappings'] as $mapping) {
+ $mappingids[] = $mapping->id;
echo $renderer->render_assessment_push_status_table($mapping);
}
@@ -155,7 +143,8 @@
}
echo '
';
-$PAGE->requires->js_call_amd('local_sitsgradepush/sitsgradepush', 'init', [$coursemoduleid]);
+// Initialize javascript.
+$PAGE->requires->js_call_amd('local_sitsgradepush/sitsgradepush', 'init', [$coursemoduleid, $mappingids]);
// And the page footer.
echo $OUTPUT->footer();
diff --git a/lang/en/local_sitsgradepush.php b/lang/en/local_sitsgradepush.php
index 4b824e8..f938dbe 100644
--- a/lang/en/local_sitsgradepush.php
+++ b/lang/en/local_sitsgradepush.php
@@ -50,6 +50,8 @@
$string['settings:userprofilefield'] = 'User Profile Field';
$string['settings:userprofilefield:desc'] = 'User profile field for export staff';
$string['label:gradepushassessmentselect'] = 'Select SITS assessment to link to';
+$string['label:jumpto'] = 'Jump to: ';
+$string['label:pushall'] = 'Push All';
$string['label:reassessmentselect'] = 'Re-assessment';
$string['label:pushgrade'] = 'Push grades';
$string['label:ok'] = 'OK';
@@ -62,25 +64,34 @@
$string['subplugintype_sitsapiclient'] = 'API client used for data integration.';
$string['cachedef_studentspr'] = 'Student\'s SPR code per SITS assessment pattern';
$string['invalidstudents'] = 'Students not valid for the mapped assessment components';
+$string['pushrecordsexist'] = 'Push records exist';
+$string['pushrecordsnotexist'] = 'No push records';
+
+// Grade push index page.
+$string['index:header'] = 'Sits Grade Push History';
// Error strings.
-$string['error:assessmentmapping'] = 'No valid mapping or component grade. {$a}';
+$string['error:assessmentmapping'] = 'Assessment mapping is not found. ID: {$a}';
$string['error:assessmentisnotmapped'] = 'This activity is not mapped to any assessment component.';
$string['error:componentgradepushed'] = '{$a} cannot be removed because it has grade push records.';
$string['error:componentgrademapped'] = '{$a} had been mapped to another activity.';
$string['error:pastactivity'] = 'It looks like this course is from a previous academic year, mappings are not allowed.';
$string['error:mapassessment'] = 'You do not have permission to map assessment.';
+$string['error:pushgradespermission'] = 'You do not have permission to push grades.';
$string['error:nostudentgrades'] = 'No student grades found.';
$string['error:nostudentfoundformapping'] = 'No student found for this assessment component.';
$string['error:emptyresponse'] = 'Empty response received when calling {$a}.';
$string['error:turnitin_numparts'] = 'Turnitin assignment with multiple parts is not supported by Grade Push.';
-$string['error:duplicatedtask'] = 'There is already a push task in queue / processing for this course module.';
+$string['error:duplicatedtask'] = 'There is already a push task in queue / processing for this assessment mapping.';
$string['error:coursemodulenotfound'] = 'Course module not found.';
$string['error:tasknotfound'] = 'Push task not found.';
$string['error:multiplemappingsnotsupported'] = 'Multiple assessment component mappings is not supported by {$a}';
$string['error:studentnotfound'] = 'Student with idnumber {$a->idnumber} not found for component grade {$a->componentgrade}';
$string['error:coursemodulenotfound'] = 'Course module not found. ID: {$a}';
$string['error:duplicatemapping'] = 'Cannot map multiple assessment components with same module delivery to an activity. Mapcode: {$a}';
+$string['error:nomoduledeliveryfound'] = 'No module delivery found.';
+$string['error:no_mab_found'] = 'No assessment component found for this module delivery.';
+$string['error:mab_not_found'] = 'Assessment component not found. ID: {$a}';
$string['form:alert_no_mab_found'] = 'No assessment components found';
$string['form:info_turnitin_numparts'] = 'Please note Turnitin assignment with multiple parts is not supported by Grade Push.';
diff --git a/lib.php b/lib.php
index 4b565a2..4c28e4a 100644
--- a/lib.php
+++ b/lib.php
@@ -71,12 +71,23 @@ function local_sitsgradepush_coursemodule_standard_elements($formwrapper, $mform
// Add component grades options to the dropdown list.
if (empty($manager->get_api_errors())) {
- // Get component grade options.
- $options = $manager->get_component_grade_options(
+ // Get module deliveries with component grades data.
+ $moduledeliveries = $manager->get_component_grade_options(
$formwrapper->get_course()->id,
$formwrapper->get_current()->coursemodule
);
+ // Combine all component grades into a single array.
+ if (!empty($moduledeliveries)) {
+ $options = [];
+ foreach ($moduledeliveries as $moduledelivery) {
+ if (empty($moduledelivery->componentgrades)) {
+ continue;
+ }
+ $options = array_merge($options, $moduledelivery->componentgrades);
+ }
+ }
+
if (empty($options)) {
$mform->addElement(
'html',
@@ -235,3 +246,49 @@ function local_sitsgradepush_extend_settings_navigation(settings_navigation $set
$modulesettings->add_node($node);
}
}
+
+/**
+ * Extend the course navigation with a link to the grade push dashboard.
+ *
+ * @param navigation_node $parentnode
+ * @param stdClass $course
+ * @param context_course $context
+ * @return void|null
+ * @throws coding_exception
+ * @throws dml_exception
+ * @throws moodle_exception
+ */
+function local_sitsgradepush_extend_navigation_course(navigation_node $parentnode, stdClass $course, context_course $context) {
+
+ global $PAGE;
+
+ // Only add this settings item on non-site course pages and if the user has the capability to perform a rollover.
+ if (!$PAGE->course || $PAGE->course->id == SITEID || !has_capability('local/sitsgradepush:mapassessment', $context)) {
+ return null;
+ }
+
+ // Is the plugin enabled?
+ $enabled = (bool)get_config('local_sitsgradepush', 'enabled');
+ if (!$enabled) {
+ return null;
+ }
+
+ $url = new moodle_url('/local/sitsgradepush/dashboard.php', [
+ 'id' => $course->id,
+ ]);
+
+ $node = navigation_node::create(
+ get_string('pluginname', 'local_sitsgradepush'),
+ $url,
+ navigation_node::NODETYPE_LEAF,
+ 'local_sitsgradepush',
+ 'local_sitsgradepush',
+ new pix_icon('repeat', get_string('pluginname', 'local_sitsgradepush'), 'local_sitsgradepush')
+ );
+
+ if ($PAGE->url->compare($url, URL_MATCH_BASE)) {
+ $node->make_active();
+ }
+
+ $parentnode->add_node($node);
+}
diff --git a/styles.css b/styles.css
new file mode 100644
index 0000000..6aa3ffd
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,57 @@
+.sitgradepush-btn-center {
+ text-align: center;
+}
+
+.sitsgradepush-dasboard .selector-container {
+ margin-bottom: 20px;
+}
+
+.sitsgradepush-dasboard .module-delivery-table {
+ text-align: center;
+ margin-bottom: 50px;
+ background-color: #fff5ea;
+}
+
+.sitsgradepush-dasboard .module-delivery-table .seq-col {
+ width: 5%;
+}
+
+.sitsgradepush-dasboard .module-delivery-table .title-col {
+ width: 40%;
+}
+
+.sitsgradepush-dasboard .module-delivery-table .weight-col {
+ width: 5%;
+}
+
+.sitsgradepush-dasboard .module-delivery-table .assessment-col {
+ width: 15%;
+}
+
+.sitsgradepush-dasboard .module-delivery-table .mark-col {
+ width: 20%;
+}
+
+.sitsgradepush-dasboard .module-delivery-table .action-col {
+ width: 15%;
+}
+
+/* Add CSS styles for the "Back to Top" button */
+.sitsgradepush-dasboard .back-to-top {
+ display: none;
+ position: fixed;
+ bottom: 20px; /* Adjust the distance from the bottom as needed */
+ right: 20px; /* Adjust the distance from the right as needed */
+ z-index: 999;
+ padding: 10px 20px;
+ background-color: #007bff; /* Button background color */
+ color: #fff; /* Button text color */
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 16px;
+}
+
+.sitsgradepush-dasboard .back-to-top:hover {
+ background-color: #0056b3; /* Hover background color */
+}
diff --git a/templates/assessmentgrades.mustache b/templates/assessmentgrades.mustache
index 04d39dd..e49b71c 100644
--- a/templates/assessmentgrades.mustache
+++ b/templates/assessmentgrades.mustache
@@ -16,7 +16,7 @@
{{!
@template local_sitsgradepush/assessmentgrades
- Template for displaying the grades for an assessment.
+ Template for displaying the grade push history for an assessment.
Classes required for JS:
* none
@@ -25,15 +25,40 @@
* none
Context variables required for this template:
- * tabletitle - The assessment name
- * students - Array variable, array of students
+ * tabletitle - String, The assessment component's name
+ * additionalinfo - Boolean, whether to display additional information
+ * students - Array, array of students
Example context (json):
- {"tabletitle":"","students":[]}
+ {
+ "tabletitle":"PHAY0063-2022-T1-A7P-001 Coursework 4000 word written case studies (50%)",
+ "additionalinfo":true,
+ "students":[{
+ "firstname":"Test",
+ "lastname":"User",
+ "idnumber":"1234567",
+ "marks":"0",
+ "handindatetime":"2019-01-01 00:00:00",
+ "lastgradepushresultlabel":"