Skip to content

Commit

Permalink
CTP-2812 Hide submission log information
Browse files Browse the repository at this point in the history
  • Loading branch information
aydevworks committed Jan 5, 2024
1 parent 823d291 commit d43c1a1
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
9 changes: 7 additions & 2 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(moodle_page $page, $target) {
* @return string Rendered HTML
* @throws \moodle_exception
*/
public function render_button(string $id, string $name, string $disabled = '', $class = '') : string {
public function render_button(string $id, string $name, string $disabled = '', string $class = '') : string {
return $this->output->render_from_template(
'local_sitsgradepush/button',
['id' => $id, 'name' => $name, 'disabled' => $disabled, 'class' => $class]
Expand All @@ -95,10 +95,11 @@ public function render_link(string $id, string $name, string $url) : string {
* Render the assessment push status table.
*
* @param \stdClass $mapping Assessment mapping
* @param int $courseid Course ID
* @return string Rendered HTML
* @throws \moodle_exception
*/
public function render_assessment_push_status_table(\stdClass $mapping) : string {
public function render_assessment_push_status_table(\stdClass $mapping, int $courseid) : string {
$students = null;
// Modify the timestamp format and add the label for the last push result.
if (!empty($mapping->students)) {
Expand Down Expand Up @@ -129,13 +130,17 @@ public function render_assessment_push_status_table(\stdClass $mapping) : string
// Check if there is any task info to display.
$additionalinfo = $lasttasktext || $hastaskinprogress;

// Check if the user has the capability to see the submission log column.
$showsublogcolumn = has_capability('local/sitsgradepush:showsubmissionlogcolumn', \context_course::instance($courseid));

// Render the table.
return $this->output->render_from_template('local_sitsgradepush/assessmentgrades', [
'mappingid' => $mappingid,
'tabletitle' => $mapping->formattedname,
'students' => $students,
'lasttask' => $lasttasktext,
'additionalinfo' => $additionalinfo,
'showsublogcolumn' => $showsublogcolumn,
]);
}

Expand Down
5 changes: 5 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [],
],
'local/sitsgradepush:showsubmissionlogcolumn' => [
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [],
],
];
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@
// Display grade push records for each mapping.
foreach ($content['mappings'] as $mapping) {
$mappingids[] = $mapping->id;
echo $renderer->render_assessment_push_status_table($mapping);
echo $renderer->render_assessment_push_status_table($mapping, $coursemodule->course);
}

// Display invalid students.
if (!empty($content['invalidstudents']->students)) {
echo $renderer->render_assessment_push_status_table($content['invalidstudents']);
echo $renderer->render_assessment_push_status_table($content['invalidstudents'], $coursemodule->course);
}
} else {
echo '<p class="alert alert-info">' . get_string('error:assessmentisnotmapped', 'local_sitsgradepush') . '</p>';
Expand Down
1 change: 1 addition & 0 deletions lang/en/local_sitsgradepush.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
// Capability strings.
$string['sitsgradepush:mapassessment'] = 'Map assessment component to Moodle activity';
$string['sitsgradepush:pushgrade'] = 'Transfer Marks to SITS';
$string['sitsgradepush:showsubmissionlogcolumn'] = 'Show Submission Log column';

// Task strings.
$string['task:pushtask:name'] = 'Schedule Transfer Task';
Expand Down
21 changes: 12 additions & 9 deletions templates/assessmentgrades.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Example context (json):
{
"tabletitle":"PHAY0063-2022-T1-A7P-001 Coursework 4000 word written case studies (50%)",
"additionalinfo":true,
"additionalinfo":false,
"students":[{
"firstname":"Test",
"lastname":"User",
Expand Down Expand Up @@ -62,12 +62,14 @@
</tr>
{{/additionalinfo}}
<tr>
<th scope="col">{{#str}} index:student, local_sitsgradepush {{/str}}</th>
<th scope="col">{{#str}} index:porticonumber, local_sitsgradepush {{/str}}</th>
<th scope="col">{{#str}} index:grade, local_sitsgradepush {{/str}}</th>
<th scope="col">{{#str}} index:submissiondate, local_sitsgradepush {{/str}}</th>
<th scope="col">{{#str}} index:lastmarktransfer, local_sitsgradepush {{/str}}</th>
<th scope="col">{{#str}} index:lastsublogtransfer, local_sitsgradepush {{/str}}</th>
<th scope="col">Student</th>
<th scope="col">Portico number</th>
<th scope="col">Grade</th>
<th scope="col">Submission date</th>
<th scope="col">Last grade push</th>
{{#showsublogcolumn}}
<th scope="col">Last submission log push</th>
{{/showsublogcolumn}}
</tr>
</thead>
<tbody>
Expand All @@ -78,8 +80,9 @@
<td>{{marks}}</td>
<td>{{handindatetime}}</td>
<td>{{{lastgradepushresultlabel}}}{{lastgradepushtime}}</td>
<td>{{{lastsublogpushresultlabel}}}{{lastsublogpushtime}}
</td>
{{#showsublogcolumn}}
<td>{{{lastsublogpushresultlabel}}}{{lastsublogpushtime}}</td>
{{/showsublogcolumn}}
</tr>
{{/students}}
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

$plugin->component = 'local_sitsgradepush';
$plugin->release = '0.1.0';
$plugin->version = 2023121900;
$plugin->version = 2023122200;
$plugin->requires = 2021051708;
$plugin->maturity = MATURITY_ALPHA;
$plugin->dependencies = [
Expand Down

0 comments on commit d43c1a1

Please sign in to comment.