Skip to content

Commit 467262f

Browse files
author
Juan Carrera
committed
Make code pass Code checker errors (warning still there).
1 parent e72d0a9 commit 467262f

13 files changed

+27
-22
lines changed

Diff for: classes/external.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,9 @@ public static function get_exescorms_by_courses_returns() {
768768
[
769769
'packagesize' => new external_value(PARAM_INT, 'EXESCORM zip package size', VALUE_OPTIONAL),
770770
'packageurl' => new external_value(PARAM_URL, 'EXESCORM zip package URL', VALUE_OPTIONAL),
771-
'version' => new external_value(PARAM_NOTAGS, 'EXESCORM version EXESCORM_SCORM_12,EXESCORM_SCORM_13,EXESCORM_SCORM_AICC)',
772-
VALUE_OPTIONAL),
771+
'version' => new external_value(PARAM_NOTAGS,
772+
'EXESCORM version EXESCORM_SCORM_12,EXESCORM_SCORM_13,EXESCORM_SCORM_AICC)',
773+
VALUE_OPTIONAL),
773774
'maxgrade' => new external_value(PARAM_INT, 'Max grade', VALUE_OPTIONAL),
774775
'grademethod' => new external_value(PARAM_INT, 'Grade method', VALUE_OPTIONAL),
775776
'whatgrade' => new external_value(PARAM_INT, 'What grade', VALUE_OPTIONAL),

Diff for: datamodels/debug.js.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,10 @@ function UpdateLog(s) {
661661
+ ' id="commitButton"'
662662
+ ' name="commitButton">'
663663
+ ' <input type="button"'
664-
+ ' value="<?php echo exescorm_version_check($exescorm->version,EXESCORM_SCORM_12) ?
664+
+ ' value="<?php echo exescorm_version_check($exescorm->version, EXESCORM_SCORM_12) ?
665665
'LMSFinish' : 'Terminate'; ?>() "'
666666
+ ' onclick="try'
667-
+ ' <?php echo exescorm_version_check($exescorm->version,EXESCORM_SCORM_12) ?
667+
+ ' <?php echo exescorm_version_check($exescorm->version, EXESCORM_SCORM_12) ?
668668
'LMSFinish' : 'LMSTerminate'; ?>();"'
669669
+ ' id="finishButton"'
670670
+ ' name="finishButton">'

Diff for: lang/en/exescorm.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@
125125
$string['displaysettings'] = 'Display settings';
126126
$string['dnduploadexescorm'] = 'Add an eXescorm SCORM package';
127127
$string['domxml'] = 'DOMXML external library';
128-
$string['editonlinebtnlabel' ] = 'Edit';
129-
$string['editonlinebtnlabel_help' ] = 'Send package to eXescorm for edition.';
128+
$string['editonlinebtnlabel'] = 'Edit';
129+
$string['editonlinebtnlabel_help'] = 'Send package to eXescorm for edition.';
130130
$string['element'] = 'Element';
131131
$string['enter'] = 'Enter';
132132
$string['entercourse'] = 'Enter course';

Diff for: lang/es/exescorm.php

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
$string['deleteattemptcheck'] = '¿Está totalmente seguro que quiere eliminar completamente estos intentos?';
111111
$string['deleteallattempts'] = 'Eliminar todos los intentos SCORM';
112112
$string['deleteselected'] = 'Eliminar los intentos seleccionados';
113-
$string['deleteattemptcheck'] = '¿Está totalmente seguro que quiere eliminar completamente estos intentos?';
114113
$string['details'] = 'Detalles del rastreo SCO';
115114
$string['directories'] = 'Mostrar enlaces de directorio';
116115
$string['disabled'] = 'Deshabilitado';

Diff for: lib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ function exescorm_reset_userdata($data) {
876876
exescorm_reset_gradebook($data->courseid);
877877
}
878878

879-
$status[] = array('component' => $componentstr, 'item' => get_string('deleteallattempts', 'mod_exescorm'), 'error' => false);
879+
$status[] = ['component' => $componentstr, 'item' => get_string('deleteallattempts', 'mod_exescorm'), 'error' => false];
880880
}
881881

882882
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.

Diff for: loadSCO.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
if ($sco->exescormtype == 'asset') {
7272
$attempt = exescorm_get_last_attempt($exescorm->id, $USER->id);
73-
$element = (exescorm_version_check($exescorm->version,EXESCORM_SCORM_13)) ? 'cmi.completion_status' : 'cmi.core.lesson_status';
73+
$element = (exescorm_version_check($exescorm->version, EXESCORM_SCORM_13)) ? 'cmi.completion_status' : 'cmi.core.lesson_status';
7474
$value = 'completed';
7575
exescorm_insert_track($USER->id, $exescorm->id, $sco->id, $attempt, $element, $value);
7676
}
@@ -91,7 +91,7 @@
9191
}
9292

9393
// We expect a SCO: select which API are we looking for.
94-
$lmsapi = (exescorm_version_check($exescorm->version,EXESCORM_SCORM_12) || empty($exescorm->version)) ? 'API' : 'API_1484_11';
94+
$lmsapi = (exescorm_version_check($exescorm->version, EXESCORM_SCORM_12) || empty($exescorm->version)) ? 'API' : 'API_1484_11';
9595

9696
echo html_writer::start_tag('html');
9797
echo html_writer::start_tag('head');

Diff for: locallib.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ function exescorm_get_attempt_status($user, $exescorm, $cm = null) {
13531353
}
13541354
$result .= html_writer::end_tag('p');
13551355
if ($attemptcount >= $exescorm->maxattempt && $exescorm->maxattempt > 0) {
1356-
$result .= html_writer::tag('p', get_string('exceededmaxattempts', 'mod_exescorm'), array('class' => 'exceededmaxattempts'));
1356+
$result .= html_writer::tag('p', get_string('exceededmaxattempts', 'mod_exescorm'), ['class' => 'exceededmaxattempts']);
13571357
}
13581358
if (!empty($cm)) {
13591359
$context = context_module::instance($cm->id);
@@ -1954,8 +1954,7 @@ function exescorm_get_toc($user, $exescorm, $cmid, $toclink=EXESCORM_TOCJSLINK,
19541954
if ($tocheader) {
19551955
$result->toc = html_writer::start_div('yui3-g-r', array('id' => 'exescorm_layout'));
19561956
$result->toc .= html_writer::start_div('yui3-u-1-5 loading', array('id' => 'exescorm_toc'));
1957-
/*$result->toc .= html_writer::div('', '', array('id' => 'exescorm_toc_title'));*/
1958-
$result->toc .= html_writer::start_div('', array('id' => 'exescorm_tree'));
1957+
$result->toc .= html_writer::start_div('', ['id' => 'exescorm_tree']);
19591958
}
19601959

19611960
if (!empty($currentorg)) {

Diff for: prereqs.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
$result = true;
7373
$request = null;
7474
if (has_capability('mod/exescorm:savetrack', context_module::instance($cm->id))) {
75-
$result = exescorm_get_toc($USER, $exescorm, $cm->id, EXESCORM_TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, false);
75+
$result = exescorm_get_toc($USER, $exescorm, $cm->id, EXESCORM_TOCJSLINK, $currentorg,
76+
$scoid, $mode, $attempt, true, false);
7677
echo $result->toc;
7778
}
7879
}

Diff for: report/basic/classes/report.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public function display($exescorm, $cm, $course, $download) {
460460
]
461461
);
462462
$row[] = $OUTPUT->pix_icon($trackdata->status, $strstatus, 'exescorm') . '<br>' .
463-
\html_writer::link($url, $score, array('title' => get_string('details', 'mod_exescorm')));
463+
\html_writer::link($url, $score, ['title' => get_string('details', 'mod_exescorm')]);
464464
} else {
465465
$row[] = $score;
466466
}

Diff for: settings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
$settings->add(new admin_setting_configcheckbox('exescorm/sendtemplate',
5555
get_string('exescorm:sendtemplate', 'mod_exescorm'), get_string('exescorm:sendtemplate_desc', 'mod_exescorm'), 0));
5656

57-
// eXescorm package validation rules.
57+
// The eXescorm package validation rules.
5858
$mandatoryfilesre = implode("\n", [
5959
'/^contentv[\d+]\.xml$/',
6060
'/^content\.xsd$/',

Diff for: tabs.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
* @package mod_exescorm
2323
*/
2424

25+
26+
require_once("../../config.php");
27+
28+
require_login();
29+
2530
if (empty($exescorm)) {
26-
print_error('cannotaccess', 'mod_exescorm');
31+
throw new moodle_exception('cannotaccess', 'mod_exescorm');
2732
}
2833
if (!isset($currenttab)) {
2934
$currenttab = '';

Diff for: tests/custom_completion_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function test_get_state(string $rule, int $rulevalue, array $uservalue, i
213213
if ($status != COMPLETION_COMPLETE) {
214214
$mockexescorm = (object) [
215215
'id' => 1,
216-
'version' =>EXESCORM_SCORM_13,
216+
'version' => EXESCORM_SCORM_13,
217217
'grademethod' => EXESCORM_GRADESCOES,
218218
'maxattempt' => $maxattempts,
219219
];

Diff for: tests/externallib_test.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ public function test_mod_exescorm_get_exescorm_user_data() {
382382
$found = 0;
383383
foreach ($result['data'] as $scodata) {
384384
foreach ($scodata['userdata'] as $userdata) {
385-
if ($userdata['element'] == 'cmi.core.lesson_status' and $userdata['value'] == 'completed') {
385+
if ($userdata['element'] == 'cmi.core.lesson_status' && $userdata['value'] == 'completed') {
386386
$found++;
387387
}
388-
if ($userdata['element'] == 'cmi.core.score.raw' and $userdata['value'] == '80') {
388+
if ($userdata['element'] == 'cmi.core.score.raw' && $userdata['value'] == '80') {
389389
$found++;
390390
}
391391
}
@@ -533,10 +533,10 @@ public function test_mod_exescorm_get_exescorm_sco_tracks() {
533533
// Find our tracking data.
534534
$found = 0;
535535
foreach ($result['data']['tracks'] as $userdata) {
536-
if ($userdata['element'] == 'cmi.core.lesson_status' and $userdata['value'] == 'completed') {
536+
if ($userdata['element'] == 'cmi.core.lesson_status' && $userdata['value'] == 'completed') {
537537
$found++;
538538
}
539-
if ($userdata['element'] == 'cmi.core.score.raw' and $userdata['value'] == '80') {
539+
if ($userdata['element'] == 'cmi.core.score.raw' && $userdata['value'] == '80') {
540540
$found++;
541541
}
542542
}

0 commit comments

Comments
 (0)