Skip to content

Commit

Permalink
Make codechecker happy
Browse files Browse the repository at this point in the history
  • Loading branch information
pmaneggia committed Nov 12, 2023
1 parent c27f9ea commit 0b00950
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion amd/build/visualiseDependencies.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/visualiseDependencies.min.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions amd/src/visualiseDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ function addFilterDropShadow() {
*/
function determineSvgSize() {
let svg = document.querySelector('svg.availdep');
let width = svg.parentNode.clientWidth;
console.log('Paola element ' + document.querySelector('div.drawercontent').clientWidth);
//let width = svg.parentNode.parentNode.clientWidth;
let width = document.querySelector('div.drawercontent').clientWidth;
let orientation = screen.orientation?.type;
let height = orientation === "portrait-primary" ? width * 1.3 : width * 0.6;
svgWidth = width;
let height = orientation === "landscape-primary" ? width * 1.3 : width * 0.6;
return {width, height};
}

Expand Down
4 changes: 2 additions & 2 deletions block_availdep.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function init() {
* {@inheritDoc}
*/
public function applicable_formats() {
return array('course-view' => true);
return ['course-view' => true];
}

/**
Expand All @@ -58,7 +58,7 @@ public function get_content() {
return $this->content;
}

$this->page->requires->js_call_amd('block_availdep/visualiseDependencies', 'init', array($courseid, 'yes'));
$this->page->requires->js_call_amd('block_availdep/visualiseDependencies', 'init', [$courseid, 'yes']);

$data = new stdClass();
$data->d3src = new moodle_url('/blocks/availdep/thirdparty/d3.v7.min.js');
Expand Down
6 changes: 3 additions & 3 deletions classes/external/fetch_course_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class fetch_course_data extends external_api {
*/
public static function fetch_course_modules_with_names_and_dependencies_parameters() {
return new external_function_parameters([
'courseid' => new external_value(PARAM_INT, 'course id')
'courseid' => new external_value(PARAM_INT, 'course id'),
]);
}

Expand Down Expand Up @@ -83,7 +83,7 @@ function ($cm) use ($predecessors) {
'id' => $cm->id,
'name' => $cm->get_name(),
'depend' => $cm->availability,
'predecessor' => $predecessors[$cm->id]
'predecessor' => $predecessors[$cm->id],
];
}, $cmsnotdeletioninprogress);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public static function fetch_course_modules_with_names_and_dependencies_returns(
'id' => new external_value(PARAM_INT, 'course module id'),
'name' => new external_value(PARAM_TEXT, 'module name', VALUE_OPTIONAL),
'depend' => new external_value(PARAM_TEXT, 'availability conditions as json string', VALUE_OPTIONAL),
'predecessor' => new external_value(PARAM_INT, 'previous course module with completion')
'predecessor' => new external_value(PARAM_INT, 'previous course module with completion'),
]));
}
}
16 changes: 8 additions & 8 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@

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

$capabilities = array(
'block/availdep:addinstance' => array(
$capabilities = [
'block/availdep:addinstance' => [
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'manager' => CAP_ALLOW,
],

'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);
'clonepermissionsfrom' => 'moodle/site:manageblocks',
],
];
24 changes: 12 additions & 12 deletions db/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@

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

$services = array(
'block_availdep_service' => array(
'functions' => array (
$services = [
'block_availdep_service' => [
'functions' => [
'block_availdep_fetch_course_modules_with_names_and_dependencies',
),
],
'restrictedusers' => 0,
'enabled' => 1,
'shortname' => 'block_availdep_service',
'downloadfiles' => 0,
'uploadfiles' => 0
)
);
'uploadfiles' => 0,
]
];

$functions = array(
'block_availdep_fetch_course_modules_with_names_and_dependencies' => array(
$functions = [
'block_availdep_fetch_course_modules_with_names_and_dependencies' => [
'classname' => 'block_availdep\external\fetch_course_data',
'methodname' => 'fetch_course_modules_with_names_and_dependencies',
'classpath' => 'blocks/availdep/classes/external/fetch_course_data.php',
'description' => 'Retrieve course modules with ids and names.',
'type' => 'read',
'ajax' => true,
'loginrequired' => true
)
);
'loginrequired' => true,
]
];
2 changes: 1 addition & 1 deletion view.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
);
$PAGE->navbar->add(get_string('pluginname', 'block_availdep'));

$PAGE->requires->js_call_amd('block_availdep/visualiseDependencies', 'init', array($courseid, $full));
$PAGE->requires->js_call_amd('block_availdep/visualiseDependencies', 'init', [$courseid, $full]);

echo $OUTPUT->header();
$renderable = new block_availdep\output\view_page($courseid, $full);
Expand Down

0 comments on commit 0b00950

Please sign in to comment.