Skip to content

Commit

Permalink
2024012500 release code
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroAps committed Jan 25, 2024
1 parent 2ea32a3 commit f095cfe
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 105 deletions.
4 changes: 3 additions & 1 deletion backup/moodle2/backup_panoptosubmission_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ protected function define_structure() {
'cutofftime',
'preventlate',
'resubmit',
'emailteachers',
'sendnotifications',
'sendlatenotifications',
'sendstudentnotifications',
'grade',
'timecreated',
'timemodified'
Expand Down
4 changes: 3 additions & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd">
<FIELD NAME="timedue" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the assignment submissions are due by"/>
<FIELD NAME="preventlate" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Prevent late submissions"/>
<FIELD NAME="resubmit" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allow for resubmissions"/>
<FIELD NAME="emailteachers" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Email submissions to the teacher"/>
<FIELD NAME="sendnotifications" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allows the disabling of email notifications."/>
<FIELD NAME="sendlatenotifications" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allows separate enabling of notifications for late student submissions."/>
<FIELD NAME="sendstudentnotifications" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Default for send student notifications checkbox when grading."/>
<FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="2" COMMENT="Maximum grade the assignment is worth"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time the assignment was created"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the assignment settings were modified"/>
Expand Down
31 changes: 31 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,36 @@ function xmldb_panoptosubmission_upgrade($oldversion) {
// Panopto savepoint reached.
upgrade_mod_savepoint(true, 2023012400, 'panoptosubmission');
}

if ($oldversion < 2023120100) {
$table = new xmldb_table('panoptosubmission');

// Update 'emailteachers' to 'sendnotifications'.
$field = new xmldb_field('emailteachers', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', null);

// Check if field exists.
if ($dbman->field_exists($table, $field)) {
// Rename field emailteachers to sendnotifications.
$dbman->rename_field($table, $field, 'sendnotifications');
}

// Add sendlatenotifications field.
$field = new xmldb_field('sendlatenotifications', XMLDB_TYPE_INTEGER,
'2', null, XMLDB_NOTNULL, null, '0', 'sendnotifications');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Add sendstudentnotifications field.
$field = new xmldb_field('sendstudentnotifications', XMLDB_TYPE_INTEGER,
'2', null, XMLDB_NOTNULL, null, '0', 'sendlatenotifications');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Update the savepoint.
upgrade_mod_savepoint(true, 2023120100, 'panoptosubmission');
}

return true;
}
46 changes: 32 additions & 14 deletions grade_submissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* main grading page for the Panopto Student Submission module
* Main grading page for the Panopto Student Submission module.
*
* @package mod_panoptosubmission
* @copyright Panopto 2021
Expand All @@ -28,7 +28,8 @@
require_once(dirname(__FILE__).'/locallib.php');
require_once(dirname(__FILE__).'/grade_preferences_form.php');

$id = required_param('cmid', PARAM_INT); // Course Module ID.
// Course Module ID.
$id = required_param('cmid', PARAM_INT);
$mode = optional_param('mode', 0, PARAM_TEXT);
$tifirst = optional_param('tifirst', '', PARAM_TEXT);
$tilast = optional_param('tilast', '', PARAM_TEXT);
Expand Down Expand Up @@ -78,10 +79,8 @@

if ($data = $prefform->get_data()) {
set_user_preference('panoptosubmission_group_filter', $data->group_filter);

set_user_preference('panoptosubmission_filter', $data->filter);


// Make sure advanced grading is disabled before we enable quick grading.
$gradingmanager = get_grading_manager($context, 'mod_panoptosubmission', 'submissions');
$controller = $gradingmanager->get_active_controller();
Expand Down Expand Up @@ -120,14 +119,14 @@

foreach ($gradedata->users as $userid => $val) {

$userto = $DB->get_record('user', ['id' => $userid]);
$param = array('panactivityid' => $pansubmissionactivity->id, 'userid' => $userid);

$usersubmissions = $DB->get_record('panoptosubmission_submission', $param);

if ($usersubmissions) {

if (array_key_exists($userid, $gradedata->menu)) {

// Update grade.
if (($gradedata->menu[$userid] != $usersubmissions->grade)) {

Expand All @@ -139,14 +138,10 @@
}
}

if (array_key_exists($userid, $gradedata->submissioncomment)) {

if (0 != strcmp($usersubmissions->submissioncomment, $gradedata->submissioncomment[$userid])) {
$usersubmissions->submissioncomment = $gradedata->submissioncomment[$userid];

$updated = true;

}
if ( array_key_exists($userid, $gradedata->submissioncomment)
&& 0 != strcmp($usersubmissions->submissioncomment, $gradedata->submissioncomment[$userid])) {
$usersubmissions->submissioncomment = $gradedata->submissioncomment[$userid];
$updated = true;
}

// Trigger grade event.
Expand All @@ -158,6 +153,18 @@

panoptosubmission_grade_item_update($pansubmissionactivity, $grade);

// Send notification to student.
if ($pansubmissionactivity->sendstudentnotifications) {
panoptosubmission_send_notification($cm,
$course,
$pansubmissionactivity->name,
$submission,
$USER,
$userto,
'feedbackavailable'
);
}

// Add to log only if updating.
$event = \mod_panoptosubmission\event\grades_updated::create(array(
'context' => $context,
Expand Down Expand Up @@ -207,6 +214,18 @@

panoptosubmission_grade_item_update($pansubmissionactivity, $grade);

// Send notification to student.
if ($pansubmissionactivity->sendstudentnotifications) {
panoptosubmission_send_notification($cm,
$course,
$pansubmissionactivity->name,
$submission,
$USER,
$userto,
'feedbackavailable'
);
}

// Add to log only if updating.
$event = \mod_panoptosubmission\event\grades_updated::create(array(
'context' => $context,
Expand All @@ -216,7 +235,6 @@
));
$event->trigger();
}

}

$updated = false;
Expand Down
41 changes: 35 additions & 6 deletions lang/en/panoptosubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
$string['preventlate_help'] = 'If enabled, this will prevent students from submitting the assignment after the due date.';
$string['allowdeleting'] = 'Allow resubmitting';
$string['allowdeleting_help'] = 'If enabled, students may replace submitted videos. Whether it is possible to submit after the due date is controlled by the \'Prevent late submissions\' setting';
$string['emailteachers'] = 'Email alerts to teachers';
$string['emailteachers_help'] = 'If enabled, teachers receive email notification whenever students add or update an assignment submission. Only teachers who are able to grade the particular assignment are notified. So, for example, if the course uses separate groups, teachers restricted to particular groups won\'t receive notification about students in other groups.';
$string['invalidid'] = 'Invalid ID';
$string['invalid_launch_parameters'] = 'Invalid launch parameters';
Expand Down Expand Up @@ -93,6 +92,16 @@
$string['submissions'] = 'Submissions';
$string['gradeitem:submissions'] = 'Submissions';
$string['feedback'] = 'Feedback';
$string['feedbackavailabletext'] = '{$a->username} has posted some feedback on your
assignment submission for \'{$a->assignment}\'
You can see it appended to your assignment submission:
{$a->url}';
$string['feedbackavailablehtml'] = '{$a->username} has posted some feedback on your
assignment submission for \'<i>{$a->assignment}</i>\'<br /><br />
You can see it appended to your <a href="{$a->url}">assignment submission</a>.';
$string['feedbackavailablesmall'] = '{$a->username} has given feedback for assignment {$a->assignment}';
$string['singlesubmissionheader'] = 'Grade submission';
$string['singlegrade'] = 'Add help text';
$string['singlegrade_help'] = 'Add help text';
Expand All @@ -102,20 +111,27 @@
$string['save'] = 'Save Changes';
$string['cancel'] = 'Close';
$string['pluginname'] = 'Panopto Student Submission';
$string['emailteachermail'] = '{$a->username} has updated their assignment submission
$string['gradersubmissionupdatedtext'] = '{$a->username} has updated their assignment submission
for \'{$a->assignment}\' at {$a->timeupdated}
View the submission here:
{$a->url}';
$string['emailteachermailhtml'] = '{$a->username} has updated their assignment submission
$string['gradersubmissionupdatedhtml'] = '{$a->username} has updated their assignment submission
for <i>\'{$a->assignment}\' at {$a->timeupdated}</i><br /><br />
It is <a href="{$a->url}">available on the web site</a>.';
$string['gradersubmissionupdatedsmall'] = '{$a->username} has updated their submission for assignment {$a->assignment}.';
$string['submissionreceipttext'] = 'You have submitted an
assignment submission for \'{$a->assignment}\'
You can see the status of your assignment submission:
{$a->url}';
$string['submissionreceipthtml'] = '<p>You have submitted an assignment submission for \'<i>{$a->assignment}</i>\'.</p>
<p>You can see the status of your <a href="{$a->url}">assignment submission</a>.</p>';
$string['submissionreceiptsmall'] = 'You have submitted your assignment submission for {$a->assignment}';
$string['messageprovider:panoptosubmission_updates'] = 'Panopto Student Submission notifications';
$string['video_preview_header'] = 'Submission preview';
$string['panoptosubmission:gradesubmission'] = 'Grade video submissions';
$string['panoptosubmission:addinstance'] = 'Add a Panopto Student Submission activity';
$string['panoptosubmission:submit'] = 'Submit';
$string['noenrolledstudents'] = 'No students are enrolled in the course';
$string['group_filter'] = 'Group Filter';
$string['noassignments'] = 'No Panopto Student Submission activities found in the course';
Expand Down Expand Up @@ -144,6 +160,15 @@
$string['quickgrade_help'] = 'If enabled, multiple assignments can be graded at the same time. Update grades and feedback and then click "Save all feedback".';
$string['no_existing_lti_tools'] = 'A preconfigured Panopto LTI tool with the custom parameter "panopto_student_submission_tool" must exist to be able to use the Panopto Student Submission activity. Please see setup documentation for more information.';
$string['no_automatic_operation_target_server'] = 'Please set Automatic Operation Target Server in the settings, so course can be provisioned.';
$string['notifications'] = 'Notifications';
$string['sendstudentnotificationsdefault'] = 'Default for \'Notify student\'';
$string['sendstudentnotificationsdefault_help'] = 'When grading each student, should \'Notify student\' be ticked by default?';
$string['sendstudentnotifications'] = 'Notify student';
$string['sendstudentnotifications_help'] = 'Tick this box to send a notification about the updated grade or feedback. If the assignment uses a marking workflow, or the grades are hidden in the grader report, then the notification will not be sent until the grade is released.';
$string['sendnotifications'] = 'Notify graders about submissions';
$string['sendnotifications_help'] = 'If enabled, graders (usually teachers) receive a message whenever a student submits an assignment, early, on time and late.';
$string['sendlatenotifications'] = 'Notify graders about late submissions';
$string['sendlatenotifications_help'] = 'If enabled, graders (usually teachers) receive a message whenever a student submits an assignment late.';
$string['privacy:metadata:emailteachersexplanation'] = 'Messages are sent to teachers through the messaging system.';
$string['privacy:metadata:panoptosubmission_submission'] = 'Panopto Student Submission submissions';
$string['privacy:metadata:panoptosubmission_submission:email'] = 'Your email is sent to Panopto to allow use of Panopto\'s email features.';
Expand All @@ -163,3 +188,7 @@
$string['privacy:metadata:panoptosubmissionquickgrade'] = 'Quick grading preference for Panopto Submission.';
$string['privacy:markedsubmissionspath'] = 'markedsubmissions';
$string['privacy:submissionpath'] = 'submission';
$string['panoptosubmission:gradesubmission'] = 'Grade video submissions';
$string['panoptosubmission:addinstance'] = 'Add a Panopto Student Submission activity';
$string['panoptosubmission:submit'] = 'Submit';
$string['panoptosubmission:receivegradernotifications'] = 'Receive grader submission notifications';
5 changes: 1 addition & 4 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* main lib.php file for the Panopto Student Submission mod
* Main lib.php file for the Panopto Student Submission mod.
*
* @package mod_panoptosubmission
* @copyright Panopto 2021
Expand Down Expand Up @@ -178,7 +178,6 @@ function panoptosubmission_user_outline($course, $user, $mod, $data) {
return $return;
}


/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
Expand Down Expand Up @@ -208,7 +207,6 @@ function panoptosubmission_print_recent_activity($course, $viewfullnames, $times
return false;
}


/**
* Must return an array of users who are participants an instance of the
* Panopto Student Submission activity
Expand All @@ -220,7 +218,6 @@ function panoptosubmission_get_participants($targetactivity) {
return false;
}


/**
* This function returns if a scale is being used by one panoptosubmission
* if it has support for grading and scales. Commented code should be
Expand Down
Loading

0 comments on commit f095cfe

Please sign in to comment.