Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pado
Asyst Moodle Plugin
Commits
2e30eaa7
Commit
2e30eaa7
authored
Sep 08, 2024
by
Artem Baranovskyi
Browse files
Few Moodle coding style fixes.
parent
d0b18af8
Changes
4
Show whitespace changes
Inline
Side-by-side
asystgrade/classes/db/
Q
uiz
Q
uery.php
→
asystgrade/classes/db/
q
uiz
q
uery.php
View file @
2e30eaa7
<?php
<?php
namespace
local_asystgrade\db
;
namespace
local_asystgrade\db
;
class
Q
uiz
Q
uery
implements
Q
uiz
Q
uery
I
nterface
class
q
uiz
q
uery
implements
q
uiz
q
uery
_i
nterface
{
{
private
$db
;
private
$db
;
...
...
asystgrade/classes/db/
Q
uiz
Q
uery
I
nterface.php
→
asystgrade/classes/db/
q
uiz
q
uery
_i
nterface.php
View file @
2e30eaa7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
local_asystgrade\db
;
namespace
local_asystgrade\db
;
interface
Q
uiz
Q
uery
I
nterface
interface
q
uiz
q
uery
_i
nterface
{
{
public
function
get_question_attempts
(
$qid
,
$slot
);
public
function
get_question_attempts
(
$qid
,
$slot
);
...
...
asystgrade/lib.php
View file @
2e30eaa7
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
use
local_asystgrade
\
api\client
;
use
local_asystgrade
\
api\client
;
use
local_asystgrade\api\http_client
;
use
local_asystgrade\api\http_client
;
use
local_asystgrade
\
db\
Q
uiz
Q
uery
;
use
local_asystgrade
\
db\
q
uiz
q
uery
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
...
@@ -41,7 +41,7 @@ function local_asystgrade_before_footer()
...
@@ -41,7 +41,7 @@ function local_asystgrade_before_footer()
$slot
=
optional_param
(
'slot'
,
false
,
PARAM_INT
);
$slot
=
optional_param
(
'slot'
,
false
,
PARAM_INT
);
if
(
$PAGE
->
url
->
compare
(
new
moodle_url
(
'/mod/quiz/report.php'
),
URL_MATCH_BASE
)
&&
$slot
)
{
if
(
$PAGE
->
url
->
compare
(
new
moodle_url
(
'/mod/quiz/report.php'
),
URL_MATCH_BASE
)
&&
$slot
)
{
$quizQuery
=
new
Q
uiz
Q
uery
();
$quizQuery
=
new
q
uiz
q
uery
();
if
(
$quizQuery
->
gradesExist
(
$qid
,
$slot
))
{
if
(
$quizQuery
->
gradesExist
(
$qid
,
$slot
))
{
error_log
(
'Grades already exist in the database.'
);
error_log
(
'Grades already exist in the database.'
);
...
@@ -113,12 +113,12 @@ function pasteGradedMarks(array $grades, array $inputNames, float $maxmark): voi
...
@@ -113,12 +113,12 @@ function pasteGradedMarks(array $grades, array $inputNames, float $maxmark): voi
/**
/**
* Processes question attempts and answers to prepare for API a data to estimate answers
* Processes question attempts and answers to prepare for API a data to estimate answers
*
*
* @param
Q
uiz
Q
uery $database
* @param
q
uiz
q
uery $database
* @param $question_attempts
* @param $question_attempts
* @param $referenceAnswer
* @param $referenceAnswer
* @return array
* @return array
*/
*/
function
prepare_api_data
(
Q
uiz
Q
uery
$database
,
$question_attempts
,
$referenceAnswer
):
array
function
prepare_api_data
(
q
uiz
q
uery
$database
,
$question_attempts
,
$referenceAnswer
):
array
{
{
$studentData
=
[];
$studentData
=
[];
...
@@ -189,16 +189,16 @@ function generate_script(array $grades, array $inputNames, float $maxmark) {
...
@@ -189,16 +189,16 @@ function generate_script(array $grades, array $inputNames, float $maxmark) {
/**
/**
* Autoloader registration
* Autoloader registration
*/
*/
spl_autoload_register
(
function
(
$classname
)
{
//
spl_autoload_register(function ($classname) {
// Check if the class name starts with our plugin's namespace
//
// Check if the class name starts with our plugin's namespace
if
(
strpos
(
$classname
,
'local_asystgrade\\'
)
===
0
)
{
//
if (strpos($classname, 'local_asystgrade\\') === 0) {
// Transforming the Namespace into the Path
//
// Transforming the Namespace into the Path
$classname
=
str_replace
(
'local_asystgrade\\'
,
''
,
$classname
);
//
$classname = str_replace('local_asystgrade\\', '', $classname);
$classname
=
str_replace
(
'\\'
,
DIRECTORY_SEPARATOR
,
$classname
);
//
$classname = str_replace('\\', DIRECTORY_SEPARATOR, $classname);
$filepath
=
__DIR__
.
DIRECTORY_SEPARATOR
.
'classes'
.
DIRECTORY_SEPARATOR
.
$classname
.
'.php'
;
//
$filepath = __DIR__ . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $classname . '.php';
//
if
(
file_exists
(
$filepath
))
{
//
if (file_exists($filepath)) {
require_once
(
$filepath
);
//
require_once($filepath);
}
//
}
}
//
}
});
//
});
asystgrade/tests/quiz_api_test.php
View file @
2e30eaa7
...
@@ -227,7 +227,6 @@ class quiz_api_test extends advanced_testcase
...
@@ -227,7 +227,6 @@ class quiz_api_test extends advanced_testcase
'referenceAnswer'
=>
$referenceAnswer
,
'referenceAnswer'
=>
$referenceAnswer
,
'studentAnswers'
=>
$studentAnswers
'studentAnswers'
=>
$studentAnswers
];
];
// var_dump($data);
error_log
(
"Data to send to API: "
.
print_r
(
$data
,
true
));
error_log
(
"Data to send to API: "
.
print_r
(
$data
,
true
));
$response
=
$apiClient
->
send_data
(
$data
);
$response
=
$apiClient
->
send_data
(
$data
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment