Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
HFTSoftwareProject
MoodleDTA
Commits
e350d2f5
Commit
e350d2f5
authored
Oct 30, 2023
by
Lückemeyer
Browse files
adjusted comments and variable names again to match moodle approval criteria
parent
dc7ec04f
Pipeline
#8835
passed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dta/locallib.php
View file @
e350d2f5
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
//Import various entity and application logic files.
//
Import various entity and application logic files.
require_once
(
$CFG
->
dirroot
.
'/mod/assign/submission/dta/models/DtaResult.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/assign/submission/dta/models/DtaResult.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/assign/submission/dta/utils/database.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/assign/submission/dta/utils/database.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/assign/submission/dta/utils/backend.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/assign/submission/dta/utils/backend.php'
);
...
@@ -30,13 +30,13 @@ require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/view.php');
...
@@ -30,13 +30,13 @@ require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/view.php');
*/
*/
class
assign_submission_dta
extends
assign_submission_plugin
{
class
assign_submission_dta
extends
assign_submission_plugin
{
//Broadly used in logic, parametrized for easier change.
//
Broadly used in logic, parametrized for easier change.
const
COMPONENT_NAME
=
"assignsubmission_dta"
;
const
COMPONENT_NAME
=
"assignsubmission_dta"
;
//Draft file area for dta tests to be uploaded by the teacher.
//
Draft file area for dta tests to be uploaded by the teacher.
const
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
=
"tests_draft_dta"
;
const
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
=
"tests_draft_dta"
;
//File area for dta tests to be uploaded by the teacher.
//
File area for dta tests to be uploaded by the teacher.
const
ASSIGNSUBMISSION_DTA_FILEAREA_TEST
=
"tests_dta"
;
const
ASSIGNSUBMISSION_DTA_FILEAREA_TEST
=
"tests_dta"
;
//File area for dta submission assignment.
//
File area for dta submission assignment.
const
ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION
=
"submissions_dta"
;
const
ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION
=
"submissions_dta"
;
/**
/**
...
@@ -54,7 +54,7 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -54,7 +54,7 @@ class assign_submission_dta extends assign_submission_plugin {
* @return void
* @return void
*/
*/
public
function
get_settings
(
MoodleQuickForm
$mform
):
void
{
public
function
get_settings
(
MoodleQuickForm
$mform
):
void
{
//Add draft filemanager to form.
//
Add draft filemanager to form.
$mform
->
addElement
(
$mform
->
addElement
(
"filemanager"
,
"filemanager"
,
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
,
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
,
...
@@ -63,22 +63,22 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -63,22 +63,22 @@ class assign_submission_dta extends assign_submission_plugin {
$this
->
get_file_options
(
true
)
$this
->
get_file_options
(
true
)
);
);
//Add help button to added filemanager.
//
Add help button to added filemanager.
$mform
->
addHelpButton
(
$mform
->
addHelpButton
(
//Form-unique element id to which to add button.
//
Form-unique element id to which to add button.
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
,
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
,
"submission_settings_label"
,
"submission_settings_label"
,
//Language file to use.
//
Language file to use.
self
::
COMPONENT_NAME
self
::
COMPONENT_NAME
);
);
//Only show filemanager if plugin is enabled.
//
Only show filemanager if plugin is enabled.
$mform
->
hideIf
(
$mform
->
hideIf
(
//Form-unique element id to hide.
//
Form-unique element id to hide.
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
,
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
,
//Condition to check.
//
Condition to check.
self
::
COMPONENT_NAME
.
'_enabled'
,
self
::
COMPONENT_NAME
.
'_enabled'
,
//State to match for hiding.
//
State to match for hiding.
'notchecked'
'notchecked'
);
);
}
}
...
@@ -90,10 +90,10 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -90,10 +90,10 @@ class assign_submission_dta extends assign_submission_plugin {
* @param array $defaultvalues
* @param array $defaultvalues
*/
*/
public
function
data_preprocessing
(
&
$defaultvalues
)
:
void
{
public
function
data_preprocessing
(
&
$defaultvalues
)
:
void
{
//Get id of draft area for file manager creation.
//
Get id of draft area for file manager creation.
$draftitemid
=
file_get_submitted_draft_itemid
(
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
);
$draftitemid
=
file_get_submitted_draft_itemid
(
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
);
//Prepare draft area with created draft filearea.
//
Prepare draft area with created draft filearea.
file_prepare_draft_area
(
file_prepare_draft_area
(
$draftitemid
,
$draftitemid
,
$this
->
assignment
->
get_context
()
->
id
,
$this
->
assignment
->
get_context
()
->
id
,
...
@@ -114,27 +114,27 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -114,27 +114,27 @@ class assign_submission_dta extends assign_submission_plugin {
*/
*/
public
function
save_settings
(
stdClass
$data
):
bool
{
public
function
save_settings
(
stdClass
$data
):
bool
{
//If the assignment has no filemanager for our plugin just leave.
//
If the assignment has no filemanager for our plugin just leave.
$draftfilemanagerid
=
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
;
$draftfilemanagerid
=
self
::
ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST
;
if
(
!
isset
(
$data
->
$draftfilemanagerid
))
{
if
(
!
isset
(
$data
->
$draftfilemanagerid
))
{
return
true
;
return
true
;
}
}
//Store files from draft filearea to final one.
//
Store files from draft filearea to final one.
file_save_draft_area_files
(
file_save_draft_area_files
(
//Form-unique element id of draft filemanager from the edit.
//
Form-unique element id of draft filemanager from the edit.
$data
->
$draftfilemanagerid
,
$data
->
$draftfilemanagerid
,
//Id of the assignment in edit.
//
Id of the assignment in edit.
$this
->
assignment
->
get_context
()
->
id
,
$this
->
assignment
->
get_context
()
->
id
,
self
::
COMPONENT_NAME
,
self
::
COMPONENT_NAME
,
self
::
ASSIGNSUBMISSION_DTA_FILEAREA_TEST
,
self
::
ASSIGNSUBMISSION_DTA_FILEAREA_TEST
,
0
0
);
);
//Get files from proper filearea.
//
Get files from proper filearea.
$fs
=
get_file_storage
();
$fs
=
get_file_storage
();
$files
=
$fs
->
get_area_files
(
$files
=
$fs
->
get_area_files
(
//Id of the current assignment.
//
Id of the current assignment.
$this
->
assignment
->
get_context
()
->
id
,
$this
->
assignment
->
get_context
()
->
id
,
self
::
COMPONENT_NAME
,
self
::
COMPONENT_NAME
,
self
::
ASSIGNSUBMISSION_DTA_FILEAREA_TEST
,
self
::
ASSIGNSUBMISSION_DTA_FILEAREA_TEST
,
...
@@ -143,16 +143,16 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -143,16 +143,16 @@ class assign_submission_dta extends assign_submission_plugin {
false
false
);
);
//Check if a file was uploaded.
//
Check if a file was uploaded.
if
(
empty
(
$files
))
{
if
(
empty
(
$files
))
{
\
core\notification
::
error
(
get_string
(
"no_testfile_warning"
,
self
::
COMPONENT_NAME
));
\
core\notification
::
error
(
get_string
(
"no_testfile_warning"
,
self
::
COMPONENT_NAME
));
return
true
;
return
true
;
}
}
//Get the file.
//
Get the file.
$file
=
reset
(
$files
);
$file
=
reset
(
$files
);
//Send file to backend.
//
Send file to backend.
return
DtaBackendUtils
::
sendTestConfigToBackend
(
$this
->
assignment
,
$file
);
return
DtaBackendUtils
::
sendTestConfigToBackend
(
$this
->
assignment
,
$file
);
}
}
...
@@ -166,7 +166,7 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -166,7 +166,7 @@ class assign_submission_dta extends assign_submission_plugin {
* @return bool
* @return bool
*/
*/
public
function
get_form_elements_for_user
(
$submissionorgrade
,
MoodleQuickForm
$mform
,
stdClass
$data
,
$userid
):
bool
{
public
function
get_form_elements_for_user
(
$submissionorgrade
,
MoodleQuickForm
$mform
,
stdClass
$data
,
$userid
):
bool
{
//Prepare submission filearea.
//
Prepare submission filearea.
$data
=
file_prepare_standard_filemanager
(
$data
=
file_prepare_standard_filemanager
(
$data
,
$data
,
'tasks'
,
'tasks'
,
...
@@ -177,26 +177,26 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -177,26 +177,26 @@ class assign_submission_dta extends assign_submission_plugin {
$submissionorgrade
?
$submissionorgrade
->
id
:
0
$submissionorgrade
?
$submissionorgrade
->
id
:
0
);
);
//Add filemanager to form.
//
Add filemanager to form.
$mform
->
addElement
(
$mform
->
addElement
(
'filemanager'
,
'filemanager'
,
//Form-unique identifier.
//
Form-unique identifier.
'tasks_filemanager'
,
'tasks_filemanager'
,
//Label to show next to the filemanager.
//
Label to show next to the filemanager.
get_string
(
"submission_label"
,
self
::
COMPONENT_NAME
),
get_string
(
"submission_label"
,
self
::
COMPONENT_NAME
),
//Attributes.
//
Attributes.
null
,
null
,
//Options.
//
Options.
$this
->
get_file_options
(
false
)
$this
->
get_file_options
(
false
)
);
);
//Add help button.
//
Add help button.
$mform
->
addHelpButton
(
$mform
->
addHelpButton
(
//Related form item.
//
Related form item.
"tasks_filemanager"
,
"tasks_filemanager"
,
//Key.
//
Key.
"submission_label"
,
"submission_label"
,
//Language file.
//
Language file.
self
::
COMPONENT_NAME
self
::
COMPONENT_NAME
);
);
...
@@ -248,15 +248,15 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -248,15 +248,15 @@ class assign_submission_dta extends assign_submission_plugin {
$submission
->
id
$submission
->
id
);
);
//If submission is empty leave directly.
//
If submission is empty leave directly.
if
(
$this
->
is_empty
(
$submission
))
{
if
(
$this
->
is_empty
(
$submission
))
{
return
true
;
return
true
;
}
}
//Get submitted files.
//
Get submitted files.
$fs
=
get_file_storage
();
$fs
=
get_file_storage
();
$files
=
$fs
->
get_area_files
(
$files
=
$fs
->
get_area_files
(
//Id of current assignment.
//
Id of current assignment.
$this
->
assignment
->
get_context
()
->
id
,
$this
->
assignment
->
get_context
()
->
id
,
self
::
COMPONENT_NAME
,
self
::
COMPONENT_NAME
,
self
::
ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION
,
self
::
ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION
,
...
@@ -265,27 +265,27 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -265,27 +265,27 @@ class assign_submission_dta extends assign_submission_plugin {
false
false
);
);
//Check if a file is uploaded.
//
Check if a file is uploaded.
if
(
empty
(
$files
))
{
if
(
empty
(
$files
))
{
\
core\notification
::
error
(
get_string
(
"no_submissionfile_warning"
,
self
::
COMPONENT_NAME
));
\
core\notification
::
error
(
get_string
(
"no_submissionfile_warning"
,
self
::
COMPONENT_NAME
));
return
true
;
return
true
;
}
}
//Get the file.
//
Get the file.
$file
=
reset
(
$files
);
$file
=
reset
(
$files
);
//Send file to backend.
//
Send file to backend.
$response
=
DtaBackendUtils
::
sendSubmissionToBackend
(
$this
->
assignment
,
$file
);
$response
=
DtaBackendUtils
::
sendSubmissionToBackend
(
$this
->
assignment
,
$file
);
//With a null response, return an error.
//
With a null response, return an error.
if
(
is_null
(
$response
))
{
if
(
is_null
(
$response
))
{
return
false
;
return
false
;
}
}
//Convert received json to valid class instances.
//
Convert received json to valid class instances.
$resultsummary
=
DtaResultSummary
::
decodeJson
(
$response
);
$resultsummary
=
DtaResultSummary
::
decodeJson
(
$response
);
//Persist new results to database.
//
Persist new results to database.
DbUtils
::
storeResultSummaryToDatabase
(
$this
->
assignment
->
get_instance
()
->
id
,
$submission
->
id
,
$resultsummary
);
DbUtils
::
storeResultSummaryToDatabase
(
$this
->
assignment
->
get_instance
()
->
id
,
$submission
->
id
,
$resultsummary
);
return
true
;
return
true
;
...
@@ -367,7 +367,7 @@ class assign_submission_dta extends assign_submission_plugin {
...
@@ -367,7 +367,7 @@ class assign_submission_dta extends assign_submission_plugin {
false
);
false
);
foreach
(
$files
as
$file
)
{
foreach
(
$files
as
$file
)
{
//Do we return the full folder path or just the file name?
//
Do we return the full folder path or just the file name?
if
(
isset
(
$submission
->
exportfullpath
)
&&
$submission
->
exportfullpath
==
false
)
{
if
(
isset
(
$submission
->
exportfullpath
)
&&
$submission
->
exportfullpath
==
false
)
{
$result
[
$file
->
get_filename
()]
=
$file
;
$result
[
$file
->
get_filename
()]
=
$file
;
}
else
{
}
else
{
...
...
dta/models/DtaResult.php
View file @
e350d2f5
...
@@ -60,8 +60,8 @@ class DtaResultSummary {
...
@@ -60,8 +60,8 @@ class DtaResultSummary {
public
$timestamp
;
public
$timestamp
;
public
$globalStacktrace
;
public
$globalStacktrace
;
public
$successfulTestCompetencyProfile
;
public
$successfulTestCompetencyProfile
;
public
$overallTestCompetencyProfile
;
public
$overallTestCompetencyProfile
;
public
$results
;
public
$results
;
/**
/**
...
...
dta/utils/backend.php
View file @
e350d2f5
...
@@ -43,16 +43,16 @@ class DtaBackendUtils {
...
@@ -43,16 +43,16 @@ class DtaBackendUtils {
return
true
;
return
true
;
}
}
//Set endpoint for test upload.
//
Set endpoint for test upload.
$url
=
$backendaddress
.
"/v1/unittest"
;
$url
=
$backendaddress
.
"/v1/unittest"
;
//Prepare params.
//
Prepare params.
$params
=
array
(
$params
=
array
(
"unitTestFile"
=>
$file
,
"unitTestFile"
=>
$file
,
"assignmentId"
=>
$assignment
->
get_instance
()
->
id
"assignmentId"
=>
$assignment
->
get_instance
()
->
id
);
);
//If request returned null, return false to indicate failure.
//
If request returned null, return false to indicate failure.
if
(
is_null
(
self
::
post
(
$url
,
$params
)))
{
if
(
is_null
(
self
::
post
(
$url
,
$params
)))
{
return
false
;
return
false
;
}
else
{
}
else
{
...
@@ -74,10 +74,10 @@ class DtaBackendUtils {
...
@@ -74,10 +74,10 @@ class DtaBackendUtils {
return
true
;
return
true
;
}
}
//Set endpoint for test upload.
//
Set endpoint for test upload.
$url
=
$backendaddress
.
"/v1/task"
;
$url
=
$backendaddress
.
"/v1/task"
;
//Prepare params.
//
Prepare params.
$params
=
array
(
$params
=
array
(
"taskFile"
=>
$file
,
"taskFile"
=>
$file
,
"assignmentId"
=>
$assignment
->
get_instance
()
->
id
"assignmentId"
=>
$assignment
->
get_instance
()
->
id
...
@@ -104,15 +104,15 @@ class DtaBackendUtils {
...
@@ -104,15 +104,15 @@ class DtaBackendUtils {
$curl
=
new
curl
();
$curl
=
new
curl
();
$response
=
$curl
->
post
(
$url
,
$params
,
$options
);
$response
=
$curl
->
post
(
$url
,
$params
,
$options
);
//Check state of request, if response code is a 2xx return the answer.
//
Check state of request, if response code is a 2xx return the answer.
$info
=
$curl
->
get_info
();
$info
=
$curl
->
get_info
();
if
(
$info
[
"http_code"
]
>=
200
&&
$info
[
"http_code"
]
<
300
)
{
if
(
$info
[
"http_code"
]
>=
200
&&
$info
[
"http_code"
]
<
300
)
{
return
$response
;
return
$response
;
}
}
//Something went wrong, return null and give an error message.
//
Something went wrong, return null and give an error message.
debugging
(
assign_submission_dta
::
COMPONENT_NAME
.
": Post file to server was not successful: http_code="
.
debugging
(
assign_submission_dta
::
COMPONENT_NAME
.
": Post file to server was not successful: http_code="
.
$info
[
"http_code"
]);
$info
[
"http_code"
]);
if
(
$info
[
'http_code'
]
>=
400
&&
$info
[
'http_code'
]
<
500
)
{
if
(
$info
[
'http_code'
]
>=
400
&&
$info
[
'http_code'
]
<
500
)
{
\
core\notification
::
error
(
get_string
(
"http_client_error_msg"
,
assign_submission_dta
::
COMPONENT_NAME
));
\
core\notification
::
error
(
get_string
(
"http_client_error_msg"
,
assign_submission_dta
::
COMPONENT_NAME
));
...
@@ -121,8 +121,8 @@ class DtaBackendUtils {
...
@@ -121,8 +121,8 @@ class DtaBackendUtils {
\
core\notification
::
error
(
get_string
(
"http_server_error_msg"
,
assign_submission_dta
::
COMPONENT_NAME
));
\
core\notification
::
error
(
get_string
(
"http_server_error_msg"
,
assign_submission_dta
::
COMPONENT_NAME
));
return
null
;
return
null
;
}
else
{
}
else
{
\
core\notification
::
error
(
get_string
(
"http_unknown_error_msg"
,
assign_submission_dta
::
COMPONENT_NAME
)
.
\
core\notification
::
error
(
get_string
(
"http_unknown_error_msg"
,
assign_submission_dta
::
COMPONENT_NAME
)
.
$info
[
"http_code"
]
.
$response
);
$info
[
"http_code"
]
.
$response
);
return
null
;
return
null
;
}
}
}
}
...
...
dta/utils/database.php
View file @
e350d2f5
...
@@ -16,9 +16,9 @@
...
@@ -16,9 +16,9 @@
class
DbUtils
{
class
DbUtils
{
//
s
ummary database table name
//
S
ummary database table name
.
private
const
TABLE_SUMMARY
=
"assignsubmission_dta_summary"
;
private
const
TABLE_SUMMARY
=
"assignsubmission_dta_summary"
;
//
r
esult database table name
//
R
esult database table name
.
private
const
TABLE_RESULT
=
"assignsubmission_dta_result"
;
private
const
TABLE_RESULT
=
"assignsubmission_dta_result"
;
/**
/**
...
@@ -34,27 +34,27 @@ class DbUtils {
...
@@ -34,27 +34,27 @@ class DbUtils {
):
DtaResultSummary
{
):
DtaResultSummary
{
global
$DB
;
global
$DB
;
//Fetch data from database.
//
Fetch data from database.
$summary
_
record
=
$DB
->
get_record
(
self
::
TABLE_SUMMARY
,
array
(
$summaryrecord
=
$DB
->
get_record
(
self
::
TABLE_SUMMARY
,
array
(
"assignment_id"
=>
$assignmentid
,
"assignment_id"
=>
$assignmentid
,
"submission_id"
=>
$submissionid
"submission_id"
=>
$submissionid
));
));
$results
_
array
=
$DB
->
get_records
(
self
::
TABLE_RESULT
,
array
(
$resultsarray
=
$DB
->
get_records
(
self
::
TABLE_RESULT
,
array
(
"assignment_id"
=>
$assignmentid
,
"assignment_id"
=>
$assignmentid
,
"submission_id"
=>
$submissionid
"submission_id"
=>
$submissionid
));
));
//Create a summary instance.
//
Create a summary instance.
$summary
=
new
DtaResultSummary
();
$summary
=
new
DtaResultSummary
();
$summary
->
timestamp
=
$summary
_
record
->
timestamp
;
$summary
->
timestamp
=
$summaryrecord
->
timestamp
;
$summary
->
globalStacktrace
=
$summary
_
record
->
global_stacktrace
;
$summary
->
globalStacktrace
=
$summaryrecord
->
global_stacktrace
;
$summary
->
successfulTestCompetencyProfile
=
$summary
_
record
->
successful_competencies
;
$summary
->
successfulTestCompetencyProfile
=
$summaryrecord
->
successful_competencies
;
$summary
->
overallTestCompetencyProfile
=
$summary
_
record
->
tested_competencies
;
$summary
->
overallTestCompetencyProfile
=
$summaryrecord
->
tested_competencies
;
$summary
->
results
=
array
();
$summary
->
results
=
array
();
//Create result instances and add to array of summary instance.
//
Create result instances and add to array of summary instance.
foreach
(
$results
_
array
as
$rr
)
{
foreach
(
$resultsarray
as
$rr
)
{
$result
=
new
DtaResult
();
$result
=
new
DtaResult
();
$result
->
packageName
=
$rr
->
package_name
;
$result
->
packageName
=
$rr
->
package_name
;
$result
->
className
=
$rr
->
class_name
;
$result
->
className
=
$rr
->
class_name
;
...
@@ -88,18 +88,18 @@ class DbUtils {
...
@@ -88,18 +88,18 @@ class DbUtils {
):
void
{
):
void
{
global
$DB
;
global
$DB
;
//Prepare new database entries.
//
Prepare new database entries.
$summary
_
record
=
new
stdClass
();
$summaryrecord
=
new
stdClass
();
$summary
_
record
->
assignment_id
=
$assignmentid
;
$summaryrecord
->
assignment_id
=
$assignmentid
;
$summary
_
record
->
submission_id
=
$submissionid
;
$summaryrecord
->
submission_id
=
$submissionid
;
$summary
_
record
->
successful_competencies
=
$summary
->
successfulTestCompetencyProfile
;
$summaryrecord
->
successful_competencies
=
$summary
->
successfulTestCompetencyProfile
;
$summary
_
record
->
tested_competencies
=
$summary
->
overallTestCompetencyProfile
;
$summaryrecord
->
tested_competencies
=
$summary
->
overallTestCompetencyProfile
;
$summary
_
record
->
timestamp
=
$summary
->
timestamp
;
$summaryrecord
->
timestamp
=
$summary
->
timestamp
;
$summary
_
record
->
global_stacktrace
=
$summary
->
globalStacktrace
;
$summaryrecord
->
global_stacktrace
=
$summary
->
globalStacktrace
;
//Prepare results to persist to array.
//
Prepare results to persist to array.
$result
_
records
=
array
();
$resultrecords
=
array
();
foreach
(
$summary
->
results
as
$r
)
{
foreach
(
$summary
->
results
as
$r
)
{
$record
=
new
stdClass
();
$record
=
new
stdClass
();
$record
->
assignment_id
=
$assignmentid
;
$record
->
assignment_id
=
$assignmentid
;
$record
->
submission_id
=
$submissionid
;
$record
->
submission_id
=
$submissionid
;
...
@@ -113,10 +113,10 @@ class DbUtils {
...
@@ -113,10 +113,10 @@ class DbUtils {
$record
->
column_number
=
$r
->
columnNumber
;
$record
->
column_number
=
$r
->
columnNumber
;
$record
->
line_number
=
$r
->
lineNumber
;
$record
->
line_number
=
$r
->
lineNumber
;
$record
->
position
=
$r
->
position
;
$record
->
position
=
$r
->
position
;
$result
_
records
[]
=
$record
;
$resultrecords
[]
=
$record
;
}
}
//If results already exist, delete old values beforehand.
//
If results already exist, delete old values beforehand.
$submission
=
$DB
->
get_record
(
self
::
TABLE_SUMMARY
,
array
(
$submission
=
$DB
->
get_record
(
self
::
TABLE_SUMMARY
,
array
(
'assignment_id'
=>
$assignmentid
,
'assignment_id'
=>
$assignmentid
,
'submission_id'
=>
$submissionid
'submission_id'
=>
$submissionid
...
@@ -134,9 +134,9 @@ class DbUtils {
...
@@ -134,9 +134,9 @@ class DbUtils {
));
));
}
}
//Create summary and single result entries.
//
Create summary and single result entries.
$DB
->
insert_record
(
self
::
TABLE_SUMMARY
,
$summary
_
record
);
$DB
->
insert_record
(
self
::
TABLE_SUMMARY
,
$summaryrecord
);
foreach
(
$result
_
records
as
$rr
)
{
foreach
(
$resultrecords
as
$rr
)
{
$DB
->
insert_record
(
self
::
TABLE_RESULT
,
$rr
);
$DB
->
insert_record
(
self
::
TABLE_RESULT
,
$rr
);
}
}
}
}
...
...
dta/utils/view.php
View file @
e350d2f5
...
@@ -28,17 +28,17 @@ class ViewSubmissionUtils {
...
@@ -28,17 +28,17 @@ class ViewSubmissionUtils {
int
$submissionid
int
$submissionid
):
string
{
):
string
{
//Fetch data.
//
Fetch data.
$summary
=
DbUtils
::
getResultSummaryFromDatabase
(
$assignmentid
,
$submissionid
);
$summary
=
DbUtils
::
getResultSummaryFromDatabase
(
$assignmentid
,
$submissionid
);
$html
=
""
;
$html
=
""
;
//Calculate success rate, if no unknown result states or compilation errors.
//
Calculate success rate, if no unknown result states or compilation errors.
$successrate
=
"?"
;
$successrate
=
"?"
;
if
(
$summary
->
unknownCount
()
==
0
&&
$summary
->
compilationErrorCount
()
==
0
)
{
if
(
$summary
->
unknownCount
()
==
0
&&
$summary
->
compilationErrorCount
()
==
0
)
{
$successrate
=
round
((
$summary
->
successfulCount
()
/
$summary
->
resultCount
())
*
100
,
2
);
$successrate
=
round
((
$summary
->
successfulCount
()
/
$summary
->
resultCount
())
*
100
,
2
);
}
}
//Generate html.
//
Generate html.
$html
.
=
$summary
->
successfulCount
()
.
"/"
;
$html
.
=
$summary
->
successfulCount
()
.
"/"
;
$html
.
=
(
$summary
->
compilationErrorCount
()
==
0
&&
$summary
->
unknownCount
()
==
0
)
$html
.
=
(
$summary
->
compilationErrorCount
()
==
0
&&
$summary
->
unknownCount
()
==
0
)
?
$summary
->
resultCount
()
.
" ("
.
$successrate
.
"%)"
?
$summary
->
resultCount
()
.
" ("
.
$successrate
.
"%)"
...
@@ -52,8 +52,8 @@ class ViewSubmissionUtils {
...
@@ -52,8 +52,8 @@ class ViewSubmissionUtils {
if
(
$summary
->
unknownCount
()
>
0
)
{
if
(
$summary
->
unknownCount
()
>
0
)
{
$html
.
=
$summary
->
unknownCount
()
.
" test(s) with unknown state<br>"
;
$html
.
=
$summary
->
unknownCount
()
.
" test(s) with unknown state<br>"
;
}
}
$html
.
=
$summary
->
successfulTestCompetencyProfile
.
" successfully tested competency profile<br>"
;
$html
.
=
$summary
->
successfulTestCompetencyProfile
.
" successfully tested competency profile<br>"
;
return
html_writer
::
div
(
$html
,
"dtaSubmissionSummary"
);
return
html_writer
::
div
(
$html
,
"dtaSubmissionSummary"
);
}
}
...
@@ -69,24 +69,24 @@ class ViewSubmissionUtils {
...
@@ -69,24 +69,24 @@ class ViewSubmissionUtils {
int
$submissionid
int
$submissionid
):
string
{
):
string
{
//Fetch data.
//
Fetch data.
$summary
=
DbUtils
::
getResultSummaryFromDatabase
(
$assignmentid
,
$submissionid
);
$summary
=
DbUtils
::
getResultSummaryFromDatabase
(
$assignmentid
,
$submissionid
);
$html
=
""
;
$html
=
""
;
//Define a few css classes and prepare html attribute arrays to beautify the output.
//
Define a few css classes and prepare html attribute arrays to beautify the output.
$tableheaderrow
_
attributes
=
array
(
"class"
=>
"dtaTableHeaderRow"
);
$tableheaderrowattributes
=
array
(
"class"
=>
"dtaTableHeaderRow"
);
$tablerow
_
attributes
=
array
(
"class"
=>
"dtaTableRow"
);
$tablerowattributes
=
array
(
"class"
=>
"dtaTableRow"
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
$unknown
_
attributes
=
'dtaResultUnknown'
;
$unknownattributes
=
'dtaResultUnknown'
;
$success
_
attributes
=
'dtaResultSuccess'
;
$successattributes
=
'dtaResultSuccess'
;
$failure
_
attributes
=
'dtaResultFailure'
;
$failureattributes
=
'dtaResultFailure'
;
$compilationerror
_
attributes
=
'dtaResultCompilationError'
;
$compilationerrorattributes
=
'dtaResultCompilationError'
;
//Summary table.
//
Summary table.
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"th"
,
"Summary"
,
array
(
"class"
=>
"dtaTableHeader"
));
$tmp
.
=
html_writer
::
tag
(
"th"
,
"Summary"
,
array
(
"class"
=>
"dtaTableHeader"
));
$tmp
.
=
html_writer
::
empty_tag
(
"th"
,
array
(
"class"
=>
"dtaTableHeader"
));
$tmp
.
=
html_writer
::
empty_tag
(
"th"
,
array
(
"class"
=>
"dtaTableHeader"
));
$header
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$tableheaderrow
_
attributes
);
$header
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$tableheaderrowattributes
);
$header
=
html_writer
::
tag
(
"thead"
,
$header
);
$header
=
html_writer
::
tag
(
"thead"
,
$header
);
$body
=
""
;
$body
=
""
;
...
@@ -102,70 +102,70 @@ class ViewSubmissionUtils {
...
@@ -102,70 +102,70 @@ class ViewSubmissionUtils {
$summary
->
resultCount
(),
$summary
->
resultCount
(),
$attributes
);
$attributes
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$unknown
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$unknownattributes
;
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"td"
,
"successes"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
"successes"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
successfulCount
(),
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
successfulCount
(),
$attributes
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
$successrate
=
"?"
;
$successrate
=
"?"
;
if
(
$summary
->
unknownCount
()
>
0
||
$summary
->
compilationErrorCount
()
>
0
)
{
if
(
$summary
->
unknownCount
()
>
0
||
$summary
->
compilationErrorCount
()
>
0
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$unknown
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$unknownattributes
;
}
else
{
}
else
{
$successrate
=
round
((
$summary
->
successfulCount
()
/
$summary
->
resultCount
())
*
100
,
2
);
$successrate
=
round
((
$summary
->
successfulCount
()
/
$summary
->
resultCount
())
*
100
,
2
);
if
(
$successrate
<
50
)
{
if
(
$successrate
<
50
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$compilationerror
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$compilationerrorattributes
;
}
else
if
(
$successrate
<
75
)
{
}
else
if
(
$successrate
<
75
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$failure
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$failureattributes
;
}
else
{
}
else
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$success
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$successattributes
;
}
}
}
}
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"td"
,
"failures"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
"failures"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
failedCount
(),
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
failedCount
(),
$attributes
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
if
(
$summary
->
failedCount
()
>
0
)
{
if
(
$summary
->
failedCount
()
>
0
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$failure
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$failureattributes
;
}
else
{
}
else
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$success
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$successattributes
;
}
}
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"td"
,
"compilation errors"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
"compilation errors"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
compilationErrorCount
(),
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
compilationErrorCount
(),
$attributes
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
if
(
$summary
->
compilationErrorCount
()
>
0
)
{
if
(
$summary
->
compilationErrorCount
()
>
0
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$compilationerror
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$compilationerrorattributes
;
}
else
{
}
else
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$success
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$successattributes
;
}
}
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"td"
,
"unknown state"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
"unknown state"
,
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
unknownCount
(),
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
$summary
->
unknownCount
(),
$attributes
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
if
(
$summary
->
unknownCount
()
>
0
)
{
if
(
$summary
->
unknownCount
()
>
0
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$unknown
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$unknownattributes
;
}
else
{
}
else
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$success
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$successattributes
;
}
}
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"td"
,
html_writer
::
tag
(
"b"
,
"success rate"
),
$attributes
);
$tmp
.
=
html_writer
::
tag
(
"td"
,
html_writer
::
tag
(
"b"
,
"success rate"
),
$attributes
);
$tmp
.
=
html_writer
::
tag
(
$tmp
.
=
html_writer
::
tag
(
"td"
,
"td"
,
html_writer
::
tag
(
"b"
,
$summary
->
successfulCount
()
html_writer
::
tag
(
"b"
,
$summary
->
successfulCount
()
...
@@ -174,55 +174,55 @@ class ViewSubmissionUtils {
...
@@ -174,55 +174,55 @@ class ViewSubmissionUtils {
:
"?"
)),
:
"?"
)),
$attributes
);
$attributes
);
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
if
(
$summary
->
unknownCount
()
>
0
||
$summary
->
compilationErrorCount
()
>
0
)
{
if
(
$summary
->
unknownCount
()
>
0
||
$summary
->
compilationErrorCount
()
>
0
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$unknown
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$unknownattributes
;
}
else
{
}
else
{
if
(
$successrate
<
50
)
{
if
(
$successrate
<
50
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$compilationerror
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$compilationerrorattributes
;
}
else
if
(
$successrate
<
75
)
{
}
else
if
(
$successrate
<
75
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$failure
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$failureattributes
;
}
else
{
}
else
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
" "
.
$success
_
attributes
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
" "
.
$successattributes
;
}
}
}
}
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$body
=
html_writer
::
tag
(
"tbody"
,
$body
);
$body
=
html_writer
::
tag
(
"tbody"
,
$body
);
$table
=
html_writer
::
tag
(
"table"
,
$header
.
$body
,
array
(
"class"
=>
"dtaTable"
));
$table
=
html_writer
::
tag
(
"table"
,
$header
.
$body
,
array
(
"class"
=>
"dtaTable"
));
$html
.
=
$table
;
$html
.
=
$table
;
//Add empty div for spacing between summary and details table.
//
Add empty div for spacing between summary and details table.
$html
.
=
html_writer
::
empty_tag
(
"div"
,
array
(
"class"
=>
"dtaSpacer"
));
$html
.
=
html_writer
::
empty_tag
(
"div"
,
array
(
"class"
=>
"dtaSpacer"
));
//Details table.
//
Details table.
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
"th"
,
"Details"
,
array
(
"class"
=>
"dtaTableHeader"
));
$tmp
.
=
html_writer
::
tag
(
"th"
,
"Details"
,
array
(
"class"
=>
"dtaTableHeader"
));
$tmp
.
=
html_writer
::
empty_tag
(
"th"
,
array
(
"class"
=>
"dtaTableHeader"
));
$tmp
.
=
html_writer
::
empty_tag
(
"th"
,
array
(
"class"
=>
"dtaTableHeader"
));
$header
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$tableheaderrow
_
attributes
);
$header
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$tableheaderrowattributes
);
$header
=
html_writer
::
tag
(
"thead"
,
$header
);
$header
=
html_writer
::
tag
(
"thead"
,
$header
);
$body
=
""
;
$body
=
""
;
$spacerrow
=
null
;
$spacerrow
=
null
;
foreach
(
$summary
->
results
as
$r
)
{
foreach
(
$summary
->
results
as
$r
)
{
//Add spacer first if not null.
//
Add spacer first if not null.
if
(
!
is_null
(
$spacerrow
))
{
if
(
!
is_null
(
$spacerrow
))
{
$body
.
=
$spacerrow
;
$body
.
=
$spacerrow
;
}
}
//New copy of base attributes array.
//
New copy of base attributes array.
$resultrow
_
attributes
=
$tablerow
_
attributes
;
$resultrowattributes
=
$tablerowattributes
;
//Check which css class to add for the colored left-border according to resuls state.
//
Check which css class to add for the colored left-border according to resuls state.
if
(
$r
->
state
==
0
)
{
if
(
$r
->
state
==
0
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
' dtaResultUnknown'
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
' dtaResultUnknown'
;
}
else
if
(
$r
->
state
==
1
)
{
}
else
if
(
$r
->
state
==
1
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
' dtaResultSuccess'
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
' dtaResultSuccess'
;
}
else
if
(
$r
->
state
==
2
)
{
}
else
if
(
$r
->
state
==
2
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
' dtaResultFailure'
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
' dtaResultFailure'
;
}
else
if
(
$r
->
state
==
3
)
{
}
else
if
(
$r
->
state
==
3
)
{
$resultrow
_
attributes
[
'class'
]
=
$resultrow
_
attributes
[
'class'
]
.
' dtaResultCompilationError'
;
$resultrowattributes
[
'class'
]
=
$resultrowattributes
[
'class'
]
.
' dtaResultCompilationError'
;
}
}
$tmp
=
""
;
$tmp
=
""
;
...
@@ -235,7 +235,7 @@ class ViewSubmissionUtils {
...
@@ -235,7 +235,7 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
$r
->
name
,
$r
->
name
,
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
$tmp
.
=
html_writer
::
tag
(
...
@@ -247,9 +247,9 @@ class ViewSubmissionUtils {
...
@@ -247,9 +247,9 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
DtaResult
::
getStateName
(
$r
->
state
),
DtaResult
::
getStateName
(
$r
->
state
),
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
//If state is something different than successful, show additional rows.
//
If state is something different than successful, show additional rows.
if
(
$r
->
state
!=
1
)
{
if
(
$r
->
state
!=
1
)
{
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
$tmp
.
=
html_writer
::
tag
(
...
@@ -261,7 +261,7 @@ class ViewSubmissionUtils {
...
@@ -261,7 +261,7 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
$r
->
failureType
,
$r
->
failureType
,
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
$tmp
.
=
html_writer
::
tag
(
...
@@ -273,9 +273,9 @@ class ViewSubmissionUtils {
...
@@ -273,9 +273,9 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
$r
->
failureReason
,
$r
->
failureReason
,
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
//Only show line, column and position if they have useful values.
//
Only show line, column and position if they have useful values.
if
(
!
is_null
(
$r
->
lineNumber
)
&&
$r
->
lineNumber
>
0
)
{
if
(
!
is_null
(
$r
->
lineNumber
)
&&
$r
->
lineNumber
>
0
)
{
$tmp
=
""
;
$tmp
=
""
;
$tmp
.
=
html_writer
::
tag
(
$tmp
.
=
html_writer
::
tag
(
...
@@ -287,7 +287,7 @@ class ViewSubmissionUtils {
...
@@ -287,7 +287,7 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
$r
->
lineNumber
,
$r
->
lineNumber
,
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
}
}
if
(
!
is_null
(
$r
->
columnNumber
)
&&
$r
->
columnNumber
>
0
)
{
if
(
!
is_null
(
$r
->
columnNumber
)
&&
$r
->
columnNumber
>
0
)
{
...
@@ -301,7 +301,7 @@ class ViewSubmissionUtils {
...
@@ -301,7 +301,7 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
$r
->
columnNumber
,
$r
->
columnNumber
,
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
}
}
if
(
!
is_null
(
$r
->
position
)
&&
$r
->
position
>
0
)
{
if
(
!
is_null
(
$r
->
position
)
&&
$r
->
position
>
0
)
{
...
@@ -315,7 +315,7 @@ class ViewSubmissionUtils {
...
@@ -315,7 +315,7 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
$r
->
position
,
$r
->
position
,
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
}
}
$tmp
=
""
;
$tmp
=
""
;
...
@@ -328,17 +328,17 @@ class ViewSubmissionUtils {
...
@@ -328,17 +328,17 @@ class ViewSubmissionUtils {
"td"
,
"td"
,
html_writer
::
tag
(
"details"
,
$r
->
stacktrace
,
array
(
"class"
=>
"dtaStacktraceDetails"
)),
html_writer
::
tag
(
"details"
,
$r
->
stacktrace
,
array
(
"class"
=>
"dtaStacktraceDetails"
)),
$attributes
);
$attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrow
_
attributes
);
$body
.
=
html_writer
::
tag
(
"tr"
,
$tmp
,
$resultrowattributes
);
}
}
//Set spacerrow value if null for next rount separation.
//
Set spacerrow value if null for next rount separation.
if
(
is_null
(
$spacerrow
))
{
if
(
is_null
(
$spacerrow
))
{
$spacerrow
=
html_writer
::
empty_tag
(
"tr"
,
array
(
"class"
=>
"dtaTableSpacer"
));
$spacerrow
=
html_writer
::
empty_tag
(
"tr"
,
array
(
"class"
=>
"dtaTableSpacer"
));
}
}
}
}
$html
.
=
html_writer
::
tag
(
"table"
,
$header
.
$body
,
array
(
"class"
=>
"dtaTable"
));
$html
.
=
html_writer
::
tag
(
"table"
,
$header
.
$body
,
array
(
"class"
=>
"dtaTable"
));
//
w
rap generated html into final div
//
W
rap generated html into final div
.
$html
=
html_writer
::
div
(
$html
,
"dtaSubmissionDetails"
);
$html
=
html_writer
::
div
(
$html
,
"dtaSubmissionDetails"
);
return
$html
;
return
$html
;
...
...
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