Commit d721c1ab authored by Lückemeyer's avatar Lückemeyer
Browse files

changed variable name camel caps and inline comments according to moodle approval guidelines

1 merge request!1Coding style and recommendations
Showing with 240 additions and 277 deletions
+240 -277
No preview for this file type
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
defined('MOODLE_INTERNAL') || die();
/** /**
* Stub for upgrade code * Stub for upgrade code
* @param int $oldversion * @param int $oldversion
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
* @package assignsubmission_dta * @package assignsubmission_dta
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
defined('MOODLE_INTERNAL') || die();
/** /**
* Serves assignment submissions and other files. * Serves assignment submissions and other files.
...@@ -85,4 +84,4 @@ function assignsubmission_dta_pluginfile( ...@@ -85,4 +84,4 @@ function assignsubmission_dta_pluginfile(
// Download MUST be forced - security! // Download MUST be forced - security!
send_stored_file($file, 0, 0, true); send_stored_file($file, 0, 0, true);
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
// import various files logic is organized in //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,18 +30,15 @@ require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/view.php'); ...@@ -30,18 +30,15 @@ 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";
// ========== abstract methods to be implemented ========== //
/** /**
* get plugin name * get plugin name
* @return string * @return string
...@@ -50,11 +47,6 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -50,11 +47,6 @@ class assign_submission_dta extends assign_submission_plugin {
return get_string("pluginname", self::COMPONENT_NAME); return get_string("pluginname", self::COMPONENT_NAME);
} }
// ========== end of section ========== //
// ========== parent methods overloaded ========== //
// ===== assignment settings ===== //
/** /**
* Get default settings for assignment submission settings * Get default settings for assignment submission settings
* *
...@@ -62,37 +54,31 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -62,37 +54,31 @@ 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", "filemanager",
// unique element name in form
self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST, self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST,
// label shown to user left of filemanager
get_string("submission_settings_label", self::COMPONENT_NAME), get_string("submission_settings_label", self::COMPONENT_NAME),
// attributes
null, null,
// options array
$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 add button to //Form-unique element id to which to add button.
self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST, self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST,
// key to search for
"submission_settings_label", "submission_settings_label",
// language file to use //Language file to use.
self::COMPONENT_NAME self::COMPONENT_NAME
); );
// only show filemanager, if our 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'
); );
} }
...@@ -104,21 +90,16 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -104,21 +90,16 @@ 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 {
$draftitemid = file_get_submitted_draft_itemid(self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST); //Get id of draft area for file manager creation.
$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(
// draft filemanager form-unique id
$draftitemid, $draftitemid,
// id of current assignment
$this->assignment->get_context()->id, $this->assignment->get_context()->id,
// component name
self::COMPONENT_NAME, self::COMPONENT_NAME,
// proper filearea
self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST, self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST,
// entry id
0, 0,
// options array?
array('subdirs' => 0) array('subdirs' => 0)
); );
...@@ -133,69 +114,59 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -133,69 +114,59 @@ 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 proper 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 we edit right now //Id of the assignment in edit.
$this->assignment->get_context()->id, $this->assignment->get_context()->id,
// component name
self::COMPONENT_NAME, self::COMPONENT_NAME,
// proper file area
self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST, self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST,
// entry id
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 current assignment //Id of the current assignment.
$this->assignment->get_context()->id, $this->assignment->get_context()->id,
// component name
self::COMPONENT_NAME, self::COMPONENT_NAME,
// proper filearea
self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST, self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST,
// entry id
0, 0,
// ?
'id', 'id',
// ?
false false
); );
// check if a file is 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 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);
} }
// ===== student submission ===== //
/** /**
* Add elements to submission form * Add elements to submission form
* *
* @param mixed $submission stdClass|null * @param mixed $submission stdClass|null
* @param MoodleQuickForm $mform * @param MoodleQuickForm $mform
* @param stdClass $data * @param stdClass $data
* @param int $userid * @param int $userid
* @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',
...@@ -206,27 +177,26 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -206,27 +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', 'filemanager',
// form-unique identifier //Form-unique identifier.
'tasks_filemanager', 'tasks_filemanager',
// label to show next to 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(
// what form item to add a helpbutton //Related form item.
"tasks_filemanager", "tasks_filemanager",
// what key to use //Key.
"submission_label", "submission_label",
// in which language file to look in //Language file.
self::COMPONENT_NAME self::COMPONENT_NAME
); );
...@@ -239,21 +209,21 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -239,21 +209,21 @@ class assign_submission_dta extends assign_submission_plugin {
*/ */
public function is_empty(stdClass $submission): bool { public function is_empty(stdClass $submission): bool {
return $this->count_files($submission->id, self::ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION) == 0; return $this->count_files($submission->id, self::ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION) == 0;
} }
/** /**
* Count the number of files in a filearea * Count the number of files in a filearea
* *
* @param int $submissionId submission id to check * @param int $submissionid submission id to check
* @param string $areaId filearea id to count * @param string $areaid filearea id to count
* @return int * @return int
*/ */
private function count_files($submissionId, $areaId) { private function count_files($submissionid, $areaid) {
$fs = get_file_storage(); $fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id, $files = $fs->get_area_files($this->assignment->get_context()->id,
self::COMPONENT_NAME, self::COMPONENT_NAME,
$areaId, $areaid,
$submissionId, $submissionid,
'id', 'id',
false); false);
...@@ -278,55 +248,49 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -278,55 +248,49 @@ 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,
// component name
self::COMPONENT_NAME, self::COMPONENT_NAME,
// proper filearea
self::ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION, self::ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION,
// entry id
$submission->id, $submission->id,
// ?
'id', 'id',
// ?
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 and post it to our backend. //Get the file.
$file = reset($files); $file = reset($files);
//Send file to backend.
$response = DtaBackendUtils::sendSubmissionToBackend($this->assignment, $file); $response = DtaBackendUtils::sendSubmissionToBackend($this->assignment, $file);
// if we got a null response, return with 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;
} }
// ===== view submission results ===== //
/** /**
* Display a short summary of the test results of the submission * Display a short summary of the test results of the submission
* This is diplayed as default view, with the option to expand * This is diplayed as default view, with the option to expand
...@@ -358,8 +322,6 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -358,8 +322,6 @@ class assign_submission_dta extends assign_submission_plugin {
); );
} }
// ========== end of section ========== //
/** /**
* generate array of allowed filetypes to upload. * generate array of allowed filetypes to upload.
* *
...@@ -371,7 +333,7 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -371,7 +333,7 @@ class assign_submission_dta extends assign_submission_plugin {
private function get_file_options(bool $settings): array { private function get_file_options(bool $settings): array {
$fileoptions = array('subdirs' => 0, $fileoptions = array('subdirs' => 0,
"maxfiles" => 1, "maxfiles" => 1,
'accepted_types' => ($settings ? array(".txt") : array(".txt",".zip")), 'accepted_types' => ($settings ? array(".txt") : array(".txt", ".zip")),
'return_types' => FILE_INTERNAL); 'return_types' => FILE_INTERNAL);
return $fileoptions; return $fileoptions;
} }
...@@ -405,7 +367,7 @@ class assign_submission_dta extends assign_submission_plugin { ...@@ -405,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 {
......
...@@ -14,10 +14,12 @@ ...@@ -14,10 +14,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
class DtaResult { class DtaResult {
public $packageName; public $packageName;
public $className; public $className;
public $name; public $name;
/** /**
...@@ -66,41 +68,41 @@ class DtaResultSummary { ...@@ -66,41 +68,41 @@ class DtaResultSummary {
* @param string $jsonString jsonString containing DtaResultSummary * @param string $jsonString jsonString containing DtaResultSummary
* @return DtaResultSummary * @return DtaResultSummary
*/ */
public static function decodeJson($jsonString): DtaResultSummary { public static function decodeJson($jsonstring): DtaResultSummary {
$response = json_decode($jsonString); $response = json_decode($jsonstring);
$summary = new DtaResultSummary(); $summary = new DtaResultSummary();
$summary->timestamp = $response->timestamp; $summary->timestamp = $response->timestamp;
$summary->globalStacktrace = $response->globalStacktrace; $summary->globalStacktrace = $response->globalStacktrace;
$summary->successfulTestCompetencyProfile = $response->successfulTestCompetencyProfile; $summary->successfulTestCompetencyProfile = $response->successfulTestCompetencyProfile;
$summary->overallTestCompetencyProfile = $response->overallTestCompetencyProfile; $summary->overallTestCompetencyProfile = $response->overallTestCompetencyProfile;
$summary->results = self::decodeJsonResultArray($response->results); $summary->results = self::decodeJsonResultArray($response->results);
return $summary; return $summary;
} }
private static function decodeJsonCompetencyArray($jsonArray): array { private static function decodeJsonCompetencyArray($jsonarray): array {
$ret = array(); $ret = array();
foreach ($jsonArray as $entry) { foreach ($jsonarray as $entry) {
$ret[] = $entry; $ret[] = $entry;
} }
return $ret; return $ret;
} }
/** /**
* @param array $jsonArray decoded json array of results array * @param array $jsonArray decoded json array of results array
* @return array of DtaResult * @return array of DtaResult
*/ */
private static function decodeJsonResultArray($jsonArray): array { private static function decodeJsonResultArray($jsonarray): array {
$ret = array(); $ret = array();
foreach ($jsonArray as $entry) { foreach ($jsonarray as $entry) {
$value = new DtaResult(); $value = new DtaResult();
$value->packageName = $entry->packageName; $value->packageName = $entry->packageName;
$value->className = $entry->className; $value->className = $entry->className;
$value->name = $entry->name; $value->name = $entry->name;
$value->state = $entry->state; $value->state = $entry->state;
$value->failureType = $entry->failureType; $value->failureType = $entry->failureType;
...@@ -122,7 +124,7 @@ class DtaResultSummary { ...@@ -122,7 +124,7 @@ class DtaResultSummary {
*/ */
public function stateOccurenceCount(int $state): int { public function stateOccurenceCount(int $state): int {
$num = 0; $num = 0;
foreach($this->results as $r) { foreach ($this->results as $r) {
if ($r->state == $state) { if ($r->state == $state) {
$num++; $num++;
} }
......
...@@ -20,13 +20,13 @@ class DtaBackendUtils { ...@@ -20,13 +20,13 @@ class DtaBackendUtils {
* @return string backend host base url * @return string backend host base url
*/ */
private static function getBackendBaseUrl(): string { private static function getBackendBaseUrl(): string {
$backendAddress = get_config(assign_submission_dta::COMPONENT_NAME, "backendHost"); $backendaddress = get_config(assign_submission_dta::COMPONENT_NAME, "backendHost");
if (empty($backendAddress)) { if (empty($backendaddress)) {
\core\notification::error(get_string("backendHost_not_set", assign_submission_dta::COMPONENT_NAME)); \core\notification::error(get_string("backendHost_not_set", assign_submission_dta::COMPONENT_NAME));
} }
return $backendAddress; return $backendaddress;
} }
/** /**
...@@ -38,21 +38,21 @@ class DtaBackendUtils { ...@@ -38,21 +38,21 @@ class DtaBackendUtils {
* @return bool true if no error occurred * @return bool true if no error occurred
*/ */
public static function sendTestConfigToBackend($assignment, $file): bool { public static function sendTestConfigToBackend($assignment, $file): bool {
$backendAddress = self::getBackendBaseUrl(); $backendaddress = self::getBackendBaseUrl();
if (empty($backendAddress)) { if (empty($backendaddress)) {
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 {
...@@ -69,15 +69,15 @@ class DtaBackendUtils { ...@@ -69,15 +69,15 @@ class DtaBackendUtils {
* @return string json string with testresults or null on error * @return string json string with testresults or null on error
*/ */
public static function sendSubmissionToBackend($assignment, $file): ?string { public static function sendSubmissionToBackend($assignment, $file): ?string {
$backendAddress = self::getBackendBaseUrl(); $backendaddress = self::getBackendBaseUrl();
if (empty($backendAddress)) { if (empty($backendaddress)) {
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,14 +104,15 @@ class DtaBackendUtils { ...@@ -104,14 +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 msg //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=" . $info["http_code"]); debugging(assign_submission_dta::COMPONENT_NAME . ": Post file to server was not successful: 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));
...@@ -120,7 +121,8 @@ class DtaBackendUtils { ...@@ -120,7 +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) . $info["http_code"] . $response); \core\notification::error(get_string("http_unknown_error_msg", assign_submission_dta::COMPONENT_NAME) .
$info["http_code"] . $response);
return null; return null;
} }
} }
......
...@@ -24,39 +24,39 @@ class DbUtils { ...@@ -24,39 +24,39 @@ class DbUtils {
/** /**
* get's summary with all corresponding result entries * get's summary with all corresponding result entries
* *
* @param int $assignmentId assignment id to search for * @param int $assignmentid assignment id to search for
* @param int $submissionId submission id to search for * @param int $submissionid submission id to search for
* @return DttResultSummary representing given submission * @return DttResultSummary representing given submission
*/ */
public static function getResultSummaryFromDatabase( public static function getResultSummaryFromDatabase(
int $assignmentId, int $assignmentid,
int $submissionId int $submissionid
): DtaResultSummary { ): DtaResultSummary {
global $DB; global $DB;
// fetch data from database //Fetch data from database.
$summaryDbRecord = $DB->get_record(self::TABLE_SUMMARY, array( $summary_record = $DB->get_record(self::TABLE_SUMMARY, array(
"assignment_id" => $assignmentId, "assignment_id" => $assignmentid,
"submission_id" => $submissionId "submission_id" => $submissionid
)); ));
$resultsDbArray = $DB->get_records(self::TABLE_RESULT, array( $results_array = $DB->get_records(self::TABLE_RESULT, array(
"assignment_id" => $assignmentId, "assignment_id" => $assignmentid,
"submission_id" => $submissionId "submission_id" => $submissionid
)); ));
// create summary instance //Create a summary instance.
$summary = new DtaResultSummary(); $summary = new DtaResultSummary();
$summary->timestamp = $summaryDbRecord->timestamp; $summary->timestamp = $summary_record->timestamp;
$summary->globalStacktrace = $summaryDbRecord->global_stacktrace; $summary->globalStacktrace = $summary_record->global_stacktrace;
$summary->successfulTestCompetencyProfile = $summaryDbRecord->successful_competencies; $summary->successfulTestCompetencyProfile = $summary_record->successful_competencies;
$summary->overallTestCompetencyProfile = $summaryDbRecord->tested_competencies; $summary->overallTestCompetencyProfile = $summary_record->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($resultsDbArray as $rr) { foreach($results_array 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;
$result->name = $rr->name; $result->name = $rr->name;
$result->state = $rr->state; $result->state = $rr->state;
...@@ -77,33 +77,33 @@ class DbUtils { ...@@ -77,33 +77,33 @@ class DbUtils {
* save given result summary and single results to database * save given result summary and single results to database
* under given assignment and submission id * under given assignment and submission id
* *
* @param int assignmentId assigment this is submission is linked to * @param int assignmentid assigment this is submission is linked to
* @param int submissionId submission of this result * @param int submissionid submission of this result
* @param DttResultSummary instance to persist * @param DttResultSummary instance to persist
*/ */
public static function storeResultSummaryToDatabase( public static function storeResultSummaryToDatabase(
int $assignmentId, int $assignmentid,
int $submissionId, int $submissionid,
DtaResultSummary $summary DtaResultSummary $summary
): void { ): void {
global $DB; global $DB;
// prepare new database entries //Prepare new database entries.
$summaryRecord = new stdClass(); $summary_record = new stdClass();
$summaryRecord->assignment_id = $assignmentId; $summary_record->assignment_id = $assignmentid;
$summaryRecord->submission_id = $submissionId; $summary_record->submission_id = $submissionid;
$summaryRecord->successful_competencies = $summary->successfulTestCompetencyProfile; $summary_record->successful_competencies = $summary->successfulTestCompetencyProfile;
$summaryRecord->tested_competencies = $summary->overallTestCompetencyProfile; $summary_record->tested_competencies = $summary->overallTestCompetencyProfile;
$summaryRecord->timestamp = $summary->timestamp; $summary_record->timestamp = $summary->timestamp;
$summaryRecord->global_stacktrace = $summary->globalStacktrace; $summary_record->global_stacktrace = $summary->globalStacktrace;
// prepare results to persist to array //Prepare results to persist to array.
$resultRecordArray = array(); $result_records = 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;
$record->package_name = $r->packageName; $record->package_name = $r->packageName;
$record->class_name = $r->className; $record->class_name = $r->className;
$record->name = $r->name; $record->name = $r->name;
$record->state = $r->state; $record->state = $r->state;
...@@ -113,30 +113,30 @@ class DbUtils { ...@@ -113,30 +113,30 @@ 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;
$resultRecordArray[] = $record; $result_records[] = $record;
} }
// if results exist yet, 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
)); ));
if ($submission) { if ($submission) {
$DB->delete_records(self::TABLE_RESULT, array( $DB->delete_records(self::TABLE_RESULT, array(
'assignment_id' => $assignmentId, 'assignment_id' => $assignmentid,
'submission_id' => $submissionId 'submission_id' => $submissionid
)); ));
$DB->delete_records(self::TABLE_SUMMARY, array( $DB->delete_records(self::TABLE_SUMMARY, array(
'assignment_id' => $assignmentId, 'assignment_id' => $assignmentid,
'submission_id' => $submissionId 'submission_id' => $submissionid
)); ));
} }
// create summary and single result entries //Create summary and single result entries.
$DB->insert_record(self::TABLE_SUMMARY, $summaryRecord); $DB->insert_record(self::TABLE_SUMMARY, $summary_record);
foreach($resultRecordArray as $rr) { foreach($result_records as $rr) {
$DB->insert_record(self::TABLE_RESULT, $rr); $DB->insert_record(self::TABLE_RESULT, $rr);
} }
} }
......
...@@ -19,29 +19,29 @@ class ViewSubmissionUtils { ...@@ -19,29 +19,29 @@ class ViewSubmissionUtils {
/** /**
* generates a short summary html * generates a short summary html
* *
* @param int assignmentId assignment * @param int assignmentid assignment
* @param int submissionId submission to create a report for * @param int submissionid submission to create a report for
* @return string html * @return string html
*/ */
public static function generateSummaryHtml( public static function generateSummaryHtml(
int $assignmentId, int $assignmentid,
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 . "%)"
: "?"; : "?";
$html .= " tests successful<br>"; $html .= " tests successful<br>";
...@@ -61,32 +61,32 @@ class ViewSubmissionUtils { ...@@ -61,32 +61,32 @@ class ViewSubmissionUtils {
/** /**
* generates detailed view html * generates detailed view html
* *
* @param int assignmentId assignment * @param int assignmentid assignment
* @param int submissionId submission to create a report for * @param int submissionid submission to create a report for
*/ */
public static function generateDetailHtml( public static function generateDetailHtml(
int $assignmentId, int $assignmentid,
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 //Define a few css classes and prepare html attribute arrays to beautify the output.
$tableHeaderRowAttributes = array("class" => "dtaTableHeaderRow"); $tableheaderrow_attributes = array("class" => "dtaTableHeaderRow");
$tableRowAttributes = array("class" => "dtaTableRow"); $tablerow_attributes = array("class" => "dtaTableRow");
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
$unknownAttrib = 'dtaResultUnknown'; $unknown_attributes = 'dtaResultUnknown';
$successAttrib = 'dtaResultSuccess'; $success_attributes = 'dtaResultSuccess';
$failureAttrib = 'dtaResultFailure'; $failure_attributes = 'dtaResultFailure';
$compErrorAttrib = 'dtaResultCompilationError'; $compilationerror_attributes = '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, $tableHeaderRowAttributes); $header = html_writer::tag("tr", $tmp, $tableheaderrow_attributes);
$header = html_writer::tag("thead", $header); $header = html_writer::tag("thead", $header);
$body = ""; $body = "";
...@@ -102,67 +102,67 @@ class ViewSubmissionUtils { ...@@ -102,67 +102,67 @@ class ViewSubmissionUtils {
$summary->resultCount(), $summary->resultCount(),
$attributes); $attributes);
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $unknownAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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);
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
$successRate = "?"; $successrate = "?";
if ($summary->unknownCount() > 0 || $summary->compilationErrorCount() > 0) { if ($summary->unknownCount() > 0 || $summary->compilationErrorCount() > 0) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $unknownAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
} else { } else {
$successRate = round(($summary->successfulCount() / $summary->resultCount()) * 100, 2 ); $successrate = round(($summary->successfulCount() / $summary->resultCount()) * 100, 2 );
if ($successRate < 50) { if ($successrate < 50) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $compErrorAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $compilationerror_attributes;
} else if ($successRate < 75) { } else if ($successrate < 75) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $failureAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $failure_attributes;
} else { } else {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $successAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
} }
} }
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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);
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
if ($summary->failedCount() > 0) { if ($summary->failedCount() > 0) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $failureAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $failure_attributes;
} else { } else {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $successAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
} }
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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);
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
if ($summary->compilationErrorCount() > 0) { if ($summary->compilationErrorCount() > 0) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $compErrorAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $compilationerror_attributes;
} else { } else {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $successAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
} }
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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);
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
if ($summary->unknownCount() > 0) { if ($summary->unknownCount() > 0) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $unknownAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
} else { } else {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $successAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
} }
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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);
...@@ -170,59 +170,59 @@ class ViewSubmissionUtils { ...@@ -170,59 +170,59 @@ class ViewSubmissionUtils {
"td", "td",
html_writer::tag("b", $summary->successfulCount() html_writer::tag("b", $summary->successfulCount()
. "/" . (($summary->compilationErrorCount() == 0 && $summary->unknownCount() == 0) ? $summary->resultCount() . "/" . (($summary->compilationErrorCount() == 0 && $summary->unknownCount() == 0) ? $summary->resultCount()
. " (" . $successRate . "%)" . " (" . $successrate . "%)"
: "?")), : "?")),
$attributes); $attributes);
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
if ($summary->unknownCount() > 0 || $summary->compilationErrorCount() > 0) { if ($summary->unknownCount() > 0 || $summary->compilationErrorCount() > 0) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $unknownAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
} else { } else {
if ($successRate < 50) { if ($successrate < 50) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $compErrorAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $compilationerror_attributes;
} else if ($successRate < 75) { } else if ($successrate < 75) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $failureAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $failure_attributes;
} else { } else {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . " " . $successAttrib; $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
} }
} }
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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, $tableHeaderRowAttributes); $header = html_writer::tag("tr", $tmp, $tableheaderrow_attributes);
$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.
$resultRowAttributes = $tableRowAttributes; $resultrow_attributes = $tablerow_attributes;
// 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) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . ' dtaResultUnknown'; $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultUnknown';
} else if ($r->state == 1) { } else if ($r->state == 1) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . ' dtaResultSuccess'; $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultSuccess';
} else if ($r->state == 2) { } else if ($r->state == 2) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . ' dtaResultFailure'; $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultFailure';
} else if ($r->state == 3) { } else if ($r->state == 3) {
$resultRowAttributes['class'] = $resultRowAttributes['class'] . ' dtaResultCompilationError'; $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultCompilationError';
} }
$tmp = ""; $tmp = "";
...@@ -230,12 +230,12 @@ class ViewSubmissionUtils { ...@@ -230,12 +230,12 @@ class ViewSubmissionUtils {
"td", "td",
"name", "name",
$attributes); $attributes);
$tmp .= html_writer::tag( $tmp .= html_writer::tag(
"td", "td",
$r->name, $r->name,
$attributes); $attributes);
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$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, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
// 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,21 +261,21 @@ class ViewSubmissionUtils { ...@@ -261,21 +261,21 @@ class ViewSubmissionUtils {
"td", "td",
$r->failureType, $r->failureType,
$attributes); $attributes);
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
$tmp = ""; $tmp = "";
$tmp .= html_writer::tag( $tmp .= html_writer::tag(
"td", "td",
"failure reason", "failure reason",
$attributes); $attributes);
$tmp .= html_writer::tag( $tmp .= html_writer::tag(
"td", "td",
$r->failureReason, $r->failureReason,
$attributes); $attributes);
$body .= html_writer::tag("tr", $tmp, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
// 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, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
} }
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, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
} }
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, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
} }
$tmp = ""; $tmp = "";
...@@ -328,12 +328,12 @@ class ViewSubmissionUtils { ...@@ -328,12 +328,12 @@ 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, $resultRowAttributes); $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
} }
// 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"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment