Skip to content

Commit

Permalink
assignfeedback_structured: Address new issues identified by codechecker
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyjbutler committed Dec 15, 2023
1 parent 0fb6425 commit 2c3d027
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ protected function define_grade_subplugin_structure() {
$subplugin = $this->get_subplugin_element();
$subpluginwrapper = new backup_nested_element($this->get_recommended_name());
$subpluginelementcomments = new backup_nested_element('feedback_structured');
$subpluginelementcomment = new backup_nested_element('structured_comment', array('id'),
array('grade', 'criterion', 'commenttext', 'commentformat'));
$subpluginelementcomment = new backup_nested_element('structured_comment', ['id'],
['grade', 'criterion', 'commenttext', 'commentformat']);

// Connect XML elements into the tree.
$subplugin->add_child($subpluginwrapper);
$subpluginwrapper->add_child($subpluginelementcomments);
$subpluginelementcomments->add_child($subpluginelementcomment);

// Set source to populate the data.
$subpluginelementcomment->set_source_table('assignfeedback_structured', array('grade' => backup::VAR_PARENTID));
$subpluginelementcomment->set_source_table('assignfeedback_structured', ['grade' => backup::VAR_PARENTID]);

$subpluginelementcomment->annotate_files(
'assignfeedback_structured',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class restore_assignfeedback_structured_subplugin extends restore_subplugin {
* @return array
*/
protected function define_grade_subplugin_structure() {
$paths = array();
$paths = [];

$elename = $this->get_namefor('grade');

Expand Down
12 changes: 6 additions & 6 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

require_once($CFG->dirroot . '/mod/assign/locallib.php');

use \core_privacy\local\metadata\collection;
use \core_privacy\local\request\writer;
use \core_privacy\local\request\contextlist;
use \mod_assign\privacy\assign_plugin_request_data;
use \mod_assign\privacy\useridlist;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\writer;
use core_privacy\local\request\contextlist;
use mod_assign\privacy\assign_plugin_request_data;
use mod_assign\privacy\useridlist;

/**
* Privacy class for requesting user data.
Expand All @@ -60,7 +60,7 @@ public static function get_metadata(collection $collection) : collection {
'grade' => 'privacy:metadata:gradepurpose',
'commenttext' => 'privacy:metadata:commentpurpose',
'criterionname' => 'privacy:metadata:criterionpurpose',
'criteriondesc' => 'privacy:metadata:critdescpurpose'
'criteriondesc' => 'privacy:metadata:critdescpurpose',
];
$collection->add_database_table('assignfeedback_structured', $data, 'privacy:metadata:tablesummary');
$collection->add_subsystem_link('core_files', [], 'privacy:metadata:filepurpose');
Expand Down
24 changes: 12 additions & 12 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@

defined('MOODLE_INTERNAL') || die();

$capabilities = array(
'assignfeedback/structured:manageowncriteriasets' => array(
$capabilities = [
'assignfeedback/structured:manageowncriteriasets' => [
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW
)
),
'assignfeedback/structured:publishcriteriasets' => array(
'archetypes' => [
'editingteacher' => CAP_ALLOW,
],
],
'assignfeedback/structured:publishcriteriasets' => [
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'manager' => CAP_ALLOW
)
)
);
'archetypes' => [
'manager' => CAP_ALLOW,
],
],
];
34 changes: 17 additions & 17 deletions db/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,48 @@

defined('MOODLE_INTERNAL') || die();

$functions = array(
'assignfeedback_structured_get_criteria' => array(
$functions = [
'assignfeedback_structured_get_criteria' => [
'classname' => 'assignfeedback_structured_external',
'methodname' => 'get_criteria',
'classpath' => 'mod/assign/feedback/structured/externallib.php',
'description' => 'Get the criteria data for a given criteria set',
'type' => 'read',
'ajax' => true
),
'assignfeedback_structured_get_criteriasets' => array(
'ajax' => true,
],
'assignfeedback_structured_get_criteriasets' => [
'classname' => 'assignfeedback_structured_external',
'methodname' => 'get_criteriasets',
'classpath' => 'mod/assign/feedback/structured/externallib.php',
'description' => 'Get all saved criteria sets for the current user',
'type' => 'read',
'ajax' => true
),
'assignfeedback_structured_save_criteriaset' => array(
'ajax' => true,
],
'assignfeedback_structured_save_criteriaset' => [
'classname' => 'assignfeedback_structured_external',
'methodname' => 'save_criteriaset',
'classpath' => 'mod/assign/feedback/structured/externallib.php',
'description' => 'Save a criteria set to copy later',
'type' => 'write',
'ajax' => true,
'capabilities' => 'assignfeedback/structured:manageowncriteriasets'
),
'assignfeedback_structured_update_criteriaset' => array(
'capabilities' => 'assignfeedback/structured:manageowncriteriasets',
],
'assignfeedback_structured_update_criteriaset' => [
'classname' => 'assignfeedback_structured_external',
'methodname' => 'update_criteriaset',
'classpath' => 'mod/assign/feedback/structured/externallib.php',
'description' => 'Update the details of a saved criteria set',
'type' => 'write',
'ajax' => true,
'capabilities' => 'assignfeedback/structured:manageowncriteriasets'
),
'assignfeedback_structured_delete_criteriaset' => array(
'capabilities' => 'assignfeedback/structured:manageowncriteriasets',
],
'assignfeedback_structured_delete_criteriaset' => [
'classname' => 'assignfeedback_structured_external',
'methodname' => 'delete_criteriaset',
'classpath' => 'mod/assign/feedback/structured/externallib.php',
'description' => 'Delete a saved criteria set',
'type' => 'write',
'ajax' => true,
'capabilities' => 'assignfeedback/structured:manageowncriteriasets'
)
);
'capabilities' => 'assignfeedback/structured:manageowncriteriasets',
],
];
Loading

0 comments on commit 2c3d027

Please sign in to comment.