Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-autograde
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CS-107
moodle-autograde
Commits
39e6e2b2
Commit
39e6e2b2
authored
1 year ago
by
Hamza Remmal
Browse files
Options
Downloads
Patches
Plain Diff
draft of the get_infos function
parent
742eeb0c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
moodle-assignsubmission-autograde/classes/external/autograde_get_infos.php
+23
-2
23 additions, 2 deletions
...ission-autograde/classes/external/autograde_get_infos.php
with
23 additions
and
2 deletions
moodle-assignsubmission-autograde/classes/external/autograde_get_infos.php
+
23
−
2
View file @
39e6e2b2
...
@@ -27,10 +27,12 @@
...
@@ -27,10 +27,12 @@
namespace
assignsubmission_autograde\external
;
namespace
assignsubmission_autograde\external
;
use
dml_exception
;
use
external_api
;
use
external_api
;
use
external_function_parameters
;
use
external_function_parameters
;
use
external_single_structure
;
use
external_single_structure
;
use
external_value
;
use
external_value
;
use
stdClass
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
...
@@ -52,8 +54,27 @@ final class autograde_get_infos extends external_api {
...
@@ -52,8 +54,27 @@ final class autograde_get_infos extends external_api {
]);
]);
}
}
public
static
function
get_infos
(
$submissionid
):
object
{
/**
return
new
\stdClass
();
* @throws dml_exception
*/
public
static
function
get_infos
(
$submissionid
):
string
{
global
$DB
;
// HR : Fetch the course's and assignment's ids of the submission
$assignment_id
=
$DB
->
get_field
(
'assign_submission'
,
'assignment'
,
array
(
'id'
=>
$submissionid
));
$course_id
=
$DB
->
get_field
(
'assign'
,
'course'
,
array
(
'id'
=>
$assignment_id
));
// HR : Fetch the assignment's and course's metadata
$assign
=
$DB
->
get_record
(
'assign'
,
array
(
'id'
=>
$assignment_id
),
'*'
,
MUST_EXIST
);
$course
=
$DB
->
get_record
(
'course'
,
array
(
'id'
=>
$course_id
),
'*'
,
MUST_EXIST
);
$category
=
$DB
->
get_field
(
'categories'
,
'name'
,
array
(
'id'
=>
$course
->
category
));
// HR : Build the infos object response
$infos
=
new
stdClass
();
$infos
->
course_short_name
=
$course
->
shortname
;
$infos
->
course_category
=
$category
;
return
json_encode
(
$infos
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment