Skip to content

Commit

Permalink
CTP-3690 indentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Sep 2, 2024
1 parent 055afb8 commit 08ae166
Show file tree
Hide file tree
Showing 51 changed files with 591 additions and 591 deletions.
2 changes: 1 addition & 1 deletion actions/upload_grading_sheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

$csvimport = new \mod_coursework\export\import($coursework, false, false);

// $csv_cells = $csvimport->csv_columns(); //all columns from spreadsheet
// $csv_cells = $csvimport->csv_columns(); //all columns from spreadsheet

$procsessingresults = $csvimport->validate_csv($content, $data->encoding, $data->delimiter_name, $csv_cells);

Expand Down
30 changes: 15 additions & 15 deletions backup/moodle2/backup_coursework_activity_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@

class backup_coursework_activity_task extends backup_activity_task {

static public function encode_content_links($content) {
global $CFG;
static public function encode_content_links($content) {
global $CFG;

$base = preg_quote($CFG->wwwroot, "/");
$base = preg_quote($CFG->wwwroot, "/");

// These have to be picked up by the restore code COURSEWORK... are arbitrary
$search = "/(".$base."\/mod\/coursework\/index.php\?id\=)([0-9]+)/";
$content = preg_replace($search, '$@COURSEWORKINDEX*$2@$', $content);
// These have to be picked up by the restore code COURSEWORK... are arbitrary
$search = "/(".$base."\/mod\/coursework\/index.php\?id\=)([0-9]+)/";
$content = preg_replace($search, '$@COURSEWORKINDEX*$2@$', $content);

$search = "/(".$base."\/mod\/coursework\/view.php\?id\=)([0-9]+)/";
$content = preg_replace($search, '$@COURSEWORKBYID*$2@$', $content);
$search = "/(".$base."\/mod\/coursework\/view.php\?id\=)([0-9]+)/";
$content = preg_replace($search, '$@COURSEWORKBYID*$2@$', $content);

return $content;
}
return $content;
}

protected function define_my_settings() {
}
protected function define_my_settings() {
}

protected function define_my_steps() {
$this->add_step(new backup_coursework_activity_structure_step('coursework_structure', 'coursework.xml'));
}
protected function define_my_steps() {
$this->add_step(new backup_coursework_activity_structure_step('coursework_structure', 'coursework.xml'));
}
}
14 changes: 7 additions & 7 deletions classes/ability.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function (coursework $coursework) {

// New feedback
$this->prevent_new_feedback_with_no_submission();
$this->prevent_new_feedback_when_submission_not_finalised();
$this->prevent_new_feedback_when_submission_not_finalised();
$this->prevent_new_feedback_when_prerequisite_stages_have_no_feedback();
$this->prevent_new_feedback_with_empty_stage();
$this->prevent_new_feedback_when_allocatable_already_has_feedback_for_this_stage();
Expand All @@ -163,7 +163,7 @@ function (coursework $coursework) {
$this->prevent_new_feedback_when_not_assessor_for_stage();
$this->prevent_new_feedback_from_non_allocated_assessors();
$this->allow_new_feedback_by_allocated_assessor();
$this->allow_new_feedback_from_any_assessor_when_allocation_is_disabled_for_stage_or_instance();
$this->allow_new_feedback_from_any_assessor_when_allocation_is_disabled_for_stage_or_instance();
$this->allow_new_feedback_if_agreed_feedback_and_user_can_add_agreed_feedback();

// Create feedback
Expand Down Expand Up @@ -230,7 +230,7 @@ function (coursework $coursework) {
// Plagiarism flagging rules for Plagiarism Alert

// New
// $this->prevent_new_plagiarism_flag_if_already_exists();
// $this->prevent_new_plagiarism_flag_if_already_exists();
$this->allow_new_plagiarism_flag_with_capability();

// Edit
Expand Down Expand Up @@ -425,7 +425,7 @@ function (submission $submission) {
}

protected function allow_show_submission_to_graders_after_feedback_release() {
// Show to graders after release
// Show to graders after release
$this->allow('show',
'mod_coursework\models\submission',
function (submission $submission) {
Expand Down Expand Up @@ -485,8 +485,8 @@ function (submission $submission) {
// take into account courseworks with personal deadlines
if ($submission->get_coursework()->personal_deadlines_enabled()) {
$deadline_passed = (bool)$submission->submission_personal_deadline() < time();
} else {
$deadline_passed = $submission->get_coursework()->deadline_has_passed();
} else {
$deadline_passed = $submission->get_coursework()->deadline_has_passed();
}
$ok_to_submit_late = $submission->get_coursework()->allow_late_submissions();
$coursework = $submission->get_coursework();
Expand Down Expand Up @@ -1202,7 +1202,7 @@ private function allow_show_grading_table_row_if_user_can_grant_extension_and_no
'mod_coursework\grading_table_row_base',
function (grading_table_row_base $row) {

return (!$row->get_coursework()->allocation_enabled() && has_capability('mod/coursework:grantextensions',
return (!$row->get_coursework()->allocation_enabled() && has_capability('mod/coursework:grantextensions',
$row->get_coursework()
->get_context()));

Expand Down
24 changes: 12 additions & 12 deletions classes/allocation/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,18 @@ public function auto_generate_sample_set() {

// Save sample set
if (!empty($auto_sample_set)) {
foreach ($auto_sample_set as $allocatable) {
$sample = new \stdClass();
$sample->courseworkid = $this->coursework->id;
$sample->allocatableid = $allocatable->id;
$sample->allocatabletype = ($this->coursework->is_configured_to_have_group_submissions()) ? "group" : "user";
$sample->stage_identifier = "assessor_{$stage_number}";
$sample->selectiontype = "automatic";

// If this a manually selected allocatable check to see if the allocatable is already in the table
$DB->insert_record("coursework_sample_set_mbrs", $sample);

}
foreach ($auto_sample_set as $allocatable) {
$sample = new \stdClass();
$sample->courseworkid = $this->coursework->id;
$sample->allocatableid = $allocatable->id;
$sample->allocatabletype = ($this->coursework->is_configured_to_have_group_submissions()) ? "group" : "user";
$sample->stage_identifier = "assessor_{$stage_number}";
$sample->selectiontype = "automatic";

// If this a manually selected allocatable check to see if the allocatable is already in the table
$DB->insert_record("coursework_sample_set_mbrs", $sample);

}
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions classes/allocation/table/cell/builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ private function prepare_allocation_table_cell() {
}
$contents .= '<br>';

if ($this->coursework->allocation_enabled()) {
$assessor_dropdown = $this->get_potential_marker_dropdown();
}
if ($this->coursework->allocation_enabled()) {
$assessor_dropdown = $this->get_potential_marker_dropdown();
}
$assessor_name = '';
if ($this->has_feedback()) {
$class .= ' has-assessor-feedback ';
Expand All @@ -210,7 +210,7 @@ private function prepare_allocation_table_cell() {
}

if ($assessor_name) {
if ($this->get_stage()->uses_sampling() && !$this->get_feedback() && !$this->has_automatic_sampling()) {
if ($this->get_stage()->uses_sampling() && !$this->get_feedback() && !$this->has_automatic_sampling()) {
$contents .= '<br>';
}
$contents .= "<span class='existing-assessor'>{$assessor_name}</span>";
Expand Down Expand Up @@ -437,15 +437,15 @@ private function has_final_feedback() {
[$this->allocatable->id(), $this->allocatable->type()]
);
if ($submission) {
$feedbacks = isset(feedback::$pool[$this->coursework->id]['submissionid'][$submission->id]) ?
$feedbacks = isset(feedback::$pool[$this->coursework->id]['submissionid'][$submission->id]) ?
feedback::$pool[$this->coursework->id]['submissionid'][$submission->id] : [];

foreach ($feedbacks as $feedback) {
if ($feedback->stage_identifier == 'final_agreed_1') {
return true;
foreach ($feedbacks as $feedback) {
if ($feedback->stage_identifier == 'final_agreed_1') {
return true;
}
}
}
}
return false;
}

Expand Down
28 changes: 14 additions & 14 deletions classes/allocation/table/processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ private function get_row($allocatable) {
private function clean_data($raw_data) {

// Data looks like this:
// $example_data = array(
// 4543 => array( // Student id
// 'assessor_1' => array(
// 'allocation_id' => 43,
// 'assessor_id' => 232,
// ),
// 'moderator_1' => array(
// 'allocation_id' => 46,
// 'assessor_id' => 235,
// 'in_set' => 1,
// )
// )
// );
// $example_data = array(
// 4543 => array( // Student id
// 'assessor_1' => array(
// 'allocation_id' => 43,
// 'assessor_id' => 232,
// ),
// 'moderator_1' => array(
// 'allocation_id' => 46,
// 'assessor_id' => 235,
// 'in_set' => 1,
// )
// )
// );

$clean_data = [];
foreach ($raw_data as $allocatable_id => $datarrays) {
Expand All @@ -117,7 +117,7 @@ private function clean_data($raw_data) {
$clean_data[$allocatable_id][$stage->identifier()] = $stage_data;
}
}
/* if (array_key_exists('moderator', $datarrays)) {
/* if (array_key_exists('moderator', $datarrays)) {
$moderator_data = $datarrays['moderator'];
$clean_data[$allocatable_id]['moderator'] = $moderator_data;
}*/
Expand Down
2 changes: 1 addition & 1 deletion classes/assessor_feedback_row.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function get_graded_by() {
* @return string
*/
public function get_graders_name() {
return $this->get_graded_by()->profile_link();
return $this->get_graded_by()->profile_link();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/feedback_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ private function next_available_stage($feedback) {
* @param $submission
*/
protected function try_auto_feedback_creation($submission) {
// automatic agreement if necessary
// automatic agreement if necessary
$auto_feedback_classname = '\mod_coursework\auto_grader\\' . $this->coursework->automaticagreementstrategy;
/**
* @var auto_grader $auto_grader
Expand Down
56 changes: 28 additions & 28 deletions classes/controllers/personal_deadlines_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,33 @@ protected function new_personal_deadline() {

$allocatables = unserialize($data->allocatableid);

foreach ($allocatables as $allocatableid) {
$data->allocatableid = $allocatableid;
$data->id = '';
//$data->id = '';
$findparams = array(
'allocatableid' => $allocatableid,
'allocatabletype' => $data->allocatabletype,
'courseworkid' => $data->courseworkid,
);
$this->personal_deadline = personal_deadline::find_or_build($findparams);

if (empty($this->personal_deadline->personal_deadline)) { // personal deadline doesnt exist
// add new
$data->createdbyid = $USER->id;
$this->personal_deadline = personal_deadline::build($data);
$this->personal_deadline->save();

} else {
// update
$data->id = $this->personal_deadline->id;
$data->lastmodifiedbyid = $USER->id;
$data->timemodified = time();
$this->personal_deadline->update_attributes($data);
}

foreach ($allocatables as $allocatableid) {
$data->allocatableid = $allocatableid;
$data->id = '';
//$data->id = '';
$findparams = array(
'allocatableid' => $allocatableid,
'allocatabletype' => $data->allocatabletype,
'courseworkid' => $data->courseworkid,
);
$this->personal_deadline = personal_deadline::find_or_build($findparams);

if (empty($this->personal_deadline->personal_deadline)) { // personal deadline doesnt exist
// add new
$data->createdbyid = $USER->id;
$this->personal_deadline = personal_deadline::build($data);
$this->personal_deadline->save();

} else {
// update
$data->id = $this->personal_deadline->id;
$data->lastmodifiedbyid = $USER->id;
$data->timemodified = time();
$this->personal_deadline->update_attributes($data);
}

}

}
redirect($coursework_page_url);
}
Expand Down Expand Up @@ -143,10 +143,10 @@ protected function set_default_current_deadline() {

// If the allocatableid is an array then the current page will probably be setting multiple the personal deadlines
// of multiple allocatable ids in which case set the personal deadline to the coursework default
if (is_array($this->params['allocatableid']) || !$this->get_personal_deadline()) { // if no personal deadline then use coursework deadline
$this->personal_deadline->personal_deadline = $this->coursework->deadline;
if (is_array($this->params['allocatableid']) || !$this->get_personal_deadline()) { // if no personal deadline then use coursework deadline
$this->personal_deadline->personal_deadline = $this->coursework->deadline;

}
}

return $params;
}
Expand Down
26 changes: 13 additions & 13 deletions classes/controllers/submissions_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ protected function create_submission() {
$submission->authorid = $submission->get_author_id(); // Create new function to get the author id depending on whether the current user is submitting on behalf
$submission->timesubmitted = time();

// Automatically finalise any submissions that's past the deadline/personal deadline and doesn't have valid extension
// Automatically finalise any submissions that's past the deadline/personal deadline and doesn't have valid extension
if ($this->coursework->personal_deadlines_enabled()) {
// Check is submission has a valid personal deadline or a valid extension
if (!$this->has_valid_personal_deadline($submission) && !$this->has_valid_extension($submission)) {
$submission->finalised = 1;
}
if (!$this->has_valid_personal_deadline($submission) && !$this->has_valid_extension($submission)) {
$submission->finalised = 1;
}
} else if ($this->coursework->deadline_has_passed() && !$this->has_valid_extension($submission)) {
$submission->finalised = 1;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ protected function create_submission() {
}
}

if ($submission->finalised) {
if ($submission->finalised) {
if (!$submission->get_coursework()->has_deadline()) {

$userids = explode(',', $submission->get_coursework()->get_submission_notification_users());
Expand Down Expand Up @@ -221,11 +221,11 @@ protected function edit_submission() {

$submit_form->set_data($submission);

if ($validation != true) {
if ($validation != true) {
$this->get_page_renderer()->edit_submission_page($submit_form, $submission);
return true;
}
}
}
}

/**
*
Expand Down Expand Up @@ -399,11 +399,11 @@ protected function check_coursework_is_open($coursework) {
*/
private function exception_if_late($submission) {
$could_have_submitted = has_capability('mod/coursework:submit', $this->coursework->get_context());
if ($this->coursework->personal_deadlines_enabled()) {
$deadline_has_passed = !$this->has_valid_personal_deadline($submission);
} else {
$deadline_has_passed = $this->coursework->deadline_has_passed();
}
if ($this->coursework->personal_deadlines_enabled()) {
$deadline_has_passed = !$this->has_valid_personal_deadline($submission);
} else {
$deadline_has_passed = $this->coursework->deadline_has_passed();
}

if ($could_have_submitted && $deadline_has_passed && !$this->has_valid_extension($submission) && !$this->coursework->allow_late_submissions()) {
throw new late_submission($this->coursework);
Expand Down
Loading

0 comments on commit 08ae166

Please sign in to comment.